Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am a Software Engineer professional. I have studied calculus as a core course in my graduation studies. I want to ask question, that what/where is the implementation of calculus in computer science?

share|improve this question
its mostly useful for physical things so mainly where something physical is involved in the problem domain –  jk. Mar 13 '12 at 11:36
@jk. What you mean by "physical things"? Do you mean something tangible? Then what about Time? Time is abstract. We can always differentiate and integrate it. And same goes for other physical quantitiies which are continous in nature. Please explain. –  Maxood Mar 13 '12 at 11:39
as in any physical data that is externally measured so time can be externally measured, voltages and currents can be externally measured using physical devices –  jk. Mar 13 '12 at 11:42
This is where analog devices comes into play. Continous physical quantities are measured using analog devices and digital devices like for example speedometer and odometer. So when a continous quanitity is translated into discrete then is that the occasion when we differentiate or integrate them? –  Maxood Mar 13 '12 at 11:53
What is "Calculus of Continious Quantities"? –  Emmad Kareem Mar 13 '12 at 13:10

11 Answers 11

Calculus is useful for looking at changes in physical quantities so is mainly useful in the physical sciences. Programming mostly only deals with calculus when the problem domain requires it.

But of course there is also the meta-problem of algorithms for good numerical approximations of integrals or differential equations e.g. http://en.wikipedia.org/wiki/Numerical_integration and http://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods which are certainly computer science orientated.

I've not used calculus in programming since university (which was to implement integration by simpson's rule in FORTRAN)

share|improve this answer

Computer Science and Calculus have nothing to do with each other, besides the somewhat incorrect assumption by academics that practicing programmers will require higher math. I say "somewhat incorrect", because whether you will or won't will depend entirely on what your "problem domain" will be. If you're writing "business logic", like many programmers, you'll probably never use any math higher than basic arithmetic. If you're writing molecular-modeling, like a physical- or chemical-scientist, you'll use it every day.

I have to say that in over 30 years of programming for a living, writing operating system, systems management, web server, and other complex programs, I've only ever needed higher math once, and only because I didn't know where to find the already-published algorithm that required only arithmetic.

share|improve this answer
i agree with you. But this also depends what branch of Calculus you are talking about. If you talk about Labda Calculus then it does have application in computation and recusrive functions. FYI:en.wikipedia.org/wiki/Lambda_calculus –  Maxood Mar 13 '12 at 11:56
Your talking about programming. OP was asking about computer science –  Tom Squires Mar 13 '12 at 12:04
@Maxood: Despite not using the proper term, I think the question is sufficiently clear on meaning infinitesimal calculus/mathematical analysis. –  Jan Hudec Mar 13 '12 at 12:08
OP described himself as a "Software Engineer professional", which I read to mean a practitioner. Perhaps I misread. –  Ross Patterson Mar 13 '12 at 12:09
Depending on your problem domain, you might never need SQL in your whole programming career (think e.g. embedded systems, computer games) or OOP (think numerical computing, or Erlang-style high-availability applications). But that doesn't mean that OOP and SQL have "nothing to do with programming", right? –  nikie Mar 13 '12 at 20:01

There are a few areas where calculus is needed, more specifically differential equations.

Every car company has to test its models to see how it behaves in crash situations. They do this by placing a multitude of sensors all over the car and crashing it. The information received from those sensors needs to be interpreted and analyzed.

If you ever write software that does this, then you'll be dealing a lot with differential equations. The angles at which each part of the car is bent from the crash are passed through these equations to get the values of the forces involved. The deceleration values must also be computed using such equations. I don't know too much about this, though...

This is only one of the applications of calculus in computer programming. Maybe someone knows other scenarios.

Programmers have always complained that various areas of mathematics don't ever apply in their work (and therefore there's no reason to learn it). This is mostly true, but sometimes you do need to know such concepts to get the job done. For example, vector spaces knowledge (from linear algebra) can be of tremendous help when making 3D rendering engines (for games, for example).

share|improve this answer
What you've described is an application of physics (and, by extension, calculus) in automotive engineering. People involve computers because it's faster than processing the data by hand. The act of designing and writing a program to carry out the steps doesn't really require an understanding of the math if the steps are well-defined. –  Blrfl Mar 13 '12 at 12:40
@Blrfl I would with SoboLAN as the area of Physics where this kind of Calculus is used, typically called Mechanics is very much involved in writing the functions or methods to work correctly. But again the answer is a scenario based application and does not address as to where we need Calculus(differentiation and integration of physical quantities) in Computer Science or programming in general. –  Maxood Mar 13 '12 at 12:46
@Maxood: That's the thing. Programming in general is only useful to the extent that it is in specific. It's like writing or journalism. It has its own rules, but without the content it's empty. I'm afraid programmers often see their function too narrowly. –  Mike Dunlavey Mar 13 '12 at 14:30
@MikeDunlavey: Sure, but the rules of journalism are still a domain unto themselves and don't have to be tied to anything else in particular to be useful. Making the argument that higher math is somehow essential to being a good programmer is tantamount to arguing than an in-depth knowledge of foreign policy is essential to a journalist covering NASCAR. –  Blrfl Mar 13 '12 at 17:01
@Blrfl: I think we're in violent agreement :-) –  Mike Dunlavey Mar 13 '12 at 17:30

Computer science usually deals with finite things. However there are cases where you use real functions and apply analytic methods, sometimes including infinitesimal calculus. One is when you need to express relations for problems of arbitrary size and granularity. This often happens in information theory e.g. in Shannon capacity or information entropy. Another sometimes occurs when calculating upper or lower bounds. Many quantities in graph theory are complex sums, that cannot be directly calculated, but can be limited by real functions or integrals. And even basic stuff like asymptotic behaviour is defined in terms of limits, so you need at least the basic concepts.

As practitioner, you probably won't need to do those calculations, but understanding the concepts makes it easier to reason about choice of algorithms and practical limits you are to encounter, especially when you get to something that involves correction codes, compression or just some complex graph algorithm. Or statistics, which also uses analysis a lot.

Also it's difficult to teach just part of mathematics without ever touching infinitesimal calculus, which includes the mathematics mainly used in computer science (graph theory, linear programming, optimization etc.)

share|improve this answer

Calculus can be used to solve recursion complexity calculations.
(The recursion's complexity can be expressed with infinite discrete sums which can be solved with their continuous counter-parts.) [ 1 ][ 2 ]

Also both calculus and other forms of maths are used in various applied computer science.
E.g. Physics Engines, Signal & Image Processing, Computer Vision, Information Theory.

share|improve this answer

It depends. Are you going to just be told what to program, or are you going to know much about the content area?

I've worked for years in graphics UIs and mathematical modeling, specifically pharmacometrics and biostatistics. I need to understand ordinary differential equations, frequentist and bayesian statistics, pharmacological modeling, and optimization algorithms. Every so often I need to solve calculus problems that nobody has figured out before, or if they did, they didn't publish it, or if they published it, they only did easy cases. I have to handle the hard cases as well.

All this is in a field where mistakes can be very costly, so it's important to be able to make air-tight justifications. Programming is fine, but it's only part of the story.

share|improve this answer

A developer needs calculus to the extent it is important to the problem domain. The developers of Twitter don't need any calculus. Developers at Boeing or Airbus need a good understanding of calculus.

share|improve this answer

I used a lot of calculus for creating continuous interpolations. For example, I use this in fractal animation software, where smooth transitions are desired. Furthermore, everything that has to do with continuous motion, like a game with a bouncing ball, etc. or acceleration sort of becomes easier with calculus. Thirdly, a lot of the stuff mentioned above can be simplified/optimized if one has a basic understanding of trigonometric functions.

share|improve this answer

I work in the Aerospace industry on spacecraft (mostly satellites) modeling and simulation software. Most recently, I was was responsible for developing a simulation model for a satellite's attitude determination and control system.

Yes, I had to use a lot of math, mostly linear algebra and calculus. While many of the physics calculations my software had to perform were well known, and the scientists and systems folks basically handed me documentation (or sometimes, their matlab scripts) for most of them, being able to convert math formulas into code is easier if you understand what the formulas are doing :)

Also, tracking down bugs and finding the occasional error in the equations I was handed would have been nigh on impossible if I had absolutely no math background.

share|improve this answer

For this topic, I highly recommend the following book: Concrete Mathematics by Ronald L. Graham, Donald E. Knuth, and Oren Patashnik. It is about CONtinuous and disCRETE mathematics, and how they are applied in computer science. Topics include stuff like sums, recurrences, binomial coefficients, number theory, discrete probability, among others. I reference my copy all the time.

share|improve this answer

I'm brushing up on my calculus because of the problems I've been encountering in the field in which I wish to become expert in: ANN's - artificial neural nets, and signal processing, which are a mixture of programming and physical systems, the physical being the relationship between the neurons, and what kind of neurons you wish to develop and what kind of network you wish to build, what you want it to do. Calculus is not handy for ANN's - it's essential.

So I suppose to answer when do you need higher math for programming I imagine the answer depends upon what problems you wish to tackle in real life. Also I imagine game programmers modelling real life would need higher math as well.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.