2

I have a set of numerical data of 1501 points, in the form of $\{x_i,a_i\}$ which I uploaded to here and here.

I need to compute the numerical derivative of this data. In particular, I need the quantities

\begin{equation} C=\frac{1}{\left| \frac{da}{dx} \right|}, \hspace{1cm} D = C' = \frac{dC}{dx} \end{equation}

To do this, I interpolated the data given in the link,

data = Get["https://pastebin.com/raw/Ccvm7Bgp"];
Interp = Interpolation[data];
Plot[Interp[x], {x, 0, x[[1501]]}, PlotRange -> All]

plot

Then I computed C by

DInterp[x_] := Interp'[x];
C[x_] := 1/Abs[DInterp[x]];

But DInterp and, consequently, C (shown below) are very noisy, let alone sC'$:

This is the derivative of the interpolation, Dinterp

This is the derivative of the interpolation, Dinterp

This is C

This is C

How can I solve this? I need to determine $C$ and $C'$ very precisely, how to I get rid of the noise to achieve this?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Sth99
  • 86
  • 4
  • 2
    Not at a computer right now, but one look at your axes tells me you chose a poor scaling of your variables. – J. M.'s missing motivation Sep 30 '18 at 16:43
  • 2
    The numbers you are working with are so small that your computations can not be made accurately enough using machine arithmetic. You can try rescaling as J.M. suggests or maybe try working with arbitrary precision arithmetic. – m_goldberg Sep 30 '18 at 17:04
  • Somewhat related: https://mathematica.stackexchange.com/q/90130/1871 – xzczd Sep 30 '18 at 17:05
  • 1
    Just tested your data, only to encounter Interpolation::inddp warning. Also, something is apparently wrong with {x, 0, x[[1501]]}. Please double-check your code sample. – xzczd Sep 30 '18 at 17:12
  • J.M. and m_goldberg, thank you for the replies. Would it make any difference working with different accuracies? xzczd, I meant to write {x, 0, data[[1501,1]]}, not use x in both places, sorry about that. – Sth99 Sep 30 '18 at 17:30
  • I think the problem is "quantisation noise" in your data. Your step size is small compared with the accuracy with which the numbers are specified. I think you can get better results by e.g. taking only every 10th point. – mikado Sep 30 '18 at 17:46
  • mikado and AccidentalFourierTransform, thank you! – Sth99 Sep 30 '18 at 18:19
  • Please correct those mistakes by clicking the edit button in the left bottom corner of your post. – xzczd Oct 01 '18 at 07:21

0 Answers0