Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
Numerical differentiation
node v8.17.0
version:
3.0.0
endpoint
share
tweet
const { Stack } = require('@hypercubed/f-flat'); const f = new Stack(); f.eval(` math: rcl use core: rcl use shuffle: rcl use 200 set-precision nd: [ dup [ over + rot bi@ - ] dip / ] ; // forward difference approximation to the derivative `).stack;
Setup f-flat with required modules and define the forward difference approximation to the derivative
f.eval(` [exp] 1 1e-100 nd `).stack[0].toString();
d(exp(x)) / dx => exp(x) exp(x) | x = 1 => e
f.eval(` clr [ dup sqrt * ] -1 1e-100 nd `).stack[0].toString();
d(x*sqrt(x))/dx => 3*sqrt(x)/2 3*sqrt(x)/2 | x = 1 => 3 / 2 * i
f.eval(` clr [ inv ] 0 1e-100 nd `).stack[0].toString();
d(1/x)/dx => -1/x^2 -1/x^2 | x = 0 => -Infinity
Loading…
no comments
sign in
to comment