#! /opt/sage/sage
# @file runSLZ-05.sage
#from scipy.constants.codata import precision
def initialize_env():
    """
    Load all necessary modules.
    """
    compiledSpyxDir = "/home/storres/recherche/arithmetique/pobysoPythonSage/compiledSpyx"
    if compiledSpyxDir not in sys.path:
        sys.path.append(compiledSpyxDir)
    if not 'mpfi' in sage.misc.cython.standard_libs:
        sage.misc.cython.standard_libs.append('mpfi')
    load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sollya_lib.sage")
    #load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageMpfr.spyx")
    load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/pobyso.py")
    load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageSLZ.sage")
    load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageNumericalOperations.sage")
    load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRationalOperations.sage")
    # Matrix operations are loaded by polynomial operations.
    load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sagePolynomialOperations.sage")
    load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRunSLZ.sage")


print "Running SLZ..."
initialize_env()
from sageMpfr import *
from sageGMP  import *
#
x = var('x')
func(x) = exp(x)
precision = 53
RRR = RealField(precision)
intervalCenter      = RRR(3/2)
icUlp               = intervalCenter.ulp()
intervalRadiusInUlp = 2^8
intervalRadius      = RRR(2^(-35))          
srs_run_SLZ_v06(inputFunction           = func, 
                inputLowerBound         = intervalCenter - intervalRadiusInUlp * icUlp, 
                inputUpperBound         = intervalCenter + intervalRadiusInUlp * icUlp, 
                alpha                   = 2, 
                degree                  = 2, 
                precision               = precision, 
                emin                    = -1022, 
                emax                    = 1023, 
                targetHardnessToRound   = precision + 10, 
                debug                   = True)
#
