import%20marimo%0A%0A__generated_with%20%3D%20%220.18.4%22%0Aapp%20%3D%20marimo.App()%0A%0Awith%20app.setup%3A%0A%20%20%20%20%23%20Import%20the%20chebyshev%20module%20from%20chebpy%0A%20%20%20%20import%20chebpy.chebyshev%20as%20cheb%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20%23%20Create%20a%20constant%20Chebyshev%20polynomial%20with%20value%205%0A%20%20%20%20%23%20from_constant%20creates%20a%20degree%200%20polynomial%20representing%20a%20constant%20function%0A%20%20%20%20f%20%3D%20cheb.from_constant(c%3D5)%0A%20%20%20%20f%0A%20%20%20%20return%20(f%2C)%0A%0A%0A%40app.cell%0Adef%20_(f)%3A%0A%20%20%20%20%23%20Check%20if%20the%20polynomial%20is%20a%20constant%20function%0A%20%20%20%20%23%20Returns%20True%20for%20our%20example%20since%20we%20created%20a%20constant%20polynomial%0A%20%20%20%20f.isconst%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(f)%3A%0A%20%20%20%20%23%20Check%20if%20the%20polynomial%20has%20complex%20coefficients%0A%20%20%20%20%23%20Returns%20False%20for%20our%20example%20since%20we%20used%20a%20real%20constant%0A%20%20%20%20f.iscomplex%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(f)%3A%0A%20%20%20%20%23%20Check%20if%20the%20polynomial%20is%20empty%20(has%20no%20coefficients)%0A%20%20%20%20%23%20Returns%20False%20for%20our%20example%20since%20we%20have%20a%20non-empty%20polynomial%0A%20%20%20%20f.isempty%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(f)%3A%0A%20%20%20%20%23%20Get%20the%20size%20(number%20of%20coefficients)%20of%20the%20polynomial%0A%20%20%20%20%23%20For%20a%20constant%20polynomial%2C%20this%20is%201%0A%20%20%20%20f.size%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(f)%3A%0A%20%20%20%20%23%20Get%20the%20symbol%20used%20for%20the%20independent%20variable%20in%20the%20polynomial%0A%20%20%20%20%23%20By%20default%2C%20this%20is%20'x'%0A%20%20%20%20f.symbol%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(f)%3A%0A%20%20%20%20%23%20Get%20the%20values%20of%20the%20polynomial%20at%20Chebyshev%20points%0A%20%20%20%20%23%20These%20are%20the%20function%20values%20at%20specific%20points%20in%20the%20domain%0A%20%20%20%20f.values%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(f)%3A%0A%20%20%20%20%23%20Get%20the%20vertical%20scale%20of%20the%20polynomial%0A%20%20%20%20%23%20This%20is%20the%20maximum%20absolute%20value%20of%20the%20function%20values%0A%20%20%20%20f.vscale%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(f)%3A%0A%20%20%20%20%23%20Calculate%20the%20indefinite%20integral%20(antiderivative)%20of%20the%20polynomial%0A%20%20%20%20%23%20For%20a%20constant%20polynomial%20f(x)%20%3D%205%2C%20the%20result%20is%20f(x)%20%3D%205x%20%2B%20C%0A%20%20%20%20f.cumsum()%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(f)%3A%0A%20%20%20%20%23%20Calculate%20the%20definite%20integral%20of%20the%20polynomial%20over%20its%20domain%0A%20%20%20%20%23%20For%20a%20constant%20polynomial%20f(x)%20%3D%205%20on%20domain%20%5B-1%2C%201%5D%2C%20this%20is%205%20*%20(1%20-%20(-1))%20%3D%2010%0A%20%20%20%20f.sum()%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(f)%3A%0A%20%20%20%20%23%20Get%20the%20degree%20of%20the%20polynomial%0A%20%20%20%20%23%20For%20a%20constant%20polynomial%2C%20the%20degree%20is%200%0A%20%20%20%20f.degree()%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(f)%3A%0A%20%20%20%20%23%20Calculate%20the%20derivative%20of%20the%20polynomial%0A%20%20%20%20%23%20For%20a%20constant%20polynomial%2C%20the%20derivative%20is%20zero%0A%20%20%20%20f.deriv()%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(f)%3A%0A%20%20%20%20%23%20Get%20the%20domain%20of%20the%20polynomial%0A%20%20%20%20%23%20By%20default%2C%20Chebyshev%20polynomials%20are%20defined%20on%20%5B-1%2C%201%5D%0A%20%20%20%20f.domain%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(f)%3A%0A%20%20%20%20%23%20Plot%20the%20polynomial%20over%20its%20domain%0A%20%20%20%20%23%20For%20a%20constant%20polynomial%2C%20this%20is%20a%20horizontal%20line%0A%20%20%20%20f.plot()%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(f)%3A%0A%20%20%20%20%23%20Find%20the%20roots%20of%20the%20polynomial%0A%20%20%20%20%23%20A%20constant%20polynomial%20(unless%20it's%20zero)%20has%20no%20roots%0A%20%20%20%20f.roots()%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(f)%3A%0A%20%20%20%20%23%20Extend%20the%20polynomial%20to%20a%20higher%20degree%20representation%0A%20%20%20%20%23%20This%20doesn't%20change%20the%20function%20but%20increases%20the%20internal%20representation%20size%0A%20%20%20%20f.prolong(n%3D4)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(f)%3A%0A%20%20%20%20%23%20Get%20the%20name%20of%20the%20basis%20used%20for%20the%20polynomial%0A%20%20%20%20%23%20This%20should%20be%20'Chebyshev'%20for%20our%20polynomial%0A%20%20%20%20f.basis_name%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(f)%3A%0A%20%20%20%20%23%20Get%20a%20specific%20basis%20polynomial%20of%20the%20given%20degree%0A%20%20%20%20%23%20This%20returns%20the%20Chebyshev%20polynomial%20T_1(x)%20%3D%20x%0A%20%20%20%20f.basis(deg%3D1)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20%23%20Empty%20cell%20for%20additional%20experimentation%0A%20%20%20%20return%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
5015b3d4421c2a779ed219e4502f0855