hw10_solution

hw10_solution - EME5 Homework 10 Solutions December 6, 2010...

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

View Full Document Right Arrow Icon
EME5 Homework 10 Solutions December 6, 2010 4 Chapter 21, Problem 1 No. It will become a type qualifier when header file, array.h, is included in a Ch program. 5 Chapter 21, Problem 8 5.1 Part 1.a 5.1.1 Solution Code #include<stdio.h> #include<array.h> #include<numeric.h> int main() { array double A1[3][3] = {5,2,2,4,5,6,7,8,9}, B1[3][3] = {7,8,9,1,2,3,4,5,6}, b1[3] = {1,4,7}; array double Y1[3][3], Z1[3][3]; int j; Y1 = sin(5*A1*B1+transpose(B1)*A1+A1*A1); Z1 = identitymatrix(3); for(j = 0; j<50; j++) { Z1 = Z1*(5*A1*B1+transpose(B1)*A1+A1*A1); } printf("%g\n", Y1); printf("%g\n", Z1); return 0; } 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
5.1.2 Solution Output -0.287874 -0.909285 0.521525 -0.683284 -0.933331 0.0441824 0.287846 0.313286 0.972609 3.29998e+161 3.69617e+161 4.3544e+161 4.69543e+161 5.25916e+161 6.19574e+161 7.32107e+161 8.20003e+161 9.66034e+161 6 Chapter 21, Problem 12 6.1 Part b 6.1.1 Solution Code #include<stdio.h> #include<math.h> #include<chplot.h> #define NUMPOINTS 50 // number of data points int main() { array double x[NUMPOINTS], y[NUMPOINTS]; /* Display the specified plot. */ lindata(-5, 5, x); y = 3*x.*x + x; plotxy(x, y); return 0; } 6.1.2 Solution Plot 2
Background image of page 2
7 Chapter 21, Problem 16 7.1 Solution Code #include <math.h> #include <chplot.h> #define NUM 200 int main() { char *title="Humps function", *xlabel="x", *ylabel="y";
Background image of page 3

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

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

This note was uploaded on 04/23/2011 for the course EME 5 taught by Professor Staff during the Fall '08 term at UC Davis.

Page1 / 10

hw10_solution - EME5 Homework 10 Solutions December 6, 2010...

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

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