Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

Jupyter notebook MECH 322 Spring 2017 Assignments/Lab 08 Practice/Lab 08 Octave More Math with Arrays Practice-bensonc7.ipynb

17 views
Kernel: Octave (MATLAB-like)

MECH 322: Lab Assignment 8 Homework

Octave More Math with Arrays Practice (70 points)

**NAME: **Chase Benson

Enter the following command into the cell below and press Shift-Enter to execute it.

ctime(time)
ctime(time)
ans = Tue Feb 07 00:42:18 2017

Purpose:

The last lab introduced a number of mathematical operations for arrays (vectors and matrices). Particularly, the focus was on operations performed with arrays and scalars and element-by-element operations. This lab will concentrate on the array operations that are used to solve systems of simultaneous equations.

Tasks to Complete:

  1. Click on the Files icon above the Jupyter logo

  2. Check the box to the left of the name of this file "Lab 08 Octave More Math with Arrays.ipynb" then click on the Duplicate button

  3. Change the name to add - FerrisID (your Ferris ID) before the file extension i.e. Lab 08 Octave More Math with Arrays - bradyb.ipynb (Files that are not renamed will not be graded)

  4. Edit the new file for submitting and grading. Click on the name of the new file to open it and start the editing process.

  5. Double-click in the Markdown cell that says NAME: located below the title and subtitle cells at the top of the page and enter your name after the last ** pair. Press Shift-Enter to execute the cell.

  6. Enter the timecode command shown below your name into the input cell provided and use Shift-Enter to execute it

  7. Complete each of the following problems from Chapter 3 of the textbook (starting on page 86). Don’t worry if you make a mistake. Fix the mistake, execute the cell again, and keep going.

  8. Enter and execute the necessary command(s) for each problem in the code cell below the problem number. If a problem requests that you make a script, just use mulitple commands in the code cell and execute after all commands are entered. The point values are given next to each problem number.

  9. Finish the assignment by following the instructions at the end of this document.

10a-c, just use Octave, no hand work necessary, 6 points

v=[15 8 -6] u=[3 -2 6] v./u u'*v u*v'
v = 15 8 -6 u = 3 -2 6 ans = 5 -4 -1 ans = 45 24 -18 -30 -16 12 90 48 -36 ans = -7

11a-c, 6 points

u=[5 -6 9] v=[11 7 -4] sum(u.*v) u*v' dot(u,v)
u = 5 -6 9 v = 11 7 -4 ans = -23 ans = -23 ans = -23

17, 6 points

rOA=[2,5,1]; rOB=[1,3,6]; rOC=[-6,8,2]; rAC=rOC-rOA; Volume=dot(rOB,cross(rOC,rAC))
Volume = 248

19, 4 points

r1=[6 -3 2] r2=[2 9 10] theta=acosd(dot(r1,r2)/(sqrt(dot(r1,r1))*sqrt(dot(r2,r2))))
r1 = 6 -3 2 r2 = 2 9 10 theta = 86.990

[31a-f, book has part e twice, 12 points

A=10*rand(4,4) R=A*A R=A.*A R=A\A R=A./A R=det(A) R=inv(A)
A = 3.509040 2.350070 1.362033 9.390418 0.643252 7.136898 1.689437 8.823713 8.117630 4.161617 2.015366 8.734735 9.142230 0.293109 0.278375 0.021852 R = 110.731 33.439 14.109 65.790 101.231 62.064 18.795 83.964 127.377 59.725 24.581 130.743 34.729 24.742 13.514 90.868 R = 1.2313e+01 5.5228e+00 1.8551e+00 8.8180e+01 4.1377e-01 5.0935e+01 2.8542e+00 7.7858e+01 6.5896e+01 1.7319e+01 4.0617e+00 7.6296e+01 8.3580e+01 8.5913e-02 7.7493e-02 4.7753e-04 R = 1.00000 -0.00000 -0.00000 -0.00000 0.00000 1.00000 -0.00000 0.00000 0.00000 0.00000 1.00000 0.00000 0.00000 -0.00000 -0.00000 1.00000 R = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 R = -182.35 R = 0.043091 0.016913 -0.063782 0.148287 -0.052440 0.283257 -0.230278 0.204668 -1.383846 -0.857390 2.357608 -1.501898 0.304233 0.047152 -0.260495 0.111210

33, 9 points

A=[-4 3 1; 5 6 -2; 2 -5 4.5]; y=[-18.2 -48.8 92.5]'; result=A\y
result = 2.8000 -6.4000 12.2000

34, 12 points

B=[2.5 -1 3 1.5 -2; 3 4 -2 2.5 -1; -4 3 1 -6 2; 2 3 1 -2.5 4; 1 2 5 -3 4]; y=[57.1 27.6 -81.2 -22.2 -12.2]'; result=B\y B*result
result = 8.2000 -2.0000 4.8000 6.0000 -5.6000 ans = 57.100 27.600 -81.200 -22.200 -12.200

37, 15 points

i1=0.74058,i2=0.60472,i3=0.61613,i4=1.53164,i5=2.16487i_1=-0.74058, i_2=0.60472, i_3=-0.61613, i_4=1.53164, i_5=2.16487

V1=40; V2=30; V3=36; R1=16; R2=20; R3=10; R4=14; R5=8; R6=16; R7=10; R8=15; R9=6; R10=4; A=[-(R1+R2+R3) R2 R3 0 0; R2 -(R2+R4+R5+R6) R5 R6 R4; R3 R5 -(R3+R5+R7) R7 0; 0 R6 R7 -(R6+R7+R8+R9) R8; 0 R4 0 R8 -(R4+R8+R10)]; V=[-V1 0 -V2 V3 V1]'; I=A\V
I = 0.74058 -0.60472 0.61613 -1.53164 -2.16487

Issue the command ctime(time) to determine the time that you finished the assignment.

ctime(time)
ans = Tue Feb 07 01:38:24 2017

Click on the Save icon and then click on the ×\times next to the notebook name in the blue tab. The instructor will automatically collect your file at the due date/time and no further edits will be graded.