Skip to main content
GameDev.net gamedev.net
🔒 Locked

function Derivation

Started by solid_snake41 Apr 24, 2003 at 7:21 PM 0 replies 250+ views
Original Post
solid_snake41
solid_snake41
what''s up guys, does anyone of you know where i can find source code that shows how to derive polynomial, i ll be gratefull.
Snake
Zipster
Zipster
You have a data structure (called "term" for example) that allows you to store a coefficient, a power, and an expression. You can then combine these "term" objects into larger objects, called "polynomials." Now, each expression for a term can either be another term, or a polynomial. This allows you to have nested polynomials as terms themselves.

The recursive-esque nature of the data structure allows you to handle complex equations. When you want to find the derivative, you can use a recursive-decent parser or similar to recurse your data structure, finding the derivative for each term and recursing if you need to. You know the general rules for differentiating, i.e multiple coefficient by power and decrement power, so you can apply that as you differentiate the equation.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.