bugGNU Octave - Bugs: bug #53576, [octave forge] (symbolic) dsolve...

 
 

bug #53576: [octave forge] (symbolic) dsolve errors on sqrt coefficient

Submitter:  Doug Stewart <dastew>
Submitted:  Fri 06 Apr 2018 04:24:39 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  1 - Later Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Doug Stewart Open/Closed:  * Closed
Release:  * 4.2.2 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 12 Nov 2021 03:12:20 AM UTC, comment #9: 

using Octave 6.4.0, windows bundled symbolic 2.9.0
comment #0 also works with the same warning.
comment #3 approach now produces the same 'dangerous' warning as comment #0 after the sqrt2 line.

no errors on any of the demos on that wiki page.  so agreeing with comment #8 and comment #7, and closing report as fixed.



Nicholas Jankowski <nrjank>
Group Member
Tue 09 Mar 2021 03:28:00 PM UTC, comment #8: 

Using Linux

Version:4.2.2
Symbolic 2.9.0
SymPy 1.5.1


The example from comment #0 works, and a plot is produced.
The warning is still given

warning: passing floating-point values to sym is dangerous, see "help sym"
warning: called from
    double_to_sym_heuristic at line 50 column 7
    sym at line 379 column 13
    mtimes at line 63 column 5
    mtimes at line 61 column 5


If using comment #3


sqrt2=sym(1.41421);
 de =diff(y, 3 ) +sqrt2*diff(y,2) + diff(y) == 0;


The warning is

warning: worked around octave bug #42735
warning: called from
    mtimes at line 53 column 5


I see bug #42735 is closed.
I think this bug can be closed.

Anonymous
Thu 22 Nov 2018 08:36:01 AM UTC, comment #7: 

should be fixed in the next sympy 1.4, can be closed

Colin Macdonald <cbm>
Mon 09 Apr 2018 09:55:39 PM UTC, comment #6: 

I've filed https://github.com/cbm755/octsympy/issues/883 with a Python example showing the same error. One of us will chase this up to SymPy.

Mike Miller <mtmiller>
Group Member
Fri 06 Apr 2018 06:51:27 PM UTC, comment #5: 

I would like to see it fixed in sympy.
I think that sqrt(2)  is used in so many places that any symbolic code should handle it.

Doug Stewart <dastew>
Fri 06 Apr 2018 06:07:01 PM UTC, comment #4: 

Should I close this as not-a-bug or do you think we should pursue getting this error fixed in SymPy?

Mike Miller <mtmiller>
Group Member
Fri 06 Apr 2018 06:03:27 PM UTC, comment #3: 

Mike you are correct. thanks for looking at this.
I will change the wiki to
sqrt2=sym(1.41421);
 de =diff(y, 3 ) +sqrt2*diff(y,2) + diff(y) == 0;

Doug Stewart <dastew>
Fri 06 Apr 2018 05:47:38 PM UTC, comment #2: 

In version 2.5.0, if the equation was written as


de = diff (y, 3) + sqrt (sym(2)) * diff (y,2) + diff (y) == 0;


then it would have failed with the same error. Thus I am changing this from regression.

Mike Miller <mtmiller>
Group Member
Fri 06 Apr 2018 05:41:36 PM UTC, comment #1: 

I think the relevant piece that has changed here is that the symbolic package now tries to work around any floating point values it sees by applying various heuristics to convert it into a symbolic expression.

In version 2.5.0, the DE was converted into this symbolic expression, with a rational approximation to sqrt(2):


de = (sym)

                    2
                   d
             1393⋅───(y(x))
                    2           3
  d               dx           d
  ──(y(x)) + ────────────── + ───(y(x)) = 0
  dx              985           3
                              dx


In the current symbolic 2.6.0, it is


de = (sym)

                  2           3
  d              d           d
  ──(y(x)) + √2⋅───(y(x)) + ───(y(x)) = 0
  dx              2           3
                dx          dx


And the sqrt(2), which wasn't there before, seems to be where SymPy's dsolve is erroring.

If you convert the coefficient to some other number, it will work again. It would be best to show an example with all integer or rational coefficients.

Mike Miller <mtmiller>
Group Member
Fri 06 Apr 2018 04:24:39 PM UTC, original submission:  


running this code from octave wiki symbolic demos now fails.

 syms y(x)
 de =diff(y, 3 ) +sqrt(2)*diff(y,2) + diff(y) == 0;
 f = dsolve(de, y(0) == 0, diff(y,1)(0) == 0 , diff(y,2)(0) == 1)
 ff=function_handle(rhs(f))
  x1=0:.01:10;
 y=ff(x1);
 plot(x1,y)
 grid minor on


with this error:


OctSymPy v2.6.0: this is free software without warranty, see source.
Initializing communication with SymPy using a popen2() pipe.
Some output from the Python subprocess (pid 3852) might appear next.
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> >>>
OctSymPy: Communication established.  SymPy v1.1.1.
>> testsym111
warning: passing floating-point values to sym is dangerous, see "help sym"
warning: called from
    double_to_sym_heuristic at line 50 column 7
    sym at line 373 column 13
    mtimes at line 65 column 5
    mtimes at line 61 column 5
    testsym111 at line 18 column 6
error: Python exception: NotImplementedError: CRootOf is not supported over EX
    occurred at line 2 of the Python code block:
    sol=sp.dsolve(ode)
error: called from
    python_cmd at line 179 column 7
    dsolve at line 200 column 10
    testsym111 at line 19 column 4
>>


I am using ubuntu 16.04

Doug Stewart <dastew>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nrjank (Posted a comment)
  • -email is unavailable- added by cbm (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by dastew (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.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-11-12 nrjank StatusPostponed Fixed
        Open/ClosedOpen Closed
    2018-04-09 mtmiller Priority5 - Normal 1 - Later
        StatusNone Postponed
    2018-04-06 mtmiller Item GroupRegression Unexpected Error or Warning
    2018-04-06 mtmiller SummarySymbolic pkg dsolve now not woeking [octave forge] (symbolic) dsolve errors on sqrt coefficient

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code