Tag Info

Hot answers tagged

17

SphericalPlot3D is having problems where the radius goes to infinity. You can use RegionFunction to restrict the plotting region to a range where the function is well-behaved: SphericalPlot3D[ Sqrt[1/(Sin[θ]^2 Cos[2 ϕ] - Cos[θ]^2)], {θ, 0, π}, {ϕ, 0, 2 π}, MaxRecursion -> 4, PlotRange -> {-3, 3}, RegionFunction -> Function[{x, y, z, θ, ϕ, ...


14

Update a working approach using Fourier transforms The following method is based on the idea that the Laplace operator is just a multiplication with $-k^2$ in Fourier space. Therefore, I first find the Fourier transform of the $1/r$ potential and then do an inverse Fourier transform of that result, multiplied by $-k^2$ (which I call laplacianFT in the ...


11

$Version (* Out[228]= "8.0 for Microsoft Windows (64-bit) (October 7, 2011)" *) The result provided by Mathematica is correct Integrate[a/(a^2 + Sin[t]^2), {t, 0, 2 \[Pi]}] (* Out[213]= (2 \[Pi])/(Sqrt[1 + 1/a^2] a) *) Now the same procedure as "always" which "explains" the zero result. The indefinite integral is Integrate[a/(a^2 + Sin[t]^2), t] (* ...


11

Just purely for fun: to illustrate approximation of volume integral. Manipulate[ Module[{dp, dpl, dpu, r = Range[0, 1, 1/n], f, cc, lb, la, ub, ua, ll, ul}, dp = Range[0, 1, 1/#] & /@ Range[2, 100]; dpl = Total[Pi Most[#]/(Length@# - 1)] & /@ dp; dpu = Total[Pi Rest[#]/(Length@# - 1)] & /@ dp; f = Sqrt /@ r; cc = Partition[{#, 0, ...


9

Assuming that you have used the parametrization $$r(t)=(\cos{t},\sin{t},t).$$ You could just make the interval over which you plot the blue line shorter, from $[0,2\pi]$ to $[\frac{1}{2}\pi,2\pi]$, so that the plots don't overlap. Then you would get something like this: Show[ ParametricPlot3D[r[t], {t, π/2, 2 π}, PlotStyle -> {Blue, Thick, ...


9

Is this what you want? Clear[Derivative, h]; h[0] = 1; (* to avoid division by zero with OP's example R *) Derivative[1][h][s_] := Block[{Derivative}, h'[\[FormalS]] /. First@Solve[ D[R[a + h[\[FormalS]]] == - \[FormalS], \[FormalS]], h'[\[FormalS]]] /. \[FormalS] -> s ]; Derivative[n_][h][s_] := D[Derivative[n - ...


8

One easy solution is to write your graphics-primitives as usual but using cylindrical coordinates instead. primitives = Table[ {Hue[z], Arrow[{{0, 0, 5 z}, {1, 2 Pi z, 5 z}}]}, {z, 0, 1, .05} ]; And before you display them inside a Graphics3D, you map all 3D points from cylindrical to Cartesian mapping[{r_, theta_, z_}] := {r Cos[theta], r ...


8

For what it's worth, you can monitor the progress of Integrate and NIntegrate. I'm not sure how helpful the tools below are, but I feel it is probably worth mentioning them. Integrate Internal`Integrate`debugSwitch If you set Internal`Integrate`debugSwitch to the magic number 10, it will print its (major) steps in searching for the answer. For instance: ...


7

You could omit the (paraboloid) surface and use its formula as a mesh function: ContourPlot3D[z, {x, -2, 2}, {y, -2, 2}, {z, 0, 4.01}, Contours -> Range[4], ContourStyle -> {Opacity[0.3]}, PlotPoints -> 30, MaxRecursion -> 3, Mesh -> {{0}}, MeshFunctions -> {Function[{x, y, z}, z - (4 x^2 + y^2)]}, MeshStyle -> Directive[Thick, ...


7

This seems to be a perfect candidate for DifferentiatorFilter: t = TimeSeries[l1[[All, 2]], {l1[[All, 1]]}] d = DifferentiatorFilter[t, .01]; ListLinePlot[d] I just had to adjust the cutoff frequency to weed out the fast oscillations. However, this filter scales the output differently for different cutoff frequencies. Unfortunately, I believe the ...


7

Your data is appended at the end this answer. Setting up (parametrizing your curve): {xs, ys} = Transpose[data]; xi = ListInterpolation[xs, {0, 1}]; yi = ListInterpolation[ys, {0, 1}]; It is a nice looking cake: ParametricPlot3D[{xi[s] Cos[t], xi[s] Sin[t], yi[s]}, {s, 0, 1}, {t, 0, 2 Pi}, Mesh -> False, Axes -> False, Boxed -> False, ...


6

The result zero does not look correct. But you can get the correct result by using PrincipalValue->True r = Integrate[a/(Sin[t]^2 + a^2), {t, 0, 2 Pi}, PrincipalValue -> True] now r/.a->2.0 gives the value you show The original answer, without PrincipalValue -> True gives r = Integrate[a/(Sin[t]^2 + a^2), t] Maple gets this ...


6

Signal-processing is not one of my strengths, but I think we used to use low-pass filters to remove such noise. It seems to work here: l2 = LowpassFilter[TimeSeries[l1], .05]; ifn = Interpolation[l2]; plot1 = Plot[Evaluate@Interpolation[l1]'[x], {x, 0, 0.5}, PlotStyle -> {Gray}]; plot2 = Plot[Evaluate@ifn'[x], {x, 0, 0.5}, PlotStyle -> {Red}]; ...


6

There probably cannot be general answer for such a general question because the bigger integrand (other conditions being equal) the more time Integrate needs to handle it. But for basic tabular integrands there are some benchmarks made by Albert Rich, the developer of Rubi - rule-based integrator. On the linked page a table is given where the "Timeout" ...


6

In the absence of a closed form analytical solution, use NDSolveValue to obtain a numerical solution. To do so, values must be assigned to the constants, and an initial condition provided. So, for instance, a = 1; b = 1; c = 1; sol = NDSolveValue[{x'[t] == a*(1 - x[t])/(t - t^2) - (b*x[t] - c*x[t]^2)/((t - t^2)*(t - x[t])), x[2] == 0}, x, {t, 2, ...


5

Define: integ[p_?NumericQ] := NIntegrate[f[x, p], {x, a, b}] Then plot it: Plot[integ[p],{p,10,100}]


5

Adding the assumption that x is real (which it is in this case) and then simplifying allows Mathematica to compute a symbolic answer: $Assumptions = Element[x, Reals]; Integrate[-((I PolyLog[2, x - x^2])/(Sqrt[3] (-(1/2) - (I Sqrt[3])/2 + x))), x]; Simplify @ %; Limit[%, x -> 1] On 10.1 these commands yield the following (after some computation time): ...


4

As is well known, and has been discussed extensively in this forum, there may be problems in general with Integrate[] and the fundamental theorem of calculus, mostly due to discontinuities or other singularities in the antiderivative. But not in this case for version 8: $Version (* Out[1]= "8.0 for Microsoft Windows (64-bit) (October 7, 2011)" *) The ...


4

Mathematica 10.1 seems to have fixed this bug:


4

EDIT Sorry but this development contains an error (replacement of bound2 by bound2a). Thanks to bbgodfrey for notifying me. It turns out that the original bound2 is ill defined in the OP as it contains a derivative of the same order as the differential equation. Only if one makes deliberately the same error as I did (writing dx/dt instaed of dx/ds on the ...


4

(I know this is an old question, but it just got nudged and I saw another way to do it.) You can also take advantage of the vector potential to do this: $$ \vec{A}(\vec{r}) = \frac{\mu_0 I}{4\pi} \oint \frac{d\vec{r}'}{|\vec{r} - \vec{r}'|} $$ Using much the same symmetry arguments as given in the answer above, we can first look at the vector potential in ...


4

There are a couple of things wrong in your code: first you need to define the recursions consistently... here I've put all the t-terms on the left and t-1 on the right hand side. Next, you need to specify initial conditions (there weren't any for the fx and fy and the y was only defined implicitly (as 1-x). So here is syntactically correct code: d = 2; k = ...


4

A better way how compute the maximum of integral $$\int_{0}^1 \left( -yt + \log(1-e^{-yt}) \right) dt $$ is following. Derivative must be equal to zero at the maximum. FullSimplify[D[Integrate[-y*t + Log[1 - Exp[-y*t]], t], y]] $$\frac{\text{Li}_2\left(e^{t y}\right)+t y \left(\log \left(1-e^{t y}\right)-t y\right)}{y^2}$$ For t=1 we have (t y (-t y + ...


4

As I've pointed out before in, Mathematica complaints that convergent integral diverges and How to help MMA to simplify integrands?, Expectation is much faster on integrands that are a sums of terms of the form polynomial * Gaussian, provided you convert the Gaussian exponential to normal distributions. It basically is a built-in version of approach 2 that ...


4

Another way using MeshShading: Clear[r, t]; r[t_] = {Cos[t], Sin[t], t/2}; Manipulate[ Show[ ParametricPlot3D[r[t], {t, 0, 2 \[Pi]}, Mesh -> {{t0}}, MeshShading -> {Red, Blue}, MeshStyle -> {Red, PointSize[Large]}, PlotStyle -> {Thick, Arrowheads[0.04]}, AxesLabel -> {"x", "y", "z"}] /. g : {___, Blue, ___} :> (g ...


4

For n even, the Sum in the question can be performed explicitly, Evaluate[Unevaluated[n*Sum[Binomial[2 n - 4 i, n - 2 i]*Binomial[n, 2 i]* Binomial[4 i, 2 i], {i, 0, Floor[n/2]}]/2^(3 n - 1)] /. n -> 2 m /. Floor[(2*m)/2] -> m] // Simplify (* 4^(1 - 3 m) m Binomial[4 m, 2 m] HypergeometricPFQ[ {1/4, 3/4, 1/2 - m, 1/2 - m, ...


4

This is due to the sum of two very large numbers (coming from CosIntegral and SinhIntegral) being carried out without sufficient machine precision used to represent them. You can fix it giving an appropriate value of WorkingPrecision as an option to plot. You can see quite clearly that the problem comes from this by plotting the two functions (the one ...


4

Edit: material reordered for clarity The formal definition of the PolyLogorithm is Sum[z^k/k^n, {n, 1, Infinity}], which converges for Abs[z] < 1. Thus, the integrand can be integrated term-wise. summand = Integrate[-I (x (1 - x))^k/(Sqrt[3] (-(1/2) - (I Sqrt[3])/2 + x)), x] // FullSimplify (* ((-1)^(1/6) x^(1 + k) AppellF1[1 + k, -k, 1, 2 + k, x, ...


3

This seems to fix part of the problem: SphericalPlot3D[{ -Sqrt[ 1/(Sin[\[Theta]]^2 Cos[2 \[Phi]] - Cos[\[Theta]]^2)], Sqrt[1/(Sin[\[Theta]]^2 Cos[2 \[Phi]] - Cos[\[Theta]]^2)]}, {\[Theta], \[Pi]/4, 3 \[Pi]/4}, {\[Phi], \[Pi]/4, -\[Pi]/4}, MaxRecursion -> 4]


3

Integrate seems to choke on your integrand, at least on my machine. However, I was able to use Rubi (the RUle Based Integrator) to quickly obtain an analytical form of your integral (note that I swapped 1/2 for the 0.5 value you had in your original expression): analytical[s_] = Int[Sin[Pi s]/((s - 1/2)^2 + 90), s] -((I Cosh[3 Sqrt[10] Pi] ...



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