Mathematica Rearranging Large Equations

Maths and statistics discussion, revision, exam and homework help.

This thread is sponsored by:
Announcements Posted on
Important: please read these guidelines before posting about exams on The Student Room 28-04-2013
Sign in to Reply
  1. Big-Daddy's Avatar
    • Peer Of The TSR Realm
    • Posts: 1,514
    Mathematica Rearranging Large Equations
    I have a very large and complex algebraic expression that I've been looking around to see if I can have rearranged in a simple way. It has variables A, B, C, D, E, F, j and k (8 in total).

    WolframAlpha is incapable of rearranging it and simply times out, so it should be obvious that human attempts to do so are likely to be short-lived. However, I think Mathematica should reasonably be able to give it a shot.

    The equation is:

    A=((((((((B*(((((C^2)+(4*F))^(0. 5))+C)/2))-((j/k)*(D*(((((E^2)+(4*F))^(0.5))+E)/2))))/(B+D)))^2)+(4*F))^(0.5))+((((B*( ((((C^2)+(4*F))^(0.5))+C)/2))-((j/k)*(D*(((((E^2)+(4*F))^(0.5))+E)/2))))/(B+D))))/2

    Yes, I'm aware that this looks like an unintelligible mess, but I'm not asking for human help in rearranging it - in fact, I'm mainly posting it so you get an idea of its complexity. If someone does want to do it for me, they can be my guest, but I'd really prefer to be taught the method.

    Basically, what I would like is for someone to drop me a quick line explaining how Mathematica, or any other adequate computer program, could be used to rearrange a large equation such this (i.e. solve for B, C, D, E, F, j and k, one by one). The normal "[Solve ...,B]" function in Mathematica offers no output at all (just a blank "[]"), but I would be grateful if someone can point me to a function that may be able to.

    If this is in the wrong forum, please move it (moderator). I thought it might belong more in the computer science forum, but I know little about the field in general and it struck me that algebraic rearranging belongs here instead.

    Thanks for any help.
  2. Intriguing Alias's Avatar
    • TSR Idol
    • Location: Yorkshire
    Re: Mathematica Rearranging Large Equations
    (Original post by Big-Daddy)
    I have a very large and complex algebraic expression that I've been looking around to see if I can have rearranged in a simple way. It has variables A, B, C, D, E, F, j and k (8 in total).

    WolframAlpha is incapable of rearranging it and simply times out, so it should be obvious that human attempts to do so are likely to be short-lived. However, I think Mathematica should reasonably be able to give it a shot.

    The equation is:

    A=((((((((B*(((((C^2)+(4*F))^(0. 5))+C)/2))-((j/k)*(D*(((((E^2)+(4*F))^(0.5))+E)/2))))/(B+D)))^2)+(4*F))^(0.5))+((((B*( ((((C^2)+(4*F))^(0.5))+C)/2))-((j/k)*(D*(((((E^2)+(4*F))^(0.5))+E)/2))))/(B+D))))/2

    Yes, I'm aware that this looks like an unintelligible mess, but I'm not asking for human help in rearranging it - in fact, I'm mainly posting it so you get an idea of its complexity. If someone does want to do it for me, they can be my guest, but I'd really prefer to be taught the method.

    Basically, what I would like is for someone to drop me a quick line explaining how Mathematica, or any other adequate computer program, could be used to rearrange a large equation such this (i.e. solve for B, C, D, E, F, j and k, one by one). The normal "[Solve ...,B]" function in Mathematica offers no output at all (just a blank "[]"), but I would be grateful if someone can point me to a function that may be able to.

    If this is in the wrong forum, please move it (moderator). I thought it might belong more in the computer science forum, but I know little about the field in general and it struck me that algebraic rearranging belongs here instead.

    Thanks for any help.
    Are you sure solving for B is actually possible here? I type it into Microsoft Mathematics and it solves for k fine, but it won't do it for B.
  3. Big-Daddy's Avatar
    • Peer Of The TSR Realm
    • Posts: 1,514
    Re: Mathematica Rearranging Large Equations
    (Original post by hassi94)
    Are you sure solving for B is actually possible here? I type it into Microsoft Mathematics and it solves for k fine, but it won't do it for B.
    Is it even possible that an expression can't be rearranged? I have no doubt that the rearrangement will be similarly large and complex, but impossible? Are there any other examples you can think of where rearrangement is impossible (preferably in a smaller and easier-to-comprehend expression)?

    Hmmm ... this equation is basically three levels of quadratic as if solved for x, with only the positive result taken on. I (meaning WolframAlpha) recently did manage to rearrange for all but one variable in an equation with two levels of quadratic, so I should think that this is possible. But, like the 5th degree polymonial formula, it may be that this is one step too far.

    I would still like to think that a professional computer program like Mathematica should be able to handle it - unless there is a genuine reason why it should be impossible? Granted, Mathematica does come out with its empty brackets rather quickly, which makes me sense that I'm using the wrong function and that's why Mathematica isn't coming out with the results I want.
  4. Intriguing Alias's Avatar
    • TSR Idol
    • Location: Yorkshire
    Re: Mathematica Rearranging Large Equations
    (Original post by Big-Daddy)
    Is it even possible that an expression can't be rearranged? I have no doubt that the rearrangement will be similarly large and complex, but impossible? Are there any other examples you can think of where rearrangement is impossible (preferably in a smaller and easier-to-comprehend expression)?

    Hmmm ... this equation is basically three levels of quadratic as if solved for x, with only the positive result taken on. I (meaning WolframAlpha) recently did manage to rearrange for all but one variable in an equation with two levels of quadratic, so I should think that this is possible. But, like the 5th degree polymonial formula, it may be that this is one step too far.

    I would still like to think that a professional computer program like Mathematica should be able to handle it - unless there is a genuine reason why it should be impossible? Granted, Mathematica does come out with its empty brackets rather quickly, which makes me sense that I'm using the wrong function and that's why Mathematica isn't coming out with the results I want.
    I don't know like ax^5 + bx^4 + cx^3 + dx^2 + ex + f = 0

    rearrange for x. No way of doing it as far as I'm aware, and there are other types of expressions that can't be arranged to leave a single letter in certain cases.

    Reading your post, I now realise you've mentioned this - and I think you're right I think it is comparable to the 5th degree polynomial formula.

    There are definitely other (non-polynomial) expressions that also can't be rearranged to a single letter = ............ but I couldn't tell you much about the proof of why or even examples
    Last edited by Intriguing Alias; 19-06-2012 at 00:41.
  5. moorbre's Avatar
    • Exalted Member
    • Posts: 386
    Re: Mathematica Rearranging Large Equations
    (Original post by Big-Daddy)
    A=((((((((B*(((((C^2)+(4*F))^(0. 5))+C)/2))-((j/k)*(D*(((((E^2)+(4*F))^(0.5))+E)/2))))/(B+D)))^2)+(4*F))^(0.5))+((((B*( ((((C^2)+(4*F))^(0.5))+C)/2))-((j/k)*(D*(((((E^2)+(4*F))^(0.5))+E)/2))))/(B+D))))/2
    wtf is that for :L:L:L
    I can only wish you luck on this endeavour...well that and solve it for A
  6. Big-Daddy's Avatar
    • Peer Of The TSR Realm
    • Posts: 1,514
    Re: Mathematica Rearranging Large Equations
    (Original post by hassi94)
    I don't know like ax^5 + bx^4 + cx^3 + dx^2 + ex + f = 0

    rearrange for x. No way of doing it as far as I'm aware, and there are other types of expressions that can't be arranged to leave a single letter in certain cases.

    Reading your post, I now realise you've mentioned this - and I think you're right I think it is comparable to the 5th degree polynomial formula.

    There are definitely other (non-polynomial) expressions that also can't be rearranged to a single letter = ............ but I couldn't tell you much about the proof of why or even examples
    Well, you're right that the 5th degree polynomial formula can't be solved. (As was rigorously proved in the 1800s.)

    But if I could get that equation into the form of aB^5...=0 then I would consider it successfully rearranged, as it would be easy to back-calculate, with all the other results, for a value of B.

    That said, I don't think it should end up as a 5th degree polynomial at all, because that implies that there would be 5 roots, whereas I am fairly certain that (just as there is only one answer for A, because in taking square roots, as we do multiple times, we only want the positive result) there will only be one for B. At least, only one real solution.
  7. BillSimpson's Avatar
    • New Member
    • Posts: 1
    Re: Mathematica Rearranging Large Equations
    (Original post by Big-Daddy)
    I have a very large and complex algebraic expression that I've been looking around to see if I can have rearranged in a simple way. It has variables A, B, C, D, E, F, j and k (8 in total).

    The equation is:

    A=((((((((B*(((((C^2)+(4*F))^(0. 5))+C)/2))-((j/k)*(D*(((((E^2)+(4*F))^(0.5))+E)/2))))/(B+D)))^2)+(4*F))^(0.5))+((((B*( ((((C^2)+(4*F))^(0.5))+C)/2))-((j/k)*(D*(((((E^2)+(4*F))^(0.5))+E)/2))))/(B+D))))/2
    In Mathematica C, D and E have predefined meanings and using those as variables will cause lots of problems and often give you incomprehensible results. In general using lower case names for all user variables is a very good idea.

    Mathematica makes a large distinction between exact math and approximate math, which uses decimal points. Using ^0.5 for square root in otherwise symbolic equations will often severely limit the power of some of the Mathematica functions. ^(1/2) or Sqrt[] will avoid some of these problems.

    Square roots in general tend to make it much more difficult for Mathematica to return solutions. I don't know whether you could reformulate your problem without the square roots, but if you could I think you would have a much better chance of getting an acceptable result.

    You say you are looking for real roots and that will influence some of the interpretation of your square roots, but I can't see how to significantly simplify your problem without my introducing uncertainty and possible errors.

    Reduce is often a powerful tool for problems like this. It tends to produce lengthy output with boolean conditions separating every alternative. Perhaps it can help you.

    I believe this is the same as your original, with Mathematica eliminating some extra () and reordering some terms.

    Reduce[A == (Sqrt[4*F + ((B*(c + Sqrt[c^2 + 4*F]))/2 - (d*(e + Sqrt[e^2 + 4*F])*j)/(2*k))^2/(B + d)^2] + ((B*(c + Sqrt[c^2 + 4*F]))/2 - (d*(e + Sqrt[e^2 + 4*F])*j)/(2*k))/(B + d))/2, {A, B,c, d, e, F, j, k}]

    If you can reformulate without the square roots then I'll spend more time on this.
    Last edited by BillSimpson; 24-06-2012 at 19:30.
  8. Big-Daddy's Avatar
    • Peer Of The TSR Realm
    • Posts: 1,514
    Re: Mathematica Rearranging Large Equations
    (Original post by BillSimpson)
    In Mathematica C, D and E have predefined meanings and using those as variables will cause lots of problems and often give you incomprehensible results. In general using lower case names for all user variables is a very good idea.

    Mathematica makes a large distinction between exact math and approximate math, which uses decimal points. Using ^0.5 for square root in otherwise symbolic equations will often severely limit the power of some of the Mathematica functions. ^(1/2) or Sqrt[] will avoid some of these problems.

    Square roots in general tend to make it much more difficult for Mathematica to return solutions. I don't know whether you could reformulate your problem without the square roots, but if you could I think you would have a much better chance of getting an acceptable result.

    You say you are looking for real roots and that will influence some of the interpretation of your square roots, but I can't see how to significantly simplify your problem without my introducing uncertainty and possible errors.

    Reduce is often a powerful tool for problems like this. It tends to produce lengthy output with boolean conditions separating every alternative. Perhaps it can help you.

    I believe this is the same as your original, with Mathematica eliminating some extra () and reordering some terms.

    Reduce[A == (Sqrt[4*F + ((B*(c + Sqrt[c^2 + 4*F]))/2 - (d*(e + Sqrt[e^2 + 4*F])*j)/(2*k))^2/(B + d)^2] + ((B*(c + Sqrt[c^2 + 4*F]))/2 - (d*(e + Sqrt[e^2 + 4*F])*j)/(2*k))/(B + d))/2, {A, B,c, d, e, F, j, k}]

    If you can reformulate without the square roots then I'll spend more time on this.
    Thank you for the help.

    Your reformulation of my equation, if indeed it is correct (I never really realized I had any superfluous brackets; if I did then it's good they're out), is far better than anything I could have hoped to achieve. And my initial reaction is that it isn't possible to remove square roots entirely, although needless-to-say they could be alternatively denoted with a ^(1/2) or Sqrt[] notation.

    I have various other ways of deriving the equation, so I could attempt to find other rearrangements. But it contains 3 different levels of quadratic, so trying to eliminate square roots will most likely not be possible.

    If I could offer a few more rearrangements (but not all of them), would that help Mathematica fill in the blanks?

    Also, I'm having trouble with another function: A=(((s/m)*(c/a))^c)*(((s/m)*(d/a))^d), and A=(((s/m)*(c/a))^c)*(((s/m)*(d/a))^d)/((s/m)^a). It appears that most programs like Wolfram Alpha and Microsoft Math find it difficult to rearrange equations of the type y=x^x. Why is that?
  9. Intriguing Alias's Avatar
    • TSR Idol
    • Location: Yorkshire
    Re: Mathematica Rearranging Large Equations
    (Original post by Big-Daddy)
    It appears that most programs like Wolfram Alpha and Microsoft Math find it difficult to rearrange equations of the type y=x^x. Why is that?

    I don't think it's possible to display x = something in the equation y=x^x - well without using the lambert W function (which I don't think they will dabble with).
Sign in to Reply
Share this discussion:  
Article updates
Moderators

We have a brilliant team of more than 60 volunteers looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

Reputation gems:
The Reputation gems seen here indicate how well reputed the user is, red gem indicate negative reputation and green indicates a good rep.
Post rating score:
These scores show if a post has been positively or negatively rated by our members.