Let us consider find a 𝑥 such that 𝑓(𝑥)=𝑥ln(𝑥)−16=0 . First, we plot the function and it seems 𝑥 is close to 8.0.

import matplotlib
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline  

import math

def f(x):
    return x * math.log(x) - 16.0

xvals = np.arange(0.01, 10, 0.01)        
yvals = np.array([f(x) for x in xvals])
plt.plot(xvals, yvals) 
plt.plot(xvals, 0*xvals)


©️2020 CSDN 皮肤主题: 1024 设计师:上身试试 返回首页