Numerical Laplace Transform in C# to an array
Posted: July 3rd, 2010, 3:20 pm
Numerical Laplace Transform in C#I am looking for some help in converting the below code from the website below into a formula that can use an array http://www.codeproject.com/KB/recipes/L ... aspxpublic static double Transform(FunctionDelegate F, double s) { const int DefaultIntegralN = 5000; double du = 0.5 / (double)DefaultIntegralN; double y = - F(0) / 2.0; double u = 0; double limit = 1.0 - 1e-10; while (u < limit) { u += du; y += 2.0 * Math.Pow(u, s - 1) * F(-Math.Log(u)); u += du; y += Math.Pow(u, s - 1) * F(-Math.Log(u)); } return 2.0 * y * du / 3.0; } double F(double t) { return 1.0 / Math.Exp(2.0*t); } ... double LCalc = Laplace.Transform(F, 2);///////////////////////////////////////////////////////////This is my assumption, then I would like to understand more about this formula, and try to explain what I want to do with itpublic static double Transform([]Myarray, double s) { const int DefaultIntegralN = 5000; int Arraylength =Myarray.Length; double y = - Myarray[0] / 2.0; double u = 0; double limit = 1.0 - 1e-10; while (u < Arraylength) { u += 1; y += 2.0 * Math.Pow(Myarray[u-1], s - 1) * -Math.Log(Myarray[u-1]); u += 1; y += Math.Pow(Myarray[u-1], s - 1) * Math.Log(Myarray[u-1]); } return 2.0 * y * 1 / 3.0; }//Called by double LCalc = Laplace.Transform(MyArray, 2);They array will be of type double and contain real numbers.I am looking to use this formula to compare and adjust a numbers post and pre-processingThe context is(All numbers stored in an array)Original number>extract laplaceSend to Haar TransformArray post Haar> extract laplaceCompare both resultsAdjust Post Haar result.///////////////////////////After reading up on Laplace, I am assuming the 2 results can be compared, and if the properties of post Haar transform have changed, I can adjust the post Haar transform.Thanks for reading, hope you can understand and helpTinkerz