Solve returns a solution in the form {{ x -> y / a^2 + y^2 / a^7 }}.

Since I want to process the input (with another program) in terms of Laurent polynomials, I would like an output with negative powers instead of fractions:

y a^(-2) + y^2 a^(-7)

Is this kind of output format possible?

Edit: I would prefer a string "x= y a^-2 + y^2 a^-7" (or something that could be parsed to this easily)

  • 5
    $\begingroup$ Both 1/a^2 and a^(-2) have the same internal form: Power[a, -2]. It will be helpful if you mention what format your external program requires. Do you need to feed it exactly {{x->y a^-2 + y^2 a^-7}} (i.e., list of rules) or do you need only a string representation of the polynomial with the desired format? $\endgroup$
    – rm -rf
    Apr 6 '13 at 19:50
  • 5
    $\begingroup$ Some useful starting points here $\endgroup$
    – geordie
    Apr 6 '13 at 23:21
  • $\begingroup$ Why was this downvoted and even flagged for closing as being "too localized"? I think it is a perfectly reasonable question given the aim of the poster (using external software) and is not trivial to solve based on the Documentation. $\endgroup$ Apr 7 '13 at 13:48
  • $\begingroup$ please see the link in geordie's comment, @user6772. Your question seems to have been answered there.. $\endgroup$
    – rm -rf
    Apr 7 '13 at 16:30
  • $\begingroup$ @rm-rf Might it be more correct to say the following, instead of your first comment above? 1/a^2 and a^-2 both evaluate to Power[a,-2]. This is not the result of one internal step, as we have Hold[a^-2] // FullForm -> Hold[Power[a,-2]], whereas Hold[1/a^2] // FullForm -> Hold[Times[1,Power[Power[a,2],-1]]], which is just a "special case of" Hold[a/b]//FullForm -> Hold[Times[a,Power[b,-1]]]. Note that Hold[Divide[a, b]] // FullForm -> Hold[Divide[a,b]] (so that it is slightly misleading that "/" points to Divide in the help). ... $\endgroup$ Apr 11 '13 at 10:33