Effacer les filtres
Effacer les filtres

unexpected parameter z3 when using solve command

2 vues (au cours des 30 derniers jours)
Seraphic
Seraphic le 31 Jan 2023
Commenté : Walter Roberson le 1 Fév 2023
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

Réponses (1)

Walter Roberson
Walter Roberson le 31 Jan 2023
Déplacé(e) : Walter Roberson le 1 Fév 2023
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 commentaires
Seraphic
Seraphic le 1 Fév 2023
Hi again Walter,
Can I use vpasolve command here?
Walter Roberson
Walter Roberson le 1 Fév 2023
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

Connectez-vous pour commenter.

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by