Message Boards Message Boards

How do interpolated functions interact with symbolic derivatives?

Posted 10 months ago

Hi!

I'm having a bit of an issue with large symbolic derivatives involving interpolated functions. Basically, I have an interpolated function f(t) defined by the following code.

noise = Interpolation[
   Normal[RandomFunction[WhiteNoiseProcess[0.000025], {0, tmax}]][[
    1]]];
NDSolve[{lineTension'[t] + 1/150*lineTension[t] == noise[t], 
  lineTension[0] == 0}, lineTension, {t, 0, tmax}, AccuracyGoal -> 2, 
 PrecisionGoal -> 3]

I'm aware that making white noise continuous defeats the point of white noise in any given time segment being uncorrelated with other segments, but it's a neat way to get a random walk of the form I want.

Next I use this to define a function and take a partial derivative with respect to a different variable (not t).

The following is a simplified version of this code:

E[diagram_] :=  Sum[lineTension[t]*EuclideanDistance[Subscript[v, i],Subscript[v, i+1]), {i, 
       Length[edges]}]

Then

force[diagram_] := 
 Sum[-D[E[diagram], Subscript[x,i]],{i,Length[vertices]}]

if the code doesn't make sense I cut out a bunch of lists and things so I wouldn't have to include 40 datafiles for it to make sense.

Anyways, when I time the calculation of the force, it massively increases as the standard deviation of the white noise from the initial creation of the lineTension function. This makes no sense to me, because the lineTension function is a function of t, whereas I'm taking the derivative with respect to a bunch of x_i's. It should be treated as a constant.

Thanks! Kaden.

POSTED BY: Kaden Tro
4 Replies

I don't understand what EuclideanDistance[Subscript[v, i], Subscript[v, i + 1]] means.

EuclideanDistance[u,v] is the distance between two points in space, but you are applying it to two coordinates of the same point.

POSTED BY: Gianluca Gorni

Oops

POSTED BY: Kaden Tro

Without working code, D[EuclideanDistance[xi, xj], xi] doesn't make a lot of sense to me, since D[] is the partial derivative operator. Thus xi etc. should be scalars for D[] and vectors for EuclideanDistance[]. But if the xi etc. are stand-ins for other values, maybe it could make sense somehow.

POSTED BY: Michael Rogers

Ah that's my bad, the xi's in the EuclideanDistance[] should probably be labeled vi, as they're vectors, and I'm taking the derivative with respect to their x components.

POSTED BY: Kaden Tro
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract