# bug #58366: [octave forge] (symbolic) equality element by element assignment produces Python exception

 Submitted by: Nicholas Jankowski Submitted on: Wed 13 May 2020 07:28:26 PM UTC Category: Octave Forge Package Severity: 3 - Normal Priority: 5 - Normal Item Group: Unexpected Error Status: None Assigned to: None Originator Name: Nicholas Jankowski Open/Closed: Open Release: 5.2.0 Operating System: Any

You are not logged in

## Discussion

Wed 13 May 2020 07:39:08 PM UTC, comment #1:

missed the link for the stackexchange post:
https://stackoverflow.com/questions/61667621/octave-symbolic-error-cannot-determine-truth-value

also crossposted on symbolic package github:
https://github.com/cbm755/octsympy/issues/1021

and for maximum information entropy, here was a quick help list post before creating the bug:
https://octave.1599824.n4.nabble.com/symbolic-unable-to-assign-equality-to-matrix-tp4697121.html

Nicholas Jankowski <nrjank>
Wed 13 May 2020 07:28:26 PM UTC, original submission:

As first evidenced in a stackexchange post [1], making an element by element assignment produces an error, apparently dependent on the assignment order. here's a simpler example than at stackexchange that causes the same error:

runs fine in Matlab 2020a:

>> syms a b c d
>> e = [a == b, c == d]
e =
[ a == b, c == d]
>> f(1) = a==b
f =
a == b
>> f(2) = c==d
f =
[ a == b, c == d]
>> g(2) = c==d
g =
[ 0, c == d]
>> g(1) = a==b
g =
[ a == b, c == d]
>> h(2) = c==d
h =
[ 0, c == d]
>> h(1) = a==b
h =
[ a == b, c == d]
>> h(3) = a==c
h =
[ a == b, c == d, a == c]

output from Octave 5.2.0, Windows 10, with Symbolic 2.9.0 (and unbundled Python 3.7):

>> syms a b c d
Symbolic pkg v2.9.0: Python communication link active, SymPy v1.3.
>> e = [a == b, c == d]
e = (sym) [a = b  c = d]  (1x2 matrix)
>> f(1) = a==b
f = (sym) a = b
>> f(2) = c==d
error: Python exception: TypeError: cannot determine truth value of Relational
occurred at line 7 of the Python code block:
if not A or not A.is_Matrix:
error: called from
pycall_sympy__ at line 178 column 7
mat_rclist_asgn at line 78 column 5
mat_replace at line 144 column 5
subsasgn at line 101 column 13
>> g(2) = c==d
g = (sym) [0  c = d]  (1x2 matrix)
>> g(1) = a==b
g = (sym) [a = b  c = d]  (1x2 matrix)
>> h(2) = c==d
h = (sym) [0  c = d]  (1x2 matrix)
>> h(1) = a==b
h = (sym) [a = b  c = d]  (1x2 matrix)
>> h(3) = a==c
h = (sym) [a = b  c = d  a = c]  (1x3 matrix)

not sure what unique case is occurring under the hood when it goes from size 1->2, but the error doesn't reoccur at size 2->3.

Nicholas Jankowski <nrjank>

## Attached Files

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Comment:

No files currently attached

## Dependencies

Depends on the following items: None found

Items that depend on this one: None found

Carbon-Copy List
• -email is unavailable- added by nrjank (Submitted the item)
• -email is unavailable- added by nrjank (package maintainer)
•

Do you think this task is very important?
This task has 0 encouragements so far.

Only project members can vote.

## History

Follows 1 latest change.

Date Changed by Updated Field Previous Value => Replaced by