unexpected parameter z3 when using solve command

2 次查看(过去 30 天)
Hi, I am new to matlab and want to solve an eqution.
syms x
eqn = x-((1-1/0.9925)*0.65-0.003)*x^((1/0.66)/(1/0.97))== 20+((1-1/0.9925)*0.65-0.003)*((1/0.97)^(-0.66)*(1-0.97*(1-0.003)-(1-0.97/0.9925)*0.65)^(-0.66));
Then, the following warning pops up.
Warning: Solutions are parameterized by the symbols: z2. 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)
In Untitled (line 4)
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)
In Untitled (line 4)
I edited my code and ran again, then unexpected parameter z3 came up.
syms x
eqn = x-((1-1/0.9925)*0.65-0.003)*x^((1/0.66)/(1/0.97))== 20+((1-1/0.9925)*0.65-0.003)*((1/0.97)^(-0.66)*(1-0.97*(1-0.003)-(1-0.97/0.9925)*0.65)^(-0.66));
[solx,parameters,conditions] = solve(eqn,x,'ReturnConditions',true)
assume(conditions);
restriction = [100>solx , -100 <solx ];
solz = solve(restriction,parameters)
valx = subs(solx,parameters,solz)
I don't understand what z3 means here and how to get my solution valx. Even the equation inside the root parenthesis seems illogical. Please help me with this.
solx =
z3^66
parameters =
z3
conditions =
-pi/66 < angle(z3) & angle(z3) <= pi/66 & z3^97 + (576460752303423488*z3^66)/4560864541524069 - 3822084685500913664/1520288180508023 == 0
solz =
root(z^97 + (576460752303423488*z^66)/4560864541524069 - 3822084685500913664/1520288180508023, z, 1)
valx =
root(z^97 + (576460752303423488*z^66)/4560864541524069 - 3822084685500913664/1520288180508023, z, 1)^66

回答(1 个)

Walter Roberson
Walter Roberson 2023-1-31
移动:Walter Roberson 2023-2-1
Should the 0.66 instead be exactly 2/3 ? Should the 0.65 be 2/3 - 1/100 ?
Should the 0.97 be 1 - 0.003*10 ?
Is there a relationship between the 0.97 and the 0.9925 ?
Q = @(v) sym(v);
F = sym(2)/sym(3);
Fm = F - 1/sym(100);
syms x
eqn = x-((1-1/Q(0.9925))*Fm-Q(0.003))*x^((1/F)/(1/Q(0.97))) == 20+((1-1/Q(0.9925))*Fm-Q(0.003))*((1/Q(0.97))^(-F)*(1-Q(0.97)*(1-Q(0.003))-(1-Q(0.97)/Q(0.9925))*Fm)^Q(-F))
eqn = 
%sol = solve(eqn, x, 'returnconditions', true)
vpa(eqn, 10)
ans = 
vpasolve(eqn, 10)
ans = 
19.295781077501889097831548029764
  3 个评论
Walter Roberson
Walter Roberson 2023-2-1
Sure, I show using vpasolve here. The Q() calls are there to convert coefficients to rationals because solve() is intended to find exact closed form solutions whenever possible, and converting to rational reduces floating point round off problems. But most importantly if you want to use solve then you need better precision about exactly what you mean by taking a variable to the power of 0.66

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by