I have written an HTML code using JavaScript to differentiate a single variable function.
My code is here. I have used Mathjax to print the output. But the output produced is not simplified. For example, the derivative of sin(x)/cos(x)
is produced as
((((cos(x))*(cos(x)))-((sin(x))*(-(sin(x)))))/((cos(x))^2))
which can be simplified to
(sin(x)^2+cos(x)^2)/cos(x)^2
I have constructed expression tree with the application of Dijkstra's shunting yard algorithm. And then constructed the expression tree of derivative recursively. But I have problem with the simplification.
Can anyone please help with the simplification of the output produced? My knowledge is not beyond elementary data structures.