Homework #5

Homework #5 - /* MAE 9: Homework #5, Fall 2008 Due on...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 /* MAE 9: Homework #5, Fall 2008 Due on Monday, November 3, by 9:00pm Scan two doubles a and b (a<b). Integrate numerically y=0.5*exp(sin(x))-1.5*pow(x,2) from x=a to x=b. Use the program based on trapezoidal rule of integration discussed in class (Problem w4-10.c from subdirectory /public/lecture/week4.c). Use two do/while statements to continue the calculations for different n_trap and different a and b. For example, use ask=1 to continue calculations for different n_term within the inner do/while loop, and ask=0 to exit that loop. Use flag=1 to continue calculations for different a and b within the outer do/while loop, and flag=0 to exit that loop. ................................................................. Your output should look like this: iacs5.ucsd.edu% gcc hw5.c -lm iacs5.ucsd.edu% a.out a and b:-1.2 2.05 Enter the number of trapezoids: 100 n_trap =100 del_x =0.0325 Integral = . ...... Do you want new n_trap: y=1/n=0
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/10/2009 for the course MAE MAE 9 taught by Professor Lubarda during the Fall '08 term at UCSD.

Page1 / 3

Homework #5 - /* MAE 9: Homework #5, Fall 2008 Due on...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online