How to use equation solver with conditions
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Alex Karakostas
el 16 de En. de 2019
Respondida: Star Strider
el 16 de En. de 2019
syms x a r
x = isolate(-((2*(90 - x)^r - (2*x + 90)^r)*(a + 4)*(r - 1)==0,a)
Is it possible to ask matlab to solve the above equation setting as a condition that "a" is a positive number?
Ideally, I want matlab to return an equation rather than -4 as the solution.
0 comentarios
Respuesta aceptada
Star Strider
el 16 de En. de 2019
Theoretically, yes:
syms x a r
assume(a > 0)
x = isolate(-((2*(90 - x)^r - (2*x + 90)^r)*(a + 4)*(r - 1))==0,a)
However,
Error using sym/isolate (line 108)
Unable to isolate 'a' because the equation has no solution.
Note that the equation you posted has an unmatched parenthesis. I added one to get this to work, so be sure all of them are in the correct places, and that you are not using more of them than you need to.
0 comentarios
Más respuestas (1)
Walter Roberson
el 16 de En. de 2019
No. Your equation has three terms multiplied together
-2*(90 - x)^r + (2*x + 90)^r
a + 4
r - 1
in order for the result to equal zero, one of the terms must equal 0. The only term that involves a is a+4 . In order for that to equal 0, a must be -4.
There are two solutions in r: r = 1 or r = -ln(2)/(ln(90 - x) - ln(2*x + 90)) neither of which involve a and so under the positivity constraint would be valid for all positive a other than x = 0 (as 0 gives a division by 0)
0 comentarios
Ver también
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!