|
From: | Doug Stewart |
Subject: | Re: Symbolica package warning: Using rat() heuristics for double-precision input (is this what you wanted?) |
Date: | Fri, 17 Feb 2017 14:14:33 -0500 |
On 17/02/17 08:18, Doug Stewart wrote:Good idea! I can help edit.
I am thinking of putting this on the wiki.
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
[Prev in Thread] | Current Thread | [Next in Thread] |