Why does vpasolve work where solve doesn't for the following:

1 visualizzazione (ultimi 30 giorni)
When I pass the following equations into solve like so
eqn1 = (120*Lt*pi*Rt)/(14400*Lt^2*pi^2 + Rt^2)^(1/2) - 338920901889975/17592186044416
eqn2 = (42000*Lt*pi*Rt)/(1764000000*Lt^2*pi^2 + Rt^2)^(1/2) - 8473022547249375/17592186044416
S = solve([eqn1,eqn2],[Rt, Lt])
I get the following error:
Warning: 4 equations in 2 variables.
> In C:\Program Files (x86)\MATLAB\R2013a Student\toolbox\symbolic\symbolic\symengine.p>symengine at 56
In mupadengine.mupadengine>mupadengine.evalin at 97
In mupadengine.mupadengine>mupadengine.feval at 150
In solve at 170
In Main at 152
Warning: Explicit solution could not be found.
> In solve at 179
In Main at 152
However, if I plug these same two equations into vpasolve like so
S = vpasolve([eqn1, eqn2], [Rt, Lt], [1e3, 1e-6]);
I get
double(S.Rt) = 482.866983 and
double(S.Lt) = 0.051144.
What am I doing wrong inside the solve function??? Thanks for any help.

Risposta accettata

David
David il 21 Ott 2013
Hey everyone,
It turns out, not surprisingly, that I needed to make eqn1 and eqn2 symbolic objects, which I did by wrapping sym() around each one. Now everything works fine. Yippee!
eqn1 = sym((120*Lt*pi*Rt)/(14400*Lt^2*pi^2 + Rt^2)^(1/2) - 338920901889975/17592186044416)
eqn2 = sym((42000*Lt*pi*Rt)/(1764000000*Lt^2*pi^2 + Rt^2)^(1/2) - 8473022547249375/17592186044416)
S = solve([eqn1, eqn2])

Più risposte (1)

Walter Roberson
Walter Roberson il 21 Ott 2013
There are two solutions:
Lt = (135/7881299347898368)*sqrt(87986205389370659588312581)/pi,
Rt = (405/17592186044416)*sqrt(439931026946853297941562905)
and the negatives of those.
I suggest switching to symbolic numbers when you construct the equation:
eqn1 = sqrt(sym(120)*Lt*sym('pi')*Rt)/(sym(14400)*Lt^2*sym('pi')^2 + Rt^2) - sym('338920901889975')/sym('17592186044416')
eqn2 = sqrt(sym(42000)*Lt*sym('pi')*Rt)/(sym('1764000000')*Lt^2*sym('pi')^2 + Rt^2) - sym('8473022547249375')/sym('17592186044416')
I used sym(120) and other small numbers, but sym('17592186044416') and other large numbers, to avoid the possibility of losing precision in converting the double precision representation of the larger numbers to symbolic form.
  2 Commenti
David
David il 21 Ott 2013
Modificato: David il 21 Ott 2013
Thanks for your quick reply and suggestions. However, I would like to ask, how is that you got these solutions using the solve function where I couldn't? Were there any differences between how you and I called the solve function? Thanks again.
David
David
David il 21 Ott 2013
Nevermind Walter, I figured out my problem. It turns out, not surprisingly, that I needed to make eqn1 and eqn2 symbolic objects, which I did by wrapping sym() around each one. Now everything works fine. Yippee!
eqn1 = sym((120*Lt*pi*Rt)/(14400*Lt^2*pi^2 + Rt^2)^(1/2) - 338920901889975/17592186044416)
eqn2 = sym((42000*Lt*pi*Rt)/(1764000000*Lt^2*pi^2 + Rt^2)^(1/2) - 8473022547249375/17592186044416)
S = solve([eqn1, eqn2])

Accedi per commentare.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by