Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please solve in python code 4. Suppose we wish to solve the boundary-value problem: y4y=0,y(1)=2y(1)=3 One way to solve this problem is to approximate y(x)
Please solve in python code
4. Suppose we wish to solve the boundary-value problem: y4y=0,y(1)=2y(1)=3 One way to solve this problem is to approximate y(x) as a nth-order Chebyshev polynomia p(x). This recasts the problem as p(x)4p(x)=0,p(1)=2p(1)=3 Just like y(x),p(x) is unknown. However, it is uniquely defined by n+1 points. Therefore, we can recast the boundary-value problem as the solution of n+1 equations. Two of the points are given by the boundary conditions. If we assume that the n+1 points are Chebyshev points on the domain [1,1] (e.g. xi=cos(i for i=0,,n.), then the boundary conditions yield the following two equations: p(x0)=2p(xn)=3 The remaining points, in the interior, need to satisy the equations: p(x1)2p(x1)=0p(xn1)2p(xn1)=0 The unknowns are the n+1 coefficients for the polynomials. We also have n+1 equations to solve for the n+1 unknowns. Therefore, we can determine these coefficients using the root command. p(x) is a polynomial of order n-1, whose coefficents are linear combinations of the coefficients of p(x). In the polynomial class within numpy, there is a builtin function for taking the derivatives of the polynomials (similar to your previous homework problem). As an example: p=[1,2,3,4]#T(x)+2T1(x)+3T2(x)+4T3(x) pd = chebder (p)# first derivative print (pd) \#[14., 12.24. pd2 = chebder (p,2)# second derivative print (pd2) \#[ 12.86. print (polyval (5,pd2)) \# second derivative evaluates at x=5:492.0 Your task is to take the concepts above and then solve the boundary-value problem above for n=20. plot of the solution, which your code should generate, is given below: Your task is to take the concepts above and then solve the boundary-value problem above for n=20. plot of the solution, which your code should generate, is given below: The blue dots represent the n+1 points used to solve the equation at these points the polynomial exactly solves the boundary-value problem. This strategy for solving boundaryvalue problems is known as collocation and is also referred to as a spectral method
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started