Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Given an expression like

a + b*y + c*y^2 + d*Sqrt[f + g*y + h*y^2]

How can I programatically, expand this to a quartic without any fractional powers?

Right now, I am having to copy and paste it as input expression and manually move the Sqrt to the RHS and square. I suspect there's an easier way to do this in Mathematica, perhaps using the Coefficient function or something similar.

share|improve this question
1  
To make sure I understand the question, you want to automatically convert the equation A+B*y+C*y^2+D*Sqrt[F+G*y+H*y^2]==0 to the equation (A+B*y+C*y^2)^2 == D^2 (F+G*y + H*y^2). And you are fine with the fact that this may introduce extraneous roots (if your variables are real and Sqrt[] is interpreted as the positive square root). –  David Speyer Feb 19 '13 at 17:50
    
Yes that's correct and I completely accept the consequences. My expression currently doesn't include the "==0"; however, that assertion is also true. –  bsdz Feb 19 '13 at 17:54
1  
Maybe you want Reduce[a + b*y + c*y^2 + d*Sqrt[f + g*y + h*y^2] == 0, y]? This works better (gives shorter solutions) when you specify additional information about your coefficients. What's the underlying problem that you want to solve? –  Thies Heidecke Feb 19 '13 at 17:54
    
You will not want to use capital C and D in your expression. They are built-in symbols. –  chuy Feb 19 '13 at 18:11
    
@ThiesHeidecke - Reduce seems to produce a very complicated output. The manual approach seems to produce a more succinct answer, i.e. Collect[Expand[(a + b*y + c*y^2)^2 - (d*Sqrt[f + g*y + h*y^2])^2], y] –  bsdz Feb 19 '13 at 18:25
show 1 more comment

1 Answer 1

I managed to find a way using Map. Map allows one to subtract, do powers and more on each side of my equation.

eq = a + b*y + c*y^2 + d*Sqrt[f + g*y + h*y^2] == 0;
eq2 = (# - eq[[1, -1]])^2 & /@ eq;
Collect[Expand[(# - eq2[[2]]) & /@ eq2], y]

$$ a^2-d^2 f + \left(2 a b-d^2 g\right)y + \left(2 a c+b^2-d^2 h\right)y^2 +2 b c y^3+c^2 y^4=0 $$

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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