![matlab symbolic toolbox solve matlab symbolic toolbox solve](https://es.mathworks.com/help/examples/symbolic/win64/SolveAlgebraicEquationLETTopicExample_03.png)
The symbol name matches the symbol's value it's easier to use the equivalent " syms x". in future x will be treated as a symbol entity). The command x=sym('x') creates a symbolic object called x which has the corresponding string representation x (i.e.
![matlab symbolic toolbox solve matlab symbolic toolbox solve](https://www.maplesoft.cz/wp-content/uploads/2014/05/matlabtoolbox_screenshot-1024x629.gif)
To convert a symbolic object into a number use double - e.g. The following, for example, produces the result 5/6 Only digits, arithmetic operations will be different to those in Objects are essentially strings, but even if those strings contain Things of this type are created using the sym and With the Symbolic Math Toolbox comes a new matlab datatype - symbolic To make the most of the Symbolic Toolbox you need to be aware ofĪ few concepts, in particular symbolic objects sym ForĬommon operations it's easy to use - e.g. Integrating, differentiating, etc) and also has some solving routines. Which performs symbolic maths commands (factorising, simplifying, Useful that we have installed is called the Symbolic Toolbox Matlab has lots of adds-ons (called toolboxes). Information look at the References Introduction Learning to use the Symbolic Toolbox might save you hours of time. Solve introduces assumptions, X~=1 and ndot4B~=0, because when you divide both sides of an inequality by a constant, then that constant cannot be 0.This little document hopes to convince you that spending a few minutes For example, even using eps instead of 1 will work: trySol = (X*ndot4A*xiB - eps)/(ndot4B - X*ndot4B) Īs horchler pointed out, if you change the > to =, then you don't need the positive value. You just need some positive value in the numerator to satisfy the > inequality. You can check on paper yourself by substituting these two values for xiA. Now try solve's answer with the same steps: trySol = (X*ndot4A*xiB - 1)/(ndot4B - X*ndot4B) IsAlways(tr圜ondition) % check if the condition holds? Tr圜ondition = subs(eqn,xiA,trySol) % substitute the answer to get the condition TrySol = (X*ndot4A*xiB)/(ndot4B - X*ndot4B) % let's try the proposed answer You can verify your proposed answer and solve's answer as: syms X ndot4B xiA ndot4A xiBĮqn = X*ndot4B*xiA - ndot4B*xiA + X*ndot4A*xiB > 0 It can be any value, hence solve introduces a parameter. You simply need some positive value in the numerator to satisfy the inequality. I also recommend learning about and using assumptions when working with solve.
![matlab symbolic toolbox solve matlab symbolic toolbox solve](https://es.mathworks.com/help/examples/symbolic/win64/SolveAlgebraicEquationLETTopicExample_06.png)
I suggest filing a service request if you want to try to ask The MathWorks why this is and if it might be a bug of some sort. It appears to treat the <= case similarly, but for some reason does not choose 0 for x (which would match the =). Rather than return an error or warning, it looks like Matlab just chose the first integer value of the parameter x that would satisfy the conditions, i.e., 1. So why does Matlab's symbolic engine (not quite the same as the MuPAD environment) return (X*ndot4A*xiB - 1)/(ndot4B - X*ndot4B) when you don't ask for the return conditions? Firstly, this answer satisfies the inequality and is perfectly valid given that there is no information (assumptions) about the ranges of each variable. Now you'll see that there is an additional parameter ( s.parameters is x) and set of conditions ( s.conditions is X ~= 1 & ndot4B ~= 0 & 0 rather than >=), the parameter x can't actually be equal to zero to guarantee satisfying the inequality (Maple may treat the two cases the same, I'm not sure). S = solve(X*ndot4B*xiA - ndot4B*xiA + X*ndot4A*xiB > 0, xiA, 'ReturnConditions', true) In your case: syms X xiA ndot4B ndot4A xiB
![matlab symbolic toolbox solve matlab symbolic toolbox solve](https://es.mathworks.com/help/examples/symbolic/win64/InteractiveContextMenusInSymbolicMathToolboxExample_06.png)
MATLAB SYMBOLIC TOOLBOX SOLVE FULL
When solving inequalities, it's best to use the 'ReturnConditions' option to see the full details of the solution. You (and perhaps Maple) are making some assumptions that aren't necessarily true or that are at least different from each other.