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
4
votes
0 answers

Derivative/gradient calculation for non structured data in python

I have a bunch of unstructured points in 3D and a function value at each one. I want to calculate the gradient of the function (first and second order derivatives) at each point. Is there somewhere (scipy, numpy,...) an implemented function for…
Robe
  • 343
  • 5
  • 10
4
votes
1 answer

Numerical implementation of n-th derivative of f(x)?

I implemented a C++ code to numerically solve the n-th derivative of a function in a point x_0: double n_derivative( double ( *f )( double ), double x_0, int n ) { if( n == 0 ) return f( x_0 ); else { const double h = pow(…
Gianluca Bianco
  • 656
  • 2
  • 11
4
votes
2 answers

Median of derivative in X axis of an image

I computed derivatives using different methods such as : convolution with an array [[-1, 1]]. Using the fourier theorem by computing DFT of the image and the array mentioned above, multiplying them and performing IDFT. Directly through the…
4
votes
1 answer

Same SerializedName for two different data types sometimes, but with Kotlin

The JSON file I'm pulling from unfortunately has a node with the same variable name but could have two different data types randomly. When I make a network call (using gson) I get the error: com.google.gson.JsonSyntaxException:…
Ben Akin
  • 167
  • 2
  • 15
4
votes
1 answer

Savitzky-Golay derivatives, computed with SciPy's signal.savgol_filter need to be scaled?

I'm computing the first and second derivatives of a signal and then plot. I chose the Savitzky-Golay filter as implemented in SciPy (signal module). I'm wondering if the output needs to be scaled - in the Matlab implementation of the same filter, it…
Irina Ciortan
  • 43
  • 1
  • 6
4
votes
1 answer

How do I get SymPy to collect partial derivatives?

I have been using SymPy to expand the terms of a complex partial differential equation and would like to use the collect function to gather terms. However, it seems to have a problem dealing with second (or higher order) derivatives where the…
4
votes
1 answer

How to do a derivative of a natural log getting TypeError: can't convert expression to float

I am running this python code to derive the equation. ​R(x)=50 * ln(5x + 1) derivative i tried numpy.log and math.log from sympy import Symbol, Derivative import numpy as np import math x= Symbol('x') function = 50*(math.log(5*x+1)) deriv=…
4
votes
1 answer

Getting gradient of vectorized function in pytorch

I am brand new to PyTorch and want to do what I assume is a very simple thing but am having a lot of difficulty. I have the function sin(x) * cos(x) + x^2 and I want to get the derivative of that function at any point. If I do this with one point…
LivingRobot
  • 883
  • 2
  • 18
  • 34
4
votes
2 answers

Why is the derivative of f(x) with respect to 'x' 'x' and not 1 in pytorch?

I am trying to understand pytorch's autograd in full and I stumbled with this: let f(x)=x, from basic maths we know that f'(x)=1, however when I do that exercise in pytorch I get that f'(x) = x. z = torch.linspace(-1, 1, steps=5,…
Sergio
  • 205
  • 1
  • 11
4
votes
0 answers

LOESS smoothing - geom_smooth vs() loess()

I have some data which I would like to fit with a model. For this example we have been using LOESS smoothing (<1.000 observations). We applied LOESS smoothing using the geom_smooth() function from the ggplot package. So far, so good. The next step…
wptmdoorn
  • 160
  • 1
  • 12
4
votes
2 answers

Sorting a formula in Mathematica according to level of derivative or exponential

I have an impedance equation which I have transferred to Mathematica in hopes to simplify it. It is representative of a circuit schematic, and the circuit impedance (Z, from V = iZ) is a large fraction of several terms in the s-plane. As an…
kando
  • 441
  • 4
  • 16
4
votes
1 answer

Keras: calculating derivatives of model output wrt input returns [None]

I need help with calculating derivatives for model output wrt inputs in Keras. I want to add a regularization functional to the loss function. The regularizer contains the derivative of the classifier function. So I tried to take the derivative of…
Romann
  • 89
  • 2
  • 7
4
votes
4 answers

How does one calculate the rate of change (derivative) of streaming data?

I have a stream of data that trends over time. How do I determine the rate of change using C#? It's been a long time since calculus class, but now is the first time I actually need it (in 15 years). Now when I search for the term 'derivatives' I…
makerofthings7
  • 60,103
  • 53
  • 215
  • 448
4
votes
1 answer

Calculate the partial derivative of the loss with respect to the input of the layer | Chain Rule | Python

The task of this assignment is to calculate the partial derivative of the loss with respect to the input of the layer. You must implement the Chain Rule. I am having a difficult time understanding conceptually how to set up the function. Any advice…
4
votes
2 answers

Can't convert expression to float

I'm trying to learn the ins and outs of symbolic manipulation in python (I'm a beginner). I have the following basic code, and the output is giving me an error telling me that it "can't convert expression to float". What's wrong with this code: from…
user3843183