Page 1 of 1

Numerical Laplace Transform in C# to an array

Posted: July 3rd, 2010, 3:20 pm
by Tinkerz1
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

Numerical Laplace Transform in C# to an array

Posted: July 3rd, 2010, 4:09 pm
by Cuchulainn
QuoteI am looking for some help in converting the below code from the website below into a formula that can use an array I am having difficulty: what is the desired output from your new function and what is the given input? If we know that then the rest becomes easier. In particular, the relation between the delegate and myArray. My guess is that you want to call the LT with an array instead of a function delegate and these numbers are the discretised function values at mesh points. Don't you need a factory to create an array of function from a delegate based on x abscissae values?

Numerical Laplace Transform in C# to an array

Posted: July 3rd, 2010, 4:50 pm
by Tinkerz1
I have an array of data that has been passed through a high bypass filter.After reading up on LP, I thought it was the solution.If I run LP on the High Bypass filter data, then pass the High Bypass filter data to a Haar wavelet to get the frequency.I can then check via LP post High Bypass filter data and post Haar wavelet to check how much has changed via LPT moments.But I must be mislead, its sounds like its going to get very complicatedTinkerz

Numerical Laplace Transform in C# to an array

Posted: December 20th, 2011, 12:29 pm
by PavelG
I need to calculate inverse laplace transform at zero, but this algorithm is infinit at zero http://www.codeproject.com/KB/recipes/L ... forms.aspx / How to handke this case? Thx!!!!

Numerical Laplace Transform in C# to an array

Posted: December 22nd, 2011, 1:53 pm
by AVt
If L is the Laplace transform of a function f, then the inverse Laplace transformof L gives you back the function f, thus you want f(0) or may be the limit.There is however no need, that f(0) exists: for taking f = log you will haveL(s) = -(const + log(s)) / s for any positive s, but for the inverse you areasking for log(0).In case you are sure it exists (say: f(t) = exp(-t^2)) you may try to approximatef(0) by some f(epsilon), say epsilon = 1E-10.