Questions tagged [derivative]

In calculus, a derivative is a measure of a function's rate of change as its input changes.

Loosely speaking, a derivative can be thought of as how much one quantity is changing in response to changes in some other quantity; for example, the derivative of the position of a moving object with respect to time is the object's instantaneous velocity.

The derivative of a function at a chosen input value describes the best linear approximation of the function near that input value. For a real-valued function of a single real variable, the derivative at a point equals the slope of the tangent line to the graph of the function at that point. In higher dimensions, the derivative of a function at a point is a linear transformation called the linearization.1 A closely related notion is the differential of a function.

The process of finding a derivative is called differentiation. The reverse process is called antidifferentiation. The fundamental theorem of calculus states that antidifferentiation is the same as integration. Differentiation and integration constitute the two fundamental operations in single-variable calculus.

enter image description here

845 questions
6
votes
3 answers

Derivative of an array in python?

Currently I have two numpy arrays: x and y of the same size. I would like to write a function (possibly calling numpy/scipy... functions if they exist): def derivative(x, y, n = 1): # something return result where result is a numpy array of…
Vincent
  • 57,703
  • 61
  • 205
  • 388
6
votes
2 answers

Mathematica clear a function's derivative definition

I defined the derivative of a function in Mathematica without defining the function itself, i.e. I have a function definition that looks like this: y'[x_] := constant * f'[x]. I can't figure out how to clear it out. If I use Clear[y'] or…
user1676921
  • 83
  • 1
  • 5
6
votes
2 answers

Derivatives in Java?

Im making a calculator app for Android, and a user requested for a derivatives calculator. Is there any preloaded function or a custom method available? Thanks.
5
votes
2 answers

Most Efficient way to calculate integrals/derivatives of inputted functions in Java?

I now have an idea, that I use the function as a string, and I calculate the real integral by hand, and ask a question to the user what the definite integral is, but that isn't a real solution. I was wondering if there was a way to input a function…
user1162715
5
votes
2 answers

What is the Sobel operator?

I tried 5 different implementations of the Sobel operator in Python, one of which I implemented myself, and the results are radically different. My question is similar to this one, but there are still differences I don't understand with the other…
imad
  • 167
  • 2
  • 12
5
votes
1 answer

Second derivative in Tensorflow 2.0

I am trying to calculate the second derivative of a simple vector function of a scalar variable f(x) = (x,x^2,x^3) using TF 2.3 with tf.GradientTape. def f_ab(x): return x, x** 2, x** 3 import tensorflow as tf in1 =…
5
votes
2 answers

How to implement the following formula for derivatives in python?

I'm trying to implement the following formula in python for X and Y points I have tried following approach def f(c): """This function computes the curvature of the leaf.""" tt = c n = (tt[0]*tt[3] - tt[1]*tt[2]) d = (tt[0]**2 +…
Upriser
  • 418
  • 2
  • 7
  • 23
5
votes
1 answer

Keras & TensorFlow: getting 2nd derivative of f(x) wrt x, where dim(x) = (1, n)

I'm working in Keras with TensorFlow under the hood. I have a deep neural model (predictive autoencoder). I'm doing something somewhat similar to this: https://arxiv.org/abs/1612.00796 -- I'm trying to understand influence of variables in a given…
iramusa
  • 193
  • 1
  • 11
5
votes
2 answers

How to apply a partial derivative Gaussian kernel to an image with OpenCV?

I'm trying reproduce results from a paper, in which they convolve the image with an horizontal partial derivative of a Gaussian kernel. I haven't found any way to achieve that with OpenCV. Is that possible ? Do I have to get Gaussian filter and…
Baptiste Wicht
  • 7,472
  • 7
  • 45
  • 110
5
votes
1 answer

Derivatives blow up in python

I am trying to find higher order derivatives of a dataset (x,y). x and y are 1D arrays of length N. Let's say I generate them as : xder0=np.linspace(0,10,1000) yder0=np.sin(xder0) I define the derivative function which takes in 2 array (x,y) and…
user3440489
  • 259
  • 1
  • 4
  • 13
5
votes
1 answer

Vectorized Partial Derivative of Multivariate Function in Python

There was a phenomenal answer posted by alko for computing a partial derivative of a multivariate function numerically in this thread. I have a follow-up question now about enhancing this function to accept an array of input values. I have some code…
hobscrk777
  • 2,347
  • 4
  • 23
  • 29
5
votes
4 answers

Partial derivative in Python

I am slowly moving from C to Python. This time I need to calculate partial derivatives numerically from a grid given. I know how to do it in C, so at the moment I just use inline adapter, i.e. def dz(x,X,Y,Z,dx): y = numpy.zeros((X,Y,Z),…
Eugene B
  • 995
  • 2
  • 12
  • 27
5
votes
2 answers

Find derivative of a function with Abs in python

I would like to compute derivative of y=Abs(0.5-0.5*sqrt(1-4*x)) in 0.1, using python. This is my code: x=Symbol('x') y=Abs(0.5-0.5*sqrt(1-4*x)) deriv=y.diff(x) d=lambdify(x,deriv,'numpy') print d(0.1) This is what I get: Traceback (most recent…
Milos
  • 518
  • 7
  • 22
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

Explicit formula versus symbolic derivatives in R

I would like to evaluate higher order derivatives of some function f in R. Two possibilities are available to me. Either I determine a general expression for f(k), the k-th derivative of f (which I can do in my particular case), and then I evaluate…
Marco
  • 9,334
  • 7
  • 33
  • 51