using System; using Science.Mathematics; using L=Science.Mathematics.IntegralEquation; namespace ScienceTest.MathematicsTest.IntegralEquationTest { /// /// InhomogeneousVolterraEquationSecondKindTest. /// public class InhomogeneousVolterraEquationSecondKindTest { public InhomogeneousVolterraEquationSecondKindTest() { } private string result; public string Result { get{return result;} } public void Compute() { Function.IntIntDoubleDoubleToDouble K = new Function.IntIntDoubleDoubleToDouble(kernel); Function.IntDoubleToDouble g = new Function.IntDoubleToDouble(function); L.InhomogeneousVolterraEquationSecondKind eq = new L.InhomogeneousVolterraEquationSecondKind(); eq.Kernel = K; eq.KernelFunction = g; eq.From = 0.0; eq.NumberOfSteps = 30; eq.StepSize = 0.001; eq.NumberOfCoupledFunctions = 2; eq.Solve(); for(int i=0; i < eq.NumberOfSteps; i++) result += Convert.ToString(eq.At[i])+"\r\n"; for(int k=0; k < eq.NumberOfCoupledFunctions; k++) for(int i=0; i < eq.NumberOfSteps; i++) result += Convert.ToString(eq.Solution[k,i])+"\r\n"; } private double kernel(int k, int l, double t, double s) { return (k==0? (l==0? - Math.Exp(t-s) : -Math.Cos(t-s)): (l==0? - Math.Exp(t+s) : -t*Math.Cos(t-s))); } private double function(int k, double t) { return (k==0? Math.Cosh(t)+t*Math.Sin(t) : 2.0*Math.Sin(t)+t*(Math.Sin(t)*Math.Sin(t)+Math.Exp(t))); } } }