public void SetAnalyticsSampleRate(IntegrationInfo integration, TracerSettings settings, bool enabledWithGlobalSetting) { if (settings != null) { AnalyticsSampleRate = settings.GetIntegrationAnalyticsSampleRate(integration, enabledWithGlobalSetting); } }
/// <summary> /// Creates a span context for outbound http requests, or get the active one. /// Used to propagate headers without changing the active span. /// </summary> /// <param name="tracer">The tracer instance to use to create the span.</param> /// <param name="integrationId">The id of the integration creating this scope.</param> /// <returns>A span context to use to populate headers</returns> public static SpanContext CreateHttpSpanContext(Tracer tracer, IntegrationInfo integrationId) { if (!tracer.Settings.IsIntegrationEnabled(integrationId)) { // integration disabled, skip this trace return(null); } try { var activeScope = GetActiveHttpScope(tracer); if (activeScope != null) { return(activeScope.Span.Context); } return(tracer.CreateSpanContext(serviceName: $"{tracer.DefaultServiceName}-{ServiceName}")); } catch (Exception ex) { Log.Error(ex, "Error creating or populating span context."); } return(null); }
internal IntegrationSettings this[IntegrationInfo integration] { get { return(integration.Name == null ? _settingsById[integration.Id] : _settingsByName.GetOrAdd(integration.Name, _valueFactory)); } }
public OutboundHttpArgs(ulong?spanId, string httpMethod, Uri requestUri, IntegrationInfo integrationInfo) { SpanId = spanId; HttpMethod = httpMethod; RequestUri = requestUri; IntegrationInfo = integrationInfo; }
internal static bool IsIntegrationEnabled(this TracerSettings settings, IntegrationInfo integration, bool defaultValue = true) { if (settings.TraceEnabled && !DomainMetadata.ShouldAvoidAppDomain()) { return(settings.Integrations[integration].Enabled ?? defaultValue); } return(false); }
internal static string GetName(IntegrationInfo integration) { if (integration.Name == null) { return(Names[integration.Id]); } return(integration.Name); }
internal static Scope CreateScope(Tracer tracer, IntegrationInfo integrationId, string host, string port, string rawCommand) { if (!Tracer.Instance.Settings.IsIntegrationEnabled(integrationId)) { // integration disabled, don't create a scope, skip this trace return(null); } var parent = tracer.ActiveScope?.Span; if (parent != null && parent.Type == SpanTypes.Redis && parent.GetTag(Tags.InstrumentationName) != null) { return(null); } string serviceName = tracer.Settings.GetServiceName(tracer, ServiceName); Scope scope = null; try { var tags = new RedisTags(); scope = tracer.StartActiveWithTags(OperationName, serviceName: serviceName, tags: tags); int separatorIndex = rawCommand.IndexOf(' '); string command; if (separatorIndex >= 0) { command = rawCommand.Substring(0, separatorIndex); } else { command = rawCommand; } var span = scope.Span; span.Type = SpanTypes.Redis; span.ResourceName = command; tags.RawCommand = rawCommand; tags.Host = host; tags.Port = port; tags.SetAnalyticsSampleRate(integrationId, tracer.Settings, enabledWithGlobalSetting: false); } catch (Exception ex) { Log.Error(ex, "Error creating or populating scope."); } return(scope); }
private async Task <List <IntegrationInfo> > GetUserIntegrationInfo(User user) { var integrationInfos = new List <IntegrationInfo>(); foreach (var integration in user.UserIntegrations) { try { switch (integration.IntegrationTypeID) { case (int)IntegrationType.IntegrationTypes.Twitch: integrationInfos.Add(new IntegrationInfo { IntegrationType = (IntegrationType.IntegrationTypes)Enum.ToObject(typeof(IntegrationType.IntegrationTypes), integration.IntegrationTypeID), IsUserLive = await _twitchIntegration.IsUserLive(user.ID), UserLiveStreamURL = "https://www.twitch.tv/" + integration.UserName } ); break; case (int)IntegrationType.IntegrationTypes.Youtube: var integrationInfo = new IntegrationInfo { UserLiveStreamURL = await _youtubeIntegration.GetLiveStreamURLIfLive(user.ID), IntegrationType = (IntegrationType.IntegrationTypes)Enum.ToObject(typeof(IntegrationType.IntegrationTypes), integration.IntegrationTypeID) }; integrationInfo.IsUserLive = integrationInfo.UserLiveStreamURL == null ? false : true; integrationInfos.Add(integrationInfo); break; default: break; } } catch (Exception) { //TODO(Dave) Log error } } return(integrationInfos); }
public static Scope CreateScope(Tracer tracer, IntegrationInfo integrationId, object pipeline, object requestData) { if (!tracer.Settings.IsIntegrationEnabled(integrationId)) { // integration disabled, don't create a scope, skip this trace return(null); } string requestName = pipeline.GetProperty("RequestParameters") .GetValueOrDefault() ?.GetType() .Name .Replace("RequestParameters", string.Empty); var pathAndQuery = requestData.GetProperty <string>("PathAndQuery").GetValueOrDefault() ?? requestData.GetProperty <string>("Path").GetValueOrDefault(); string method = requestData.GetProperty("Method").GetValueOrDefault()?.ToString(); var url = requestData.GetProperty("Uri").GetValueOrDefault()?.ToString(); var serviceName = $"{tracer.DefaultServiceName}-{ServiceName}"; Scope scope = null; try { var tags = new ElasticsearchTags(); scope = tracer.StartActiveWithTags(OperationName, serviceName: serviceName, tags: tags); var span = scope.Span; span.ResourceName = requestName ?? pathAndQuery ?? string.Empty; span.Type = SpanType; tags.Action = requestName; tags.Method = method; tags.Url = url; tags.SetAnalyticsSampleRate(integrationId, tracer.Settings, enabledWithGlobalSetting: false); } catch (Exception ex) { Log.Error(ex, "Error creating or populating scope."); } return(scope); }
internal static void FlushSpans(IntegrationInfo integrationInfo) { if (!TestTracer.Settings.IsIntegrationEnabled(integrationInfo)) { return; } try { var flushThread = new Thread(() => InternalFlush().GetAwaiter().GetResult()); flushThread.IsBackground = false; flushThread.Name = "FlushThread"; flushThread.Start(); flushThread.Join(); } catch (Exception ex) { Log.Error(ex, "Exception occurred when flushing spans."); }
public static Scope CreateScope <T>(Tracer tracer, IntegrationInfo integrationId, RequestPipelineStruct pipeline, T requestData) where T : IRequestData { if (!tracer.Settings.IsIntegrationEnabled(integrationId)) { // integration disabled, don't create a scope, skip this trace return(null); } var requestParameters = pipeline.RequestParameters; string requestName = requestParameters?.GetType().Name.Replace("RequestParameters", string.Empty); var pathAndQuery = requestData.Path; string method = requestData.Method; var url = requestData.Uri?.ToString(); string serviceName = tracer.Settings.GetServiceName(tracer, ServiceName); Scope scope = null; try { var tags = new ElasticsearchTags(); scope = tracer.StartActiveWithTags(OperationName, serviceName: serviceName, tags: tags); var span = scope.Span; span.ResourceName = requestName ?? pathAndQuery ?? string.Empty; span.Type = SpanType; tags.Action = requestName; tags.Method = method; tags.Url = url; tags.SetAnalyticsSampleRate(integrationId, tracer.Settings, enabledWithGlobalSetting: false); } catch (Exception ex) { Log.Error(ex, "Error creating or populating scope."); } return(scope); }
public static ExComp TakeAntiDerivativeGp(ExComp[] gp, AlgebraComp dVar, ref IntegrationInfo pIntInfo, ref EvalData pEvalData, string lowerStr, string upperStr) { string boundaryStr = (lowerStr == "" ? "" : "_" + lowerStr) + (upperStr == "" ? "" : "^" + upperStr); pEvalData.GetWorkMgr().FromFormatted(WorkMgr.STM + "\\int" + boundaryStr + "(" + GroupHelper.ToAlgTerm(gp).FinalToDispStr() + ")\\d" + dVar.ToDispString() + WorkMgr.EDM, "Evaluate the integral."); // Take out all of the constants. ExComp[] varTo, constTo; gp = GroupHelper.ForceDistributeExponent(gp); GroupHelper.GetConstVarTo(gp, out varTo, out constTo, dVar); if (varTo.Length == 1 && varTo[0] is PowerFunction && (varTo[0] as PowerFunction).GetPower().IsEqualTo(ExNumber.GetNegOne())) { PowerFunction pf = varTo[0] as PowerFunction; List<ExComp[]> denGps = pf.GetBase().ToAlgTerm().GetGroupsNoOps(); if (denGps.Count == 1) { // To be able to find the coefficient on a term like (28x)^4 ExComp[] denGp = GroupHelper.ForceDistributeExponent(denGps[0]); ExComp[] denVarTo, denConstTo; GroupHelper.GetConstVarTo(denGp, out denVarTo, out denConstTo, dVar); if (denConstTo.Length != 0 && !(denConstTo.Length == 1 && denConstTo[0].IsEqualTo(ExNumber.GetOne()))) { ExComp[] tmpConstTo = new ExComp[constTo.Length + 1]; for (int i = 0; i < constTo.Length; ++i) { tmpConstTo[i] = constTo[i]; } tmpConstTo[tmpConstTo.Length - 1] = new PowerFunction(GroupHelper.ToAlgTerm(denConstTo), ExNumber.GetNegOne()); constTo = tmpConstTo; varTo = new ExComp[] { new PowerFunction(GroupHelper.ToAlgTerm(denVarTo), ExNumber.GetNegOne()) }; } } } string constOutStr = ""; string constToStr = GroupHelper.ToAlgTerm(constTo).FinalToDispStr(); if (constTo.Length > 0) { constOutStr = constToStr + "\\int(" + (varTo.Length == 0 ? "1" : GroupHelper.ToAlgTerm(varTo).FinalToDispStr()) + ")\\d" + dVar.ToDispString(); if (constToStr.Trim() != "1") pEvalData.GetWorkMgr().FromFormatted(WorkMgr.STM + constOutStr + WorkMgr.EDM, "Take out the constants."); } if (varTo.Length == 1 && varTo[0] is AlgebraTerm) { AlgebraTerm varToTerm = varTo[0] as AlgebraTerm; List<ExComp[]> gps = varToTerm.GetGroupsNoOps(); if (gps.Count > 1) { // This integral should be split up even further. string overallStr = ""; string[] gpsStrs = new string[gps.Count]; for (int i = 0; i < gps.Count; ++i) { gpsStrs[i] = "\\int" + GroupHelper.ToAlgTerm(gps[i]).FinalToDispStr() + "\\d" + dVar.ToDispString(); overallStr += gpsStrs[i]; if (i != gps.Count - 1) overallStr += "+"; } pEvalData.GetWorkMgr().FromFormatted(WorkMgr.STM + overallStr + WorkMgr.EDM, "Split the integral up."); // Independently take the derivative of each group. ExComp[] adGps = new ExComp[gps.Count]; for (int i = 0; i < gps.Count; ++i) { IntegrationInfo integrationInfo = new IntegrationInfo(); int prevStepCount = ArrayFunc.GetCount(pEvalData.GetWorkMgr().GetWorkSteps()); pEvalData.GetWorkMgr().FromFormatted(""); WorkStep lastStep = pEvalData.GetWorkMgr().GetLast(); lastStep.GoDown(ref pEvalData); ExComp aderiv = AntiDerivativeHelper.TakeAntiDerivativeGp(gps[i], dVar, ref integrationInfo, ref pEvalData, lowerStr, upperStr); lastStep.GoUp(ref pEvalData); if (aderiv == null) { pEvalData.GetWorkMgr().PopStepsCount(ArrayFunc.GetCount(pEvalData.GetWorkMgr().GetWorkSteps()) - prevStepCount); return null; } lastStep.SetWorkHtml(WorkMgr.STM + gpsStrs[i] + "=" + WorkMgr.ToDisp(aderiv) + WorkMgr.EDM); adGps[i] = aderiv; } // Convert to a term. ExComp finalEx = adGps[0]; for (int i = 1; i < adGps.Length; ++i) { finalEx = AddOp.StaticCombine(finalEx, adGps[i].ToAlgTerm()); } if (adGps.Length > 1) pEvalData.GetWorkMgr().FromSides(finalEx, null, "Add back together."); if (constTo.Length > 0) { finalEx = MulOp.StaticCombine(finalEx, GroupHelper.ToAlgTerm(constTo)); pEvalData.GetWorkMgr().FromSides(finalEx, null, "Multiply the constants back in."); } return finalEx; } } ExComp antiDeriv = TakeAntiDerivativeVarGp(varTo, dVar, ref pIntInfo, ref pEvalData); if (antiDeriv == null) return null; if (constTo.Length != 0) { if (constToStr.Trim() != "1") { pEvalData.GetWorkMgr().FromFormatted(WorkMgr.STM + constOutStr + "=" + WorkMgr.ToDisp(GroupHelper.ToAlgTerm(constTo)) + WorkMgr.ToDisp(antiDeriv) + WorkMgr.EDM, "Multiply the constants back in."); } return MulOp.StaticCombine(antiDeriv, GroupHelper.ToAlgTerm(constTo)); } else return antiDeriv; }
private static ExComp SingularIntByParts(ExComp ex0, AlgebraComp dVar, string thisSTr, ref IntegrationInfo pIntInfo, ref EvalData pEvalData) { ExComp intByParts = IntByParts(ex0, ExNumber.GetOne(), dVar, thisSTr, ref pIntInfo, ref pEvalData); return intByParts; }
private static ExComp TakeAntiDerivativeVarGp(ExComp[] gp, AlgebraComp dVar, ref IntegrationInfo pIntInfo, ref EvalData pEvalData) { // For later make a method that makes the appropriate substitutions. // If the inside of a function isn't just a variable and the derivative // isn't variable, make the substitution. // Derivative of nothing is just the variable being integrated with respect to. if (gp.Length == 0) { pEvalData.GetWorkMgr().FromFormatted(WorkMgr.STM + "\\int\\d" + dVar.ToDispString() + "=" + dVar.ToDispString() + WorkMgr.EDM, "Use the antiderivative power rule."); return dVar; } ExComp atmpt = null; // Is this a single function? (power included) if (gp.Length == 1 && gp[0] is AlgebraFunction) { if (gp[0] is PowerFunction) gp[0] = (gp[0] as PowerFunction).ForceCombineExponents(); atmpt = GetIsSingleFunc(gp[0], dVar, ref pEvalData); if (atmpt != null) { pEvalData.AttemptSetInputType(InputType.IntBasicFunc); return atmpt; } if (pIntInfo.ByPartsCount < IntegrationInfo.MAX_BY_PARTS_COUNT && (gp[0] is LogFunction || gp[0] is InverseTrigFunction)) { string thisStr = GroupHelper.ToAlgTerm(gp).FinalToDispStr(); pIntInfo.IncPartsCount(); atmpt = SingularIntByParts(gp[0], dVar, thisStr, ref pIntInfo, ref pEvalData); if (atmpt != null) { pEvalData.AttemptSetInputType(InputType.IntParts); return atmpt; } } } else if (gp.Length == 1 && gp[0] is AlgebraComp) { pEvalData.GetWorkMgr().FromFormatted(WorkMgr.STM + "({0}^(1+1))/(1+1)=({0}^2)/(2)" + WorkMgr.EDM, "Use the antiderivative power rule.", gp[0]); return AlgebraTerm.FromFraction(new PowerFunction(gp[0], new ExNumber(2.0)), new ExNumber(2.0)); } else if (gp.Length == 2) // Is this two functions multiplied together? { ExComp ad = null; // Are they two of the common antiderivatives? if (gp[0] is TrigFunction && gp[1] is TrigFunction && (gp[0] as TrigFunction).GetInnerEx().IsEqualTo(dVar) && (gp[0] as TrigFunction).GetInnerEx().IsEqualTo(dVar)) { if ((gp[0] is SecFunction && gp[1] is TanFunction) || (gp[0] is TanFunction && gp[1] is SecFunction)) ad = new SecFunction(dVar); else if ((gp[0] is CscFunction && gp[1] is CotFunction) || (gp[0] is CotFunction && gp[1] is CscFunction)) ad = MulOp.Negate(new CscFunction(dVar)); } if (ad != null) { pEvalData.GetWorkMgr().FromFormatted(WorkMgr.STM + "\\int(" + gp[0].ToAlgTerm().FinalToDispStr() + gp[1].ToAlgTerm().FinalToDispStr() + ")\\d" + dVar.ToDispString() + "=" + ad.ToAlgTerm().FinalToDispStr() + WorkMgr.EDM, "Use the common antiderivative."); pEvalData.AttemptSetInputType(InputType.IntBasicFunc); return ad; } } if (pIntInfo.USubCount < IntegrationInfo.MAX_U_SUB_COUNT) { pIntInfo.IncSubCount(); atmpt = AttemptUSub(gp, dVar, ref pIntInfo, ref pEvalData); if (atmpt != null) { pEvalData.AttemptSetInputType(InputType.IntUSub); return atmpt; } } if (gp.Length == 1 || gp.Length == 2) { ExComp[] den = GroupHelper.GetDenominator(gp, false); if (den != null && den.Length == 1) { ExComp[] num = GroupHelper.GetNumerator(gp); if (num.Length == 1) { int prePFWorkStepCount = ArrayFunc.GetCount(pEvalData.GetWorkMgr().GetWorkSteps()); atmpt = AttemptPartialFractions(num[0], den[0], dVar, ref pIntInfo, ref pEvalData); if (atmpt != null) return atmpt; pEvalData.GetWorkMgr().PopStepsCount(prePFWorkStepCount); } } } // Trig substitutions. int prevTrigSubWorkCount = ArrayFunc.GetCount(pEvalData.GetWorkMgr().GetWorkSteps()); atmpt = (new TrigSubTech()).TrigSubstitution(gp, dVar, ref pEvalData); if (atmpt != null) return atmpt; else pEvalData.GetWorkMgr().PopSteps(prevTrigSubWorkCount); if (gp.Length == 2) { // Using trig identities to make substitutions. atmpt = TrigFuncIntegration(gp[0], gp[1], dVar, ref pIntInfo, ref pEvalData); if (atmpt != null) return atmpt; // Integration by parts. if (pIntInfo.ByPartsCount < IntegrationInfo.MAX_BY_PARTS_COUNT) { int prevWorkStepCount = ArrayFunc.GetCount(pEvalData.GetWorkMgr().GetWorkSteps()); string thisStr = GroupHelper.ToAlgTerm(gp).FinalToDispStr(); pIntInfo.IncPartsCount(); // Is one of these a denominator because if so don't do integration by parts. if (!(gp[0] is PowerFunction && (gp[0] as PowerFunction).IsDenominator()) && !(gp[1] is PowerFunction && (gp[1] as PowerFunction).IsDenominator())) { atmpt = IntByParts(gp[0], gp[1], dVar, thisStr, ref pIntInfo, ref pEvalData); if (atmpt != null) { pEvalData.AttemptSetInputType(InputType.IntParts); return atmpt; } else pEvalData.GetWorkMgr().PopStepsCount(ArrayFunc.GetCount(pEvalData.GetWorkMgr().GetWorkSteps()) - prevWorkStepCount); } } } return null; }
private static ExComp IntByParts(ExComp ex0, ExComp ex1, AlgebraComp dVar, string thisStr, ref IntegrationInfo pIntInfo, ref EvalData pEvalData) { // Integration by parts states \int{uv'}=uv-\int{vu'} // Choose either ex0 or ex1 to be a suitable u and v' //if (ex0 is PowerFunction && (ex0 as PowerFunction).Power.IsEqualTo(Number.NegOne) && (ex0 as PowerFunction).Base is PowerFunction) //{ // PowerFunction ex0Pf = ex0 as PowerFunction; // ex0 = new PowerFunction((ex0Pf.Base as PowerFunction).Base, MulOp.StaticCombine((ex0Pf.Base as PowerFunction).Power, ex0Pf.Power)); //} //if (ex1 is PowerFunction && (ex1 as PowerFunction).Power.IsEqualTo(Number.NegOne) && (ex1 as PowerFunction).Base is PowerFunction) //{ // PowerFunction ex1Pf = ex0 as PowerFunction; // ex1 = new PowerFunction((ex1Pf.Base as PowerFunction).Base, MulOp.StaticCombine((ex1Pf.Base as PowerFunction).Power, ex1Pf.Power)); //} ExComp u, dv; if (ex0 is ExNumber) { u = ex1; dv = ex0; } else if (ex1 is ExNumber) { u = ex0; dv = ex1; } else if ((ex0 is PowerFunction && (ex0 as PowerFunction).GetPower() is ExNumber && !((ex0 as PowerFunction).GetBase() is PowerFunction && !(((ex0 as PowerFunction).GetBase() as PowerFunction).GetPower() is ExNumber))) || ex0 is AlgebraComp) { u = ex0; dv = ex1; } else if ((ex1 is PowerFunction && (ex1 as PowerFunction).GetPower() is ExNumber && !((ex1 as PowerFunction).GetBase() is PowerFunction && !(((ex1 as PowerFunction).GetBase() as PowerFunction).GetPower() is ExNumber))) || ex1 is AlgebraComp) { u = ex1; dv = ex0; } else if (ex1 is AppliedFunction) { u = ex0; dv = ex1; } else if (ex0 is AppliedFunction) { u = ex1; dv = ex0; } else return null; int stepCount = ArrayFunc.GetCount(pEvalData.GetWorkMgr().GetWorkSteps()); Integral antiderivativeOfDV = Integral.ConstructIntegral(dv.CloneEx(), dVar); antiderivativeOfDV.SetInfo(pIntInfo); antiderivativeOfDV.SetAddConstant(false); ExComp v = antiderivativeOfDV.Evaluate(false, ref pEvalData); if (v is Integral) { pEvalData.GetWorkMgr().PopStepsCount(ArrayFunc.GetCount(pEvalData.GetWorkMgr().GetWorkSteps()) - stepCount); // Try to switch the variables. ExComp tmp = u; u = dv; dv = tmp; antiderivativeOfDV = Integral.ConstructIntegral(dv, dVar); antiderivativeOfDV.SetInfo(pIntInfo); antiderivativeOfDV.SetAddConstant(false); v = antiderivativeOfDV.Evaluate(false, ref pEvalData); if (v is Integral) return null; } List<WorkStep> stepRange = pEvalData.GetWorkMgr().GetWorkSteps().GetRange(stepCount, ArrayFunc.GetCount(pEvalData.GetWorkMgr().GetWorkSteps()) - stepCount); pEvalData.GetWorkMgr().GetWorkSteps().RemoveRange(stepCount, ArrayFunc.GetCount(pEvalData.GetWorkMgr().GetWorkSteps()) - stepCount); pEvalData.GetWorkMgr().FromFormatted("", "Integrate by parts using the formula " + WorkMgr.STM + "\\int u v' = uv - \\int v u' " + WorkMgr.EDM + " where " + WorkMgr.STM + "u=" + u.ToAlgTerm().FinalToDispStr() + ", dv = " + dv.ToAlgTerm().FinalToDispStr() + WorkMgr.EDM); Derivative derivativeOfU = Derivative.ConstructDeriv(u, dVar, null); pEvalData.GetWorkMgr().FromFormatted(WorkMgr.STM + "du=" + derivativeOfU.FinalToDispStr() + WorkMgr.EDM, "Find " + WorkMgr.STM + "du" + WorkMgr.EDM); WorkStep lastStep = pEvalData.GetWorkMgr().GetLast(); lastStep.GoDown(ref pEvalData); ExComp du = derivativeOfU.Evaluate(false, ref pEvalData); lastStep.GoUp(ref pEvalData); lastStep.SetWorkHtml(WorkMgr.STM + "\\int(" + thisStr + ")d" + dVar.ToDispString() + "=" + WorkMgr.ToDisp(du) + WorkMgr.EDM); if (du is Derivative) return null; pEvalData.GetWorkMgr().FromFormatted(WorkMgr.STM + "v=" + antiderivativeOfDV.FinalToDispStr() + "=" + WorkMgr.ToDisp(v) + WorkMgr.EDM, "Find " + WorkMgr.STM + "v" + WorkMgr.EDM); lastStep = pEvalData.GetWorkMgr().GetLast(); lastStep.GoDown(ref pEvalData); pEvalData.GetWorkMgr().GetWorkSteps().AddRange(stepRange); lastStep.GoUp(ref pEvalData); pEvalData.GetWorkMgr().FromFormatted(WorkMgr.STM + "({0})({1})-\\int ({1}) ({2}) d" + dVar.ToDispString() + WorkMgr.EDM, "Substitute the values into the integration by parts formula.", u, v, du); ExComp uv = MulOp.StaticCombine(u, v.CloneEx()); ExComp vDu = MulOp.StaticCombine(v, du); Integral antiDerivVDU = Integral.ConstructIntegral(vDu, dVar); antiDerivVDU.SetInfo(pIntInfo); antiDerivVDU.SetAddConstant(false); ExComp antiDerivVDUEval = antiDerivVDU.Evaluate(false, ref pEvalData); if (antiDerivVDUEval is Integral) return null; ExComp finalEx = SubOp.StaticCombine(uv, antiDerivVDUEval); pEvalData.GetWorkMgr().FromSides(finalEx, null); return finalEx; }
private static ExComp SecTanTrig(SecFunction sf, TanFunction tf, int sp, int tp, AlgebraComp dVar, ref IntegrationInfo pIntInfo, ref EvalData pEvalData) { if (!sf.GetInnerEx().IsEqualTo(tf.GetInnerEx())) return null; bool spEven = sp % 2 == 0; bool tpEven = tp % 2 == 0; if (!spEven && tp == 1) { //ExComp[] gp = new ExComp[] { PowOp.StaticCombine(sf, new Number(sp - 1)), new AlgebraTerm(sf, new MulOp(), tf) }; //return AttemptUSub(gp, dVar, ref pIntInfo, ref pEvalData); AlgebraComp subInVar = null; if (sf.Contains(new AlgebraComp("u")) || tf.Contains(new AlgebraComp("u"))) { if (sf.Contains(new AlgebraComp("w")) || tf.Contains(new AlgebraComp("u"))) subInVar = new AlgebraComp("v"); else subInVar = new AlgebraComp("w"); } else subInVar = new AlgebraComp("u"); string innerStr = "(" + WorkMgr.ToDisp(sf.GetInnerTerm()) + ")"; pEvalData.GetWorkMgr().FromFormatted(WorkMgr.STM + "\\int \\sec^{" + (sp - 1).ToString() + "}" + innerStr + "sec" + innerStr + "tan" + innerStr + " d" + dVar.ToDispString() + WorkMgr.EDM, "Split the term up."); ExComp subbedIn = PowOp.StaticCombine(subInVar, new ExNumber(sp - 1)); pEvalData.GetWorkMgr().FromFormatted(WorkMgr.STM + "\\int " + subInVar.ToDispString() + "^{" + (sp - 1).ToString() + "} d" + subInVar.ToDispString() + WorkMgr.EDM, "Make the substitution " + WorkMgr.STM + subInVar.ToDispString() + "=\\sec" + innerStr + ", d" + subInVar.ToDispString() + "=sec" + innerStr + "tan" + innerStr + "d" + subInVar.ToDispString()); ExComp antiDeriv = TakeAntiDerivativeVarGp(new ExComp[] { subbedIn }, subInVar, ref pIntInfo, ref pEvalData); AlgebraTerm subbedBack = antiDeriv.ToAlgTerm().Substitute(subInVar, sf); pEvalData.GetWorkMgr().FromSides(subbedBack, null, "Sub back in."); return subbedBack; } //else if (!spEven && tpEven && sp > 2) //{ // ExComp secSubed = PowOp.StaticCombine( // AddOp.StaticCombine( // Number.One, // PowOp.StaticCombine(new TanFunction(sf.InnerEx), new Number(2.0))), // new Number((sp - 2) / 2)); // ExComp[] gp = new ExComp[] { PowOp.StaticCombine(tf, new Number(tp)), secSubed, PowOp.StaticCombine(sf, new Number(2.0)) }; // return AttemptUSub(gp, dVar, ref pIntInfo, ref pEvalData); //} return null; }
private static ExComp AttemptUSub(ExComp[] group, AlgebraComp dVar, ref IntegrationInfo pIntInfo, ref EvalData pEvalData) { // looking for f'(x)g(f(x)) List<ExComp> potentialUs = GetPotentialU(group, dVar); foreach (ExComp potentialU in potentialUs) { int prevWorkStepCount = ArrayFunc.GetCount(pEvalData.GetWorkMgr().GetWorkSteps()); ExComp attempt = TryU(group, potentialU, dVar, ref pIntInfo, ref pEvalData); if (attempt != null) return attempt; else pEvalData.GetWorkMgr().PopStepsCount(ArrayFunc.GetCount(pEvalData.GetWorkMgr().GetWorkSteps()) - prevWorkStepCount); } return null; }
private static ExComp AttemptUSub(ExComp[] group, AlgebraComp dVar, ExComp forcedU, ref IntegrationInfo pIntInfo, ref EvalData pEvalData) { int prevWorkStepCount = ArrayFunc.GetCount(pEvalData.GetWorkMgr().GetWorkSteps()); ExComp attempt = TryU(group, forcedU, dVar, ref pIntInfo, ref pEvalData); if (attempt != null) return attempt; else pEvalData.GetWorkMgr().PopStepsCount(ArrayFunc.GetCount(pEvalData.GetWorkMgr().GetWorkSteps()) - prevWorkStepCount); return null; }
private static ExComp AttemptPartialFractions(ExComp num, ExComp den, AlgebraComp dVar, ref IntegrationInfo pIntInfo, ref EvalData pEvalData) { if (!(den is AlgebraTerm)) return null; AlgebraTerm numTerm = num.ToAlgTerm(); AlgebraTerm denTerm = den.ToAlgTerm(); PolynomialExt numPoly = new PolynomialExt(); PolynomialExt denPoly = new PolynomialExt(); if (!numPoly.Init(numTerm) || !denPoly.Init(denTerm)) return null; if (denPoly.GetMaxPow() < 2) return null; if (numPoly.GetMaxPow() > denPoly.GetMaxPow()) { // First do a synthetic division. ExComp synthDivResult = DivOp.AttemptPolyDiv(numPoly.Clone(), denPoly.Clone(), ref pEvalData); if (synthDivResult == null) return null; ExComp intEval = Integral.TakeAntiDeriv(synthDivResult, dVar, ref pEvalData); return intEval; } ExComp atmpt = PartialFracs.Split(numTerm, denTerm, numPoly, dVar, ref pEvalData); if (atmpt == null) return null; ExComp antiDerivEval = Integral.TakeAntiDeriv(atmpt, dVar, ref pEvalData); return antiDerivEval; }
/// <summary> /// Creates a scope for outbound http requests and populates some common details. /// </summary> /// <param name="tracer">The tracer instance to use to create the new scope.</param> /// <param name="httpMethod">The HTTP method used by the request.</param> /// <param name="requestUri">The URI requested by the request.</param> /// <param name="integrationId">The id of the integration creating this scope.</param> /// <param name="tags">The tags associated to the scope</param> /// <param name="spanId">The span ID</param> /// <returns>A new pre-populated scope.</returns> public static Scope CreateOutboundHttpScope(Tracer tracer, string httpMethod, Uri requestUri, IntegrationInfo integrationId, out HttpTags tags, ulong?spanId = null) { tags = null; if (!tracer.Settings.IsIntegrationEnabled(integrationId)) { // integration disabled, don't create a scope, skip this trace return(null); } try { if (GetActiveHttpScope(tracer) != null) { // we are already instrumenting this, // don't instrument nested methods that belong to the same stacktrace // e.g. HttpClientHandler.SendAsync() -> SocketsHttpHandler.SendAsync() return(null); } var args = new OutboundHttpArgs(spanId, httpMethod, requestUri, integrationId); var scope = tracer.OutboundHttpConvention.CreateScope(args, out tags); return(scope); } catch (Exception ex) { Log.Error(ex, "Error creating or populating scope."); return(null); } }
private static ExComp TryU(ExComp[] group, ExComp uatmpt, AlgebraComp dVar, ref IntegrationInfo pIntInfo, ref EvalData pEvalData) { string groupStr = GroupHelper.ToAlgTerm(GroupHelper.CloneGroup(group)).FinalToDispStr(); string thisStr = "\\int(" + groupStr + ")" + dVar.ToDispString(); string atmptStr = uatmpt.ToAlgTerm().FinalToDispStr(); pEvalData.GetWorkMgr().FromFormatted(WorkMgr.STM + "\\int (" + groupStr + ") \\d" + dVar.ToDispString() + WorkMgr.EDM, "Use u-substitution."); AlgebraTerm term = GroupHelper.ToAlgNoRedunTerm(group); AlgebraComp subInVar; if (term.Contains(new AlgebraComp("u"))) { if (term.Contains(new AlgebraComp("w"))) subInVar = new AlgebraComp("v"); else subInVar = new AlgebraComp("w"); } else subInVar = new AlgebraComp("u"); bool success = false; term = term.Substitute(uatmpt, subInVar, ref success); if (!success) return null; List<ExComp[]> updatedGroups = term.GetGroupsNoOps(); // The group count started as one and should not have been altered by substitutions. if (updatedGroups.Count != 1) return null; Derivative derivative = Derivative.ConstructDeriv(uatmpt, dVar, null); pEvalData.GetWorkMgr().FromFormatted(WorkMgr.STM + thisStr + WorkMgr.EDM, "Substitute " + WorkMgr.STM + subInVar.ToDispString() + "=" + uatmpt.ToAlgTerm().FinalToDispStr() + WorkMgr.EDM); pEvalData.GetWorkMgr().FromFormatted("", "Find " + WorkMgr.STM + "d" + subInVar.ToDispString() + WorkMgr.EDM); WorkStep last = pEvalData.GetWorkMgr().GetLast(); last.GoDown(ref pEvalData); ExComp evaluated = derivative.Evaluate(false, ref pEvalData); last.GoUp(ref pEvalData); if (evaluated is Derivative) return null; last.SetWorkHtml(WorkMgr.STM + "\\frac{d}{d" + dVar.ToDispString() + "}[" + atmptStr + "]=" + WorkMgr.ToDisp(evaluated) + WorkMgr.EDM); group = updatedGroups[0]; List<ExComp[]> groups = evaluated.ToAlgTerm().GetGroupsNoOps(); ExComp constEx = null; if (groups.Count == 1) { ExComp[] singularGp = groups[0]; ExComp[] varTo, constTo; GroupHelper.GetConstVarTo(singularGp, out varTo, out constTo, dVar); constEx = constTo.Length == 0 ? ExNumber.GetOne() : (ExComp)AlgebraTerm.FromFraction(ExNumber.GetOne(), GroupHelper.ToAlgTerm(constTo)); if (varTo.Length == 0) { if (GroupHelper.GroupContains(group, dVar)) return null; pEvalData.GetWorkMgr().GetWorkSteps().Add(new WorkStep(WorkMgr.STM + thisStr + WorkMgr.EDM, "Make the substitution " + WorkMgr.STM + subInVar.ToDispString() + "=" + atmptStr + WorkMgr.EDM + " and " + WorkMgr.STM + "d" + subInVar.ToDispString() + "=" + evaluated.ToAlgTerm().FinalToDispStr() + WorkMgr.EDM, true)); pEvalData.GetWorkMgr().FromFormatted(WorkMgr.STM + constEx.ToAlgTerm().FinalToDispStr() + "\\int (" + GroupHelper.ToAlgTerm(group.ToArray()).FinalToDispStr() + ") d" + subInVar.ToDispString() + WorkMgr.EDM); ExComp innerAntiDeriv = TakeAntiDerivativeGp(group, subInVar, ref pIntInfo, ref pEvalData, "", ""); if (innerAntiDeriv == null) return null; pEvalData.GetWorkMgr().FromSides(MulOp.StaticWeakCombine(constEx, innerAntiDeriv), null, "Substitute back in " + WorkMgr.STM + subInVar.ToDispString() + "=" + atmptStr + WorkMgr.EDM); // Sub back in the appropriate values. innerAntiDeriv = innerAntiDeriv.ToAlgTerm().Substitute(subInVar, uatmpt); ExComp retEx = MulOp.StaticCombine(innerAntiDeriv, constEx); pEvalData.GetWorkMgr().FromSides(retEx, null); return retEx; } evaluated = GroupHelper.ToAlgTerm(varTo).RemoveRedundancies(false); } else { ExComp[] groupGcf = evaluated.ToAlgTerm().GetGroupGCF(); ExComp[] varTo, constTo; GroupHelper.GetConstVarTo(groupGcf, out varTo, out constTo, dVar); AlgebraTerm constToAg = GroupHelper.ToAlgTerm(constTo); evaluated = DivOp.StaticCombine(evaluated, constToAg.CloneEx()); constEx = AlgebraTerm.FromFraction(ExNumber.GetOne(), constToAg); } for (int j = 0; j < group.Length; ++j) { if (group[j].IsEqualTo(evaluated)) { List<ExComp> groupList = ArrayFunc.ToList(group); ArrayFunc.RemoveIndex(groupList, j); pEvalData.GetWorkMgr().GetWorkSteps().Add(new WorkStep(WorkMgr.STM + thisStr + WorkMgr.EDM, "Make the substitution " + WorkMgr.STM + subInVar.ToDispString() + "=" + atmptStr + WorkMgr.EDM + " and " + WorkMgr.STM + "d" + subInVar.ToDispString() + "=" + evaluated.ToAlgTerm().FinalToDispStr() + WorkMgr.EDM, false)); bool mulInCost = constEx != null && !ExNumber.GetOne().IsEqualTo(constEx); string mulInCostStr = (mulInCost ? constEx.ToAlgTerm().FinalToDispStr() : ""); group = groupList.ToArray(); if (GroupHelper.GroupContains(group, dVar)) return null; pEvalData.GetWorkMgr().FromFormatted(WorkMgr.STM + mulInCostStr + "\\int (" + GroupHelper.ToAlgTerm(group).FinalToDispStr() + ") d" + subInVar.ToDispString() + WorkMgr.EDM); ExComp innerAntiDeriv = TakeAntiDerivativeGp(group, subInVar, ref pIntInfo, ref pEvalData, "", ""); if (innerAntiDeriv == null) return null; pEvalData.GetWorkMgr().FromFormatted(WorkMgr.STM + mulInCostStr + "(" + innerAntiDeriv.ToAlgTerm().FinalToDispStr() + ")" + WorkMgr.EDM, "Substitute back in " + WorkMgr.STM + subInVar.ToDispString() + "=" + uatmpt.ToAlgTerm().FinalToDispStr() + WorkMgr.EDM); // Sub back in the appropriate values. innerAntiDeriv = innerAntiDeriv.ToAlgTerm().Substitute(subInVar, uatmpt); ExComp retEx; if (mulInCost) retEx = MulOp.StaticCombine(constEx, innerAntiDeriv); else retEx = innerAntiDeriv; pEvalData.GetWorkMgr().FromSides(retEx, null); return retEx; } else if (group[j] is PowerFunction && evaluated is PowerFunction && (group[j] as PowerFunction).GetPower().IsEqualTo((evaluated as PowerFunction).GetPower())) { PowerFunction groupPf = group[j] as PowerFunction; PowerFunction evaluatedPf = evaluated as PowerFunction; List<ExComp[]> baseGps = groupPf.GetBase().ToAlgTerm().GetGroupsNoOps(); if (baseGps.Count == 1) { // Search the base for like terms. for (int k = 0; k < baseGps[0].Length; ++k) { if (baseGps[0][k].IsEqualTo(evaluatedPf.GetBase())) { List<ExComp> baseGpsList = ArrayFunc.ToList(baseGps[0]); ArrayFunc.RemoveIndex(baseGpsList, k); group[j] = new PowerFunction(GroupHelper.ToAlgTerm(baseGpsList.ToArray()), evaluatedPf.GetPower()); pEvalData.GetWorkMgr().GetWorkSteps().Add(new WorkStep(WorkMgr.STM + thisStr + WorkMgr.EDM, "Make the substitution " + WorkMgr.STM + subInVar.ToDispString() + "=" + atmptStr + WorkMgr.EDM + " and " + WorkMgr.STM + "d" + subInVar.ToDispString() + "=" + evaluated.ToAlgTerm().FinalToDispStr() + WorkMgr.EDM, false)); bool mulInCost = constEx != null && !ExNumber.GetOne().IsEqualTo(constEx); string mulInCostStr = (mulInCost ? constEx.ToAlgTerm().FinalToDispStr() : ""); pEvalData.GetWorkMgr().FromFormatted(WorkMgr.STM + mulInCostStr + "\\int (" + GroupHelper.ToAlgTerm(group).FinalToDispStr() + ") d" + subInVar.ToDispString() + WorkMgr.EDM); ExComp innerAntiDeriv = TakeAntiDerivativeGp(@group, subInVar, ref pIntInfo, ref pEvalData, "", ""); if (innerAntiDeriv == null) return null; pEvalData.GetWorkMgr().FromFormatted(WorkMgr.STM + mulInCostStr + "(" + innerAntiDeriv.ToAlgTerm().FinalToDispStr() + ")" + WorkMgr.EDM, "Substitute back in " + WorkMgr.STM + subInVar.ToDispString() + "=" + uatmpt.ToAlgTerm().FinalToDispStr() + WorkMgr.EDM); // Sub back in the appropriate values. innerAntiDeriv = innerAntiDeriv.ToAlgTerm().Substitute(subInVar, uatmpt); ExComp retEx; if (mulInCost) retEx = MulOp.StaticCombine(constEx, innerAntiDeriv); else retEx = innerAntiDeriv; pEvalData.GetWorkMgr().FromSides(retEx, null); return retEx; } } } } } return null; }
public async Task SaveChangesAsync() { _logger.LogInformation("Start migration to DB"); foreach (var appDetail in AppDetails) { try { var game = new Game(); game.Name = appDetail.Name; game.Description = appDetail.DetailedDescription; game.Publisher = appDetail.Publishers.FirstOrDefault(); game.Developer = appDetail.Developers.FirstOrDefault(); var genres = appDetail.Genres; var genreValue = Genre.Default; foreach (var genre in genres) { // Поиск первого подходящего жанра. genreValue = genre.Description switch { "Экшены" => Genre.Action, "Симуляторы" => Genre.Simulation, "Стратегии" => Genre.Strategy, "Ролевые игры" => Genre.RPG, "Головоломки" => Genre.Puzzle, "Казуальные игры" => Genre.Arcade, "Гонки" => Genre.Race, _ => Genre.Default }; if (genreValue != Genre.Default) { break; } } game.Genre = genreValue; game.ReleaseDate = Convert.ToDateTime(appDetail.ReleaseDate.Date); game.AgeRating = appDetail.RequiredAge.ToString(); using (var webclient = new WebClient()) { game.Logo = webclient.DownloadData(appDetail.HeaderImage); } await _appDBContext.Games.AddAsync(game); await _appDBContext.SaveChangesAsync(); _logger.LogInformation($"Created game(Id = {game.Name})"); var integrationInfo = new IntegrationInfo(); integrationInfo.ExternalSystemDescriptor = ExternalSystemDescriptor; integrationInfo.ExternalGameId = Convert.ToInt32(appDetail.SteamAppId); integrationInfo.InternalGameId = game.Id; integrationInfo.Date = DateTime.Now; await _appDBContext.IntegrationInfos.AddAsync(integrationInfo); await _appDBContext.SaveChangesAsync(); _logger.LogInformation($"Created integration info(Id = {integrationInfo.InternalGameId})"); } catch (Exception e) { _logger.LogError(e, "Произошла ошибка при миграции в БД"); } } }
public static CallTargetState OnMethodBegin <TTarget, TRequest>(TTarget instance, TRequest requestMessage, CancellationToken cancellationToken, IntegrationInfo integrationId, Func <bool> isTracingEnableFunc = null) where TRequest : IHttpRequestMessage { if (requestMessage.Instance is not null && IsTracingEnabled(requestMessage.Headers, isTracingEnableFunc)) { Scope scope = ScopeFactory.CreateOutboundHttpScope(Tracer.Instance, requestMessage.Method.Method, requestMessage.RequestUri, integrationId, out HttpTags tags); if (scope != null) { tags.HttpClientHandlerType = instance.GetType().FullName; // add distributed tracing headers to the HTTP request SpanContextPropagator.Instance.Inject(scope.Span.Context, new HttpHeadersCollection(requestMessage.Headers)); return(new CallTargetState(scope)); } } return(CallTargetState.GetDefault()); }
/// <summary> /// Creates a scope for outbound http requests and populates some common details. /// </summary> /// <param name="tracer">The tracer instance to use to create the new scope.</param> /// <param name="httpMethod">The HTTP method used by the request.</param> /// <param name="requestUri">The URI requested by the request.</param> /// <param name="integrationId">The id of the integration creating this scope.</param> /// <param name="tags">The tags associated to the scope</param> /// <param name="spanId">The span ID</param> /// <returns>A new pre-populated scope.</returns> public static Scope CreateOutboundHttpScope(Tracer tracer, string httpMethod, Uri requestUri, IntegrationInfo integrationId, out HttpTags tags, ulong?spanId = null) { tags = null; if (!tracer.Settings.IsIntegrationEnabled(integrationId) || HttpBypassHelper.UriContainsAnyOf(requestUri, tracer.Settings.HttpClientExcludedUrlSubstrings)) { // integration disabled, don't create a scope, skip this trace return(null); } Scope scope = null; try { if (GetActiveHttpScope(tracer) != null) { // we are already instrumenting this, // don't instrument nested methods that belong to the same stacktrace // e.g. HttpClientHandler.SendAsync() -> SocketsHttpHandler.SendAsync() return(null); } string resourceUrl = requestUri != null?UriHelpers.CleanUri(requestUri, removeScheme : true, tryRemoveIds : true) : null; string httpUrl = requestUri != null?UriHelpers.CleanUri(requestUri, removeScheme : false, tryRemoveIds : false) : null; tags = new HttpTags(); string serviceName = tracer.Settings.GetServiceName(tracer, ServiceName); scope = tracer.StartActiveWithTags(OperationName, tags: tags, serviceName: serviceName, spanId: spanId); var span = scope.Span; span.Type = SpanTypes.Http; span.ResourceName = $"{httpMethod} {resourceUrl}"; tags.HttpMethod = httpMethod?.ToUpperInvariant(); tags.HttpUrl = httpUrl; tags.InstrumentationName = IntegrationRegistry.GetName(integrationId); tags.SetAnalyticsSampleRate(integrationId, tracer.Settings, enabledWithGlobalSetting: false); } catch (Exception ex) { Log.Error(ex, "Error creating or populating scope."); } // always returns the scope, even if it's null because we couldn't create it, // or we couldn't populate it completely (some tags is better than no tags) return(scope); }
private static ExComp TrigFuncIntegration(ExComp ex0, ExComp ex1, AlgebraComp dVar, ref IntegrationInfo pIntInfo, ref EvalData pEvalData) { int tf0Pow = -1; int tf1Pow = -1; TrigFunction tf0 = null; TrigFunction tf1 = null; if (ex0 is TrigFunction) { tf0Pow = 1; tf0 = ex0 as TrigFunction; } else if (ex0 is PowerFunction) { PowerFunction pf0 = ex0 as PowerFunction; if (pf0.GetBase() is TrigFunction && pf0.GetPower() is ExNumber && (pf0.GetPower() as ExNumber).IsRealInteger()) { tf0 = pf0.GetBase() as TrigFunction; tf0Pow = (int)(pf0.GetPower() as ExNumber).GetRealComp(); } } else return null; if (ex1 is TrigFunction) { tf1Pow = 1; tf1 = ex1 as TrigFunction; } else if (ex1 is PowerFunction) { PowerFunction pf1 = ex1 as PowerFunction; if (pf1.GetBase() is TrigFunction && pf1.GetPower() is ExNumber && (pf1.GetPower() as ExNumber).IsRealInteger()) { tf1 = pf1.GetBase() as TrigFunction; tf1Pow = (int)(pf1.GetPower() as ExNumber).GetRealComp(); } } else return null; if (tf1Pow < 0 || tf0Pow < 0) return null; ExComp simplified = null; if (tf1Pow == 0 && tf0Pow == 0) simplified = SingularPowTrig(tf0, tf1); else if ((tf0 is SinFunction && tf1 is CosFunction) || (tf0 is CosFunction && tf1 is SinFunction)) { int sp, cp; SinFunction sf; CosFunction cf; if (tf0 is SinFunction) { sf = tf0 as SinFunction; cf = tf1 as CosFunction; sp = tf0Pow; cp = tf1Pow; } else { sf = tf1 as SinFunction; cf = tf0 as CosFunction; sp = tf1Pow; cp = tf0Pow; } string dispStr = "\\int ( " + WorkMgr.ToDisp(ex0) + WorkMgr.ToDisp(ex1) + " ) d" + dVar.ToDispString(); simplified = SinCosTrig(sf, cf, sp, cp, dispStr, dVar, ref pEvalData); } else if ((tf0 is SecFunction && tf1 is TanFunction) || (tf0 is TanFunction && tf1 is SecFunction)) { int sp, tp; SecFunction sf; TanFunction tf; if (tf0 is SecFunction) { sf = tf0 as SecFunction; tf = tf1 as TanFunction; sp = tf0Pow; tp = tf1Pow; } else { sf = tf1 as SecFunction; tf = tf0 as TanFunction; sp = tf1Pow; tp = tf0Pow; } // This gets the actual anti-derivative not just evaluable form. ExComp secTanTrigEval = SecTanTrig(sf, tf, sp, tp, dVar, ref pIntInfo, ref pEvalData); return secTanTrigEval; } if (simplified != null) { ExComp intEval = Integral.TakeAntiDeriv(simplified, dVar, ref pEvalData); return intEval; } return null; }