# Mathematica Real Part of Solve output

• Mathematica

## Main Question or Discussion Point

I am trying to solve 0.125 + 0.5 (1-x)^3 - (12.5/y)==0 for x, when y is real and y>0. I thus want to find x= 1- 0.63 ((100-y)/y)^(1/3), so that if y=100, x=1. Mathematica's Solve yields 3 roots:

sol=Solve[0.125 + 0.5 (1 - x)^3 - (12.5/y) == 0, x]

Root 1:
1.+((0.+0. I) y^(1/3))/(-100.+1. y)^(1/3)-((0.31498+0.545562 I) (-100.+1. y)^(1/3))/y^(1/3),

Root 2:
1.+((0.+0. I) y^(1/3))/(-100.+1. y)^(1/3)-((0.31498-0.545562 I) (-100.+1. y)^(1/3))/y^(1/3),

Root 3:
1.+(0. y^(1/3))/(-100.+1. y)^(1/3)+(0.629961 (-100.+1. y)^(1/3))/y^(1/3)

If I now evaluate root 1 at y=100, I get an Infy error because of division by zero. How can I drop the imaginary part of this function? I have tried (without succes) a bunch of things such as:

xroot1=x/.sol[]

*ComplexExpand[xroot1]

*Assuming[p > 0, {Simplify[xroot1]}]

Related MATLAB, Maple, Mathematica, LaTeX News on Phys.org
phyzguy
Try:

Limit[xroot1,y->100]

Marvelous, that indeed does the trick. However, if the polynomial is of a higher order (see below) I again run into trouble.

For instance, if I want to find the real root of 0.1 + 0.5 (1-x)^4 - (1/y)=0, (which you can easily solve for x=1- [ 2 (1-0.1 y ) / y ]^(1/4) ), I again use

sol = Solve[0.1 + 0.5 (1 - x)^4 - (1/y) == 0, x];

If I now plot the real part of these roots, none of them look like the one found above.

e.g. Plot[Re[(x /. sol[])], {y, 0, 10}]

Is the solve algorithm not suited for solving equations of this order or am I doing something very very wrong?

EDIT1: It seems to be a Mathematica 7 problem. In Mathematica 8 the plots are just fine. Is this a known bug?

Last edited:
phyzguy