Question
For this assignment you are to take the parse tree, as input and create and print a derivative tree. The derivative tree should be a
For this assignment you are to take the parse tree, as input and create and print a derivative tree. The derivative tree should be a binary tree with the nodes that contain the normal data, left, right, and parent fields.
The derivative of an expression that involves the variable x or X can be defined by a few recursive rules:
If A is an expression, let D(A) be the derivative of A.
The derivative of a constant is 0. D(C) = 0.
The derivative of x or X is 1. D(x) = D(X) = 1.
If A and B are expressions, let D(A) be the derivative of A and D(B) be the derivative of B. Then
The D(A + B) is D(A) + D(B).
The D(A - B) is D(A) - D(B).
The D(A * B) is (A * D(B)) + (B * D(A)).
The D(A / B) is ((B * D(A)) - (A * D(B))) / (B * B) [Extra Credit]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started