Hi!
I new in this forum, so if this thread already exsist, you can delete this post.
I would like to do a console application in Delphi which will calculate derivatives of polynoms. Does anybody already done something like that? I write a code in Delphi which seperate polynom and save all numbers, but now I don't know how to calculate this thing. Can anybody help me?
It will depend a little on how you're saving the polynomial. If you save a term "5x^7" as a pair (5,7), then the derivative of that term would be the pair (5*7,7-1) = (35,6)
The input is given like that (x^2+3x+1), and then I save 2,3 and 1. Now I don't know how to derivate this in Delphi. I know that the solution is (2x+3) but I don't know how to write this in Delphi.
Why would you save it as 2,3,1 instead of 1,3,1?
If you save the coefficients in an array, where the coefficient is in the position where the index is the power on x, then you would have:
poly[2]=1
poly[1]=3
poly[0]=1
Then:
deriv[1]=poly[2]*2
deriv[0]=poly[1]*1
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks