Question

Comment puis-je résoudre cette équation

  

x 3 + x - 1 = 0

en utilisant itération de point fixe?

Y at-il point fixe itération code (en particulier en Python) je peux trouver en ligne?

Était-ce utile?

La solution

Utilisation scipy.optimize.fixed_point :

import scipy.optimize as optimize

def func(x):
    return -x**3+1

# This finds the value of x such that func(x) = x, that is, where
# -x**3 + 1 = x
print(optimize.fixed_point(func,0))
# 0.682327803828

Le code Python définissant fixed_point est en scipy / optimiser / minpack.py. L'emplacement exact dépend de l'endroit où scipy est installé. Vous pouvez constater que en tapant

In [63]: import scipy.optimize

In [64]: scipy.optimize
Out[64]: <module 'scipy.optimize' from '/usr/lib/python2.6/dist-packages/scipy/optimize/__init__.pyc'>

Le code actuel source fixed_point est disponible en ligne en allant à la page de documentation et en cliquant sur le lien [source].

scroll top