Tag Info

Hot answers tagged

11

There is a specific function called CountRoots, which does exactly what you want: CountRoots[poly, x] (* 12 *) You can then compare this number to the number of roots given by the length of the coefficient list: Length@CoefficientList[poly, x] - 1 (* 36 *)


11

I've got a theory.... Let's try to get the antiderivative: Integrate[(1 + 16*Tan[2*x - y]^2)/(1 + 4*Tan[2*x - y]^2), x, Assumptions -> y \[Element] Reals] (*returns 5 x - (5 y)/2 - ArcTan[2 Tan[2 x - y]] *) Seems legit. You can test with D[5 x - (5 y)/2 - ArcTan[2 Tan[2 x - y]], x] and plot or rearrange. This antiderivative is technically correct, ...


10

Chances are it will behave similarly to Integrate[Exp[-x t^3 ], {t, 0, π/2}]. I show a numerical verification below. We'll use the dominant series term, which we can compute, for the above integral, and compare to numerical integrations of the one we cannot compute analytically. ee1[x_] := Exp[-x*t^3] ee2[x_] := Exp[-x*t^3*Cos[t]]; Let's get the candidate ...


9

Converting to polar coordinates helps with the xy integral: Assuming[θ ∈ Reals && h ∈ Reals && h > 0 && x ∈ Reals && y ∈ Reals && z ∈ Reals && z > 0, Integrate[((7695 h x^2 y^2 z^6 Sin[2 θ]) / (2 π (h^2 + x^2 + y^2)^(5/2) (h^2 + x^2 + y^2 + 2 h z + z^2)^8) /. {x -> r Cos[t], y -> r ...


8

This will work with any number of independent integrants. Define: repl[l_] := # /. Thread[#[[All, 1]] -> Table[x, {Length[#]}]] &[l] inTfaC[int_] := Times @@ MapThread[Integrate[#1, #2] &, repl /@ {First[#], Rest[#]} &[ int /. {Integrate -> List, Times -> List}]] Now verify: test = Integrate[p[x] p[y] q[z] r[s] r[u], {x, ...


8

It has to do with the default behavior of GenerateConditions in multivariate integrals. Setting it explicitly to True will help in this case. Some explanation may be found here or here. The gist is that, for multiple integration, automatically checking conditions and issuing provisos for all but the final integration is typically both too costly (in speed) ...


7

It seems, that findExponentialGeneratingFunction would be equivalent to FindGeneratingFunction of the sequence {a1/0!,a2/1!,a3/2!,...}. Therefore findExponentialGeneratingFunction = FindGeneratingFunction[#1/(Factorial /@ Range[0, Length@#1 - 1]), #2] & findExponentialGeneratingFunction[{1,1,1,1,1,1,1,1},x] (* Exp[x] *)


7

The "trick" which works frequently when Mathematica refuses to calculate a definite integral is to calculate first the indefinite integral, then take the limits at the ends of the integration interval and subtract the results. Here we go. Let the integrand be f = -((cA Log[1 + mgl^2/sa1])/(-1 + x)) + (cA Log[-(sa1/(-mgl^2 - sa1))])/(1 - x) + (cA cF Log[-1 ...


6

In a sense, the returned solutions are valid, but only over a restricted domain. We can determine the domain for each solution with something like Reduce[ode && -Infinity < t < Infinity /. sol, t] We can join the domain with the corresponding solution via ConditionExpression. ode = {x'[t] == Sqrt[x[t]], x[0] == 4}; dsol = DSolve[ode, x, ...


6

Integrate[Max[0, (4 + 4 Cos[t])^2/2 - 6^2/2 ], {t, -Pi, Pi}] or Integrate[(4 + 4 Cos[t])^2/2 - 6^2/2 , {t, -Pi/3, Pi/3}] 18 Sqrt[3] - 4 Pi Edit: another approach: Area[{r Sin[t], r Cos[t]}, {t, -Pi, Pi}, {r, 6, Max[6, 4 + 4 Cos[t]]}] or Area[CoordinateTransform[ "Polar" -> "Cartesian", {r, t}], {t, -Pi, Pi}, ...


6

The inverse square root term is responsible for the errors as it diverges logarithmically at infinity. You could do one step at a time and see if you agree with the procedure of introducing a regularizing term, doing the integral and then removing it. int1 = Integrate[(r BesselJ[0, r])/(2 (r^2 + z^2)^(1/2)) Exp[-α z^2], {z, -Infinity, ...


6

First of all, for a mathematical explanation on how to compute the first terms of the series with pen&paper check out this math.SE question. That said, here is what I ended up doing with Mathematica 10.0 to obtain an arbitrary number of terms of the asymptotic expansion. I warn you that I'm not very proficient with Mathematica so any advice on how to ...


6

[Edit notice: I'll put the gist up front.] 10 π is not wrong With proper assumptions given, the integral evaluates as desired by the OP, to 6 π. Without them, it gives one of the correct values of the integral, 10 π, the one that in some sense is more likely, but without the correct conditions attached. (One may well argue that is a bug. However, ...


6

evenFQ[f_] := Simplify[f[t] - f[-t]] === 0 oddFQ[f_] := Simplify[f[t] + f[-t]] === 0 Examples: ef[x_] := x^2 of[x_] := x^3 evenFQ/@ {ef, of} {True, False} oddFQ/@ {ef, of} {False, True} evenFQ /@ {# &, Im, Sin, Tan, Sinh, Erf} {False, False, False, False, False, False} oddFQ /@ {# &, Im, Sin, Tan, Sinh, Erf} { True, ...


5

This s not an answer but an extended comment about results with v10.1 $Version "10.1.0 for Mac OS X x86 (64-bit) (March 24, 2015)" Integrate[1/(x y z), {x, 0, 1}, {y, 0, 1}, {z, 0, 1}] 0 Integrate[1./(x y z), {x, 0, 1}, {y, 0, 1}, {z, 0, 1}] 0 However,NIntegrate gives the a large result in either case with convergence warnings ...


5

Rather than imposing x>0 one can also do FullSimplify[ ForAll[x, myOddFunction[x] == myOddFunction[-x]]] which yields False.


5

Products are polynomials in x: Table[Expand[Product[x^k*(1-x^k), {k, 1, n}]], {n, 1, 3}] (* {x - x^2, x^3 - x^4 - x^5 + x^6, x^6 - x^7 - x^8 + x^10 + x^11 - x^12} *) Integration of polynomials is easy: Table[Integrate[Expand[Product[x^k*(1-x^k), {k, 1, n}]], x], {n, 1, 3}] (* {x^2/2 - x^3/3, x^4/4 - x^5/5 - x^6/6 + x^7/7, x^7/7 - x^8/8 - x^9/9 + x^11/11 ...


4

The reason this is happening might be because Mathematica is internally producing AppellF1 functions. If you replace Sqrt[b^2 - c^2] with Sqrt[k] and integrate, then afterwards put back the b^2 - c^2 you get this mess ... tmp = Integrate[1/(-Sqrt[k] + b*Cosh[x] + c*Sinh[x])^(1/2), x]; tmp //. k -> b^2 - c^2 (* Result *) (1/(Sqrt[1 - b^2/c^2] c))2 ...


4

Here's another approach just to illustrate the difficulty with multiple integrals that are not absolutely (i.e. $L^1$) convergent. The integral on any finite disk centered at the origin is zero. So it would be natural to conclude that the integral over the whole {r,z} plane is zero. In terms of polar coordinates: Integrate[ ((r BesselJ[0, r])/(2 (r^2 + ...


4

There is probably a better way to do this, but one can find the degree of a polynomial via the length of the CoefficientList, and one can get the number of real roots by adding up the multiplicities given by RootIntervals: poly = 331776*x^36 - 11943936*x^34 + 195747840*x^32 - 1932263424*x^30 + 12809871360*x^28 - 60216016896*x^26 + 206610186240*x^24 ...


4

Perhaps this? Clear[DoubleContourIntegral]; DoubleContourIntegral[field_?VectorQ, surface : {changeOfVars : ({x_, y_, z_} -> param : {xuv_, yuv_, zuv_}), {u_, u1_, u2_}, {v_, v1_, v2_}}] := Integrate[ Dot[field /. Thread[changeOfVars], Cross[D[param, u], D[param, v]]], {u, u1, u2}, {v, v1, v2}]; Clear[a, b, c]; S = {{x, y, z} -> ...


4

Doing the z integration first it takes less than a minute to run Timing[ Assuming[\[Theta]\[Element]Reals&&h\[Element]Reals&&h>0&&x\[Element]Reals&&y\[Element]Reals&&z\[Element]Reals&&z>0, Integrate[r*Integrate[(7695*h*x^2*y^2*z^6*Sin[2*\[Theta]])/(2*Pi*(h^2 + x^2 + y^2)^(5/2)*(h^2 + x^2 + y^2 + 2*h*z ...


4

You need Simplify with an assumption: myOddFunction[x_] := x^3; Simplify[ Equal[myOddFunction[x], myOddFunction[-x]], x > 0 ] False Refine also works in this case, again with the appropriate assumption: Refine[Equal[myOddFunction[x], myOddFunction[-x]], x > 0] False


3

I can't speak for what's happening with your second example, but to answer your second question, you can ensure DiracDelta is included by integrating over a larger interval then taking a limit. Limit[Integrate[f[x], {x, -ε, ∞}, Assumptions -> 0 < ε < 1/10^10], ε -> 0] 2


3

I can break the calculations down, but I cannot really explain the first one. This seems wrong: Integrate[DiracDelta[x] + Exp[-x], {x, 0, b}] (* ConditionalExpression[-Cosh[b] + 2 HeavisideTheta[b] + Sinh[b], b ∈ Reals] *) Its limit is 2. The ConditionalExpression suggests that Integrate is using assumptions to make choices. Let's help it out ...


3

Not an answer but an extended comment on belisarius' answer. I think the plot will look more like what I believe the OP is expecting if a few options are added. Show[RevolutionPlot3D[#, {x, 0, Sqrt[3]}, PlotRange -> {Automatic, Automatic, {0., Automatic}}, MeshStyle -> None, Axes -> None, Boxed -> False, PlotStyle -> Opacity[.5]] ...


3

You can also use FindInstance, specifying the domain over all reals pol = 331776*x^36 - 11943936*x^34 + 195747840*x^32 - 1932263424*x^30 + 12809871360*x^28 - 60216016896*x^26 + 206610186240*x^24 - 524928024576*x^22 + 991718940672*x^20 - 1386996203520*x^18 + 1415900528640*x^16 - 1026732589056*x^14 + 505483296768*x^12 - 158084628480*x^10 + ...


3

I think that you can use RootIntervals to do what you want: poly = 331776*x^36 - 11943936*x^34 + 195747840*x^32 - 1932263424*x^30 + 12809871360*x^28 - 60216016896*x^26 + 206610186240*x^24 - 524928024576*x^22 + 991718940672*x^20 - 1386996203520*x^18 + 1415900528640*x^16 - 1026732589056*x^14 + 505483296768*x^12 - 158084628480*x^10 + ...


3

As HyperGroups suggests, we can take advantage of the Area function new in v10. First, we'll represent the region implicitly. We want: $$ 6 < r < 4 + 4\cos\theta \\ 6 < \sqrt{x^2+y^2} < 4 + 4\cos\arctan\frac y x $$ First we'll plot this region to make sure we're correct: Show[ RegionPlot[6 < Sqrt[x^2 + y^2] < 4 + 4 Cos[ArcTan[x, y]], ...


3

Appreciating the nice answers of Daniel Lichtblau and glance I would like to note that they go in the classical mathematical direction. Let me add here a different, Mathematica-oriented view on the problem at hand. Let us make a table with the structure {n, Integral} where I substitute x=10^n as follows: lst = Table[{n, NIntegrate[Exp[-10^n t^3 ...



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