Looking for derivative script

后端 未结 6 613
情话喂你
情话喂你 2021-01-05 20:20

I am desperately looking for a JavaScript that can calculate the first derivative of a function. The function always includes only one variable, x.



        
6条回答
  •  生来不讨喜
    2021-01-05 21:06

    You can do similar things using diff.js. You could do:

    x = range(-10, 10, 0.01); // works only in latest browsers
    f = diffXY(x, x.map(F));
    

    which would give you the values of the derivative f of your function F at x = -10 to 10 with stepsize 0.01.

提交回复
热议问题