Calculating Derivatives/Slopes in JMP<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />Hello again,
I have to columns of data, let's call them x and y. I want to calculate the center derivative of y with respect to x (dy/dx). If I am using the center derivative, that means I will be "missing" a point at the beginning and end of the dy/dx column.
For example, in row two of dy/dx, I want it to equal dy/dx = y3-y1/x3-x1 and on row three of dy/dx, I want it to equal dy/dx = y4-y2/x4-x2. I am having a hard time not using jmp like I would with excel, so I am not even sure if is possible to do this in the formula editor.
Thanks!
Re: Calculating Derivatives/Slopes in JMPThank you, it worked well.
I used it in a script, but I had to add As Column.
col <Re: Calculating Derivatives/Slopes in JMP
This code should give you some ideas. The column formula makes use of the LAG function:
dt = open("$sample_data\Big Class.jmp");
// Create formula column
// Height = X
// Weight = Y
// dy/dx = (y+1) - (y-1)/(x+1) - (x-1)
// y+1: lag(:weight, -1)
// y-1: lag(:weight, 1)
// x+1: lag(:height, -1)
// x-1: lag(:height, 1)
dt << New Column( "dy/dx",
Numeric,
Continuous,
Format( "Best", 12 ),
Formula( lag(:weight, -1) - lag(:weight, 1) / lag(:height, -1) - lag(:height, 1))
);
Re: Calculating Derivatives/Slopes in JMPnatalie_,
The Formula Editor has a derivative option. You can access it by clicking the red triangle at the top of the Editor dialog.

Hope this helps.
Dave