コード例 #1
0
        private void UpdateChangingValue(SimpsonIntegral integral, double value)
        {
            switch (SelectedParameter)
            {
            case SelectedParameter.Alpha:
                integral.Alpha = value;
                break;

            case SelectedParameter.Betta:
                integral.Betta = value;
                break;

            case SelectedParameter.Gamma:
                integral.Gamma = value;
                break;

            case SelectedParameter.Delta:
                integral.Delta = value;
                break;

            case SelectedParameter.Epsilon:
                integral.Epsilon = value;
                break;
            }
        }
コード例 #2
0
    private double Rp(double I)
    {
        I = Math.Abs(I);

        double T(double r)
        {
            Interpolation itp = new LinearInterpolation(t0Table.I, t0Table.T0);
            double        t0  = itp.FindValue(I);

            itp = new LinearInterpolation(mTable.I, mTable.M);
            double m = itp.FindValue(I);

            return((Tw - t0) * Math.Pow((r / R), m) + t0);
        }

        double f(double p)
        {
            Integral itgN = new SimpsonIntegral(r =>
            {
                Interpolation2 ditp = new LinearLogInterpolation2(nTable.T, nTable.P, nTable.N);
                double n            = ditp.FindValue(T(r), p);
                return(n * r);
            });

            return((2 / Math.Pow(R, 2)) * itgN.FindValue(0, R, INTEGRAL_NODES) - (P0 * 7242 / Ts));
        }

        Dichotomy dch    = new Dichotomy(f);
        double    pValue = 1;
        double    h      = 1;

        while (f(pValue) * f(pValue + h) > 0)
        {
            pValue += h;
        }
        pValue = dch.FindSolution(pValue, pValue + h);

        Integral itgSigma = new SimpsonIntegral(r =>
        {
            Interpolation2 ditp = new LinearLogInterpolation2(sigmaTable.T, sigmaTable.P, sigmaTable.Sigma);
            double n            = ditp.FindValue(T(r), pValue);
            return(n * r);
        });

        return(Le / (2 * Math.PI * itgSigma.FindValue(0, R, INTEGRAL_NODES)));
    }
コード例 #3
0
        public void Update(double plotWidth)
        {
            double          step       = (RightBorder - LeftBorder) / plotWidth;
            SimpsonIntegral calculator = new SimpsonIntegral
            {
                Alpha         = Alpha,
                Betta         = Betta,
                Gamma         = Gamma,
                Delta         = Delta,
                Epsilon       = Epsilon,
                IntegralStart = IntegralStart,
                IntegralEnd   = IntegralEnd,
                NumberOfParts = InitialNumberOfParts,
                Precision     = CalculationError
            };
            List <DataPoint> graphPoints     = new List <DataPoint>();
            double           currentPosition = LeftBorder;
            int maxNumberOfParts             = -1;

            while (currentPosition < RightBorder + 1) // margin of error
            {
                UpdateChangingValue(calculator, currentPosition);
                calculator.NumberOfParts = InitialNumberOfParts;

                graphPoints.Add(new DataPoint(currentPosition, calculator.CalculateIntegral()));

                if (calculator.NumberOfParts > maxNumberOfParts)
                {
                    maxNumberOfParts = calculator.NumberOfParts;
                }

                currentPosition += step;
            }

            MaximumNumberOfParts = maxNumberOfParts;
            DataPoints           = graphPoints;
        }
コード例 #4
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SimpsonIntegral obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
コード例 #5
0
ファイル: SimpsonIntegral.cs プロジェクト: minikie/test
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SimpsonIntegral obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }