public double function( double i )
    {
        switch( type ) 
        {
            case 1: return function_hill_valley(i);
            case 2: return function_downhill(i);
            case 3: return function_stairs(i);
            default: return 0;
        }
    }