views:

82

answers:

4

Hi

I am using Mathematica 7 in the notebook interface and I want to rearrange an inequality so that I get a certain variable on one side. For eg.

FullSimplify[x^3+L+r>3x^3+2r]

Gives

L > r + 2 x^3

However, I want :

r < L-2x^3

Is there anyway we can instruct FullSimplify to order variables in a particular way? I am using Mathematica for presentation as well so, the way I arrange the variables is important to me.

Thanks

SR

Edit: I tried Reduce, while that works for this example, it does not work for the actual expression I have, I get an error saying,

 This system cannot be solved with the methods available to Reduce.

Edit: here is the actual expression:

{L - (m^2 ((-2 + e)^2 \[Delta] + (5 + 
     2 e (-7 + 4 e)) \[Tau]) \[Omega])/(36 (2 - 3 e + e^2)^2)} > {0}

I want this to be displayed in the form of \[delta]< *something* Thanks!

+1  A: 
Reduce[x^3 + L + r > 3 x^3 + 2 r, r, Reals]

Will do.

As I don't use Mathematica for editing or presentation, perhaps someone else may come with some extra advice.

Edit

based on your comment, you may try:

Reduce[{L - (m^2 ((-2 + e)^2 Delta + (5 + 
        2 e (-7 + 4 e)) Tau) Omega)/(36 (2 - 3 e + e^2)^2) > 0}, Delta, Reals]  

Where I corrected some syntax errors. But you'll find that the resulting expression is rather unpleasant. To simplify it further you need to know the valid ranges for your vars. Please post that info if you have it. HTH!

belisarius
Edit: here is the actual expression:{L - (m^2 ((-2 + e)^2 \[Delta] + (5 + 2 e (-7 + 4 e)) \[Tau]) \[Omega])/(36 (2 - 3 e + e^2)^2)} > {0}I want this to be displayed in the form of \[delta]< *something* Thanks!
skr
@user491410 Do you know the signs of L,e,Delta, Tau, Omega?
belisarius
+1  A: 

First of all, getting Mathematica to output something exactly as you would like it is something of a black art, and requires a lot of patience. That said, if you apply Reduce to your original expression, as per Belisarius, you'd get

In[1]:=Reduce[x^3 + L + r > 3 x^3 + 2 r, r, Reals]
Out[1]:= r < L - 2 x^3

However, as you pointed out, this isn't the full expression, and Reduce produces what can only be described as a less than helpful answer when applied to it. It is at this point where patience and a lot of extra processing is required. I'd start with

In[2]:=Reduce[ <full expression>, Delta, Reals] // LogicalExpand // Simplify

While this doesn't give you a clean answer, it is better than before and reveals more of the structure of your solution. (I would not use FullSimplify as that mixes Delta in with the other terms.) At this point, we need to know more about the terms themselves, and the output from In[2] is not quite as useful as we want.

I'd re-expand this with LogicalExpand which gives you twelve terms that are significantly simpler than the what Reduce alone gives. (You'll note that only the last six terms actually involve Delta, so I'd check that the variable conditions actually match those.) Selecting those last six terms only,

In[3]:=%2[[-6;;]] // Simplify
Out[3]:= m != 0 
       && ((Omega > 0 && Delta < something) || (Omega > 0 && Delta < something else)
       && (1 < e < 2 || e < 1 || e > 2)

The third term is tautological, but Simplify nor FullSimplify can't seem to remove it. And we're really only interested in the middle term anyway. If Omega > 0 your expression can then be extracted via %[[2,1,2]].

Putting this all together in one expression:

In[4]:=Simplify[LogicalExpand[Reduce[<expression>, Delta, Reals]]][[-6;;]] //
       Simplify // #[[2,1,2]]&
Out[4]:= Delta < something

After writing that out, I realized that there is a much simpler way to approach this. I'd redo line 2, above, as follows:

In[5]:= Reduce[ <full expression>, Delta, Reals] // LogicalExpand // Simplify //
       Cases[#, ___ && Delta < _ && ___, Infinity]&
Out[5]:= {Omega > 0 && Delta < something}

Or, provided you really do know that m != 0 and Omega > 0 you can do

In[6]:= Reduce[ <expr> && m!=0 && Omega > 0, Delta, Reals ] // LogicalExpand // 
        Simplify // #[[2]]&
rcollyer
+1 for "It is at this point where patience and a lot of extra processing is required.". Really True.
belisarius
thanks! really helpful
skr
@belisarius, This one was easy; I can waste an entire morning reformatting an expression to get it to look the way I want. My personal favorite is to replace `I` with `q` (`Complex[a_,b_]:> a + q b`), so that I can use `Collect` on it. Sometimes it is the only way to get a reasonable result.
rcollyer
@rcollyer Never tried that one! But many hours lost in melee with Exp[I phi], TrigExpand, Collect, Expand, Simplify ... I think we all know that feeling.
belisarius
@belisarius, the rationale behind the change is that while Mathematica understands how to work with complex numbers, it will often group things in such a way that is difficult to work with. And, by combining real and imaginary numbers together, it can be difficult to extract anything meaningful. So, we substitute in something that it has no addt'l notions on how to manipulate it, and, voila, we have regained some measure of control.
rcollyer
A: 

Inspect the output of

r=Simplify[Reduce[L-(m^2((-2+e)^2\\[Delta]+(5+2e(-7+4e))\\[Tau])\\[Omega])/(36(2-3e+e^2)^2)>0,\\[Delta],Reals]]  

to see that

r[[2,1,1,1]] gives \\[Delta]>expr, 

but

r[[2, 1, 2, 2]] gives \\[Delta]< expr, 

because the sign of \[Omega] in the denominator of expr. All this ignores the other conditions on the values of L, e, m and \[Omega] that will change the result and different versions of Mathematica may change the form of the result from Simplify[Reduce[]] which will invalidate all of this.