Tag Info

Hot answers tagged

23

Fixed (see below) Here's an approach: r1 = Exp[-x^3 - y] - 1 == z; r2 = y == z; We create ImplicitRegions: reg1 = ImplicitRegion[r1, {x, y, z}]; reg2 = ImplicitRegion[r2, {x, y, z}]; The intersection of these regions is the line you seek: reg = RegionIntersection[reg1, reg2]; And here is the length (note the inclusion of the range of values in ...


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

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

After a lengthy study (I'm using version 8) I conclude that there is a bug in Mathematica in the Integrate function when applied to a Sqrt integrand. Ok. let's go (some patience is required because of the long text) Let us define the functions corresponding to your integrals. Remark: because of the relation $1 + cos(2x) = 2 cos^2(x)$ the two forms of ...


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}}


16

Since another answer provides misleading results I'm motivated to explain what's wrong there and suggest a correct solution. One can guess that the error there has been produced by DiscretizeRegion or by an improper parametrization of the curve with RegionIntersection (more likely the former reason). Let's start from the begining defining the following ...


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 ...


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

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 ...


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

In this second answer I give the cause for the mismatch in the integrals, show how to remove it, and make a suggestion to improve the function Integrate[]. Simplified restatement of the problem In order to focus on the core of the problem we consider the simpler integral $\int_0^1 \sqrt{\cos (2 π k r)+1} \, dr$. It has the square root and the cosine ...


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 ...


11

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, ...


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

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

RegionPlot3D[ 5 (x^2 + y^2) < z < 6 - 7 x^2 - y^2, {x, -1, 1}, {y, -1, 1}, {z, -0, 6}, PlotStyle -> Orange, Mesh -> None, PlotPoints -> 50] Integrate[ Boole[5 (x^2 + y^2) < z < 6 - 7 x^2 - y^2], {x, -1, 1}, {y, -1, 1}, {z, 0, 6}] (* (3 π)/Sqrt[2] *)


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

Like the example in the documentation Limit can return different values for this limit as follows: Limit[Tanh[β*A], β -> ∞, Assumptions -> #] & /@ {A > 0, A == 0, A < 0} {1, 0, -1} When given a ∈ Reals the documentation example returns unevaluated: Limit[x^a, x -> Infinity, Assumptions -> (a ∈ Reals)] Limit[x^a, x -> ∞, ...


10

You could use Lagrange multipliers to maximize $f(x,y)=y$ subject to the constraint that $$g(x,y) = x^2 + y^2 - (2 x^2 + 2 y^2 - x)^2 = 0.$$ f[x_, y_] = y; g[x_, y_] = x^2 + y^2 - (2 x^2 + 2 y^2 - x)^2; eqs = {D[f[x, y], x] == lambda*D[g[x, y], x], D[f[x, y], y] == lambda*D[g[x, y], y], g[x, y] == 0}; Solve[eqs, {x, y, lambda}] // InputForm (* Out: { ...


10

Here is the derivation promised earlier. I have chosen to create a new answer in order not to mix things up and because it shows some handling which I like to call "man-machine" interaction with Mathematica. And, sorry for the "Greeks", but I find it very cumbersome to reedit them :-( $Version "8.0 for Microsoft Windows (64-bit) (October 7, 2011)" ...


10

The limit is definitely computed correctly. Keep in mind that Limit assumes the variable (n, in this case) is continuous. Thus, this is a specific example of the general fact that $f(x)\sin(g(x))$ oscillates back and forth over the whole real line, whenever $f(x)$ and $g(x)$ both increase to $\infty$ with $x$. A plot verifies this is correct. ...


10

Thanks to Artes for helping me sort out bugs in this answer. Solve[E^(-x^3 - y) - 1 - y == 0, y] {{y -> -1 + ProductLog[E^(1 - x^3)]}} To account for that fact that $-4 < y = z < 4$ we need to find the range of allowed $x$ values. FindRoot[-1 + ProductLog[E^(1 - x^3)] == 4, {x, 1}] {x -> -1.77681} FindRoot[-1 + ProductLog[E^(1 - ...


10

I suspect you are correct in your assessment. Since there are approximate numbers in the input, Maximize punts to NMaximize, which uses penalty methods to enforce some constraints (not sure why it needs them here for linear constraints; I need to check into that). You can get better behavior by forcing real values. NMaximize[{Re[(h*10)/(300*(100 - (l^.5 + ...



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