Thread: Calculus on C?

  1. #1
    Comment your source code! Lynux-Penguin's Avatar
    Join Date
    Apr 2002

    Calculus on C?

    Is it possible to write Calculus functions for C. IT would be very usefull, I am sure it is possible because there are math programs out there today.

    int integrate(statement, int variable, int limit1, int limit2)
    something like that
    and have the power rule of integration apply
    ux^n = [u(x)^(n-1)]/(n-1)

    my question is, do you think it is possible for the console programming?
    I know how to do the integrate function on ASM because of the functions of memory but on C, do you think it is possible (using the standard libraries of course)
    Asking the right question is sometimes more important than knowing the answer.
    Please read the FAQ
    C Reference Card (A MUST!)
    Pointers and Memory
    The Essentials
    CString lib

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Waterloo, Texas
    Don't be ridiculous! Of course you could. Simply a matter of design...
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
        return std::pow
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;

  3. #3
    Registered User
    Join Date
    Apr 2002
    originally posted by Lynux-Penguin
    ux^n = [u(x)^(n-1)]/(n-1)
    Actually, that is differentiation, not integration (assuming you are attempting to integrate the left side and the result is the right side)

    Anyways, it is incredibly hard (or it would be for me) to write a program that would symbolically integrate a function so that it is able to utilize substitution, integration by parts, and numerous other techniques. You would have to use some pretty damn complex pattern matching function, and a lot of other advanced goodies. A really weak analogy: integration is differentiation as factoring is to multiplication. All functions, no matter how complex, can be differentiated fairly easily using a simple set of rules, so one does not really have to make "decisions." Integration is far harder: Should I substitute u(x) for x^2+3? Maybe I need to call that u and sin x dv, so that int(udv)=uv-int(vdu)? Can i change this around so that it will fit the 1/(x^2+1), the derivative of inverse tangent? You see the point...

    However, it is really pretty easy to numerically integrate a function, there exist many algorithms for doing this-they are all pretty much the same thing. I would suggest this as a way to "build up" to symbolic integration.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using calculus w/o knowing it
    By VirtualAce in forum A Brief History of
    Replies: 21
    Last Post: 12-26-2005, 11:11 AM
  2. I like calculus
    By Silvercord in forum A Brief History of
    Replies: 34
    Last Post: 05-11-2004, 08:38 PM
  3. calculus problem: motion
    By Silvercord in forum A Brief History of
    Replies: 8
    Last Post: 10-10-2003, 10:56 AM
  4. I want nothing more than to take calculus
    By Silvercord in forum A Brief History of
    Replies: 61
    Last Post: 06-20-2003, 05:23 PM
  5. Anyone want to part with a Calculus Text?
    By FillYourBrain in forum A Brief History of
    Replies: 5
    Last Post: 12-09-2002, 07:46 AM
Website Security Test