An actual non-answer from solve
Afficher commentaires plus anciens
The following code results in a an empty sym. Would anyone care to comment on (a) why no solution? and (b) how to actually get a solution from the symbolic math toolbox?
reset(symengine);clear all;
syms x lambda A k positive;
syms eta;
lambda = sym(1);
k = sym(2*pi);
eq1 = A*sin(eta)-10;
eq2 = A*sin(k*lambda/6 + eta)-20;
eq3 = A*sin(k*5*lambda/12 + eta);
% try to solve
b=solve(eq1,eq2,eq3,A,eta,k)
% --> answer is [ empty sym ]
subs(eq1,{A,eta,k},{20,pi/6,2*pi/lambda})
subs(eq2,{A,eta,k},{20,pi/6,2*pi/lambda})
subs(eq3,{A,eta,k},{20,pi/6,2*pi/lambda})
Réponse acceptée
Plus de réponses (2)
Walter Roberson
le 2 Juin 2011
solve() is failing because you are attempting to solve for k, but k has a value already so eq1 eq2 and eq3 do not contain k anymore. Even if they did somehow still contain k, because k has a value, it would be the value that would be passed in to solve() where you list k at the end; you would need to quote k to get just the name passed in
solve(eq1,eq2,eq3,A,eta,'k')
but like I said this would fail because there is no k in eq* because eq* were constructed after k was defined.
Susan
le 2 Juin 2011
1 commentaire
Walter Roberson
le 2 Juin 2011
Works for me in Maple:
solve([eq1, eq2, eq3], [A, eta, k],UseAssumptions);
[[A = 20, eta = (1/6)*Pi, k = 2*Pi/lambda],
[A = 20, eta = (5/6)*Pi, k = 10*Pi/lambda],
[A = 20, eta = (5/6)*Pi, k = -2*Pi/lambda],
[A = 20, eta = (1/6)*Pi, k = -10*Pi/lambda],
[A = (80/7)*14^(1/2), eta = arctan((1/22)*14^(1/2)*2^(1/2)), k = 12*arctan((1/2)*14^(1/2)*2^(1/2))/lambda],
[A = (80/7)*14^(1/2), eta = -arctan((1/22)*14^(1/2)*2^(1/2))+Pi, k = 12*(-arctan((1/2)*14^(1/2)*2^(1/2))+Pi)/lambda],
[A = (80/7)*14^(1/2), eta = -arctan((1/22)*14^(1/2)*2^(1/2))+Pi, k = -12*arctan((1/2)*14^(1/2)*2^(1/2))/lambda],
[A = (80/7)*14^(1/2), eta = arctan((1/22)*14^(1/2)*2^(1/2)), k = 12*(arctan((1/2)*14^(1/2)*2^(1/2))-Pi)/lambda]]
You have to eliminate the ones with negative k from this, as Maple does not seem to fully process the assumptions on k with the assumptions on lambda,
Catégories
En savoir plus sur Code Performance dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!