gnu-octave / symbolic

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

Array construction fails with row of doubles #8

Open cbm755 opened 10 years ago

cbm755 commented 10 years ago
A = [sym(0) 1; sym(2) 3];
B = [sym(0) 1; 2 3];

A works but B fails on Octave 3.6.4 and 3.8.1 with:

error: octave_base_value::map_value(): wrong type argument 'scalar'
error: octave_base_value::parent_class_name_list(): wrong type argument 'scalar'

It works in Matlab, maybe an Octave bug?

cbm755 commented 10 years ago

Looks like:

https://savannah.gnu.org/bugs/?38128

which is supposed to be solved by still see this on Octave dev. Will investigate further.

[updated comment, wrong link before]

cbm755 commented 10 years ago

https://savannah.gnu.org/bugs/index.php?42152

filled upstream. can't fix it here.

cbm755 commented 10 years ago

Workaround, extract brackets around the row vec:

B = [sym(0) 1; [2 3]];
cbm755 commented 9 years ago

maybe I should leave this open so people see it? E.g., this upstream

johnnyontheweb commented 7 years ago

Same error here with v. 4.2.1 w64 for windows: syms d T=[1 d 0 0 0 1 0 0 0 0 1 d 0 0 0 1]

fails with: error: octave_base_value::map_value(): wrong type argument 'scalar'

cbm755 commented 7 years ago

Thanks for confirming, but note there is nothing we can do here until this is fixed in upstream Octave---see https://github.com/cbm755/octsympy/issues/8#issuecomment-40898024, see also workaround noted above.

johnnyontheweb commented 7 years ago

sorry, I read that page but I think it was a too old bug to not be solved yet. Thanks for the info.

cbm755 commented 7 years ago

no problem! Any chance you want to take a deep dive into Octave's parsing, see if you can fix it? I'm sure someone like @mtmiller (who knows the internals better than me) would review such a fix.

NRJank commented 4 years ago

just came across this. guess it's still an issue with Octave 5.2,0 symbolic 2.9.0

`>> syms a b c d

mattest = [a b ; c d] mattest = (sym 2x2 matrix)

[a b] [ ] [c d]

mattest = [a 1 ; c d] mattest = (sym 2x2 matrix)

[a 1] [ ] [c d]

mattest = [1 1 ; c d] error: octave_base_value::map_value(): wrong type argument 'scalar'

mattest = [[1 1] ; c d] mattest = (sym 2x2 matrix)

[1 1] [ ] [c d]

`