I got a non-answer from solve()
2 views (last 30 days)
Show older comments
Here's some code. I know that one solution is eta = pi/6, A=20, and k=2*pi/lambda. I get a non-answer (A=A, eta=eta, k=k) from solve():
reset(symengine);clear all;
syms x lambda A k positive;
syms eta;
lambda = 1;
eq1 = A*sin(eta)-10;
eq2 = A*sin(k*lambda/6 + eta)-20;
eq3 = A*sin(k*5*lambda/12 + eta);
% try to solve
solve(eq1,eq2,eq3,A,eta,k)
ans =
A: [1x1 sym]
eta: [1x1 sym]
k: [1x1 sym]
Other things I've tried have yielded different results, but they were also non-productive. What am I missing here?
Thanks,
Susan
0 Comments
Accepted Answer
Sean de Wolski
on 2 Jun 2011
You get an answer!
b = solve(eq1,eq2,eq3,A,eta,k)
b.A %A
b.eta %eta
b.k %k
6 Comments
Walter Roberson
on 2 Jun 2011
Those values for A and k are incompatible with the "syms A k positive" that Susan had.
More Answers (1)
Walter Roberson
on 2 Jun 2011
Sometimes instead of putting an assumption on the range of a variable, it is better to select() the answers that meet the criteria.
1 Comment
Walter Roberson
on 2 Jun 2011
By selecting the admissible solutions after finding them all, the complete set I get is
[A = 20, eta = (1/6)*Pi, k = 2*Pi]
[A = 20, eta = (5/6)*Pi, k = 10*Pi]
[A = (80/7)*14^(1/2), eta = -arctan((1/11)*7^(1/2))+Pi, k = -12*arctan(7^(1/2))+12*Pi]
[A = (80/7)*14^(1/2), eta = arctan((1/11)*7^(1/2)), k = 12*arctan(7^(1/2))]}
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!