1
$\begingroup$

I would like to compare my Mathematica calulations with the results from a paper.

I get:

myRes= (b/g)^0.25 + (0.25*(b/g)^0.25*w[x])/g + (b*((-0.09375*b)/(b/g)^1.75 + (0.25*g)/(b/g)^0.75)*w[x]^2)/g^4 + (0.1171875*b^3*w[x]^3)/((b/g)^2.75*g^6) + 
 ((0.12646484375*b^4)/((b/g)^3.75*g^8) - (0.03125*(b/g)^0.25)/g^4)*w[x]^4

The paper gets:

paperRes = b^0.25*(g^(-0.25) + (0.25*w[x])/g^1.25 + (0.15625*w[x]^2)/g^2.25 + (0.1171875*w[x]^3)/g^3.25 + (0.09521484375*w[x]^4)/g^4.25)

I want to be sure that those two expressions are actually the same. How can I do it ?

I already tried: Reduce[myRes==paperRes] but it does not seem to work

$\endgroup$
2
$\begingroup$

You need to assume that b > 0 and g > 0

myRes = (b/g)^0.25 + (0.25*(b/g)^0.25*w[x])/
     g + (b*((-0.09375*b)/(b/g)^1.75 + (0.25*g)/(b/g)^0.75)*w[x]^2)/
     g^4 + (0.1171875*b^3*w[x]^3)/((b/g)^2.75*
       g^6) + ((0.12646484375*b^4)/((b/g)^3.75*g^8) - (0.03125*(b/g)^0.25)/
        g^4)*w[x]^4 // Rationalize // Simplify[#, b > 0 && g > 0] &

(* (1/(2048 g^(17/4)))b^(
 1/4) (2048 g^4 + 512 g^3 w[x] + 320 g^2 w[x]^2 + 240 g w[x]^3 + 195 w[x]^4) *)

paperRes = 
 b^0.25*(g^(-0.25) + (0.25*w[x])/g^1.25 + (0.15625*w[x]^2)/
       g^2.25 + (0.1171875*w[x]^3)/g^3.25 + (0.09521484375*w[x]^4)/g^4.25) // 
   Rationalize // Simplify[#, b > 0 && g > 0] &

(* (1/(2048 g^(17/4)))b^(
 1/4) (2048 g^4 + 512 g^3 w[x] + 320 g^2 w[x]^2 + 240 g w[x]^3 + 195 w[x]^4) *)

myRes == paperRes

(* True *)
$\endgroup$
  • $\begingroup$ Wow, nice answer ! Thanks a lot!! $\endgroup$ – james Mar 28 '18 at 14:56
1
$\begingroup$

Very simple method: Just plot both functions for some chosen constants and see if they have the same shape. Of course, this is not a general proof that the functions are the same, but sometimes it is sufficient.

myRes= (b/g)^0.25 + (0.25*(b/g)^0.25*w[x])/g + (b*((-0.09375*b)/(b/g)^1.75 + (0.25*g)/(b/g)^0.75)*w[x]^2)/g^4 + (0.1171875*b^3*w[x]^3)/((b/g)^2.75*g^6) + 
 ((0.12646484375*b^4)/((b/g)^3.75*g^8) - (0.03125*(b/g)^0.25)/g^4)*w[x]^4;

paperRes = b^0.25*(g^(-0.25) + (0.25*w[x])/g^1.25 + (0.15625*w[x]^2)/g^2.25 + (0.1171875*w[x]^3)/g^3.25 + (0.09521484375*w[x]^4)/g^4.25);

a = Plot[myRes /. {w[x] -> x, b -> 1, g -> 2}, {x, -10, 10}, PlotStyle -> {Blue, Thin}];
b = Plot[paperRes /. {w[x] -> x, b -> 1, g -> 2}, {x, -10, 10}, 
  PlotStyle -> {Dotted, Red, Thickness[0.01]}];

Show[a,b]

enter image description here

$\endgroup$
  • $\begingroup$ Thanks. This is also a great method. $\endgroup$ – james Mar 28 '18 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.