Tag Info

Hot answers tagged

20

The most direct way to test this is probably the following: $Assumptions = x > 0; Element[x, Reals] // Simplify (* Out[1]= True *) $Assumptions = True; Element[x, Reals] // Simplify (* Out[4]= x ∈ Reals *) So $x>0$ seems to imply that $x$ is real.


17

It is assumed that $x$ is a real number. Everything else would mathematically not make sense because on complex numbers there does not exist an ordering relation. An example would be to take the expression $\sqrt{x^2}$ and to imagine that this is not equal $x$ for $x=-\mathbb{i}$. Therefore the expression is in a general form not simplified In[37]:= ...


16

You can modify the global system variable $Assumptions, to get the effect you want: $Assumptions = aa[t] > 0 Then Integrate[D[yy[x, t], t]^2, {x, 0, 18}] 10.1601 Derivative[1][aa][t]^2 This may, however, be somewhat error-prone. Here is how I'd do this with local environments. This is a generator for a local environment: ...


16

The problem is due to Mathematica thinking that the version with the Re[] is actually simpler. This is because the default complexity function is more or less LeafCount[], and In[332]:= ArcTan[-Re[x+z],y]//FullForm Out[332]//FullForm= ArcTan[Times[-1,Re[Plus[x,z]]],y] whereas In[334]:= ArcTan[-x-z,y]//FullForm Out[334]//FullForm= ...


16

I can explain this. The definite flavor of Integrate works with assumptions in a few ways. One is to use them in Simplify, Refine, and a few other places that accept Assumptions, to do what they will in the hope of attaining a better result (it also uses them to determine convergence and presence or absence of path singularities). Those places also get the ...


15

The behaviour you observed is completely independent of NumericQ. It could also be seen with a function foo which has the initial definition foo[_]=False. Example 1: Initially you define NumerixQ[x]=True, which tells Mathematica that whenever it evaluates the expression NumericQ[x], it should evaluate to True. Since for symbols, it is pre-defined to return ...


13

For Integrate as well as for Simplify, Refine FunctionExpand, Limit etc. there is an option Assumptions: Integrate[ 1/Sqrt[ z^2 + u^2], {z, -l, l}, Assumptions -> (u | l) ∈ Reals] ConditionalExpression[ 2 ArcSinh[ l/Abs[ u]], u != 0 && l >= 0] or one can use Assuming[ (u | l) ∈ Reals, Integrate[ 1/Sqrt[ z^2 + u^2], {z, -l, l}]] the ...


13

There's a bit more to the story. Mathematica treats variables as complex by default, and I for one have had trouble figuring out how Limit figures out how to treat variables such as c in this case. Some analysis First, let's examine a0 (= a in OP) with the assumption thatc is real: a0 = (h^2 + c^2 h^2 + Sqrt[4 h^2 + (h^2 + c^2 h^2)^2])^2 / (4 (h^2 ...


13

Working with such a sophisticated function as Reduce, if we can't get the result initially we should add possibly many assumptions. Without the Backsubstitution option it yielded: Reduce[ Abs[x] + Abs[y] + Abs[z] + Abs[t] == 1 && t != 0, {x, y, z, t}, Reals] No more memory available. Mathematica kernel has shut down. Try quitting other ...


12

In Simplify[%,a>0] the symbol > is a logical operator. In Simplify[%,a=0] the symbol = is not a logical operator. You must use the logical operator Equal, so Simplify[%,a==0] works fine! Example: (a + b)^2 // Expand a^2 + 2 a b + b^2 Simplify[%, a == 0] gives b^2 the right answer. :-) Orleo


11

It is a bug in Series. Note that a := (h^2 + c^2 h^2 + Sqrt[4 h^2 + (h^2 + c^2 h^2)^2])^2/( 4 (h^2 + 1/4 (h^2 + c^2 h^2 + Sqrt[4 h^2 + (h^2 + c^2 h^2)^2])^2)) b = FullSimplify[a] Series[a,{h,Infinity,0}] (* Out: 1 + O[1/h]^2 *) Series[b,{h,Infinity,0}] (* Out: O[1/h]^2 *) The fact is that for $h\to\infty$ there are two terms cancelling each other in the ...


10

Integrate can take the option Assumptions. Integrate[1/Sqrt[z^2 + u^2], {z, -l, l}, Assumptions -> u > 0 && l > 0 && Element[u | l, Reals]] ==> 2 Log[(l + Sqrt[l^2 + u^2])/u] Alternatively use Assuming. Assuming[u > 0 && l > 0 && Element[u | l, Reals], Integrate[1/Sqrt[z^2 + u^2], {z, -l, l}]] ...


10

This is a known limitation in Series and Limit. Series does not handle roots in a flawless manner. For example, here is an expansion at the branch point (zero) that is only "half" correct. In[4]:= Series[Sqrt[x^2], {x,0,2}] 3 Out[4]= x + O[x] This is fine for re(x)>0, but not so good for ...


9

In your particular examples, PowerExpand[Log[x^a]/a] evaluates to Log[x], and PowerExpand[1/a*Log[(x + Log[x]*Cos[x])^a]] also works. EDIT: To be clear, and as commented upon by Andrzej, PowerExpand may give wrong answers. See the documentation, in particular this. EDIT2: Does something like (1/a*Log[(3*Exp[-1/x]*Sqrt[1 - Exp[1/x]])^a]) //. Log[Times[x_, ...


9

Here is a quick description. GenerateConditions -> False will both skip some code for checking parameter regions of validity for an integral, and also a regularized integral might be computed. This interface should probably be improved but i've no idea if or when that might happen. GenerateConditions -> Automatic behaves like True for single definite ...


9

Simplification in Mathematica is often a black art, and requires great use of your own intuition and knowledge to be effective. That said, I bring your attention to the series from of $\DeclareMathOperator{\erfi}{erfi}\erfi(z)$, $$\erfi(z) = \frac{2}{\sqrt{\pi}}\sum^\infty_{k=1} \frac{z^{(2k+1)}}{k! (2k+1)}.$$ Consider what happens when we use that to ...


9

You should assume that your variables are real, (if you want M to proceed further) because Mathematica treats variables in general as complex. One of many ways to do it : expr = A ((Cos[k y] + I Sin[k y]) 2 I Sin[t ω]); Refine[ Im[ expr], (A | k y | t ω) ∈ Reals] 2 A Cos[k y] Sin[t ω] We needn't use ComplexExpand defining expr, but in this case it ...


9

Let's define : a1 = (h^2 + c^2 h^2 + Sqrt[4 h^2 + (h^2 + c^2 h^2)^2])^2/(4 (h^2 + 1/4 (h^2 + c^2 h^2 + Sqrt[4 h^2 + (h^2 + c^2 h^2)^2])^2)); a2 = a1 // Simplify a3 = a1 // FullSimplify Mathematica 7 and 9 Limit[ #, h -> Infinity]& /@ {a1, a2, a3} {1, 1, 0} while assuming that c is a real number : Limit[#, h -> Infinity, ...


9

To make your integral convergent you should have assumed m > Sqrt[u + 1], then you shouldn't have assumed other conditions for m. If we do that we get a pretty nice result : int[u_, m_] = Integrate[ 1/Sqrt[(s^2 - u)^2 - 1], {s, m, Infinity}, Assumptions -> u > 2 && m > Sqrt[u + 1]] ...


8

I would avoid applying PowerExpand to anything except very simple expressions, since PowerExpand can easily return incorrect answers. For example, PowerExpand[Sqrt[(1 - x)^2] + Log[(x - 1)^2]] will return 1 - x + 2 Log[-1 + x], which is wrong, except when x=1 and both expressions are infinite. So if you only want to expand logarithms, it is better to use ...


8

Mathematica is a term rewriting system, variables need not to be declared as in compiled languages. For a general view I recommend reading this post by Leonid Shifrin. In general, symbolic variables are processed as complex if not assumed otherwise. To specify assumptions there are a few ways : $Assumptions are recommended when you want to use global ...


8

Maximize does not take $Assumptions into account by default, but wants the assumptions to be given explicitly: Assuming[Abs[x]>=3,Maximize[-x^2,x]] (* ==> {0, {x -> 0}} *) Maximize[{-x^2,Abs[x]>=3},x] (* ==> {-9, {x -> -3}} *) However you can inject $Assumptions explicitly: Assuming[Abs[x]>=3,Maximize[{-x^2,$Assumptions},x]] (* ...


8

In general the situation is much more subtle than the other answers suggest. For example this issue is present in version 8 while not in version 7 : Integrate[ Exp[-a^2] Sin[2 t] (a^2 + b^2 + b*Cos[t] + a*Sin[t]), {t, 0, 2 Pi}] $Assumptions = {x > 0}; Integrate[ Exp[-a^2] Sin[2 t] (a^2 + b^2 + b*Cos[t] + a*Sin[t]), {t, 0, 2 Pi}] 0 8/3 Sqrt[a^2 + ...


8

We need an appropriate complexity function. There were a few questions on this topic but in general, it is not obvious how to design an adequate function and it may appear quite difficult. Moreover there have been certain hidden changes of ComplexityFunction in Mathematica 9 (see: FullSimplify does not work on this expression with no unknowns. By default ...


8

df2 = D[df1, μ]; $Assumptions = Flatten[{Thread[{c1, c2, λ, μ} > 0], Element[{c1, c2, λ, μ}, Reals], μ > λ}]; FullSimplify@Positive[df2] (* True *) FullSimplify@Sign[df2] (* 1 *) Or, you can use your assumptions directly as the rhs of the Assumptions option, or as the first argument of Assuming, without setting the value of the global variable ...


7

I think this is a bug. Close enough expressions yield better results, e.g. FullSimplify[ ArcTan[ -# Re[x + z], y], (x | y | z) \[Element] Reals ] === ArcTan[ -# (x + z), y] & /@ { 1.0, 1, Sqrt[1.], Exp[0.], 1 - 0., 2, a} {True, False, True, True, True, True, True} The problem seems to be specific for a ...


7

Usually simplifying the result with appropriate assumptions gives desired result: m={{3, 2, 1}, {3, 1, 2}, {2, 3, -1}, {-(3/b), -(3/b^2) - 2/b, -(3/b^3) - 2/b^2 - 1/b}, {-(3/b), -(3/b^2) - 1/b, -(3/b^3) - 1/b^2 - 2/b}, {-(2/b), -(2/b^2) - 3/b, -(2/b^3) - 3/b^2 + 1/b}}; Simplify[PseudoInverse[m], b \[Element] Reals]


7

You can use /. (ReplaceAll) : % /. a->0 Simplify[%,a=0] produces an error ( this expression a = 0 cannot be used as an assumption) because it means just setting the value zero to the variable a, in another form Set[ a, 0], see Set. In some cases, when there are more variables which depends on another ones you may need the repeated replacement for ...


7

Good: Integrate[Sqrt[1 - (x^2 + y^2)] Boole[x^2 + y^2 <= 1], {x, -1, 1}, {y, -1, 1}] Better: Integrate[r Sqrt[1 - r^2], {r, 0, 1}, {θ, -π, π}] Vastly better: 2 π Integrate[r Sqrt[1 - r^2], {r, 0, 1}] Exercise: why?


6

We get correct results if we act ComplexExpand on the integrand ComplexExpand @ Exp[-a w^2 + b I w^3] E^(-a w^2) Cos[b w^3] + I E^(-a w^2) Sin[b w^3] 1. Integrate[ ComplexExpand @ Exp[-a w^2 + b I w^3], {w, -Infinity, Infinity}] ConditionalExpression[ (2 a E^((2 a^3)/(27 b^2)) BesselK[1/3, (2 a^3)/(27 b^2)])/( 3 Sqrt[3] Abs[b]), ...



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