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/121cheers,

Colin

_______________________________________________

Help-octave mailing list

[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave