Can Calculus be Applied in C/C++, PERL, and PYTHON for Real-Time Programming?

  • Context: Undergrad 
  • Thread starter Thread starter karthik3k
  • Start date Start date
  • Tags Tags
    Calculus Programming
Click For Summary

Discussion Overview

The discussion centers on the application of calculus within programming languages such as C, C++, PERL, and PYTHON, particularly in the context of real-time programming. Participants explore methods for differentiation and integration, including the use of libraries and algorithms.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Some participants suggest that while basic functions exist in these languages, more complex calculus operations require additional algorithms or libraries.
  • There is a belief among some that these languages may not inherently support advanced mathematical functions, but packages might be available to facilitate this.
  • One participant mentions the necessity of using special math libraries for algebraic solutions, noting that many integrals cannot be solved exactly and often require approximations.
  • Numerical methods such as Runge-Kutta and Monte Carlo are proposed as common approaches for numerical integration and differentiation.
  • Another participant emphasizes the use of integral tables in C/C++ programs, suggesting that integration can be performed by referencing these tables rather than through built-in functions.
  • Recommendations for resources include "Numerical Recipes in C" and "Math Toolkit For Realtime Programming," highlighting their relevance for scientific programming.

Areas of Agreement / Disagreement

Participants express a general consensus that built-in functions for calculus are lacking in these programming languages, but there is no agreement on the best approach to implement calculus operations. Multiple competing views on the use of libraries, methods, and resources remain present.

Contextual Notes

Some participants note that the results obtained through programming may differ from hand-calculated answers due to the nature of mathematical expressions and approximations used in numerical methods.

karthik3k
Messages
149
Reaction score
0
Calculus in Programming ??

How can i differentiate / Integrate in C/C++, PERL, PYTHON ?
 
Physics news on Phys.org
Generally speaking, programming languages like C++,PERL, and PYTHON have basic functions built in but for more complex operations like diffentiation and integration, you have to either write or get algoriths.

Especially if you want symbolic "algebra" results!
 
I don't think those kinds of languages can handle that kind of mathematics. But maybe there's some kind of package out there to let them.

And the stereotypical answer, just for good measure: you write a program to do it!

cookiemonster
 
You will definitely have to look for special math libraries to find algebraic solutions. Most programming uses approximations because, as yu probably know, many integrals are not exactly solvable. Runge-Kutta is the most efficient in general, but Monte Carlo methods are sometimes used. I like the simplicity of Monte Carlo methods- screw math, just get drunk and throw darts at pictures of your equations, and you'll have the answer.
 
Hi:
I thinkit is not possible to do diff/Int directly but u can always develope the code to fit to u r needs..There are plenty of codes available on line else u can use "Numerical Recieps in C", i t is an excellent book for these type of codes..
Surendra
 
Originally posted by rick1138
You will definitely have to look for special math libraries to find algebraic solutions. Most programming uses approximations because, as yu probably know, many integrals are not exactly solvable. Runge-Kutta is the most efficient in general, but Monte Carlo methods are sometimes used. I like the simplicity of Monte Carlo methods- screw math, just get drunk and throw darts at pictures of your equations, and you'll have the answer.

And the drunkenness is a requirement of the system! The answers are likely to be wrong if the dart thrower is sober. :smile:
 
therez definitely no built-in integ or deriv function that u can call in c/c++/perl etc...
wut some c/c++ programs do is basically load a database of integral tables and then call the appropriate function and search the function's tables to find the appropriate integral form...in short, it uses integration by table.I think softwarez like maple and deriv, which do these, were written in C...making them user friendly...

if u want to do the integration and stuff using C then ull need to download functions and then include them like " include <bhahbhah.h> " and then pass appropriate parameters.
much easier to use software like maple...

be warned that ur answer can look different from the answer u get by hand because the answerz can be expressed in different forms esp forms involving trig functions.

- Mr. Kamadolli
 
If you're talking about doing numerical differentiation and integration, look no further than the book "Numerical Recipes in C." It's a classic book, a must-own for any scientific programmer, and is available in its entirety, for free, at www.nr.com.

Enjoy!

- Warren
 
I'm at work so I can't give you an exact title of the book. I'll edit it the first chance I get.

The book is called Math Tookit For Realtime Programming by Jack Krenshaw. The author is an engineer who programmed embedded systems at NASA. The CAS(Computer Algerbra Systems) are great but programming the code is better. If you go that I highly recommend MATHCAD. :biggrin:
 

Similar threads

  • · Replies 49 ·
2
Replies
49
Views
9K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 9 ·
Replies
9
Views
14K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 6 ·
Replies
6
Views
5K