bugGNU Octave - Bugs: bug #64655, [Octave Forge] (Symbolic) A...


bug #64655: [Octave Forge] (Symbolic) A problem with evaluating symbolic expression

Submitter:  Ahmed Salah Hammad Ahmed <asalahhammad>
Submitted:  Mon 11 Sep 2023 03:20:05 PM UTC
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * other Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Mon 11 Sep 2023 05:29:37 PM UTC, comment #2: 

"exp" is a build-in octave function. A variable with the same name would "shadow" this function which can lead to some problems down the line.  Don't do that. Try to come up with a unique name like
"asha_exp" or "exp01".


Dmitri A. Sergatskov <dasergatskov>
Mon 11 Sep 2023 05:21:43 PM UTC, comment #1: 

try  this

syms x y z

exp = a1 * (vpa('1e-19')*x + vpa('1e-22')*y + z*vpa('1e-15'))

Doug Stewart <dastew>
Mon 11 Sep 2023 03:20:05 PM UTC, original submission:  

Whenever there's an expression that looks exactly like this and with such large numbers as coefficients:

syms x y z
exp = 1.435647686e28 * (1e-19*x + 1e-22*y + z*1e-15)
          x + y + ─────────────────────
        ans = (sym) x + y + 9223.37203686⋅z

which is obviously wrong.. and the problem persists whenever an expression is evaluated, for example:

f = @(x,y,z) 1.435647686e28 * (1e-19*x + 1e-22*y + z*1e-15)
        f =
        @(x, y, z) 1.435647686e28 * (1e-19 * x + 1e-22 * y + z * 1e-15)
syms x y z
          x + y + ─────────────────────

And even when sending the whole expression to the built in function 'eval' and started debugging a little, the expression keeps ok until it is evaluated at the function fh, as appearing in the screenshot attached

And.., the same code works on matlab well..

I tried the same thing using octave v:7.1.1 and v:9.0.0 on a PC with Linux Ubuntu 20.04

Ahmed Salah Hammad Ahmed <asalahhammad>


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

Attach Files:

Attached Files


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by dastew (Posted a comment)
  • -email is unavailable- added by asalahhammad (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-09-11 asalahhammad Attached File- Added Screenshot@from@2023-09-11@18-00-42.png, #55128

    Back to the top

    Powered by Savane 3.13-3736.
    Corresponding source code