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.ToLastType K = new Function.ToLastType(kernel); Function.ToLastType g = new Function.ToLastType(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))); } } } /* 0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01 0.011 0.012 0.013 0.014 0.015 0.016 0.017 0.018 0.019 0.02 0.021 0.022 0.023 0.024 0.025 0.026 0.027 0.028 0.029 1 0.999000499500208 0.998001998001332 0.99700449450487 0.996007988013317 0.995012477530168 0.994017962059912 0.993024440608033 0.99203191218101 0.991040375786317 0.990049830432418 0.98906027512877 0.988071708885821 0.987084130715011 0.986097539628766 0.985111934640504 0.98412731476463 0.983143679016535 0.982161026412598 0.981179355970184 0.980198666707643 0.979218957644312 0.978240227800507 0.977262476197532 0.976285701857674 0.9753099038042 0.974335081061361 0.973361232654387 0.972388357609492 0.971416454953872 0 0.00199999966683343 0.00399999733399704 0.00599999100146964 0.0079999786691941 0.00999995833705924 0.0119999280048819 0.013999885672389 0.0159998293391994 0.0179997570048059 0.0199996666685576 0.0219995563296413 0.023999423987064 0.0259992676396349 0.0279990852859472 0.02999887492436 0.031998634552981 0.0339983621696475 0.0359980557719096 0.0379977133570111 0.0399973329218725 0.0419969124630724 0.04399644997683 0.0459959434589869 0.0479953909049889 0.0499947903098691 0.0519941396682286 0.0539934369742197 0.0559926802215275 0.0579918674033519 */