Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
Hello,
I've made a symbolic derivative solver quickly in C for the calculator. I'm posting it here if you want to use it: it solves for the derivative of an equation in Y1 and outputs the derivative to Y2, overwriting anything there. Even though the derivative is correct, it is often not in simplified form. Make sure you back up your programs, because if you enter too complicated or long of equation or with too many X variables, the calculator will run out of memory and crash. If you happen to find any bugs/wrong derivatives, please make an issue on github! The code is a little messy because I just made the program to show my teacher.

Link: https://github.com/nathanfarlow/SymbolicDerivative/
You can download the compiled binary at bin/DERIV.8xp


Something something don't cheat
Well done - thanks for sharing
Simplification is easy if you use an AST and recursion. When you are simplifying a given node, first simplify all children nodes, then check if the given node can be simplified. If it can, replace the given node with the simplified version of itself. If a node (represented as [U operation V]), has an operation of '*', and U==1, replace the node with V, or if U==0, replace it with U(eg with zero). Just think of all the things that could be simplified (1*V, 0*V,0+V,ln(e) etc) and make test statements for it. If a node had an operation between two numbers, just apply the operation on those numbers. It's a bit tricky if your tree is something like 5*(8*X ), as the '8' is "stuck" in the same node as the 'X', and can't be multiplied with the 5. There might be better solutions, but what I did is write an algorithm to restructure the tree so that constants are lower in the tree, eg the previous example would be X*(5*8 ). (And use the "If a node had an operation between two numbers, just apply the operation on those numbers" rule.) You could also swap the order of the U and V in the node if U is for example 'X' and V is a constant, in order to make the result more pretty and have print a result of "6*X" instead of "X*6"

Ofc I made my simbolic derivator in java with OOP, might be a pain to do this sort of thing recursively without OOP.
Thanks c4ooo, those simplifications are already implemented in a similar way to what you described. What I would like to add is the simplification of like-terms, but the way I programmed the cas, it would be difficult to do without rewriting the inner workings. I am likely going to implement all the other simplifications when I rewrite the cas as a library for the CE. I do miss oop haha
Hi there. I was able to load your program onto my TI-84+ CE, but when I try to run it I just get a syntax error. Any idea why?
I'll bet you forgot to use the Asm( token. Wink
Press [2nd]>[0] then scroll down to the Asm( token, then press [enter].
Now press [prgm] and select the program

Your homescreen should look something like this:
Asm(prgmNAME

If you need any more help, I made a trouble shooting video that will help you with most issues you could face. It has an index in the description so you can quickly find the error you're encountering! Very Happy

Problem solved. Thanks man! And thanks for replying so quickly.
Now, if only there was an similar program for symbolic integration hehe
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement