Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168695
Image: ubuntu2004
#illustration of minimax problem of interpolation #equally spaced points from numpy import linspace x = var('x') #equally spaced points between -1.0 and 1.0 xpoints = linspace(start=-1.0, stop= 1.0, num = 9) #create an array of the terms for interpolation error polynomial terms = [x- xpoints[i] for i in range(xpoints.size)] #multiply the terms together and place in a fuction func = prod(terms) p = plot(func) #create tuple of points for which y(x) = 0 pointsAtZero = [[xpoints[i],0] for i in range(xpoints.size)] p1 = list_plot(pointsAtZero, rgbcolor = (1,0,0)) (p + p1).show(ymax = .02)