From where is this exp in syms calculus?
1 view (last 30 days)
Show older comments
syms V1 V2 p1 p2 n
eqv=p1*V1^n==p2*V2^n;
solve(eqv,V2)
Warning: Solutions are parameterized by the symbols: l. To include parameters
and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
> In sym/solve>warnIfParams (line 475)
In sym/solve (line 357)
Warning: Solutions are only valid under certain conditions. To include
parameters and conditions in the solution, specify the 'ReturnConditions' value
as 'true'.
> In sym/solve>warnIfParams (line 478)
In sym/solve (line 357)
ans =
exp(-(l*6.2832i)/n)*((V1^n*p1)/p2)^(1/n)
true ans ((V1^n*p1)/p2)^(1/n).
0 Comments
Accepted Answer
James Tursa
on 2 Sep 2020
Edited: James Tursa
on 3 Sep 2020
The solution space has multiple values, not just one. The solver has parameterized the solution space for you. There are multiple complex roots possible. E.g., a simpler example:
>> syms Y X n
>> eqv = Y==X^n;
>> solve(eqv,X)
Warning: Solutions are parameterized by the symbols: l. To include parameters and conditions in the
solution, specify the 'ReturnConditions' value as 'true'.
> In solve>warnIfParams (line 475)
In solve (line 357)
Warning: Solutions are valid under the following conditions: 0 <= real(n)*(pi - imag(log(Y)/n) +
2*l*pi*real(1/n)) & 0 < real(n) & 0 < real(n)*(pi + imag(log(Y)/n) - 2*l*pi*real(1/n)) & in(l,
'integer') | real(n)*(pi - imag(log(Y)/n) + 2*l*pi*real(1/n)) <= 0 & real(n) < 0 & real(n)*(pi +
imag(log(Y)/n) - 2*l*pi*real(1/n)) < 0 & in(l, 'integer'). To include parameters and conditions in the
solution, specify the 'ReturnConditions' value as 'true'.
> In solve>warnIfParams (line 482)
In solve (line 357)
ans =
Y^(1/n)*exp(-(pi*l*2i)/n)
The obvious solution by inspection is X = Y^(1/n). That happens to be the solution for the parameter choice l=0, but there are other solutions for other values of l also. Essentially it includes the n'th roots of 1 as a multipler in this case (the exp stuff).
E.g., to get rid of those complex n'th roots of 1:
>> solve(eqv,X,'Real',true)
Warning: Solutions are valid under the following conditions: 0 < Y. To include parameters and
conditions in the solution, specify the 'ReturnConditions' value as 'true'.
> In solve>warnIfParams (line 482)
In solve (line 357)
ans =
Y^(1/n)
And thus your code could be:
>> syms V1 V2 p1 p2 n
>> eqv = p1*V1^n==p2*V2^n;
>> solve(eqv,V2,'Real',true)
Warning: Solutions are valid under the following conditions: 0 < (V1^n*p1)/p2 &
in(((V1^n*p1)/p2)^(1/n), 'real'). To include parameters and conditions in the solution, specify the
'ReturnConditions' value as 'true'.
> In solve>warnIfParams (line 482)
In solve (line 357)
ans =
((V1^n*p1)/p2)^(1/n)
1 Comment
More Answers (0)
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!