A little while ago I was sitting in calculus and thought that since the ti-84s could calculate derivatives at a point, the calculator could calculate it on a certain interval and then, that data could be used to try and work out the derivative of a function. I quickly put together a little program that has a billion issues but sort of works for simple inputs. here is the code...

Of course, the methods used are very bad and I can think of a million functions for which the program would not work, but nonetheless, it can get some basic stuff done and at only 160 bytes, I think it's worth discussing

Basically, it just calculates the derivative at five points, then using the built-in regression methods, tries to fit the appropriate type of function to it. As one might expect, the output is often very funky but correct (for the few functions that are valid input, which are basically the family of functions that have a built-in regression method)

It can work out the derivatives of polynomials up to degree 5 (since the derivative is a degree 4 polynomial and it uses quartreg) which includes linear functions, it can do sin/cos function with SinReg since any cos function can be expresed as a sine function, and it can do exponential functions, which is probably the most interesting part because working these out by hand requires logarithmic differentiation which means the program could actually be useful. However it can't handle composite functions such as f(x) = sin(x) + (3x³ - 5x² + 4x + 3) even though this would probably be very easy to implement for addition and subtraction of functions.

Here is a screenshot of the derivative of sin(x)

If you squint a little, you can see a cos(x) hidden deep in there

Also, I'm quite surprised to see how big the rounding errors become, as you can see at the beginning of the output, the rounding errors are not just the last one or two decimal places, but rather the last 8!

This is not a project of mine, I just thought I'd share this because I couldn't find a topic about it and I thought it was interesting even thought it is nowhere near what one would expect a derivative calculator to do.

**Code:**```
ClrList L1
```

ClrList L2

ClrHome

Input "f(x)=",Str1

String>Equ(Str1,{Y1}

For(A,1,5

nDeriv({Y1},X,A)->L1(1+dim(L1

A->L2(1+dim(L2

End

If inString(Str1,"sin(") or inString(Str1,"cos(

Then

SinReg L2,L1,{Y1}

Else

If inString(Str1,"^X

Then

ExpReg L2,L1,{Y1}

Else

QuartReg L2,L1,{Y1}

End:End

Equ>String({Y1},Str1

Output(3,1,Str1

Pause

Of course, the methods used are very bad and I can think of a million functions for which the program would not work, but nonetheless, it can get some basic stuff done and at only 160 bytes, I think it's worth discussing

Basically, it just calculates the derivative at five points, then using the built-in regression methods, tries to fit the appropriate type of function to it. As one might expect, the output is often very funky but correct (for the few functions that are valid input, which are basically the family of functions that have a built-in regression method)

It can work out the derivatives of polynomials up to degree 5 (since the derivative is a degree 4 polynomial and it uses quartreg) which includes linear functions, it can do sin/cos function with SinReg since any cos function can be expresed as a sine function, and it can do exponential functions, which is probably the most interesting part because working these out by hand requires logarithmic differentiation which means the program could actually be useful. However it can't handle composite functions such as f(x) = sin(x) + (3x³ - 5x² + 4x + 3) even though this would probably be very easy to implement for addition and subtraction of functions.

Here is a screenshot of the derivative of sin(x)

If you squint a little, you can see a cos(x) hidden deep in there

Also, I'm quite surprised to see how big the rounding errors become, as you can see at the beginning of the output, the rounding errors are not just the last one or two decimal places, but rather the last 8!

This is not a project of mine, I just thought I'd share this because I couldn't find a topic about it and I thought it was interesting even thought it is nowhere near what one would expect a derivative calculator to do.