Mathematica provides complicated forms of solutions [closed]

I always wonder how can one find solutions in Mathematica in a simple form. When I find answers to an equation, the output is always in a messy form. For example below is the answer for a parameter I got when I run my code:

-((0.09428090415820634  Sqrt[-1 +
15 e ro] (alpha ro ((0. +
1.119744*^9 I) - (0. + 3.919104*^10 I) e ro + (0. +
4.19904*^11 I) e^2 ro^2 - (0. +
1.259712*^12 I) e^3 ro^3) +
dr ((0. -
8.0621568*^11 I) + (0. +
3.22486272*^13 I) e ro - (0. +
4.43418624*^14 I) e^2 ro^2 + (0. +
2.41864704*^15 I) e^3 ro^3 - (0. +
4.5349632*^15 I) e^4 ro^4)) v Cos[
t])/(alpha ro (-298598.40000000026 + 1.1943936*^7 e ro -
1.6422912*^8 e^2 ro^2 + 8.957952*^8 e^3 ro^3 -
1.679616*^9 e^4 ro^4) +
dr (2.14990848*^8 - 9.674588159999992*^9 e ro +
1.61243136*^11 e^2 ro^2 - 1.236197376*^12 e^3 ro^3 +
4.43418624*^12 e^4 ro^4 - 6.0466176*^12 e^5 ro^5)))


I'm sure that it could be shown in more simple way. for example multiplication of some terms with exponents. Is there any way to change the solution in this form? I have tried Simplify but it doesn't change the form of the solution. Any answer which could show the solution in more simple way is highly approcated. *By more simple I mean more compact form. for example I prefer the solution (x+a)^3+(x+b)^3 other than 2 x^3 + 3x^2 a + 3x^2 b+....

I have applied the procedure in the answer to below expression:

ex = ((0. + 11.785113019775793 I) dr  Sqrt[-1. +
15. e ro] (h^2 (0.004629629629629629 h +
0.000462962962962963 alpha ro) +
dr h (h (0.3472222222222222 - 1.0416666666666667 e ro) +
alpha ro (0.034722222222222224 -
0.10416666666666667 e ro)) +
dr^2 (alpha ro (0.2 + 1. e ro) + h (2. + 10. e ro))) v Cos[
t])/(dr^2 h (-0.0074074074074074086 h -
0.0005555555555555556 alpha ro) +
h^3 (-4.822530864197532*^-6 h -
4.018775720164609*^-7 alpha ro) +
dr h^2 (alpha ro (-0.00003858024691358025 +
0.00011574074074074075 e ro) +
h (-0.00048225308641975306 + 0.0014467592592592592 e ro)) +
dr^3 (alpha ro (0.013333333333333329 -
0.26666666666666666 e ro + 1. e^2 ro^2) +
h (0.2 - 4. e ro + 15. e^2 ro^2)))


where

h= 30 dr (6 e ro - 1.2 + 0.8 Sqrt[3 - 30 e ro]);


I could change ex to

((0. + 500. I) v (-3. + X) Sqrt[1 - X^2] (3. + 38. X - 52. X^2 + 10. X^3 + 1. X^4 + alpha ro (-0.0166667 - 0.233333 X - 0.0166667 X^2)) Cos[t])/((-1. + X) (9. - 6. X - 113. X^2 + 140. X^3 - 25. X^4 - 6. X^5 + 1. X^6 + alpha ro (-0.0625 - 0.15 X + 0.475 X^2 + 0.0166667 X^3 - 0.0125 X^4)))


by below change

e -> (3 - X^2)/(30 ro)


But after that, Simplify can not make it simpler. Could anyone guess what is the problem and how to solve it?

• You need to be more specific about what you regard as "simple". Have you tried Expand? Is that "simple"? If e, ro, dr etc. are real, then how about ComplexExpand? Commented May 5, 2017 at 20:03
• Yes they are real. By more simple I mean more compact form. forexample one can write (x+a)^3+ (x+b)^3 in a more complicated form: 2 x^3 + 3 a x^2 +... @MariusLadegårdMeyer Commented May 5, 2017 at 20:13
• Can you show how you would like the expression above to look when it is at its most simple? Or a slightly smaller, but not trivial example? Commented May 5, 2017 at 20:16
• ComplexExpand and Expand do a vice-versa! they made solution more complicated(more terms apear when using them) @MariusLadegårdMeyer Commented May 5, 2017 at 20:17
• Forexample maybe the numerator and denominator could be written in the form of sum of (constant + e ro)^n @MariusLadegårdMeyer Commented May 5, 2017 at 20:20

Sometimes Simplify works like magic, but other times you need to apply a bit of mathematical intuition to help it. These are the steps I took to find a simpler expression.

First notice that e and ro always appear together, so put the expression in terms of x = e ro

expr /. e -> x/ro

(* -((0.0942809 v Sqrt[-1 +
15 x] (alpha ro ((0. +
1.11974*10^9 I) - (0. + 3.9191*10^10 I) x + (0. +
4.19904*10^11 I) x^2 - (0. + 1.25971*10^12 I) x^3) +
dr ((0. -
8.06216*10^11 I) + (0. + 3.22486*10^13 I) x - (0. +
4.43419*10^14 I) x^2 + (0. +
2.41865*10^15 I) x^3 - (0. + 4.53496*10^15 I) x^4)) Cos[
t])/(alpha ro (-298598. + 1.19439*10^7 x - 1.64229*10^8 x^2 +
8.95795*10^8 x^3 - 1.67962*10^9 x^4) +
dr (2.14991*10^8 - 9.67459*10^9 x + 1.61243*10^11 x^2 -
1.2362*10^12 x^3 + 4.43419*10^12 x^4 - 6.04662*10^12 x^5))) *)


There are several polynomials in x with awkward machine precision coefficients. Try pulling out an overall numerical factor from those. I also wrap the numerical factors in Hold to stop everything multiplying out again.

% /. Plus[n_?NumberQ, m__] :> Hold[n] Rationalize@Expand[(n + m)/n]

(* -((0.0942809 v Cos[
t] Sqrt[(1 -
15 x) Hold[-1]] (alpha ro (1 - 35 x + 375 x^2 -
1125 x^3) Hold[0. + 1.11974*10^9 I] +
dr (1 - 40 x + 550 x^2 - 3000 x^3 + 5625 x^4) Hold[
0. - 8.06216*10^11 I]))/(alpha ro (1 - 40 x + 550 x^2 -
3000 x^3 + 5625 x^4) Hold[-298598.] +
dr (1 - 45 x + 750 x^2 - 5750 x^3 + 20625 x^4 - 28125 x^5) Hold[
2.14991*10^8])) *)


Okay, that was successful - the polynomials are revealed to have nice integer coefficients. Perhaps Simplify can do something useful now. (I also release the held numbers after simplifying).

ReleaseHold[Simplify[%]]

(* (0.0188562 v Sqrt[-1 +
15 x] ((0. - 2.23949*10^8 I) alpha ro - (0. +
8.06216*10^11 I) dr (-0.2 + 1. x)) Cos[
t])/((-0.2 + 1. x) (59719.7 alpha ro +
2.14991*10^8 dr (-0.2 + 1. x))) *)


It's getting better. Next notice that -0.2 + 1. x appears in several places, so replace that with y and try simplifying again.

Simplify[% /. {(-0.2 + 1. x) -> y}]

(* -(((0. + 70.7107 I) v Sqrt[-1 +
15 x] (0.000277778 alpha ro + 1. dr y) Cos[t])/(
y (0.000277778 alpha ro + 1. dr y))) *)


At this point I just manually cancelled the bracketed term from the top and bottom, and put x and y back in terms of e and ro. Oh, and recognised that 70.7107 is 100/Sqrt[2].

expr2 = (100/Sqrt[2]) I v Sqrt[15 e ro - 1] Cos[t]/(0.2 - e ro)


Finally I chucked in a few test parameters to make sure that expr and expr2 gave the same result.

The same thing might work for your other expressions, it depends how similar they are. Note that a key part was being able to express the polynomials with exact integer coefficients (using Rationalize) so that Simplify could divide them. If possible you could try redoing the original calculation with rationals in place of machine precision values, you might find you get a result which Simplify can process directly.

• It was the best answer I have ever seen on this site. Thank you very much. Commented May 6, 2017 at 16:14
• I used this procedure for the solution I added to the question, but it was not successful to make it simpler. Could you please give me some guide about this case? Commented May 6, 2017 at 18:09
• @saralolisaraloli, I had a look at the second case but I can't see any way to get a similar compact expression, if one exists. Commented May 7, 2017 at 12:13
• Could you please look at my new question? Do you have any ideas? mathematica.stackexchange.com/questions/145488/… Commented May 8, 2017 at 13:10