Tag Info

0

As of at least V9 and after, you do not need to protect the function with NumericQ when using Plot: Plot[NIntegrate[x^2 + y^2, {x, 0, t}, {y, 6, 10}], {t, 0, 6}] Aside: This is true for ParametricPlot in V9, too, but no in V10.2. In V10.2, you get a single warning message: ParametricPlot[{t, NIntegrate[x^2 + y^2, {x, 0, t}, {y, 6, 10}]}, {t, 0, 6}, ...

3

The error messages come from Integrate/NIntegrate calls on functions with symbolic (non-numerical) parameters a, b, c. These calls come before FindRoot substitutes numerical values for these parameters. (Taking N of Integrate here is effectively the same as calling NIntegrate.) In this case the best approach it seems to me is to do the integral first, ...

5

The the function y is the integral of a logarithmic singularity, so it is relatively easy to understand. The function JacobiCN[s, 7/10] is relatively flat near s == EllipticK[7/10], so that the integral of its reciprocal can be approximated by a logarithm: y[s]/JacobiCN[s, 7/10] ~= y0 / (jp (s - EllipticK[7/10])) where y0 ~= y[s] at s == EllipticK[7/10] ...

3

My question is: how to set that NDSolve will not save whole InterpolationFunction for the result? There is actually a very simple way to do this: instead of specifying a list of functions in the second argument, specify an empty list instead. This now begs the question of how one can obtain results. The solution is to use the event location ...

11

WhenEvent is working. Try WhenEvent[x[t] < 0, Print[t]; x[t] -> 0] to see that every crossing is detected. The problem is that it only detects crossings. So changing x[t] -> 0 does not reset the event. At the next step x[t] becomes negative and no event is detected. (This is how it is supposed to behave.) The way to deal with this is to use ...

5

Since your integrand does not approach zero but a finite positive number, Limit[Exp[-16.136 (1 - Exp[-0.012*t])], t -> Infinity] (* 9.82255*10^-8 *) the integral over {t, 0, Infinity} does not converge. By the way, the error in the NIntegrate[integrand, {t, 0, 1000}] should be about 10^-7, which seems better than R. In fact, the precision seems ...

4

When you try to NIntegrate your expression, the error messages include: "suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small". Your expression does not have a singularity, its integral is manifestly not zero, it is not oscillatory, so it must be a numerical precision problem. ...

0

In an effort to answer the question, I Rationalized all constants. Used WhenEvent to stop DSolvebefore z'[ρ] becomes singular. Solved for both z and z' in the second instance of DSolve to improve the accuracy of the integrand of the subsequent NIntegrate. Commented out the instance of NIntegrate involving fnp, which has no significant effect on the ...

1

The OP's -- oops, they're bbodfrey's -- pictures suggest the problem is with interpolation, as bbgodfrey also observed. Some of the problem can be ameliorated with the InterpolationOrder option. From InterpolationOrder: In functions such as NDSolve, InterpolationOrder->All specifies that the interpolation order should be chosen to be the same as the ...

7

Mathematica seems to split the integrand component, E^(-((-m + Log[x])^2/(2 s^2))) into E^(-((m^2 + Log[x]^2)/(2 s^2))) times the sort-of "coefficient" E^((m Log[x])/s^2) (* == x^(m/s^2) *) in order to calculate the integral in terms of Meijer $G$. For reasons that are obscure to me, it seems to want the coefficient of m in the exponent to be ...

1

I think if you examine the solutions, you will see that z'[t] -> - Infinity near the point where the integration ends. Manipulate[ With[{ρminmax = Flatten[z["Domain"] /. s[i, d]]}, (* start/stop values *) Plot[ {z[ρ], z'[ρ]} /. s[i, d] // Flatten // Evaluate, (* fn. & deriv. *) {ρ, ρminmax[[1]], ρminmax[[2]]}, PlotLabel -> ...

2

This interesting problem can be solved by iterating several times on μ. (WhenEvent cannot be used, because this is a boundary value, not an initial value, computation.) μ[t_] = 0; β = 1/10; c1 = 10; c2 = 30; k1 = 100; k2 = 300; T = 100; δ1 = 1/10; δ2 = 3/10; Subscript[y, 0] = 1000; a = 4000; b = 200; d[t_] = a + b*Sin[(2*π*t/25)]; y3[t_] = ...

2

The problem appears to be associated with interpolation by the InterpolatingFunction produced by NDSolve rather than by NDSolve itself. For instance, with sol = NDSolve[{(R'[t])^2 + 2 R[t] R''[t] == -1, R[1] == 1, R'[1] == 2/3}, {R}, {t, 1, 1.2}, WorkingPrecision -> 100]; a Plot of R and its first two derivatives yields near t = 0 Plot[{R[t], ...

1

This issue has been fixed as of version 10.2.0. NIntegrate[1, x ∈ ImplicitRegion[(x > 5 && x < 9) || (x > 11 && x < 13), {x}], Method -> "MonteCarlo"] (* 6.06192 *) The syntax is fine, since x is taken to be a vector variable, similarly to NIntegrate[1, x ∈ Ball[]]

4

Do you wan the entire area enclosed by the outer envelope? A bit brute force, but note the 10-fold symmetry, so that only two arc segments define the outer boundary: base = Line@Table[ curve02, {\[Tau], 0, 5 Pi, Pi/1000}]; r1 = FindRoot[ (curve02 /. \[Tau] -> x) == (curve02 /. \[Tau] -> y), {x, .5}, {y, 5.5}]; p1 = y /. FindRoot[ (ArcTan @@ ...

5

(Reposting my comment as an answer, just to take the question off the unanswered list) This is a bug and has been fixed in version 10.2. I am not aware of any workarounds that may be applicable in earlier versions.

3

I may have missed the point but I post out of interest. p = ParametricPlot[curve02, {\[Tau], 0, 5 Pi}] c[t_] := curve02 /. \[Tau] -> t point = SortBy[c /@ Range[0, 5 Pi, 0.001], Norm]; Manipulate[ ListPlot[point[[1 ;; n]], AspectRatio -> Automatic], {n, 1, 15000, 1}] The manipulate allows to get "interior" Getting desired points: points = ...

3

As a modified version of Michael E2 answer: I tried to rewrite your original curve as below for $t\in [0,\tfrac{\pi}{2}]$, just in order to make sure the derivatives of the parametric form can be obtained easily by avoiding Abs or Sign: ncurve={(Cos[t]^2 )^(1/4),(Sin[t]^2)^(1/4)} Then the result of the closed area can be obtained by applying Greens ...

2

After thinking about it, i solved the problem by considering: region = RegionBoundary[ BoundaryDiscretizeRegion[Ellipsoid[{0, 0, 0}, {1, 0.125, 0.125}], MaxCellMeasure -> 0.1]] in this only the surface is discretized and the mesh quality can be specified by MaxCellMeasure.

3

It's a good idea to include the error you got in your question. It gives a clue and might prompt someone to investigate: NDSolve::ndinid: Initial condition {0} is not in the range specified by the discrete variable NDSolve`s$147246. >> Now Sign is discontinuous and will cause NDSolve to invoke special processing of the ODE. I suspect that the strange ... 7 Now fixed in version 10.2. In[1]:= Catch[NIntegrate[ 1, {x, y} \[Element] Triangle[{{0, 0}, {1, 2}, {2, 1}}], Method -> "MonteCarlo", EvaluationMonitor :> Throw[{x, y}]]] Out[1]= {0.615426, 0.793388} There is also RandomPoint: In[2]:= ... 3 It seems that your integral effectively diverges. Let's define: ee[x_] := 1/(1 -E^x)^10 (*div is the divergent part*) div[x_] := Evaluate[Series[ee[x], {x, 0, -1}] // Normal] all[x_] := ee[x] - div[x] You're right that you "killed" the divergence at zero: Integrate[all[x], {x, 0, 1}] // N (* 0.253202 *) But the "original" function's integral was ... 0 Integrate[ y^2 Exp[-y], {y, (a Cos[θ])/x, Sqrt[1 + (a Cos[θ])^2]/x}, Assumptions -> {θ > 0, x > 0}]$\frac{e^{-\frac{\sqrt{a^2 \cos ^2(\theta )+1}}{x}} \left(-\frac{2 x}{\sqrt{a^2 \cos ^2(\theta )+1}}-2 x^2-1\right)+a^2 \cos ^2(\theta ) \left(e^{-\frac{\sqrt{a^2 \cos ^2(\theta )+1}}{x}} \left(-\frac{2 x}{\sqrt{a^2 \cos ^2(\theta ...

1

Is this what you want to plot? ParametricPlot[Chop @ {z[l], r[l]}, {l, 0, 2}, PlotStyle -> {Red, Thick}, AspectRatio -> Automatic, GridLines -> Automatic] ParametricPlot[Chop @ {r[l], r'[l]}, {l, 0, 2}, PlotStyle -> {Red, Thick}, AspectRatio -> Automatic, GridLines -> Automatic]

4

A small remark on the error: CoefficientArrays::poly: -(1 + 3.27432/(1 + 0.092 Ccu)^2) Ccu11498 - (3 Ccu11499)/200 + 1.38465 Ccu$11500 is not a polynomial. >> First note that Ccu is your dependent variable in your PDE. The expression being complained about has several variables, Ccu and ones like Ccu$11498.. (The ones like Ccu\$11498 are internal, ...

3

Mathematica's finite element PDE methods only work for linear PDEs as of v10.1. See here or here for some other tips on how to deal with this. Given the form of your equation (some kind of non-linear reaction-diffusion equation?), I would suspect that you're better off using Mathematica's default "Method of Lines" algorithm than trying to use finite ...

1

g[a_] := ( 2 Sin[a]^4 - Cos[a]^2 Sin[a]^2 ) 1/( 2 Sin[a]^4 (Cot[a]^2 - 1) (Cot[a]^2 - 0.5)) (-(1/(Cos[a]^2) )); GaussLegendreQuadrature[a_, b_, n_, f_] := Module[{weights, i}, weights = GaussianQuadratureWeights[n, -1, 1]; (b - a)/2*Sum[weights[[i, 2]] f[(a + b)/2 + (b - a)/2 weights[[i, 1]]],{i,1, n}]] GaussLegendreQuadrature[0, Pi, n, g] Is it ...

Top 50 recent answers are included