gnu-octave / symbolic

A Symbolic Package for Octave using SymPy
https://octave.sourceforge.io/symbolic/
GNU General Public License v3.0
154 stars 36 forks source link

vpasolve compatibility: multivariable outputs should return as a struct #1276

Open NRJank opened 11 months ago

NRJank commented 11 months ago

this came up again in a suggested answer on stackoverflowit seems that matlab returns the results for multi-varialbe inputs to vpasolve as a struct with a field for each variable containing an ordered array of answers:

>> syms x1 x2
eqn1= -x1+2.*x1.^3+x2==0;
eqn2= -x1-x2==0;
>> sol=vpasolve([eqn1,eqn2],[x1,x2],[0,0])

sol = 

  struct with fields:

    x1: [3×1 sym]
    x2: [3×1 sym]

>> sol.x1

ans =

   0
 1.0
-1.0

>> sol.x2

ans =

   0
-1.0
 1.0

noted that there's already an open report about vpasolve not finding all roots that is unlikely to be fixed soon but output format matching may be worth doing for compatibility even if the data was incomplete