Solving for a variable with many solutions
1 view (last 30 days)
Show older comments
I have a equation which I know must equal zero.
(( 2*L^2*k*cos(k*L)*sin(k*L)-2*L*sin(k*L)^2 = 0))
I know that this expression will be true when k = n*pi/L, where n=1,2,3,... However, using the solve function in Matlab returns a "cannot find explicit solution" error. Is there a way I can solve for k and get an answer similar to k = pi/L?
Here is my code:
syms k L
eqn = 2*L^2*k*cos(k*L)*sin(k*L)-2*L*sin(k*L)^2 ==0
>> solve(eqn,k)
Warning: Cannot find explicit solution.
> In solve (line 318)
ans =
Empty sym: 0-by-1
To prove that there is an explicit solution, see:
>> f = @(k) 2*L^2*k*cos(k*L)*sin(k*L)-2*L*sin(k*L)^2
f =
@(k)2*L^2*k*cos(k*L)*sin(k*L)-2*L*sin(k*L)^2
>> f(pi/L)
ans =
0
0 Comments
Answers (1)
Kiran
on 11 Feb 2016
MATLAB is trying to find the "Explicit" solution, meaning particular variable should be expressed in terms of other variables. If a variable cannot be isolated and thus appears on both sides of the equation then solution is implicit.
In your case to get the explicit solution you need to simplify the equation a bit.
After simplification your equation become:
sin(x) ( xcos(x) - sin(x))==0
where x = kL
This will give two separate solutions to your original equation. If you give
eqn = sin(x) == 0;
[solx, params, conds] = solve(eqn, x, 'ReturnConditions', true)
This will give you result as pi*k which will be, after substitution, the generic solution pi*x/L
However I simplified second equation to x = tan(x) still it has implicit solution.
Hope this help.
2 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!