Questions tagged [calculus]

Calculus is the study of change of one or more variables with respect to another variable. Calculus has two main operators: differentiation and integration. Differentiation can be used to study the change of one variable with respect to another. Integration can be used to find the area bounded by a function.

Calculus plays an important role in computer science, for example, in the comparison of the performance of various algorithms and the complexity of various problems. These are often expressed using big O notation, which relies on the idea of the limits of ratios of functions as a variable tends to infinity.

On the practical programming side, there are several fields that will require calculus to a greater or lesser extent:

  • Numerical analysis and computation.
  • Signal processing (Image, video, audio, etc).
  • Data analysis and prediction for business applications.
  • Modeling of dynamical systems.
  • Machine learning.
  • Physics engines for video games.
580 questions
4
votes
5 answers

Uniform distance between points

How could I, having a path defined by several points that are not in a uniform distance from each other, redefine along the same path the same number of points but with a uniform distance. I'm trying to do this in Objective-C with NSArrays of…
Leonardo Marques
  • 3,721
  • 7
  • 36
  • 50
4
votes
2 answers

calculating the Gradient and the Hessian in R

As you know, the Gradient of a function is the following vector: and the Hessian is the following matrix: Now, I wonder, is there any way to calculate these in R for a user defined function at a given point? First, I've found a package named…
A S
  • 1,195
  • 2
  • 12
  • 26
4
votes
2 answers

Recursive Haskell; Newton's Method: Why Doesn't This Converge?

I've been trying to learn Haskell by building short programs. I'm somewhat new to the functional programming world but have already done a good amount of reading. I have a relatively short recursive function in Haskell for using Newton's method to…
GBXWA
  • 47
  • 5
4
votes
2 answers

Library for polynomial calculus in Java?

Are there any (preferably open source) library for Java that allows one to do calculus with polynomial e.g. addition, multiplying, dividing by constans etc. ? Also if it would be capable to interpolate several 2D points in a polynomial with Lagrange…
Alexandru Chirila
  • 2,274
  • 5
  • 29
  • 40
4
votes
2 answers

Finding the optimal 3D box sizes for a group of 3D rectangular items

When I say box I am talking about shipping boxes. I have a number of random sized, small items that I need to pack into as few boxes as possible. I need to know what box sizes are optimal. All items are rectangular prisms. It's easy to exclude a…
unixman83
  • 9,421
  • 10
  • 68
  • 102
4
votes
3 answers

Algorithm to calculate a diminishing value, approaching a limit

I've been trying to find a Javascript version of a handy method I'd used (not written) a while ago in LPC, it was called dimval(), and it took this form: NAME dimval() - returns values with a reduced increase in output as input…
danjah
  • 2,939
  • 2
  • 30
  • 47
3
votes
2 answers

How to find the distance between a point and a parabola in code

I am trying to find the closest point on a parabola to an arbitrary point in 2d, for a DirectX pixel shader. A great amount of googling has revealed to me that this is a common pre-calculus homework problem. Unfortunately, the hundreds of relevant…
Greg Bahm
  • 638
  • 6
  • 11
3
votes
3 answers

Project Euler #368 (Math Formula)

In Project Euler, a problem asks me to write a program to find the convergence value of 20 terms from the Harmonic sequence: 1/111, 1/222, 1/333, 1/444, 1/555, 1/666, 1/777, 1/888, 1/999, 1/1000, 1/1110, 1/1111, 1/1112, 1/1113, 1/1114, 1/1115,…
Neobane
  • 33
  • 2
3
votes
5 answers

Need some math - Projecting Slope

I have a rectangle. Its height (RH) is 400. Its width (RW) is 500. I have circle. Its height (CH) is 10. Its width (CW) is 10. Its starting location (CX1, CY1) is 20, 20. The circle has moved. Its new location (CX2, CY2) is 30, 35. Assuming my…
Jerry Nixon
  • 31,313
  • 14
  • 117
  • 233
3
votes
2 answers

creating random numbers that favor smaller numbers

say i generated a set of random numbers and put them into an array, (pre-sorted for simplicity) i'll use javascript to show the math: var vals = new Array(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,...,10000); then in a loop, i created a random number…
kona
  • 139
  • 8
3
votes
2 answers

Converting a python recursive function into excel

So, I have to run a recursive function times but it's going to take too long to actually print out all the values. Thus, my professor recommended using Excel but I don't know Excel at all. I need help converting the code into Excel. It's probably…
Snooch
  • 53
  • 3
3
votes
0 answers

Translate integral calculation from Mathematica to R

I am trying to convert the below integral implementation in Mathematica into R syntax: xprime = 0.5; yprime = 3; dimx = 20/1000; dimy = 20/1000; NIntegrate[Boole[Abs[x - xprime] < dimx/2 && Abs[y - yprime] < dimy/2] 1/(20 Pi Sqrt[x^2 + y^2]), …
3
votes
3 answers

Propositional calculus in python

I'm looking for a propositional calculus module that works in python. My users need to input a formula in a text area, then I have to check whether it's correct or not. I cannot directly test if the input text equals the correct one as it didn't…
Studer
  • 611
  • 2
  • 8
  • 21
3
votes
1 answer

SymPy's "function_range" doesn't work for seemingly simply functions

I'm trying to determine the range of a function, in this case a polynomial. My program already uses a lot of SymPy functions so I thought I could use the function_range function from the sympy.calculus.util module. For the polynomial…
DeepQuantum
  • 273
  • 3
  • 14
3
votes
0 answers

Problem evaluating iterated integral in SymPy

I'm teaching a course in Multivariate Calculus and decided to convert my notes from Sage to Jupyter using SymPy. I have rewritten nearly all my notes as Jupyter Notebooks and am very impressed how I can use multiple cells like Mathematica and I can…