Questions tagged [differentiation]

The process of finding a derivative.

In calculus, a branch of mathematics, the derivative is a measure of how a function changes 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.

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.

216 questions
3
votes
1 answer

Avoid sorting args in Python module Sympy

I am currently developing a differential operator for sympy that can be placed in matricial form. In this case the order of the args list when creating a Mul object is very important to guarantee that the differentiation is performed where it is…
Saullo G. P. Castro
  • 49,101
  • 22
  • 160
  • 223
3
votes
2 answers

Why derivative of a function is used to calculate Local Minimum instead of the actual function?

In Machine learning regression problem, why the local minimum is computed for a derivative function instead of the actual function? Example: http://en.wikipedia.org/wiki/Gradient_descent The gradient descent algorithm is applied to find a local…
2
votes
1 answer

How to do numeric differentiation using Boost Units?

I would like to perform a numeric differentiation in C++. For type safety, I'd like to use boost::units to avoid mixing units but also boost::units::absolute to avoid mixing relative and absolute units. A minimal example is to calculate the velocity…
user2968115
  • 123
  • 7
2
votes
1 answer

Custom Gradients in Tensor Flow - Unable to understand this example

I keep thinking that I am about to understand custom gradients but then I test it out this example and I can just not figure out what is going on. I am hoping somebody can walk me through what exactly is happening below. I think this essentially is…
briry12
  • 21
  • 3
2
votes
1 answer

Partial differentiation using Coqelicot on Coq

I want to partially differentiate functions which expects n arguments for arbitrary natural number n. I hope to differentiate arbitrary an argument only once and not the others. Require Import Reals. Open Scope R_scope. Definition myFunc (x y z:R)…
Daisuke Sugawara
  • 281
  • 3
  • 18
2
votes
1 answer

PyTorch: Is it possible to differentiate a matrix?

How do you differentiate a matrix in PyTorch? I have tried the following but neither work: Instance 1: a = torch.tensor([1., 2, 3], requires_grad=True) b = torch.tensor([4., 5, 6], requires_grad=True) c = a*b c.backward() #print(b.grad) >>>…
DexYap
  • 195
  • 1
  • 10
2
votes
0 answers

numericDeriv alters result of eval in R?

I've run into something unexpected (for me, maybe). Take a look at the code bellow: > env1 = new.env() > env1$x = rnorm(10) > env1$a = 3 > eval(quote(x^a), env1) [1] 0.26046508 1.37188255 -0.17077313 0.25959068 -3.38565765 [6] 0.11537940…
rcon1
  • 21
  • 3
2
votes
0 answers

Maxima: equations: eliminate variable inside diff() expression

I have this code: (%i3)depends([y,x],t)$ eqsp: [y=2*x, v=diff(y,t,1)+y]; eliminate(eqsp,[y]); (eqsp) [y=2*x,v='diff(y,t,1)+y] (%o3) [-'diff(y,t,1)-2*x+v] And this is a picture for better visualization: PNG of code in wxMaxima I…
2
votes
0 answers

Gradient computation in Tensorflow

I am using Tensorflow v1.14 for creating networks and training them. Everything works fine and I don't have any problem with code. I use the function tf.reduce_min() in my loss function. For the gradients to flow, it is essential that the loss…
learner
  • 1,990
  • 1
  • 9
  • 23
2
votes
0 answers

Why does mpmath-function "diff" produce error AttributeError: 'MPContext' object has no attribute 'difference'?

I wanted to differentiate a function by using mpmaths function diff. In order to just try if everything works on a simple example, I used an example being described in the documentary. But it threw the error "AttributeError: 'MPContext' object has…
Johnny A
  • 21
  • 3
2
votes
1 answer

maxima gradef differentiation

I try to define the derivative of the standard normal pdf in terms of the function: φ(x) := exp (-x^2/2)/sqrt(2 * %pi); gradef(φ(x),-x*φ(x)); but if I type then: diff(φ(x),x); I get: -(x*%e^(-x^2/2))/(sqrt(2)*sqrt(%pi))` not as I want…
Karl
  • 263
  • 3
  • 9
2
votes
2 answers

From symbolic to proper differentiation in Maxima

I'm struggling to find a way to switch from a symbolic declaration of the differential operator to its implementation I give you an example. F: (10-'diff(x(t),t)^2 -2*x(t)*'diff(x(t),t) -5*x(t)^2)*%e^(-t); E: ratsimp(diff(F, x(t)) - diff(diff(F,…
Marco Repetto
  • 123
  • 1
  • 12
2
votes
0 answers

OCaml Function to Perform Differentiation

I'm currently studying the language OCaml, and was solving an exercise problem when I came across a question that I can't seem to wrap my head around. Here's the question: "Write a function differentiate : expression * string -> expression that…
Seankala
  • 1,988
  • 4
  • 22
  • 43
2
votes
1 answer

How to fix shift and scaling errors in an FFT-powered differentiation program?

So I am trying, like many others before me, to sift through all the celestial alignments of phase shifts and normalization coefficients necessary to make differentiation via Fourier transform work. I am trying to use as little code as possible,…
urquiza
  • 277
  • 1
  • 9
2
votes
0 answers

How do I compute Divergence and Curl for 2D vector fields?

I'm coding an applet that displays 2D vector fields in Processing. On a 1000x1000 canvas, I'm drawing a 20-pixel-long arrow starting from every point identified by a grid on the canvas with a direction relative to the components of the vector…
Alberto
  • 21
  • 2
1 2
3
14 15