<p>This depends on what you mean by "applying calculus to computer science."  In your comment to Quaternary's answer, you make a distinction between "direct" and "indirect" application, but it's not clear to me exactly what distinction you're making.  Following are some areas of computer science where calculus/analysis is applicable.</p>

<ol>
<li><p><b>Scientific computing</b>.  Computer algebra systems that compute integrals and derivatives directly, either symbolically or numerically, are the most blatant examples here, but in addition, any software that simulates a physical system that is based on continuous differential equations (e.g., computational fluid dynamics) necessarily involves computing derivatives and integrals.</p></li>
<li><p><b>Design and analysis of algorithms</b>.  The behavior of a combinatorial algorithm on very large instances is often most easily analyzed using calculus.  This is especially true for randomized algorithms; modern probability theory is heavily analytic.  In the other direction, sometimes one can design an algorithm for a discrete problem by considering a continuous analogue, using calculus to solve the continuous problem, and then discretizing to obtain an algorithm for the original problem.  The simplest example of this might be finding an approximate root of a polynomial equation; using calculus, one can formulate Newton's method, and then discretize it.</p></li>
<li><p><b>Asymptotic enumeration</b>.  Sometimes the only way to get a handle on an enumeration problem is to form a generating function and use analytic methods to estimate its asymptotic behavior.  See the book <i>Analytic Combinatorics</i> by Flajolet and Sedgewick.</p></li>
</ol>

CC BY-SA 3.0
2012-03-13T15:58:15.220Z
2012-03-13T15:58:15.220Z
Timothy Chow
<p>The Flajolet-Sedgewick book on analytic combinatorics demonstrates how to analyze running times of algorithms by looking at the poles of a related complex function. </p>

CC BY-SA 3.0
2012-03-13T16:50:28.913Z
2012-03-13T16:50:28.913Z
Suresh Venkat
<p>There are a bunch of approximation algorithms with approximation ratio that is not a rational number. Such a number is often arrived as as the optimum of some continuous function, or as a limit. The most notorious of them is probably (1-1/e)  , which can be arrived at in a surprising number of ways. </p>

<p>The Goemans-Williamson max cut algorithm (http://people.orie.cornell.edu/~dpw/maxcut.ps) also has an approximation ratio that is the optimum of some function.</p>

<p>Factor revealing LP's model worst case instances of a given size. As instance size goes to infinity the optimal LP solution sometimes approaches some continuous function. A toy example of this would be Section 4 in <a href="http://arxiv.org/pdf/cs/0612052v1.pdf" rel="nofollow">http://arxiv.org/pdf/cs/0612052v1.pdf</a> (I'm sure there are others, this one I'm familiar with because I'm a coauthor on the paper).</p>

CC BY-SA 3.0
2012-03-13T19:50:08.877Z
2012-03-13T19:50:08.877Z
Martin Pál
<p>In stochastic simulation, we are often interested in estimating the expected value of a random variable. The expected value of a continuous random variable is an integral over the real numbers. To estimate this quantity, we use the Monte Carlo method which consists of generating instances of this random variable from pseudorandom uniform variables. From these uniform variables, we can generate random variables from a given distribution by inverting the cumulative distribution function which is defined itself as an integral.</p>

CC BY-SA 3.0
2012-03-13T19:57:25.263Z
2012-03-13T19:57:25.263Z
lamontap
<p>Oh hell yes! </p>

<ol>
<li><a href="https://en.wikipedia.org/wiki/Lagrange_multipliers#Example%3a_entropy" rel="nofollow">Lagrange Multipliers (Entropy example)</a></li>
<li><a href="http://www3.ntu.edu.sg/home/guohua/richter-thomass.pdf" rel="nofollow">Relation between crossing numbers of complete and complete bipartite graphs</a> </li>
<li><a href="http://www.johndcook.com/blog/2011/06/10/stirling-approximation/" rel="nofollow">Simpler version of Stirling’s approximation</a></li>
<li><strike>It is impossible to write computer game without calculus. </strike> Many computer games use calculus. </li>
</ol>

<p>It is used but I don't think it is used enough. </p>

CC BY-SA 3.0
2012-03-13T23:28:05.843Z
Tetris needs calculus?!
Jeffε
CC BY-SA 3.0
2012-03-13T20:11:45.793Z
2012-03-14T08:08:32.953Z
2012-03-14T08:08:32.953Z
Pratik Deoghare
<p>Where are derivatives and integrals used in the field of Computer Science? What are their applications?</p>

CC BY-SA 3.0
2012-03-13T14:06:41.917Z
For one thing, anytime you "choose an epsilon to be optimized later".
Mahdi Cheraghchi
CC BY-SA 3.0
2012-03-13T16:08:07.857Z
Whenever a "Turing machine" is used to control/process/simulate something "physical" (robotics, CAD/CAM, image processing, computational chemistry, ...)
Marzio De Biasi
CC BY-SA 3.0
2012-03-13T17:13:38.743Z
I am not sure if this is a suitable question for cstheory, the scope of this site is *research-level* questions in *theoretical* computer science, please see the [FAQ].
Kaveh
CC BY-SA 3.0
2012-03-13T17:39:11.380Z
I also have mixed feelings, even though I answered !
Suresh Venkat
CC BY-SA 3.0
2013-10-18T15:30:08.743Z
I just feel like the question should got moved, no downvoted! Its a perfectly legitimate question for, say, stackoverflow. Isn't it?
Leonel
<big-picture>
Application of calculus in computer science
user48694
# Application of calculus in computer science

(Asked by: username_0 on 2012-03-13)

Where are derivatives and integrals used in the field of Computer Science? What are their applications?

**Tags:** big-picture
> **Comments:**
> **username_1**: For one thing, anytime you "choose an epsilon to be optimized later".  
> **username_2**: Whenever a "Turing machine" is used to control/process/simulate something "physical" (robotics, CAD/CAM, image processing, computational chemistry, ...)  
> **username_3**: I am not sure if this is a suitable question for cstheory, the scope of this site is *research-level* questions in *theoretical* computer science, please see the [FAQ].  
> **username_4**: I also have mixed feelings, even though I answered !  
> **username_5**: I just feel like the question should got moved, no downvoted! Its a perfectly legitimate question for, say, stackoverflow. Isn't it?  

---

## 5 answers

### Answer by username_6 on 2012-03-13. Score: 7

This depends on what you mean by "applying calculus to computer science." In your comment to Quaternary's answer, you make a distinction between "direct" and "indirect" application, but it's not clear to me exactly what distinction you're making. Following are some areas of computer science where calculus/analysis is applicable.

1. **Scientific computing**. Computer algebra systems that compute integrals and derivatives directly, either symbolically or numerically, are the most blatant examples here, but in addition, any software that simulates a physical system that is based on continuous differential equations (e.g., computational fluid dynamics) necessarily involves computing derivatives and integrals.
2. **Design and analysis of algorithms**. The behavior of a combinatorial algorithm on very large instances is often most easily analyzed using calculus. This is especially true for randomized algorithms; modern probability theory is heavily analytic. In the other direction, sometimes one can design an algorithm for a discrete problem by considering a continuous analogue, using calculus to solve the continuous problem, and then discretizing to obtain an algorithm for the original problem. The simplest example of this might be finding an approximate root of a polynomial equation; using calculus, one can formulate Newton's method, and then discretize it.
3. **Asymptotic enumeration**. Sometimes the only way to get a handle on an enumeration problem is to form a generating function and use analytic methods to estimate its asymptotic behavior. See the book *Analytic Combinatorics* by Flajolet and Sedgewick.


---

### Answer by username_4 on 2012-03-13. Score: 4

The Flajolet-Sedgewick book on analytic combinatorics demonstrates how to analyze running times of algorithms by looking at the poles of a related complex function.


---

### Answer by username_7 on 2012-03-13. Score: 3

There are a bunch of approximation algorithms with approximation ratio that is not a rational number. Such a number is often arrived as as the optimum of some continuous function, or as a limit. The most notorious of them is probably (1-1/e) , which can be arrived at in a surprising number of ways.

The Goemans-Williamson max cut algorithm (http://people.orie.cornell.edu/~dpw/maxcut.ps) also has an approximation ratio that is the optimum of some function.

Factor revealing LP's model worst case instances of a given size. As instance size goes to infinity the optimal LP solution sometimes approaches some continuous function. A toy example of this would be Section 4 in <http://arxiv.org/pdf/cs/0612052v1.pdf> (I'm sure there are others, this one I'm familiar with because I'm a coauthor on the paper).


---

### Answer by username_8 on 2012-03-13. Score: 1

In stochastic simulation, we are often interested in estimating the expected value of a random variable. The expected value of a continuous random variable is an integral over the real numbers. To estimate this quantity, we use the Monte Carlo method which consists of generating instances of this random variable from pseudorandom uniform variables. From these uniform variables, we can generate random variables from a given distribution by inverting the cumulative distribution function which is defined itself as an integral.


---

### Answer by username_9 on 2012-03-13. Score: 1

Oh hell yes!

1. [Lagrange Multipliers (Entropy example)](https://en.wikipedia.org/wiki/Lagrange_multipliers#Example%3a_entropy)
2. [Relation between crossing numbers of complete and complete bipartite graphs](http://www3.ntu.edu.sg/home/guohua/richter-thomass.pdf)
3. [Simpler version of Stirling’s approximation](http://www.johndcook.com/blog/2011/06/10/stirling-approximation/)
4. It is impossible to write computer game without calculus.  Many computer games use calculus.

It is used but I don't think it is used enough.

> **Comments:**
> **username_10**: Tetris needs calculus?!  

---

