- #1
larsbentley
- 29
- 0
I am using Mathematica to create a formula to solve for (Vs) in an equation shown at the top of the attached image. Using the assumptions shown, Mathematica outputs three possible solutions, all of which appear to be incorrect when I check them using actual values.
I get this error when Mathematica generates the three possible solutions :
"Solve::ratnz: Solve was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result."
...and I believe this may be the cause of the problem, but I have no idea how to get around this.
If I plug sample values into the original equation (as shown at the bottom of the attached jpg) it will produce a valid result (596.704) as the third possible solution.
If I plug these same values into the second of the three long equations Mathematica has given me it will produce a value for (Vs) that is very close to correct (596.7044277254138 - 3.67761*10^-15 I), but includes an additional small imaginary number
Does anyone have experience with Mathematica that may help me produce a valid equation to solve for (Vs)?
(Vs) is peak velocity in a trapezoidal move, while (Vi) is initial velocity, which is always greater than zero for my purposes. (Ma) is counts of acceleration, (Md) is counts of deceleration, (d) is counts of total distance , (t) is total time. Final velocity is always assumed to be zero, so it is not shown in the original formula.
Original formula:
Assuming[Vs \[Element] Reals; d > 0; t > 0; Vi > 0; Vs > 0; Ma > 0;
Md < 0;, Solve[ d == ((Vs + Vi)/2)*((Vs - Vi)/(.5*Vs^2/Ma)) + ((Vs/2)*(-Vs/(.5*Vs^2/Md))) + (Vs*(t - (-Vs/(.5*Vs^2/Md)) - ((Vs - Vi)/(.5*Vs^2/Ma)))), Vs]]
Thanks,
Lars
I get this error when Mathematica generates the three possible solutions :
"Solve::ratnz: Solve was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result."
...and I believe this may be the cause of the problem, but I have no idea how to get around this.
If I plug sample values into the original equation (as shown at the bottom of the attached jpg) it will produce a valid result (596.704) as the third possible solution.
If I plug these same values into the second of the three long equations Mathematica has given me it will produce a value for (Vs) that is very close to correct (596.7044277254138 - 3.67761*10^-15 I), but includes an additional small imaginary number
Does anyone have experience with Mathematica that may help me produce a valid equation to solve for (Vs)?
(Vs) is peak velocity in a trapezoidal move, while (Vi) is initial velocity, which is always greater than zero for my purposes. (Ma) is counts of acceleration, (Md) is counts of deceleration, (d) is counts of total distance , (t) is total time. Final velocity is always assumed to be zero, so it is not shown in the original formula.
Original formula:
Assuming[Vs \[Element] Reals; d > 0; t > 0; Vi > 0; Vs > 0; Ma > 0;
Md < 0;, Solve[ d == ((Vs + Vi)/2)*((Vs - Vi)/(.5*Vs^2/Ma)) + ((Vs/2)*(-Vs/(.5*Vs^2/Md))) + (Vs*(t - (-Vs/(.5*Vs^2/Md)) - ((Vs - Vi)/(.5*Vs^2/Ma)))), Vs]]
Thanks,
Lars
Attachments
Last edited: