Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementation of differentiation in C#

Tags:

c#

math

I have the following differentiation, I need to implement it in C#:

W(t)=d/dt(log(A(t)))

Where A(t) is a array of double data.

How can I obtain the resulting W(t) array from the derivative above?

Thanks

edit:

public double[,] derivative()
{
    dvdt = new double[envelope.GetLength(0), envelope.GetLength(1)];
    int h = 1;

    for (int j = 0; j < envelope.GetLength(0); j++)
    {
        for (int i = 0; i < envelope.GetLength(1)-1 ; i++)
        {
            dvdt[j, i] = (envelope[j, i + h] - envelope[j, i]) / (h);
        }
    }
    return dvdt;
}

I found this library http://autodiff.codeplex.com/ but i cant understand how the sample code is working and how i can apply it to my problem eh

like image 726
Tristan Demanuele Avatar asked Mar 31 '11 16:03

Tristan Demanuele


1 Answers

None of this directly addresses your question, but it may help you to get moving again. Getting stuck on trivial items in your thesis can be a royal pain.

Do you have access to Mathematica? Last I checked they had a .NET wrapper around their core engine called .NET/Link.

The performance of Mathematica is stellar. Also, it now supports resources such as GPUs and clusters which could provide a huge performance boost if any of your app lends itself to parallelization.

This would let you focus on the rest of your app instead of having to reinvent the wheel. Also, since you could enter your formulas directly in the Mathematica notebook editor, you could take a more generic, data-driven approach from the C# side.

Here is some typically-impenetrable Wolfram documentation.

See also this thread about parsing Mathematica in C#.

(I only recommend Mathematica because you mentioned that you may need a solver for more than one formula/equation/etc. Unless implementing the solver is a core part of your theses topic, I'd recommend using an off-the-shelf component like this and focusing on your original research.)

like image 55
3Dave Avatar answered Sep 28 '22 19:09

3Dave