Solve showing more equations than I entered
2 views (last 30 days)
Show older comments
I am attempting to solve a system of 3 equations. The equations contain 3 variables I am trying to solve for plus 2 parameters. I use the solve command to specify which 3 variables to solve for. However, I get a warning saying there are 6 equations in 5 variables.
Additionally, if I don't specify the variables to solve for, it still can't give me any solution.
syms a b m f r real
eq1=r*((4*b + 4*f*a)/(1 - 4*r*m)^(1/2) - 4) == 0
eq2=2*b + 2*f*a - 2*(1 - 4*r*m)^(1/2) == 0
eq3=2*f*(b+a*f-(1-4*m*r)^.5)==0
solve([eq1, eq2, eq3], [a, b, m])
Warning: 6 equations in 5 variables.
> In C:\Program Files\MATLAB\R2013a\toolbox\symbolic\symbolic\symengine.p>symengine at 56
In mupadengine.mupadengine>mupadengine.evalin at 97
In mupadengine.mupadengine>mupadengine.feval at 150
In solve at 170
Warning: Explicit solution could not be found.
> In solve at 179
solve([eq1, eq2, eq3])
Warning: Explicit solution could not be found.
> In solve at 179
I have tried adding in some assumptions (m is negative, all other variables and parameters are positive)
assume(m<0)
assume(a>0)
assume(b>0)
assume(f>0)
assume(r>0)
solve([eq1, eq2, eq3], [a, b, m])
Warning: 6 equations in 5 variables.
> In C:\Program Files\MATLAB\R2013a\toolbox\symbolic\symbolic\symengine.p>symengine at 56
In mupadengine.mupadengine>mupadengine.evalin at 97
In mupadengine.mupadengine>mupadengine.feval at 150
In solve at 170
Warning: Explicit solution could not be found.
> In solve at 179
>> solve([eq1, eq2, eq3])
ans =
f: [1x1 sym]
m: [1x1 sym]
r: [1x1 sym]
[Af, Am, Ar]=solve([eq1, eq2, eq3])
Af =
1
Am =
-1
Ar =
1
Even if I was trying to solve for f, m, and r, those solutions don't make any sense without values for b and a (to show this simply, look at equation 2 - without knowing b, there is no way to know if the left side is equal to zero.
So, I have two questions: 1) why is it telling me there are 6 equations and 5 variables? 2) Is there an exact symbolic solution and can MATLAB find it?
0 Comments
Answers (1)
Walter Roberson
on 5 Jun 2015
If you have a sufficiently old MATLAB then it might not treat the "==" as a symbolic condition to be satisfied: it might treat it as something to test immediately, discover that the symbols are not 0, and assign 0 to the variables. In such a case, remove "== 0" tests and replace "a == b" tests with (a)-(b)
I do not have the symbolic toolbox to test with, but the solution is b = -f*a+sqrt(-4*m*r+1) for all a and m
0 Comments
See Also
Categories
Find more on Assumptions in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!