# This is a sample Python script.
import math

import numpy as np
import matplotlib.pyplot as plt
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
C = math.sqrt((15+math.sqrt(65))/8)

def f(x):
    return np.exp(x**3-2*x**2)-1
# Press the green button in the gutter to run the script.
def f_prime(x):
    return np.exp(x**3-2*x**2)*(3*x**2 - 4 * x)



def fixed_iterator(x):
    tmp = 0
    while(tmp<10000):
        tmp+=1
        x = f(x)
    return x
if __name__ == '__main__':
    print(fixed_iterator(-0.8))
    x = np.linspace(-1.0104, -0.8104, 2000)
    y = fixed_iterator(x)
    print(np.max(f_prime(x)))
    print(np.min(f_prime(x)))
    print(np.max(f(x)))
    print(np.min(f(x)))
    plt.plot(x, y,
            label=r'$e^{-\frac{2}{5}\left(\frac{x}{2.3}\right)^4 + \frac{3}{2}\left(\frac{x}{2.3}\right)^2} - 1$')
    plt.title("Graph of the Function")
    plt.xlabel("x")
    # plt.ylabel("f(x)")

    # 显示图例
    plt.legend()

    # 显示网格
    plt.grid(True)

    # 显示图像
    plt.show()

# See PyCharm help at https://www.jetbrains.com/help/pycharm/
