Tag Info

Hot answers tagged

20

We define the function f and multiple constraint functions g1, g2: f[x_, y_, z_] := x y + y z g1[x_, y_] := x^2 + y^2 - 2 g2[x_, z_] := x^2 + z^2 - 2 then, in order to find necessary conditions for constrained extrema we introduce the Lagrange function h with Lagrange multipliers λ1 and λ2: h[x_, y_, z_, λ1_, λ2_] := f[x, y, z] - λ1 g1[x, y] - λ2 g2[x, ...


20

The integrand has two singular points: Solve[ 4z^2 + 4z + 3 == 0, z] {{z -> 1/2 (-1 - I Sqrt[2])}, {z -> 1/2 (-1 + I Sqrt[2])}} At infinity it becomes zero: Limit[ 1/Sqrt[ 4 z^2 + 4 z + 2], z -> ComplexInfinity] 0 All these points are the branch points, thus we should define appropriately integration contours in order to avoid possible ...


16

This is indeed a serious and problematic issue. We know many similar problems with symbolic integration which provides Integrate. There were some improvments in newer versions of the system but also some issues become worse, see e.g. Mathematica 9 can't integrate this function but earlier versions could. ). One can find more problems looking for tags ...


16

I'd advocate taking differences between successive peaks and likewise troughs. These can be found by keeping track of when the derivative is zero. pts = Reap[s = NDSolve[{y'[x] == y[x] Cos[x + y[x]], y[0] == 1, WhenEvent[y'[x] == 0, Sow[x]]}, {y, y'}, {x, 0, 30}]][[2, 1]] (* Out[290]= {0.448211158984, 4.6399193764, 7.44068279785, 10.953122261, \ ...


16

Maximize[{y, x^2 + y^2 == (2 x^2 + 2 y^2 - x)^2}, {x, y}] {(3 Sqrt[3])/8, {x -> 3/8, y -> (3 Sqrt[3])/8}}


14

In general Mathematica cannot compute symbolically infinite sums over primes because of the lack of appropriate mathematical tools. However there are infinite products over primes which are basically well understood on the mathematical level. One famous example is the Euler formula for the Riemann zeta function, one of the most beautiful (and mysterious ...


14

For this function: f[z_] := (1 - E^z + z)/(z^3 (z - 1)^2) there are no branch cuts in the complex plane therefore we simply use Cauchy integral theorem and the related formula of the complex residue, i.e. we sum up residues of the function $f$ in the circle $\mid z \mid =2$. Let's denote $$int = \oint_{\mid z \mid =2}\frac{1-e^z+z}{z^3 (z-1)^2}dz$$ Now ...


14

Short story $$ \vartheta(x) = \arg \left[(\operatorname{Bi}x+i \operatorname{Ai}x)e^{-\frac{2}{3} i (-x)^{3/2}}\right]+\frac{2}{3} \operatorname{Re}\left[(-x)^{3/2}\right] $$ Update: I see that you want use only real functions, so you can expand this as $$ \vartheta(x) = \begin{cases} \arctan\frac{\cos \left(\frac{2}{3} (-x)^{3/2}\right) ...


13

You can get a parametric representation for your curve : eqn = 1/x + 3/4 (((y - 1/Sqrt[3])/x)^2 + 1) Exp[ArcTan[(y - 1/Sqrt[3])/x] - Pi/6] ; aux = First@Solve[(eqn /. {y -> 1/Sqrt[3] + t x}) == 0, x] (* {x -> -((4 E^(\[Pi]/6 - ArcTan[t]))/(3 (1 + t^2)))} *) solx = aux[[1, 2]] (* -((4 E^(\[Pi]/6 - ArcTan[t]))/(3 (1 + t^2))) *) soly = 1/Sqrt[3] + t ...


13

This is not an answer (yet). Rather it explores the question in more depth. n = 8; parameters = ConstantArray[{0, 1}, n]; variables = Symbol /@ CharacterRange["a", FromCharacterCode[ToCharacterCode["a"] + n - 1]]; The following takes a long time to evaluate, but the results it produces reveal give us a better view of the problem with Probability. ...


13

Here's the exact answer: i1 = Integrate[x^n Exp[-(x - a)^2], {x, 0, Infinity}, Assumptions -> n > 0] /. n -> 1/2 (* 1/2 E^-a^2 (Gamma[3/4] Hypergeometric1F1[3/4, 1/2, a^2] + 1/2 a Gamma[1/4] Hypergeometric1F1[5/4, 3/2, a^2]) *) i1 /. a -> 0.3 (* 0.907605 *)


13

This is standard cancellation error (please Google for it). See below for more details. Take a look at the exact result first: result = Integrate[x^50*Sin[x], {x, 0, 1}] (* ==> 16432804687774250383441481995831940788236063969597816674967907249 Cos[1] + 50 (-608281864034267560872252163321295376887552831379210240000000000 + ...


13

It's not a bug if you consider this behavior as a logical continuation of the following permissible syntax: D[a + b x^3, x, x, x] (* ==> 6 b *) D[a + b x^3, x, x] (* ==> 6 b x *) D[a + b x^3, x] (* ==> 3 b x^2 *) D[a + b x^3] (* ==> a + b x^3 *) The point is that a Sequence of variables is allowed following the first argument of D. And ...


12

It's not a bug, it's a feature Exact integration returns 1/Sqrt[2 Pi] Integrate[(1 + Sqrt[x])^2 Exp[I k x], {x, -Infinity, Infinity}, Assumptions -> {k \[Element] Reals}] Integrate::idiv: "Integral of E^(I\k\x)\ (1+[Sqrt]x)^2 does not converge on {-Infinity,Infinity}." However we can multiply by Exp[-b Abs[x]] and then put b -> 0 ...


12

Artes' guess seems basically right. Here is a way to reach the correct result. First, the antiderivative returned by Mathematica: i0 = FullSimplify[ Integrate[Sqrt[(2 t)^2 + (4 - 3 t^2)^2], t], t > 0] (* (2 (Sqrt[16 - 2 I (-5 I + Sqrt[11]) t^2] Sqrt[8 + I (5 I + Sqrt[11]) t^2] ( 5 (-5 I + Sqrt[11]) EllipticE[ArcSin[1/2 t Root[9 - 5 ...


12

If you want to calculate this integral with Mathematica use beautiful (and very powerful!)$\;$ Cauchy Integral Formula implying an adequate theorem of Complex Residue. Thus we have $$\int_{\left | z \right |=1}\frac{dz}{z}= 2\pi i\; Res_{z_{0}=0} f$$ where $f(z)=\frac{1}{z}$. We can find the residue at $z_0=0$ of $f(z)$ in Mathematica with Residue: ...


12

Plot3D[{5 (x^2 + y^2), 6 - 7 x^2 - y^2}, {x, -1, 1}, {y, -1, 1}, RegionFunction -> Function[{x, y}, 5 (x^2 + y^2) < 6 - 7 x^2 - y^2]] Integrate[(6 - 7 x^2 - y^2 - 5 (x^2 + y^2)) UnitStep[(6 - 7 x^2 - y^2 - 5 (x^2 + y^2))], {x, -10, 10}, {y, -10, 10}] (3 π)/Sqrt[2] Edit Since working with the UnitStep function (rather ...


11

You are using the same dummy variable for all integrals. Extended answer Modify your code slightly and note that all integrals use the same dummy: BallVolume[dimension_, radius_] := If[dimension == 0, 2*radius, Assuming[radius > 0, testIntegrate[ BallVolume[dimension - 1, Sqrt[radius^2 - x^2]], {x, -radius, radius}]]]; ...


11

If $X = (X_1, ..., X_n)$ denotes a $n$-variate multivariate Normal random variable $N(\mu, \Sigma)$, then the moment generating function is given by: $$ M(t)=E\left[e^{t'X}\right] = exp\left({t'\mu + \frac12 t' \Sigma t}\right)$$ The mgf can then be used to derive the raw moments you seek. For instance, in say a bivariate setting, the product raw moment ...


11

The answer is no because of fundamental mathematical limitations which origin in the set theory regarding countability (see e.g. Cantor's theorem) - functions over a given set are more numerous than its (power) cardinality. Neither Mathematica nor any other system can integrate every function in even much more restricted class, namely Riemann integrable ...


10

Borwein integrals As Eckhard wrote in comments B[n] is the n-th Borwein integral. (The letter B was not accidental :) ) This funny properties of Borwein integrals is related to the Fourier transform of Sinc function FourierTransform[Sinc[x], x, k] 1/2 Sqrt[Pi/2] (Sign[1 - k] + Sign[1 + k]) Plot[%, {k, -2, 2}, Filling -> 0] which is the box ...


10

If we define f[x] e.g. like this: f[x_] := Abs[x] the following returns interesting points: Reduce[ Limit[(f[x + h] - f[x])/h, h -> 0, Assumptions -> x ∈ Reals, Direction -> -1] != Limit[(f[x + h] - f[x])/h, h -> 0, Assumptions -> x ∈ Reals, Direction -> 1], x] x == 0 Let's try another function defined with Piecewise, ...


10

Pairs is unordered and index in each pair is also unordered. Let us choose the order: In each pair the first index is less then the second. Pairs is sorted in ascending order by the first index. If the first indexes is equal then sort by the second. Examples in the question have the right order. Let we have powers $(0,\ldots,0,r_i,r_{i+1},\ldots,r_n)$. ...


10

In this particular case Mathematica for some reason considers b[i] as a constant. Compare: Integrate[Exp[Sum[-((cw λ - b)^2/(2 σ^2)), {i, 1, n}]], {cw, 0, 1}] (Sqrt[π/2] σ (Erf[(b Sqrt[n])/(Sqrt[2] σ)]-Erf[(Sqrt[n] (b-λ))/(Sqrt[2] σ)]))/(Sqrt[n] λ) A possible workaround consists in the manually expanding the sum Integrate[Exp[(-n cw^2 λ^2 + 2 cw λ ...


10

Your definition of entropy is incorrect. It's $E(-\ln(P(x)))$, with $E$ the expectation operator and $P$ the probability mass function of the random variable $x$. I believe you may have been mixing up a few things. The formal definition of the expectation is $E(x)=\int{x P(x)dx}$. I assume that you had this in mind and you further confused your random ...


10

Try not to supply machine numbers to integrals over infinite domains. They can cause errors that build up to the extent you have seen. Either compute the symbolic integral with exact numbers (and then convert it to a numeric value) L = 2; sn = 1; a = 10^(sn/10); b = 10^(sn/10); c = a/100; result = 2*Sqrt[1/Pi]*Integrate[(1/(E^z*Sqrt[z]))*(1 - (a/(a + ...


10

Just to contribute to the debate, here is some more evidence that supports the proposition that numerical error is the issue. If we run the integral through various permutations of the ways of making exact and approximate calculations, the pattern I think suggests that numerical error is the reason the OP's integral is so far off. (* the integrand and ...


10

I don't think the limit is $1$. $$\begin{split} P:=&\frac{1}{n^n}\prod _{k=1}^n \frac{n\sqrt{n}+(n+1)\sqrt{k}}{\sqrt{n}+\sqrt{k}}\\ =&\exp\left( \sum_{k=1}^{n} \log\frac{\left(\frac{1}{n}+1\right) \sqrt{\frac{k}{n}}+1}{\sqrt{\frac{k}{n}}+1} \right) \end{split}$$ So when $n\to\infty$, by expanding the $\log(\cdots)$ terms againt $1/n$ around $0$, we ...


10

From NSum: You should realize that with sufficiently pathological summands, the algorithms used by NSum can give wrong answers. In most cases, you can test the answer by looking at its sensitivity to changes in the setting of options for NSum. For instance: NSum[((-1)^n)/(n - (-1)^n), {n, 1, Infinity}, NSumTerms -> 100000] (* 0.693149 - ...


10

One can simply use: Limit[((1 + a x)^(1/4) - (1 + b x)^(1/4))/x, x -> 0] to get the result. However Limit does know about the l'Hopital rule. Nonetheless there are different ways to go, e.g. let's use Series to write down the first few terms of the Taylor series of ((1 + a x)^(1/4) - (1 + b x)^(1/4))/x: Series[((1 + a x)^(1/4) - (1 + b x)^(1/4))/x, ...



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