On Tue, Jul 11, 2017 at 18:31:38 -0400, RT wrote:

> I know the symbolic package isn't the same as matlab but this error

> confuses me and I'm not sure what causes this

> What I type in to test it

>

> pkg load symbolic

> syms x y

> sol = solve([x^2+y^2==20,y==x^2,x>0,y>0],[x,y])

>

> I should get x=2 and y=4

>

> but I get this instead

[…]

> Any ideas how to get this to work should I not use the symbolic package?

Our solve function is not quite Matlab compatible, but it will give you

what you want if you adapt slightly.

The first difference is to pass each equality, inequality, and variable

as separate arguments instead of as a matrix.

The second difference is that SymPy doesn't appear to handle solving

systems of inequalities for more than one variable at a time.

To work around both of these differences, I used the following

syms x y

assume x y positive

sol = solve (x^2+y^2==20, y==x^2, x, y)

That gives the solution you're after.

--

mike

_______________________________________________

Help-octave mailing list

[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave