Quantcast
Channel: Math.NET Numerics - Math.NET
Viewing all articles
Browse latest Browse all 224

Problem with NumericalDerivative, returning zeros

$
0
0

@ancailliau wrote:

Hi,

I'm trying to use numerical differentiation. Although it works with Math.Sin, it appears it is not functioning with my empirical PDF function. Here is the code:

var whiteNoise = Generate.Normal(1000, mean: 10.0, standardDeviation: 2.0);
// Console.WriteLine(string.Join(",", whiteNoise));

var ecdf = Statistics.EmpiricalCDFFunc(whiteNoise);
var data = Generate.LinearRangeMap(step: 1, start: 3.0, stop: 17.0, map: ecdf);
// Console.WriteLine(string.Join(",", data));

var derivative = new NumericalDerivative();
var epdf = derivative.CreateDerivativeFunctionHandle(ecdf, 1);
data = Generate.LinearRangeMap(step: 1, start: 3.0, stop: 17.0, map: epdf);
Console.WriteLine(string.Join(",", data));

It outputs a list of zeros. I've checked with R, and it should not return zeros. The expected values are something like this: NA 0.0030 0.0155 0.0360 0.0585 0.1140 0.1780 0.1920 0.1705 0.1210 0.0660 0.0310 0.0105 0.0030 NA

However, I'm not 100% sure that I'm using the library correctly.

Thanks in advance for the help :slight_smile:

Antoine

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 224

Trending Articles