I have a derivative of a function, and Octave displays it as an expression:
10____ ⎛ 10 ⎞
╲╱ 11 ⋅⎜- ── + log(11)⎟
⎝ 11 ⎠
This is nice and tidy, and completely accurate. However, I would like to get a numerical approximation of said expression, without manually typing the expression (which seems counter-intuitive to me). I can't figure out how to do this, but I probably just don't know what exactly to search for (English is not my native language), and therefore I can't tell if this question is a duplicate.
This is how I got there:
octave> f(x)=(1+(1/x))^x
f(x) = (symfun)
x
⎛ 1⎞
⎜1 + ─⎟
⎝ x⎠
octave> F(x)=diff(f(x))
F(x) = (symfun)
x
⎛ 1⎞ ⎛ ⎛ 1⎞ 1 ⎞
⎜1 + ─⎟ ⋅⎜log⎜1 + ─⎟ - ─────────⎟
⎝ x⎠ ⎜ ⎝ x⎠ ⎛ 1⎞⎟
⎜ x⋅⎜1 + ─⎟⎟
⎝ ⎝ x⎠⎠
octave> F(0.1)
warning: passing floating-point values to sym is dangerous, see "help sym"
[...]
10____ ⎛ 10 ⎞
╲╱ 11 ⋅⎜- ── + log(11)⎟
⎝ 11 ⎠
I think you need the eval
function
https://octave.org/doc/v4.0.1/Evaluation.html
For instance
>> eval("log(11)")
ans = 2.3979