Tag Info

Hot answers tagged

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

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]:= ...


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

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


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

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


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


12

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


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

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

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

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

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


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

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

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

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

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

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


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

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

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


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]


6

Let's see if this clarifies your issues with the usefulness of the construct. Probably not because I am not sure I understood them. You want to have some numeric value, represented by a symbol. A constant, a unit, who knows. You do NumericQ[symb]=True Now, any function defined to only receive numeric input (_?NumericQ) will know it can take symb as an ...


6

Many situations where assumptions play a role in differentiations can be equally or more clearly expressed by going back to the Limit defining the derivative in the first place. And Limit does take assumptions. So for your example, instead of using D, you could write Limit[(Abs[x + e] - Abs[x])/e, e -> 0, Assumptions -> x > 0] (* ==> 1 *) ...


6

As the OP mentioned in a comment, pattern matching has difficulties with something more complex, such as 1/a*Log[(3*Sqrt[1-x])^a] where $(3 \sqrt{1 - x})^a$ is interpreted as $3^a (1-x)^{a/2}$. It is possible to create something more general that will cover this case, and a few others. To do so is significantly more complicated, as follows: ...


6

I think it's useful to manipulate the integrand before integration; notice you have a negative number under square root : simplifiedIntegrand = Simplify[ComplexExpand[integral, TargetFunctions -> {Re, Im}], Assumptions -> {a > 0, b > 0, 0 < x < 1}] (* I (-ArcTan[-a + b + 2 a x, 2 a Sqrt[(1 - x) x]] + ArcTan[-a + b - 2 b x, 2 b ...



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