Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(26)  |  Call(17)  |  Derive(0)  |  Import(9)

        def Newton(f, x, dfdx, epsilon=1.0E-7, N=100, store=False):
    f_value = f(x)
    n = 0
    if store: info = [(x, f_value)]
    while abs(f_value) > epsilon and n <= N:
        dfdx_value = float(dfdx(x))
        if abs(dfdx_value) < 1E-14:
            raise ValueError("Newton: f'(%g)=%g" % (x, dfdx_value))

        x = x - f_value/dfdx_value

        n += 1
        f_value = f(x)
        if store: info.append((x, f_value))
    if store:
        return x, info
    else:
        return x, n, f_value
        


src/s/c/scipro-primer-HEAD/src/class/session.py   scipro-primer(Download)
 
sys.path.insert(0, os.path.join(os.pardir, 'diffeq'))
from Newton import Newton
 
def f(x):
plot(x, y, x, y0, axis=[x[0],x[-1],-1.15,y[-1]], hardcopy='tmp.eps')
df = Derivative(f)
Newton(f, 1.01, df, epsilon=1E-5)
Newton(f, 1.01, df, epsilon=1E-10)
Newton(f, 0.92, df, epsilon=1E-10)
                   (x-0.9)**2*3*(x-1.1)**2)
 
Newton(f, 1.01, df_exact, epsilon=1E-5)
def fm(x):
    return f(x)/100000.0

src/s/c/scipro-primer-HEAD/src-3rd/class/session.py   scipro-primer(Download)
 
sys.path.insert(0, os.path.join(os.pardir, 'diffeq'))
from Newton import Newton
 
def f(x):
plot(x, y, x, y0, axis=[x[0],x[-1],-1.15,y[-1]], hardcopy='tmp.eps')
df = Derivative(f)
Newton(f, 1.01, df, epsilon=1E-5)
Newton(f, 1.01, df, epsilon=1E-10)
Newton(f, 0.92, df, epsilon=1E-10)
                   (x-0.9)**2*3*(x-1.1)**2)
 
Newton(f, 1.01, df_exact, epsilon=1E-5)
def fm(x):
    return f(x)/100000.0

src/s/c/scipro-primer-HEAD/src/diffeq/Newton_movie.py   scipro-primer(Download)
x axis in the plot has extent [xmin, xmax].
"""
from Newton import Newton
from scitools.std import *
 
    df = StringFunction(df_formula)
    df.vectorize(globals())
x, info = Newton(f, x0, df, store=True)
illustrate_Newton(info, f, df, xmin, xmax)
 

src/s/c/scipro-primer-HEAD/src-3rd/ode2/ODESolver.py   scipro-primer(Download)
# BackwardEuler needs to import function Newton from Newton.py:
try:
    from Newton import Newton
except ImportError:
    pass
        dFdw = Derivative(F)
        w_start = u[k] + dt*f(u[k], t[k])  # Forward Euler step
        u_new, n, F_value = Newton(F, w_start, dFdw, N=30)
        if k == 0:
            self.Newton_iter = []

src/s/c/scipro-primer-HEAD/src-3rd/diffeq/Newton_movie.py   scipro-primer(Download)
x axis in the plot has extent [xmin, xmax].
"""
from Newton import Newton
from scitools.std import *
 
    df = StringFunction(df_formula)
    df.vectorize(globals())
x, info = Newton(f, x0, df, store=True)
illustrate_Newton(info, f, df, xmin, xmax)
 

src/s/c/scipro-primer-HEAD/src/diffeq/inverse_function.py   scipro-primer(Download)
"""
 
from Newton import Newton
from scitools.std import *
 
        gamma0 = g[i-1]
 
    gamma, n, F_value = Newton(F, gamma0, dFdx)
    g[i] = gamma
 

src/s/c/scipro-primer-HEAD/src-3rd/diffeq/inverse_function.py   scipro-primer(Download)
"""
 
from Newton import Newton
from scitools.std import *
 
        gamma0 = g[i-1]
 
    gamma, n, F_value = Newton(F, gamma0, dFdx)
    g[i] = gamma