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
5
votes
2 answers

Ploting solid of revolution in Python 3 (matplotlib maybe)

Greetings the problem: R is a region in the xy plane bounded by the parabola y=x^2+1 and line y=x+3. A solid of revolution is formed by rotating R around the x axis. I need to plot parabola and line in 2D and solid revolution 3D, How do it? I have…
Robby
  • 269
  • 4
  • 8
5
votes
2 answers

Understanding softmax classifier

I am trying to understand a simple implementation of Softmax classifier from this link - CS231n - Convolutional Neural Networks for Visual Recognition. Here they implemented a simple softmax classifier. In the example of Softmax Classifier on the…
Shubhashis
  • 10,411
  • 11
  • 33
  • 48
5
votes
2 answers

Using machine learning to make a computer learn calculus

Are there any known approaches of making a machine learn calculus? I've learnt that it is quite simple to teach calculating derivatives because it is possible to implement an algorithm. Meanwhile, an implementation of integration is possible but is…
5
votes
1 answer

Integrand Syntax in R

I'm trying to complete a straightforward integration, but I'm running into an issue that (I think) is due to the form in which I'm writing the integrand. Suppose I want to find the area bound by f(x) = 3x and g(x) = x^2. Geometrically, the area…
user4275591
5
votes
2 answers

differentiable maximum and minimum

I need an approximation to maximum and minimum. Since the max and min are not differentiable I am looking for an differentiable approximation to it. Does anybody know about it? for example I need to minimize the following: [max (a - max_{x\in c}(x)…
user570593
  • 3,420
  • 12
  • 56
  • 91
5
votes
10 answers

algorithm to find derivative

I'm writing program in Python and I need to find the derivative of a function (a function expressed as string). For example: x^2+3*x Its derivative is: 2*x+3 Are there any scripts available, or is there something helpful you can tell me?
Dixtosa
  • 81
  • 1
  • 1
  • 6
4
votes
1 answer

How to find Partial derivative of f(x,y) along x and y: del^2 f(x,y)/[del(x)][del (y)] in python

I have a 2D function f(x,y) defined in a (xx,yy) meshgrid. I want to numerically obtain it's partial derivative as shown below. Note that np.gradient doesn't do the job, as it returns a vector field along each of the axes. How can I do that? Here…
Alam
  • 315
  • 5
  • 17
4
votes
1 answer

Creating and working with exact differentials in SymPy

I am trying to figure out how to create and manipulate exact differentials (algebraic treatment of Leibniz notation) in SymPy. To be clear, it is well known that from sympy import * init_printing() x, y=symbols('x, y') f=Function('f')(x,…
SKArm
  • 71
  • 1
  • 7
4
votes
4 answers

Find midpoints between values in vector

This is for a function to calculate the AUC using the Midpoint Rule. Using R how can I define a vector that contains the midpoints between values of a previous vector? Or how can I shift the values of a vector to their midpoints? # define h (or…
abk
  • 309
  • 6
  • 15
4
votes
1 answer

Python - Sympy Minima and Maxima

I'm trying to learn sympy's calculus functions and I'm able to get as far as getting the roots of the second derivative for the critical points of the extrema via: import numpy as np from numpy import linspace, math, arange, linspace …
cmcgrath
  • 77
  • 1
  • 5
4
votes
5 answers

Use python to calculate a special limit

I want to calculate this expression: (1 + 1 / math.inf) ** math.inf, which should evaluates to e. However Python returns 1. Why is that? =====UPDATE======== What I want to do here is to derive the effective annual rate from user's input, APR…
Ryan
  • 1,040
  • 3
  • 16
  • 25
4
votes
2 answers

scipy.integrate.quad precision on big numbers

I try to compute such an integral (actually cdf of exponential distribution with its pdf) via scipy.integrate.quad(): import numpy as np from scipy.integrate import quad def g(x): return .5 * np.exp(-.5 * x) print quad(g, a=0., b=np.inf) print…
Denis Korzhenkov
  • 383
  • 3
  • 15
4
votes
1 answer

Chain rule in sympy

I'm trying some basic practice with SymPy. I would like to take a second derivative symbolically of a function in rectangular coordinates with respect to the radius parameter in polar coordinates. I'd like a nice chain rule symbolic expression…
Hatshepsut
  • 5,962
  • 8
  • 44
  • 80
4
votes
2 answers

How can I calculate 10^400, without MATLAB returning "inf"?

I am dealing with very big numbers, on the scale of 10^500,10^800. When I try to calculate 10^309 it reurns inf. >> 10^309 ans = Inf I tested format long it also returns inf. >> format long >> 10^309 ans = Inf I also tested the vpa…
user4569486
4
votes
1 answer

LibGDX Path (CatmullRomSpline) Constant Speed

I’m trying to achieve constant speed on a path using the LibGDX CatmullRomSpline and I’m having problems getting it to work. I’ve tried researching on this topic a lot including reading the LibGDX wiki, but their explanation for achieving constant…
Tekkerue
  • 1,497
  • 1
  • 11
  • 17
1 2
3
38 39