Question: 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

Answer: 
Usually you work out the formula for the derivative on your own, and if memory serves `d/dx[log_b x] = [1/(x ln b)] dx`. If `A(t)` is a simple array:

```
double log_b = Math.Log(10); // Assumes Math.Log = ln and b = 10
double dt = 1.0;             // dt is 1 in this case, change if otherwise

double[] W = new double[A.GetLength(0)];
for (int t = 0; t < A.GetLength(0); ++t)
{
    W[t] = dt / (A[t] * log_b);
}

```
I think many of the answers are overthinking this. `d/dt(log(x))` is just `1/x`, so you just need to calculate the reciprocal for each point in the array `A`.

```
double[] W = Array.ConvertAll<double, double>(A, x => 1.0 / x);

```