示例#1
0
            public SplitFunction(IntegrableFunction <R, S> first, R tsplit, IntegrableFunction <R, S> second, bool seal = false)
            {
                s   = seal;
                f1  = first;
                f2  = second;
                t   = tsplit;
                ft  = first.F(t);
                fit = first.FI(t);
                sit = second.FI(t);
                st  = second.F(t);
#if (USING_EXPRESSIONS)
                deltat = Operations <S> .Sub(ft, st);

                deltait = Operations <S> .Sub(fit, sit);
#else
                deltat  = (dynamic)ft - st;
                deltait = (dynamic)fit - sit;
#endif
                if (seal)
                {
                    f2 += new PolyFunc <S, R>(deltat);

                    sit = f2.FI(t);
#if (USING_EXPRESSIONS)
                    deltait = Operations <S> .Sub(fit, sit);
#else
                    deltait = (dynamic)fit - sit;
#endif
                }

                fSt = x =>
                {
                    if ((dynamic)x < t)
                    {
                        return(f1.F(x));
                    }
                    return(f2.F(x));
                };
                fISt = x =>
                {
                    if ((dynamic)x < t)
                    {
                        return(f1.FI(x));
                    }
#if (USING_EXPRESSIONS)
                    return(Operations <S> .Add(f2.FI(x), deltait));
#else
                    return((dynamic)f2.FI(x) + deltait);
#endif
                };
            }
示例#2
0
 public TC this[int i]
 {
     get
     {
         return(coeffs[i]);
     }
     set
     {
         if (i >= coeffs.Dimension)
         {
             coeffs = coeffs.MakeDim(i + 1);
         }
         coeffs[i] = value;
         integral  = null; derivative = null;
     }
 }