ps4solnsF06

# ps4solnsF06 - %Engineering 6 Fall 2006 Problem 4.1...

This preview shows pages 1–3. Sign up to view the full content.

%Engineering 6, Fall 2006, Problem 4.1 Solution %(Estimating value of e using (1+1/n)^n as n gets large) %Suppress extra lines in output and set fixed short g display format compact ; format short g ; clc; %Clear command window %Create vector of values for n n = [1 10 20 50 100 500 1000 2000 4000 8000]; %Calculate value of (1+1/n)^n for each value in the n vector y = (1 + 1./n).^n; %Calculate the relative percentage error between each value %in y and the true value exp(1) rel_error = abs((y-exp(1))/exp(1))*100; %Construct array with each vector being a column table_of_values = [n' y' rel_error']; %Display table of values disp( 'Using (1+1/1n)^n to calculate e (2.7183):' ); disp( ' n (1+1/n)^n Rel. % error' ); disp(table_of_values); Displayed results: Using (1+1/1n)^n to calculate e (2.7183): n (1+1/n)^n Rel. % error 1 2 26.424 10 2.5937 4.5815 20 2.6533 2.3906 50 2.6916 0.98201 100 2.7048 0.49546 500 2.7156 0.099817 1000 2.7169 0.049954 2000 2.7176 0.024989 4000 2.7179 0.012497 8000 2.7181 0.0062493

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

View Full Document
%Engineering 6, Fall 2006, Problem 4.2 Solution %(Piston-crank mechanism) %Turn off extra line breaks in display format compact ; %Clear command window and variables clc; clear all ; %Define initial variables theta_dot = 500*2*pi/60;
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern