Ejemplo n.º 1
0
    public void initIC()
    { // Utility function to initialise the payoff function
        currentIndex = res.MinRowIndex;
        maxIndex     = res.MaxRowIndex;

        tprev = tnow = taxis.low;

        // Initialise at the boundaries
        vecOld[vecOld.MinIndex] = pde.BCL(taxis.low);
        vecOld[vecOld.MaxIndex] = pde.BCR(taxis.high);

        // Now initialise values in interior of interval using
        // the initial function 'IC' from the PDE
        for (int j = xarr.MinIndex + 1; j <= xarr.MaxIndex - 1; j++)
        {
            vecOld[j] = pde.IC(xarr[j]);
        }


        res.Row(currentIndex, vecOld);
    }
Ejemplo n.º 2
0
    public void initIC(Vector <double> xarr)
    {             // Initialise the solutin at time zero. This occurs only
                  // at the interior mesh points of xarr (and there are J-1
                  // of them).


        vecOld = new Vector <double> (xarr.Size, xarr.MinIndex);

        // Initialise at the boundaries
        vecOld[vecOld.MinIndex] = pde.BCL(0.0);
        vecOld[vecOld.MaxIndex] = pde.BCR(0.0);

        // Now initialise values in interior of interval using
        // the initial function 'IC' from the PDE
        for (int j = xarr.MinIndex + 1; j <= xarr.MaxIndex - 1; j++)
        {
            vecOld[j] = pde.IC(xarr[j]);
        }

        result = vecOld;
    }