Tag Info

Hot answers tagged

6

Large t Approximation Because this is a neutral delay integral-differential equation, solving it may seem very difficult at first glance. However, the term 1/5^t makes the integral negligible for t greater than about 2. So, with the integral ignored for large t, the equation can be reduced to x[t] - x[t - 1]/(2 E) = c[2] t^2 + c[1] t + c[0] where the ...


4

Here is a general approach, illustrated with a basic Lotka-Volterra model. In this case I simply registered events when the derivative of x is zero (crossing from above), thus there is a local maximum. This is not foolproof as there could be e.g/ a plateau like in case of your blue curve that might trigger the event multiple times due to small numerical ...


4

On the borderline of comment and answer: I've found it helpful to read the error messages carefully. They contain important information specific to your problem. These are telling you that b x+a x^2+c[T] is not a number when a number is substituted for x. In particular, a and b are nonnumeric symbols. It's complicated why the symbol T is present -- it ...


4

This works on the simple example: vars = Array[a, 1]~Join~Array[b, 1]; FromCoefficientRules[ MapAt[ NIntegrate[ #, {u, 0, 2 Pi}, AccuracyGoal -> 14] &, CoefficientRules[f[u], vars], {All, -1}], vars] (* 2.0944 - 0.872665 a[1]^2 - 1.3713*10^-17 a[1] b[1] - 0.872665 b[1]^2 *) Chop[%] (* 2.0944 - 0.872665 a[1]^2 - 0.872665 ...


4

Too long for a comment: ClearAll[x, y, a, b, c, T, z, data2, X] y[a_, b_, x_, T_] := a*x^2 + b*x + c[T]; c[T_?NumericQ] := Piecewise[{{0, T == 1}, {1, T == 2}, {-1, T == 3}, {Indeterminate, True}}]; z[X_?NumericQ, T_?NumericQ, a_?NumericQ, b_?NumericQ] := NIntegrate[y[a, b, x, T], {x, 0, X}]; data2 = {{0, 1, 0.0178038}, {1, 1, 1.34999}, {2, 1, 6.6659}, {3, ...


4

Normally in Mathematica, you just need to type the integral and it will evaluate without needing to specify a substitution or anything. Unfortunately Mathematica does not know how to do this integral. I agree with what george2079 said in the comments: This is an example where it is far easier to do the substitution by hand and feed the integral in terms ...


4

Try this idea: Plot[If[x < 0, Integrate[Exp[x*z^2], {z, -\[Infinity], \[Infinity]}], None], {x, -1, 1}] Within this example you will get the following plot: Have fun!


2

The consistent behavior displayed by the OP's integral -- increase recursion, increase the magnitude of the integral -- normally is the result of a divergent integral. It's possible the OP seeks the principal value of the integral. There is one pole of order 3 in the interval of integration f = (5184 (-11 + k (98 + k (-16 + k (-40 + k (17 + 2 k (7 + ...


2

There are too many singularities in your integrand (according to Reduce there are infinity of them, but these are complex valued) and then there are 3 real valued poles {-1., -3.82843, 1.82843} (I did not check for zero/pole cancellations). So the only real pole in the range of the integration is 1.82843 or -1 + 2 Sqrt[2] integrand = 5184 ((-11 + k (98 + k ...


2

Integrate[f, x] integrates the function that is a constant (with value f), so the answer is f x. Then you are solving f x=x^4. The correct answer is, of course, f=x^3. It looks like what you are trying to do is to find the function f[x], which, when integrated, gives x^4. The way to solve this is to take derivatives of both sides of the equation. The left ...


2

I'll use a simpler form for an example. One can keep track of the least value that has given an error/warning message in a variable. It can be set whenever a message is generated using Check. The use of Quiet is optional. You may want to limit the messages that trigger a Check or that are suppressed by Quiet. See their documentation for more. I also ...


2

Reap@NIntegrate[Cos@x, {x, 0, 10}, Method -> {"RiemannRule", "Type" -> "Left", "Points" -> 50}, MaxRecursion -> 0, EvaluationMonitor :> Sow@x] (* {-0.451614, {{0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1., 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2., 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, ...


2

The easiest solution is to give the root finder [FindRoot] better starting points. for example use: ropt[\[Gamma]_] := FindRoot[diff[r, \[Gamma]], {r, 2, 4}][[1]][[2]]; Also your print statement has a minor syntax error. For[\[Gamma] = 10, \[Gamma] <= 5000, \[Gamma] += 10^Floor[Log10[\[Gamma]]], Print["\[Gamma]=", \[Gamma], ", ...


1

Your Area results in a special function output with an assumption. You can force the evaluation simply by appending //N Area[2 Sqrt[(1 - p^2)^2 - r^2], {p, 0, 1}, {r, 0, 1 - p^2}] (* Integrate[-(-1 + p^2) Sqrt[1 + 16 p^2] EllipticE[-(3/(1 + 16 p^2))], {p, 0, 1}, Assumptions -> 0 < 1 - p^2] *) Area[2 Sqrt[(1 - p^2)^2 - r^2], {p, 0, 1}, {r, 0, 1 - ...


1

How about something like Options[NArea] = Options[NIntegrate]; NArea[R__, ops:OptionsPattern[]] := Internal`InheritedBlock[{Integrate}, Unprotect[Integrate]; Integrate[Shortest[e__], r___Rule] := NIntegrate[e, ops]; Area[R] ] NArea[2 Sqrt[(1 - p^2)^2 - r^2], {p, 0, 1}, {r, 0, 1 - p^2}] 2.38377


1

Put everything into SI units. Also, Mma appears to want "Kelvins" rather than "kelvins". $Version "10.0 for Mac OS X x86 (64-bit) (December 4, 2014)" h = UnitConvert[Quantity["PlanckConstant"]]; c = UnitConvert[Quantity["SpeedOfLight"]]; kb = UnitConvert[Quantity["BoltzmannConstant"]]; Iplanck[lambda_, T_] := Module[ {lambdaSI = ...


1

I didn't go deep to the possible repetitive calculation of f[x] and its derivative (actually I doubt if they are the bottleneck of speed, due to my… intuition), but your code got a 1.25X speed up in my computer with the Together in your integrand[t] being taken away: gauMix[means_, vars_] := Total[Apply[(1/(Sqrt[2*Pi*#2]*Length[vars]))* E^-(((x - ...


1

You are defining t as numeric (t_?NumericQ) and a region is not numeric, as the error message explained. Let's check NumericQ[Interval[{2, 4}]] False This works f[a_, t_] := t^3; NIntegrate[f[a, t], t \[Element] Interval[{2, 4}]] {60.}


1

The error occurs because of the integral extending to Infinity. If I simply do NIntegrate[r*BesselJ[0, 10*r]* (BesselJ[0, Sqrt[0.01/r]] - 1 + BesselJ[1, 1]/ BesselY[1, 1]*(2/Pi*Log[0.5*Exp[EulerGamma]*Sqrt[0.01/r]] - BesselY[0, Sqrt[0.01/r]])), {r, 0.01, 10000}] I get the error NIntegrate::ncvb: "NIntegrate failed to converge to prescribed accuracy ...


1

Some points: You are integrating a function of InterpolatingFunction. See this thread for guidance how to achieve maximum precision in this situation using NIntegrate. You are using Sum for summing up imprecise numbers which is the worst way to do this as demonstrated here. Use Total with option "CompensatedSummation" -> True instead. Avoid using ...



Only top voted, non community-wiki answers of a minimum length are eligible