Solving a symbolic equation with integer variables

时光毁灭记忆、已成空白 提交于 2021-02-11 12:14:35

问题


Why does the following return an empty solution?

syms a b positive integer
s = solve(a + b == 5, 'ReturnConditions', 1)

This does work:

s = solve([a + b <= 5, a + b >= 5], 'ReturnConditions', 1)

It seems that I had a problem in general solving a system with degrees of freedom:

Solving a symbolic equation system with degrees of freedom

The solution over there applies here:

s = solve(a + b == 5, [a b], 'ReturnConditions', 1)

来源:https://stackoverflow.com/questions/65748247/solving-a-symbolic-equation-with-integer-variables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!