Solving symbolic equation with additional assumptions

Once again, lets assume simple symbolic equation:
syms a b
solve(a+a.*b==2)
also, lets assume that a.*b is always ==0; so the solution of the eq is supposed to be a=-2; How can I implement such assumption (a.*b==0) into matlab code? Any help appreciated!

Answers (1)

syms a b
[sola, solb] = solve([a+a*b == 2, a*b == 0], [a, b])
Best wishes
Torsten.

2 Comments

Hi Torsten, after passing your code to matlab (2014a) I'm getting a massage:
Warning: 4 equations in 2 variables. > In C:\Program Files\MATLAB\R2014a\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 sola = [ empty sym ] Am I missing something?
You will have to consult the 2014a documentation on how to use "solve" for your MATLAB version.
For the recent version, the syntax is as stated:
https://de.mathworks.com/help/symbolic/solve.html
Best wishes
Torsten.

Sign in to comment.

Asked:

on 2 Feb 2017

Commented:

on 2 Feb 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!