There’s a lot of methods that a computer can use. For real world data, which is where I’d argue you’ll find most of your calculus, the answer is surprisingly simple. *Don’t* do calculus. Real data is made up of discrete points, so riemann sum “integrals” and basic rise over run slope calculations are the obvious choice.
There are two ways.
With code that can do a analytic solution like you do with pen and paper. It can give a exact result.
The other way is with numerical analysis, it do not need to find a analytical solution for the equation. It is something like if you calculate the value of the function at many points along it’s length, connected the points with strait lines and calculate the area between the points along that line.
For the rate of change, calculate the value of two points close to eachother, the value difference an distance between the point can be used to calculate the rate of change.
In practise you have a bit more complicated ways to get a better result but it all used calculated values att different points
They basically calculate the answer on a very small scale. So say you want the integral of an equation. It will calculate the area under the curve of an extremely small scale using two points very close together to get an approximation. It does this thousands of times to calculate a total. It is done on such a small scale it can be accurate to several decimal points. That is why you might get an answer that is supposed to be a whole number but comes off as .0000001.
>How do calculators do calculus?
Different computer programs will “do calculus” in different ways.
**Computer algebra systems** will actually be programmed with algorithms to specifically work out operations like *Int[2x]=x^2* before evaluating *x* over the specified ranges.
**Numerical methods** instead use algorithms that “plug and chug” by chopping up a problem into a bunch of finely-sliced arithmetic-on-datapoints problems to try to get a “close enough” numerical answer to some specific level of numerical precision.
same way you do before you learn easy differential tricks: Estimate with asymptotes. If you can’t program in the fancy equation to get the exact slope at x=8, just calculate the slope between x=8 and x=8.000000000000000000000000001. The calculator will run out of room on the display before the difference gets shown.
It’s been too long, but I remember programming my pocket computer to do a Newton Cauchy calculation … on something. I forgot. But there are practical ways to do math and get an actual number. You can’t have more than one unknown, but if you are talking about using actual numbers, it can be done by brute force math.
I’m a hardware engineer, and don’t recall much of the software algorithms I worked with to do these calculations, but i have implemented many complex math operations in hardware using newtons method. The idea is we can make a guess using linear mathematics and then use newtons method in iterations using an FSM to get a more accurate result.
For something like a simple derivative or integral, we can trivially solve im hardware or software using iterations.
Latest Answers