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
3
votes
1 answer

How to plot vector field on image?

In order to understand visually the involved vector, scalar fields of an image operation which involves calculating, gradient, divergence, laplacian etc, I am trying to plot them also on the image involved. I started with gradient as below, but…
Parthiban Rajendran
  • 430
  • 1
  • 7
  • 18
3
votes
1 answer

'Symbol' object has no attribute 'sin'

I have defined a function integrate_boole as follows: def integrate_boole(f,l,r,N): N = 4 * int(N // 4) h=((r-l)/N) xN = np.linspace(l,r,N+1) fN = f(xN) return ((2*h)/45)*(7*fN[0]+32*(np.sum(fN[1:-1:2]))+12*.…
yerman
  • 267
  • 2
  • 4
  • 12
3
votes
3 answers

formula for the sum of n+n/2+n/3+...+n/n

so I got this algorithm I need to calculate its time complexity which goes like for i=1 to n do k=i while (k<=n) do FLIP(A[k]) k = k + i where A is an array of booleans, and FLIP is as it is, flipping the current value.…
stylo
  • 496
  • 4
  • 12
3
votes
1 answer

Translating “neither…nor” into a mathematical logical expression

Having some difficulty doing translations for complicated neither...nor sentences. With these characters: ~ Negation V Disjunction & Conjunction I'm trying to translate and understand, for example: "Neither John nor Mary are standing in front of…
Philoxopher
  • 1,660
  • 3
  • 15
  • 17
3
votes
1 answer

Compute sum of image pixels along a circular path

I have an image where I am trying to compute the line integral (sum) along a circular path. My idea to approach this is: Compute the circular path to sum over Mask the image based on the path, where everything except whatever pixels coincide with…
Gerges
  • 6,269
  • 2
  • 22
  • 44
3
votes
1 answer

Sympy - limit() Error: Result depends on the sign

I'm attempting to solve the following problem: Applying the following I get the correct answer. α, t, x = symbols('α t x') integrate(α*x*exp(-α*x), (x, 0, oo), conds='none') To check the solution (1/α) I attempted the…
Josmoor98
  • 1,721
  • 10
  • 27
3
votes
1 answer

Limits involving the cumulative distribution function of a normal variable

I'm working through some exercises on improper integrals and I've stumbled across an issue I can't resolve. I'm attempting to use the limit() function on the following problem: Here N(x) is the cumulative distribution function of the standard…
Josmoor98
  • 1,721
  • 10
  • 27
3
votes
3 answers

Activation Function in Machine learning

What is meant by Activation function in Machine learning. I go through with most of the articles and videos, everyone states or compare that with neural network. I'am a newbie to machine learning and not that much familiar with deep learning and…
mohangraj
  • 9,842
  • 19
  • 59
  • 94
3
votes
1 answer

Trapezoidal Riemann Sum in C

I've been trying to do Riemann Sums to approximate integrals in C. In my code below, I'm trying to approximate by both the trapezoidal way and the rectangular way (The trapezoidal way should be better, obviously). I tried making an algorithm for…
defunct-user
  • 183
  • 1
  • 11
3
votes
1 answer

Find intersection of 2 curves & area under a curve to the right of the intersection w/ Mathematica

I have 2 curves illustrated with the following Mathematica code: Show[Plot[PDF[NormalDistribution[0.044, 0.040], x], {x, 0, 0.5}, PlotStyle -> Red], Plot[PDF[NormalDistribution[0.138, 0.097], x], {x, 0, 0.5}]] I need to do 2 things: Find the x…
Jagra
  • 3,149
  • 1
  • 18
  • 19
3
votes
1 answer

What is the difference between 'qr' and 'SVD' in Matlab to get the single vectors of a matrix?

Spefifically, the following two kinds of code can get the same S and V idealy. However, the second one's speed is usually faster than the first one in Matlab. Can someone tell me the reason? Moreover, which method is more numerically…
olivia
  • 381
  • 3
  • 14
3
votes
1 answer

Numerical integration in R : bad integrand behaviour error

This is my matrix func=structure(c(-14.7690673280818, -14.5543581356252, -12.1406211639974, -10.7200919648493, -9.55507848352318, -9.20790894914246, -8.74647670464071, -8.26548763467919, -7.3962484443768, -6.94590909664862, -6.63903257406218,…
Joao Baptista
  • 33
  • 1
  • 4
3
votes
1 answer

Cardano's formula not working with numpy?

--- using python 3 --- Following the equations here, I tried to find all real roots of an arbitrary third-order-polynomial. Unfortunatelly, my implementation does not yield the correct result and I cannot find the error. Maybe you are able to spot…
varantir
  • 6,624
  • 6
  • 36
  • 57
3
votes
1 answer

Calculating the boundary of irregular shape in Cartesian Coordinate 2D

I'm looking for a solution to calculate the boundary of an irregular shape. Lats take a look at Square example: if i have Minimum x and y and Maximum x and y like: MaxX = 5 MinX = 1 MaxY = 5 MinY = 1 in python language: #Python Code X = {"Min":1,…
Bear
  • 550
  • 9
  • 25
3
votes
3 answers

How can I get more exact decimal values in Python

from math import sqrt a=1e-8 b=10 c=1e-8 x1 = ((-b)-sqrt((b**2)-(4*a*c)))/(2*a) x2 = ((-b)+sqrt((b**2)-(4*a*c)))/(2*a) print 'x1 = {}'.format(x1) print 'x2 = {}'.format(x2) print (4*a*c) print (sqrt(b**2-4*a*c)) print b**2 print 2*a When I run…
magnus852
  • 35
  • 6