Calculus Calculator calculus.zip

This is a very old program I wrote in my late teens (so old I no longer have the Pascal source code).  It will differentiate very complex equations, and can handle partial derivatives.  I post it here mostly as a novelty.  There are no instructions and the interface is a bit clunky, so email if you are confused by it.  It is menu driven (entering a blank line will return to the previous menu), and basically you need to:

  1. Define your variables using menu item A.  For example, enter xyz to define x, y, and z as variables.
  2. Define your constants, if any using menu item B.  For example, enter abc to define these three letters as constants.  The constant e is pre-defined.
  3. Define any functions using menu item C.  For example, enter fgh to define these as functions.
  4. Define function parameters for previously defined functions using menu item D.  The program will ask for the function name, then its parameters.  Parameter variables must have been previously defined in #1.  So, entering f, then xyz, will defined the function: f(x, y, z).
  5. Enter the "respect" variable using menu item E.  This is the variable that you are differentiating with respect to.  Traditionally this is x.
  6. Menu item F may be used to indicate that you wish to do a partial derivative.
  7. Enter the equation using menu item G.  Equations can be very complex, and can contain transcendental functions.  The program recognizes: exp, ln, log, sin, cos, tan, sec, cot, csc, arcsin, arccos, arctan, arccot, arcsec, arccsc, hypsin, hypcos, hyptan, hypcot, hypsec, hypcsc, archypsin, archypcos, archyptan, archypcot, archypsec, archypcsc, abs, sqrt, def, and part.  def and part may be using to define derivatives using the original equation.  For example, def(y) defines the first derivative of y with respect to the current respect variable.  def:x2(y + z) defines the second derivate of y + z with respect to x.  Note, its hard to see, but there is a colon (:) between the f and the "def" and the "x2."  The program accepts the following algebraic operators:  +, -, *, /, ^.  + and - may be used for both unary and binary operators.
  8. Differentiate the equation using menu item H.
  9. You can differentiate the resulting derivate using menu item I.  The old derivative becomes the current equation.
  10. Menu Items J and K display the current equation and derivative, respectively.
  11. Menu Item L can be used to toggle the cleanup routine on and off.  This routine tries to simplify the equation by doing such things as removing sub-equations multiplied by zero, combining constants, etc.  It will not remove infinities, such as 0 / 0.
  12. Exit the program using menu item z.

Derivatives are represented as such: y':x is the derivate of y with respect to x, y'':x2 is the second, and y''':x3 is the third.  Above the third, they are represented as such:  yn:xn, where n is a number.  So, y4:x4 is the 4th derivative.

Partial derivatives are defined by placing an at-sign ("@") in front of the variable or function name.  Thus, the first partial derivative of the function f(x, y) is @f':x(x, y).  So, if the user enters:  f(x, y) = 3*x + x^2 * y^2 + 2*x^3*y (representing: f(x, y) = 3x + x2y2 + 2x3y), the program will return: @f':x(x,y) = 3 + y ^ 2 * 2 * x + y * 2 * 3 * x ^ 2.  As you can see, the cleanup is far from perfect.

Any comments or questions, please email me.

Return to Main Software Page