[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Symbolica package warning: Using rat() heuristics for double-precisi
From: |
Colin Macdonald |
Subject: |
Re: Symbolica package warning: Using rat() heuristics for double-precision input (is this what you wanted?) |
Date: |
Fri, 17 Feb 2017 09:43:02 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 |
On 17/02/17 08:18, Doug Stewart wrote:
I am thinking of putting this on the wiki.
Good idea! I can help edit.
But first, the essential pattern here is:
1. Do a symbolic calculation (in this case, a derivative)
2. Evaluate that result for double values.
"subs" is not really the right tool for this. It makes symbolic
substitutions.
Perhaps the right pattern here is:
>> df = diff(...)
>> dfh = function_handle(df)
>> dfh(3.1415927)
Here "dfh" is a regular plain-old Octave anonymous function, can be
evaluated efficiently for doubles, etc.
Note: you can also write this as "dfh = matlabFunction(df)" for
compatibility with the Matlab Symbolic Toolbox.
There is some discussion about all this in
https://github.com/cbm755/octsympy/issues/121
cheers,
Colin