Tag Info

Hot answers tagged

9

Use NDSolve antiD = NDSolveValue[{f'[x] == Sqrt[1 + x^3], f[0] == 0}, f, {x, 0, 10}] Example usage: Plot[antiD[x], {x, 0, 10}] Alternatively... This works because this function can be antidifferentiated (by Mathematica). antiD = FunctionInterpolation[ Evaluate @ Integrate[Sqrt[1 + x^3], {x, 0, t}, Assumptions -> 0 < t < 10], {t, 0, ...


9

In Mathematica 10, this computation may be made as follows: Clear @ r volSphere9[r_] = RegionMeasure[Ball[ConstantArray[0, 10], r]] (π^5 r^10)/120 volSphere9[1000.] 2.55016*10^30


7

The sum of the squares should be less than or equal to r^2 rather than r. d = 10; r = 1000; F = Piecewise[{{1, Sum[x[i]^2, {i, d}] <= r^2}}, 0]; NIntegrate[F, {x[1], -1000, 1000}, {x[2], -1000, 1000}, {x[3], -1000, 1000}, {x[4], -1000, 1000}, {x[5], -1000, 1000}, {x[6], -1000, 1000}, {x[7], -1000, 1000}, {x[8], -1000, 1000}, {x[9], -1000, 1000}, ...


5

If you just plot the region of the graph you're interested in: pl = Plot[f[x], {x, (x /. a[[2]]), (x /. b[[2]])}, Epilog -> {Red, PointSize[Medium], Point[{{x /. a[[2]], a[[1]]}, {x /. b[[2]], b[[1]]}}]}, ImageSize -> 300, PlotPoints -> 500] Then, you can do: ArcLength @ DiscretizeGraphics @ pl 0.30827679


5

Based on @RunnyKine's comment the trouble is with Re. It seems there should be a more elegant way to do this, but moving the Re outside the differential does the job: da[x_] = Sqrt[1 + (Re@D[(-2 (ExpIntegralEi[(ZetaZero[n]) Log[x]]) Log[x]/Sqrt[x]),x])^2 ] NIntegrate[da[x], {x, x /. a[[2]], x /. b[[2]]}] .308277 Also, yet another line ...


4

This volume between the regions can be obtained as follows: f[x_] := Pi^2 Sin[x] Cos[x]^3 g[x_] := 4 x^2 v1 = Integrate[Pi g[z]^2, {z, 0, Pi/4}] v2 = Integrate[Pi f[z]^2, {z, 0, Pi/4}] N[v2 - v1] yielding: [Pi]^6/320,(1/48 + (5 [Pi])/512) [Pi]^5, 12.7596 respectively. You can use a number of v10 capabilities to visualize region and approximate volume ...


4

The problem is that NDSolve is not HoldAll or HoldFirst. Therefore the differential equation is evaluated symbolically before it is passed to NDSolve. Thus the differential equation that NDSolve sees is {R*Q'[t] + Q[t]/C2 == newfSign[t], Q[0] == 0} (* {4.54545*10^6 Q[t] + 2000 Derivative[1][Q][t] == 5, Q[0] == 0} *) The reason that one does not see the ...


4

For me it looks like the OddQ function behaves unexpected If it is replaced by OddQ2[n_] := If[Mod[n, 2] == 1, True, False] then s = NDSolve[{R*Q'[t] + Q[t]/C2 == newfSign[t], Q[0] == 0}, Q, {t, 0, 4 \[Tau]}] Plot[Q[t]/C2 /. s, {t, 0, 4 \[Tau]}, PlotRange -> Full] outputs As I stated in my comment, for functions with fast oscillations there are ...


3

Or Create an interpolation function from the plot and calculate its arc length. Note that I have modified the definitions of a and b. n = 2; f[x_] := -2 Re[ExpIntegralEi[(ZetaZero[n]) Log[x]]] Log[x]/Sqrt[x] a = FindArgMin[f[x], {x, 1.4}][[1]] // Quiet; b = FindArgMax[f[x], {x, 1.7}][[1]] // Quiet; plt = Plot[f[x], {x, a, b}]; f2 = Interpolation[ ...


3

Amplifying on Chenminqi's answer g = 1/10; func = (p^2*Sqrt[1 - (2*p)/(-g + p*(1 + p))])/(-1 + (p/g)*(p - 1)) - p^2/((1 + p/g)*(1 + p))*Sqrt[1 - (2*p)/(g + p*(1 + p))] // Simplify; fd = FunctionDomain[func, p] This is equivalent to requiring that the arguments of Sqrt be positive fd == Reduce[ Thread[ Cases[func, Sqrt[x_] -> x, Infinity] ...


3

Your method is perfectly fine in principle, because in one dimension energy conservation leads to a "quadrature" solution (i.e., you formally avoid solving the usual equation of motion). But since inverting the numerical integration is another numerical step it doesn't actually end up making the solution very easy to obtain. For example, you have to think ...


3

There are two aspects in this problem depending on the exact definition of the task, and, as we shall see, both are completely solved by MMA without any additional facility. The aspects are a) calculate the interpolation of the definite integral $f=\int_0^t \sqrt{1+x^3} \, dx$ b) calculate the interpolation of the antiderivative $fad=\int\sqrt{1+x^3} \, ...


3

Since it was Daniel Lichtblau who added the tag bugs, I would say the answer to your question is "yes".


3

One can decrease the difficulty of the problem by reducing the Dyson series to a matrix ODE. Let's start from the definition $$ U(x,x_0) = 1 + \int_{x_0}^{x}{dy_1V(y_1)}+\int_{x_0}^x{dy_1\int_{x_0}^{y_1}{dy_2V(y_1)V(y_2)}}+\ldots $$ and take the derivative with respect to $x$ $$ \frac{\partial}{\partial x}U(x,x_0) = ...


3

ftop = Pi^2 Sin[x] Cos[x]^3 fbtm = 4 x^2; Plot[{ftop, fbtm}, {x, 0, Pi/4}] Use Volume = Pi r^2 * h (cylinder volume) for top and bottom and take the difference (i.e remove volume of inner cylinder from outer) vtop = Pi Integrate[ftop^2, {x, 0, Pi/4}]; vbtm = Pi Integrate[fbtm^2, {x, 0, Pi/4}]; vtop - vbtm N[%] (* 12.7596 *) The area of the ...


2

Summarizing all of the comments: Clear[T] T[e_?NumericQ] := (1/Pi)*NIntegrate[ 1/Sqrt[Sin[ArcCos[-e]/2]^2 - Sin[\[Phi]/2]^2], {\[Phi], 0, ArcCos[e]/2}] Plot[ {Re[T[e]], Im[T[e]], Abs[T[e]]}, {e, -2, 2}, PlotRange -> All, WorkingPrecision -> 25, PlotLegends -> "Expressions", Frame -> True, Axes -> False] EDIT: With the ...


2

I think it is a working precision problem because you work with big numbers (for Factorial, Gamma and HypergeometricU these numbers are big). Therefore, you can simply increase the precision Nprob[α_, γ_, T_, k_] := prob @@ SetPrecision[{α, γ, T, k}, 100] prob[0.145, 1.71, 53, 100] Nprob[0.145, 1.71, 53, 100] 0. ...


2

Your precison is limited by using machine precision numbers in your definitions (e.g., 0.5 (for Sqrt) and 0.25). WorkingPrecision cannot undo that. After correcting those, you can use a much lower WorkingPrecision (I used WP -> 20 below). Also, as a general rule, restrict the arguments of functions that directly or indirectly use numerical techniques (e.g., ...


1

One can integrate Derivative[0, 1][y][x, t]^2 along with the pde: pde = D[y[x, t], t, t] == D[y[x, t], x, x]; solnDerivative = NDSolve[{pde, y[x, 0] == Exp[-(x)^2], Derivative[0, 1][y][x, 0] == 0, Derivative[1, 0][y][-50, t] == Derivative[0, 1][y][-50, t], Derivative[1, 0][y][50, t] == -Derivative[0, 1][y][50, t], (**) Derivative[0, ...


1

You can integrate the mean square error mse at the same time as computing u[x]. s = NDSolve[{ u''[x] == (h*L*L/(d*d))*phi[x]*phi[x]*u[x] - F*L*L*(1 - phi[x]), u[-W*d/L] == 0, u[1 + W*d/L] == 0, mse'[x] == (u[x] - vE[x])^2, mse[-W*d/L] == 0}, {u, mse}, {x, -W*d/L, 1 + W*d/L}, Method -> "StiffnessSwitching", WorkingPrecision -> 40, ...



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