Title | Tutorial 9 SP - 1. Write a C++ program using Taylor’s series method to solve the equation |
---|---|
Course | Structured Programming |
Institution | Universiti Malaya |
Pages | 18 |
File Size | 245.8 KB |
File Type | |
Total Downloads | 64 |
Total Views | 140 |
1. Write a C++ program using Taylor’s series method to solve the equation ...
TUTORIAL 9 QUESTION 1 Write a C++ program using Taylor’s series method to solve the equation =3x+y2 to approximate y when x=0.1, given that y=1 when x=0. #include #include #include using namespace std; int main() { double x0=0,y0=1 , h=0.1,y1,y2,y3,y4, y; y1=3*x0 + y0*y0; y2=3+ 2*y0*y1; y3=2*y1*y1 + 2*y0*y2; y4=6*y1*y2 + 2*y0*y3; y= y0+ (y1*h) + (y2*pow(h,2))/2 + (y3*pow(h,3))/6 + (y4*pow(h,4))/24; cout...