SlideShare a Scribd company logo
1 of 8
Download to read offline
AMTH250                                                      Assignment 5
                                Solutions

                            September 16, 2011


Question 1
Here is a script to generate the equations in matrix form:
k = sqrt(2)/2;

a = zeros(13,13);
b = zeros(13,1);

a(1,2) = 1;
a(1,6) = -1;

a(2,3) = 1;
b(2) = 10;

a(3,1) = k;
a(3,4) = -1;
a(3,5) = -k;

a(4,1) = k;
a(4,3) = 1;
a(4,5) = k;

a(5,4) = 1;
a(5,8) = -1;

a(6,7) = 1;

a(7,5) = k;
a(7,6) = 1;
a(7,9) = -k;
a(7,10) = -1;

a(8,5)   = k;
a(8,7)   = 1;
a(8,9)   = k;
b(8) =   15;



                                       1
a(9,10) = 1;
a(9,13) = -1;

a(10,11) = 1;
b(10) = 20;

a(11,8) = 1;
a(11,9) = k;
a(11,12) = -k;

a(12,9) = k;
a(12,11) = 1;
a(12,12) = k;

a(13,13) = 1;
a(13,12) = k;

% Exact solution

x0 =[-20*sqrt(2) 20 10 -30 10*sqrt(2) 20 0 -30 5*sqrt(2) 25 20 -25*sqrt(2) 25]’;

(a)
      Solving in Octave:
octave:> x = ab
x =
  -28.28427
   20.00000
   10.00000
  -30.00000
   14.14214
   20.00000
    0.00000
  -30.00000
    7.07107
   25.00000
   20.00000
  -35.35534
   25.00000
The accuracy can be estimated using the condition number of the matrix:
octave:> rerr =cond(a)*eps
rerr = 2.3120e-15

(b)
   The actual error is
octave:> err = norm(x-x0)/norm(x0)
err = 1.3820e-16




                                     2
(c)

octave:> eig(a)
ans =
  -1.27279 + 0.00000i
  -0.49903 + 1.07138i
  -0.49903 - 1.07138i
  -0.52561 + 0.56675i
  -0.52561 - 0.56675i
  -0.12363 + 0.93904i
  -0.12363 - 0.93904i
   1.14770 + 0.96283i
   1.14770 - 0.96283i
   0.87329 + 0.70838i
   0.87329 - 0.70838i
   0.72297 + 0.00000i
   0.51150 + 0.00000i

   The matrix a has three real eigenvalues The real eigenvalues and their cor-
responding eigenvectors are:

octave:> [V L] = eig(a);
octave:> real([L(1,1) L(12,12) L(13,13)])
ans =
  -1.27279   0.72297   0.51150

octave:> real([V(:,1) V(:,12) V(:,13)])
ans =
   0.2707445 -0.2173918 -0.1703240
   0.1057564   0.3980937   0.3917440
  -0.1346055   0.2878090   0.2003763
  -0.2821253 -0.1321592 -0.0946017
   0.4274406 -0.3247553 -0.1814827
   0.4503570   0.5552610   0.4788643
  -0.5732094   0.4014359   0.2449382
   0.2619164   0.1026285 -0.0017736
  -0.0882485 -0.1380302 -0.1661952
   0.0854298   0.1330010   0.3427691
  -0.1087340   0.0961555   0.1753257
   0.0864365 -0.0912040 -0.2955285
  -0.0268920   0.2327925   0.4277776




                                      3
Question 2
(a)

octave:> for n = 1:30
>   chilb(n) = cond(hilb(n));
> end
octave:> semilogy(chilb)


                    1020




                      15
                    10




                    1010




                    105




                    100
                           0   5       10        15   20    25   30




(b)
   This shows that the condition number grows exponentially with n up to
about n = 12. After that it appears to to be fairly constant, but what has
happened is that rounding errors have taken over and the results are unreliable.
   Note that the departure from linearity in the graph occurs at a condition
number of about 1016 ≈ 1/εmach .
(c)
      An estimate for relative error in the solution of a system of linear equations
is
                                   Erel ≈ cond Hn × εmach
Therefore to obtain a relative error less than 10−4 we require the condition
number to be less than
octave:20> 1e-4/eps
ans = 4.5036e+11

octave:> chilb(8)
ans = 1.5258e+10
octave:> chilb(9)
ans = 4.9315e+11

So n ≤ 8.




                                             4
(d)
   Here is a script to compute the maximum and minimum eigenvalues:

maxeig = zeros(30,1);
mineig = zeros(30,1);
for n = 1:30
  eighilb = abs(eig(hilb(n)));
  maxeig(n) = max(eighilb);
  mineig(n) = min(eighilb);
end


                                                             0
               2                                          10




              1.8


                                                         10-5




              1.6




                                                         10-10




              1.4




                                                         10-15

              1.2




               1                                         10-20
                    0   5   10   15   20   25   30               0   5   10   15   20   25   30




Figure 1: Maximum and minimum eigenvalues of Hn (n.b. minimum eigenvalues
use semilog scale)

    The maximum eigenvalue grows slowly with n increasing from 1 at n = 1 to
just less than 2 at n = 30.
    The minimum eigenvale decreases exponentially with n up to about n = 12.
After that it appears to to be fairly constant, but again what has happened is
that rounding errors have taken over and the results are unreliable.
    The departure from linearity in the graph occurs at a minimum eigenvalue
of about 10−16 ≈ εmach .
(e)
   Experimentation shows that the computed eigenvalues are all positive up to
n = 12. For n ≥ 13 the computed eigenvalues contain some negative values.




                                                     5
(f )

octave:> [chilb(1:12) maxeig(1:12) mineig(1:12) maxeig(1:12)./mineig(1:12)]
ans =
   1.0000e+00   1.0000e+00   1.0000e+00   1.0000e+00
   1.9281e+01   1.2676e+00   6.5741e-02   1.9281e+01
   5.2406e+02   1.4083e+00   2.6873e-03   5.2406e+02
   1.5514e+04   1.5002e+00   9.6702e-05   1.5514e+04
   4.7661e+05   1.5671e+00   3.2879e-06   4.7661e+05
   1.4951e+07   1.6189e+00   1.0828e-07   1.4951e+07
   4.7537e+08   1.6609e+00   3.4939e-09   4.7537e+08
   1.5258e+10   1.6959e+00   1.1115e-10   1.5258e+10
   4.9315e+11   1.7259e+00   3.4997e-12   4.9315e+11
   1.6025e+13   1.7519e+00   1.0931e-13   1.6027e+13
   5.2153e+14   1.7749e+00   3.4480e-15   5.1476e+14
   1.6620e+16   1.7954e+00   1.0942e-16   1.6408e+16


                                            λmax (Hn )
                             cond(Hn ) =
                                            λmin (Hn )

(g)
    Negative eigenvalues occur for n ≥ 13. The values of the condition number
and minimum eigenvalue exhibit a change after n = 12. That these changes
occurs when the condition number reaches 1/εmach and the minimum eigenvalue
reaches εmach indicate that rounding error could well be the cause. Therefore it is
reasonable to conclude that the results for the condition number and minimum
eigenvalue are only reliable up to n = 12. There is no indication that the
computation of the maximum eigenvalue is unreliable for any of the values of n
we have looked at.




                                        6
Question 3
The formulation as a linear programming problem is:
   Variables: A, B, C, D, E — number of units of each product manufactured.
   Objective: Maximize the profit:

                   c =10A + 9B + 10C + 9.5D + 5E
                          9
                      − (15A + 8B + 8C + 12D + 9E)
                         60
                          9
                      − (8A + 10B + 12C + 4D + 4E)
                         60
                         12
                      − (6A + 9B + 10C + 12D + 0E)
                         60
                     =5.35A + 4.5B + 5C + 4.7D + 3.05E


   Constraints:

                     15A + 8B + 8C + 12D + 9E ≤ 4800
                     8A + 10B + 12C + 4D + 4E ≤ 4800
                     6A + 9B + 10C + 12D + 0E ≤ 4800

   Lower Bounds:

                A ≥ 0,   B ≥ 0,    C ≥ 20,   D ≥ 30,    E≥0

    It is a little unclear whether this a linear programming problem or integer
programming problem; i.e. whether fractions of a product can be produced and
sold. Thefore we will solve both the LP and IP problems.
    Here is the Octave script to solve both problems
obj = [5.35 4.5 5 4.7 3.05]’;
vtype1 = "CCCCC";
vtype2 = "IIIII";
ptype = -1;
cnstr=[15 8 8 12 9; 8 10 12 4 4; 6 9 10 12 0];
lb = [0 0 20 30 0]’;
ub = [];
rhs = [4800 4800 4800]’;
ctype = "UUU";

[lx, lopt] = glpk(obj, cnstr, rhs, lb, ub, ctype, vtype1, ptype);
[ix, iopt] = glpk(obj, cnstr, rhs, lb, ub, ctype, vtype2, ptype);




                                      7
The solutions are:
octave:> lx, lopt
lx =
     0.00000
     0.00000
   334.88372
   120.93023
    74.41860
lopt = 2469.8

octave:> ix, iopt
ix =
     1
     6
   330
   120
    73
iopt = 2469




                       8

More Related Content

What's hot

Pseudo Random Number Generators
Pseudo Random Number GeneratorsPseudo Random Number Generators
Pseudo Random Number GeneratorsDarshini Parikh
 
Cg my own programs
Cg my own programsCg my own programs
Cg my own programsAmit Kapoor
 
Problem Application of Antiderivatives
Problem Application of AntiderivativesProblem Application of Antiderivatives
Problem Application of Antiderivativesnyaz26
 
Optimal Budget Allocation: Theoretical Guarantee and Efficient Algorithm
Optimal Budget Allocation: Theoretical Guarantee and Efficient AlgorithmOptimal Budget Allocation: Theoretical Guarantee and Efficient Algorithm
Optimal Budget Allocation: Theoretical Guarantee and Efficient AlgorithmTasuku Soma
 
W ee network_theory_10-06-17_ls2-sol
W ee network_theory_10-06-17_ls2-solW ee network_theory_10-06-17_ls2-sol
W ee network_theory_10-06-17_ls2-solAnkit Chaurasia
 
Regret Minimization in Multi-objective Submodular Function Maximization
Regret Minimization in Multi-objective Submodular Function MaximizationRegret Minimization in Multi-objective Submodular Function Maximization
Regret Minimization in Multi-objective Submodular Function MaximizationTasuku Soma
 
Maximizing Submodular Function over the Integer Lattice
Maximizing Submodular Function over the Integer LatticeMaximizing Submodular Function over the Integer Lattice
Maximizing Submodular Function over the Integer LatticeTasuku Soma
 
Tabela completa de derivadas e integrais
Tabela completa de derivadas e integraisTabela completa de derivadas e integrais
Tabela completa de derivadas e integraisDiego Rodrigues Vaz
 
Computer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsComputer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsKandarp Tiwari
 
Kanodia murolia previousyears
Kanodia murolia previousyearsKanodia murolia previousyears
Kanodia murolia previousyearsAnwesa Roy
 
parameterized complexity for graph Motif
parameterized complexity for graph Motifparameterized complexity for graph Motif
parameterized complexity for graph MotifAMR koura
 
Tabela derivadas-e-integrais
Tabela derivadas-e-integraisTabela derivadas-e-integrais
Tabela derivadas-e-integraismariasousagomes
 
The low-rank basis problem for a matrix subspace
The low-rank basis problem for a matrix subspaceThe low-rank basis problem for a matrix subspace
The low-rank basis problem for a matrix subspaceTasuku Soma
 
Programming for Mechanical Engineers in EES
Programming for Mechanical Engineers in EESProgramming for Mechanical Engineers in EES
Programming for Mechanical Engineers in EESNaveed Rehman
 
Additional mathematics
Additional mathematicsAdditional mathematics
Additional mathematicsgeraldsiew
 

What's hot (20)

Pseudo Random Number Generators
Pseudo Random Number GeneratorsPseudo Random Number Generators
Pseudo Random Number Generators
 
Cg my own programs
Cg my own programsCg my own programs
Cg my own programs
 
Problem Application of Antiderivatives
Problem Application of AntiderivativesProblem Application of Antiderivatives
Problem Application of Antiderivatives
 
Optimal Budget Allocation: Theoretical Guarantee and Efficient Algorithm
Optimal Budget Allocation: Theoretical Guarantee and Efficient AlgorithmOptimal Budget Allocation: Theoretical Guarantee and Efficient Algorithm
Optimal Budget Allocation: Theoretical Guarantee and Efficient Algorithm
 
Ch14s
Ch14sCh14s
Ch14s
 
W ee network_theory_10-06-17_ls2-sol
W ee network_theory_10-06-17_ls2-solW ee network_theory_10-06-17_ls2-sol
W ee network_theory_10-06-17_ls2-sol
 
Regret Minimization in Multi-objective Submodular Function Maximization
Regret Minimization in Multi-objective Submodular Function MaximizationRegret Minimization in Multi-objective Submodular Function Maximization
Regret Minimization in Multi-objective Submodular Function Maximization
 
Ch14 23
Ch14 23Ch14 23
Ch14 23
 
Maximizing Submodular Function over the Integer Lattice
Maximizing Submodular Function over the Integer LatticeMaximizing Submodular Function over the Integer Lattice
Maximizing Submodular Function over the Integer Lattice
 
Tabela completa de derivadas e integrais
Tabela completa de derivadas e integraisTabela completa de derivadas e integrais
Tabela completa de derivadas e integrais
 
Computer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsComputer Graphics Lab File C Programs
Computer Graphics Lab File C Programs
 
Kanodia murolia previousyears
Kanodia murolia previousyearsKanodia murolia previousyears
Kanodia murolia previousyears
 
parameterized complexity for graph Motif
parameterized complexity for graph Motifparameterized complexity for graph Motif
parameterized complexity for graph Motif
 
Tabela derivadas-e-integrais
Tabela derivadas-e-integraisTabela derivadas-e-integrais
Tabela derivadas-e-integrais
 
Chapter003
Chapter003Chapter003
Chapter003
 
Ch09s
Ch09sCh09s
Ch09s
 
The low-rank basis problem for a matrix subspace
The low-rank basis problem for a matrix subspaceThe low-rank basis problem for a matrix subspace
The low-rank basis problem for a matrix subspace
 
Arithmatic &Logic Unit
Arithmatic &Logic UnitArithmatic &Logic Unit
Arithmatic &Logic Unit
 
Programming for Mechanical Engineers in EES
Programming for Mechanical Engineers in EESProgramming for Mechanical Engineers in EES
Programming for Mechanical Engineers in EES
 
Additional mathematics
Additional mathematicsAdditional mathematics
Additional mathematics
 

Similar to AMTH250 Assignment 5 Solutions

Amth250 octave matlab some solutions (1)
Amth250 octave matlab some solutions (1)Amth250 octave matlab some solutions (1)
Amth250 octave matlab some solutions (1)asghar123456
 
chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptx
chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptxchapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptx
chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptxSurendra Loya
 
Solutions Manual for Friendly Introduction To Numerical Analysis 1st Edition ...
Solutions Manual for Friendly Introduction To Numerical Analysis 1st Edition ...Solutions Manual for Friendly Introduction To Numerical Analysis 1st Edition ...
Solutions Manual for Friendly Introduction To Numerical Analysis 1st Edition ...Willowew
 
William hyatt-7th-edition-drill-problems-solution
William hyatt-7th-edition-drill-problems-solutionWilliam hyatt-7th-edition-drill-problems-solution
William hyatt-7th-edition-drill-problems-solutionSalman Salman
 
130 problemas dispositivos electronicos lopez meza brayan
130 problemas dispositivos electronicos lopez meza brayan130 problemas dispositivos electronicos lopez meza brayan
130 problemas dispositivos electronicos lopez meza brayanbrandwin marcelo lavado
 
Solution of matlab chapter 3
Solution of matlab chapter 3Solution of matlab chapter 3
Solution of matlab chapter 3AhsanIrshad8
 
Unit 1 PDF.pptx
Unit 1 PDF.pptxUnit 1 PDF.pptx
Unit 1 PDF.pptxChandraV13
 
A successful maximum likelihood parameter estimation in skewed distributions ...
A successful maximum likelihood parameter estimation in skewed distributions ...A successful maximum likelihood parameter estimation in skewed distributions ...
A successful maximum likelihood parameter estimation in skewed distributions ...Hideo Hirose
 
Curve fitting and Optimization
Curve fitting and OptimizationCurve fitting and Optimization
Curve fitting and OptimizationSyahrul Senin
 
Linear circuit analysis - solution manuel (R. A. DeCarlo and P. Lin) (z-lib.o...
Linear circuit analysis - solution manuel (R. A. DeCarlo and P. Lin) (z-lib.o...Linear circuit analysis - solution manuel (R. A. DeCarlo and P. Lin) (z-lib.o...
Linear circuit analysis - solution manuel (R. A. DeCarlo and P. Lin) (z-lib.o...Ansal Valappil
 
Applied numerical methods lec14
Applied numerical methods lec14Applied numerical methods lec14
Applied numerical methods lec14Yasser Ahmed
 
Home Work; Chapter 9; Inventory Policy Decisions
Home Work; Chapter 9; Inventory Policy DecisionsHome Work; Chapter 9; Inventory Policy Decisions
Home Work; Chapter 9; Inventory Policy DecisionsShaheen Sardar
 
Solution of matlab chapter 1
Solution of matlab chapter 1Solution of matlab chapter 1
Solution of matlab chapter 1AhsanIrshad8
 

Similar to AMTH250 Assignment 5 Solutions (20)

Amth250 octave matlab some solutions (1)
Amth250 octave matlab some solutions (1)Amth250 octave matlab some solutions (1)
Amth250 octave matlab some solutions (1)
 
Introduction to MATLAB
Introduction to MATLAB Introduction to MATLAB
Introduction to MATLAB
 
chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptx
chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptxchapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptx
chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptx
 
Solutions Manual for Friendly Introduction To Numerical Analysis 1st Edition ...
Solutions Manual for Friendly Introduction To Numerical Analysis 1st Edition ...Solutions Manual for Friendly Introduction To Numerical Analysis 1st Edition ...
Solutions Manual for Friendly Introduction To Numerical Analysis 1st Edition ...
 
William hyatt-7th-edition-drill-problems-solution
William hyatt-7th-edition-drill-problems-solutionWilliam hyatt-7th-edition-drill-problems-solution
William hyatt-7th-edition-drill-problems-solution
 
jacobi method, gauss siedel for solving linear equations
jacobi method, gauss siedel for solving linear equationsjacobi method, gauss siedel for solving linear equations
jacobi method, gauss siedel for solving linear equations
 
130 problemas dispositivos electronicos lopez meza brayan
130 problemas dispositivos electronicos lopez meza brayan130 problemas dispositivos electronicos lopez meza brayan
130 problemas dispositivos electronicos lopez meza brayan
 
vertical-curves
vertical-curvesvertical-curves
vertical-curves
 
Solution of matlab chapter 3
Solution of matlab chapter 3Solution of matlab chapter 3
Solution of matlab chapter 3
 
Numerical Methods Solving Linear Equations
Numerical Methods Solving Linear EquationsNumerical Methods Solving Linear Equations
Numerical Methods Solving Linear Equations
 
Unit 1 PDF.pptx
Unit 1 PDF.pptxUnit 1 PDF.pptx
Unit 1 PDF.pptx
 
A successful maximum likelihood parameter estimation in skewed distributions ...
A successful maximum likelihood parameter estimation in skewed distributions ...A successful maximum likelihood parameter estimation in skewed distributions ...
A successful maximum likelihood parameter estimation in skewed distributions ...
 
Ch11s
Ch11sCh11s
Ch11s
 
Curve fitting and Optimization
Curve fitting and OptimizationCurve fitting and Optimization
Curve fitting and Optimization
 
Problemas de funciones
Problemas de funcionesProblemas de funciones
Problemas de funciones
 
Linear circuit analysis - solution manuel (R. A. DeCarlo and P. Lin) (z-lib.o...
Linear circuit analysis - solution manuel (R. A. DeCarlo and P. Lin) (z-lib.o...Linear circuit analysis - solution manuel (R. A. DeCarlo and P. Lin) (z-lib.o...
Linear circuit analysis - solution manuel (R. A. DeCarlo and P. Lin) (z-lib.o...
 
Applied numerical methods lec14
Applied numerical methods lec14Applied numerical methods lec14
Applied numerical methods lec14
 
Mark 20121024
Mark 20121024Mark 20121024
Mark 20121024
 
Home Work; Chapter 9; Inventory Policy Decisions
Home Work; Chapter 9; Inventory Policy DecisionsHome Work; Chapter 9; Inventory Policy Decisions
Home Work; Chapter 9; Inventory Policy Decisions
 
Solution of matlab chapter 1
Solution of matlab chapter 1Solution of matlab chapter 1
Solution of matlab chapter 1
 

More from asghar123456

Answers assignment 5 open channel hydraulics-fluid mechanics
Answers assignment 5 open channel hydraulics-fluid mechanicsAnswers assignment 5 open channel hydraulics-fluid mechanics
Answers assignment 5 open channel hydraulics-fluid mechanicsasghar123456
 
Answers assignment 4 real fluids-fluid mechanics
Answers assignment 4 real fluids-fluid mechanicsAnswers assignment 4 real fluids-fluid mechanics
Answers assignment 4 real fluids-fluid mechanicsasghar123456
 
Answers assignment 3 integral methods-fluid mechanics
Answers assignment 3 integral methods-fluid mechanicsAnswers assignment 3 integral methods-fluid mechanics
Answers assignment 3 integral methods-fluid mechanicsasghar123456
 
Answers assignment 2 fluid statics-fluid mechanics
Answers assignment 2 fluid statics-fluid mechanicsAnswers assignment 2 fluid statics-fluid mechanics
Answers assignment 2 fluid statics-fluid mechanicsasghar123456
 
assignment 1 properties of fluids-Fluid mechanics
assignment 1 properties of fluids-Fluid mechanicsassignment 1 properties of fluids-Fluid mechanics
assignment 1 properties of fluids-Fluid mechanicsasghar123456
 
Buckling test engt110
Buckling test engt110Buckling test engt110
Buckling test engt110asghar123456
 
Amth250 octave matlab some solutions (3)
Amth250 octave matlab some solutions (3)Amth250 octave matlab some solutions (3)
Amth250 octave matlab some solutions (3)asghar123456
 
Amth250 octave matlab some solutions (2)
Amth250 octave matlab some solutions (2)Amth250 octave matlab some solutions (2)
Amth250 octave matlab some solutions (2)asghar123456
 

More from asghar123456 (11)

Answers assignment 5 open channel hydraulics-fluid mechanics
Answers assignment 5 open channel hydraulics-fluid mechanicsAnswers assignment 5 open channel hydraulics-fluid mechanics
Answers assignment 5 open channel hydraulics-fluid mechanics
 
Answers assignment 4 real fluids-fluid mechanics
Answers assignment 4 real fluids-fluid mechanicsAnswers assignment 4 real fluids-fluid mechanics
Answers assignment 4 real fluids-fluid mechanics
 
Answers assignment 3 integral methods-fluid mechanics
Answers assignment 3 integral methods-fluid mechanicsAnswers assignment 3 integral methods-fluid mechanics
Answers assignment 3 integral methods-fluid mechanics
 
Answers assignment 2 fluid statics-fluid mechanics
Answers assignment 2 fluid statics-fluid mechanicsAnswers assignment 2 fluid statics-fluid mechanics
Answers assignment 2 fluid statics-fluid mechanics
 
assignment 1 properties of fluids-Fluid mechanics
assignment 1 properties of fluids-Fluid mechanicsassignment 1 properties of fluids-Fluid mechanics
assignment 1 properties of fluids-Fluid mechanics
 
Buckling test engt110
Buckling test engt110Buckling test engt110
Buckling test engt110
 
Assignment6
Assignment6Assignment6
Assignment6
 
Assignment5
Assignment5Assignment5
Assignment5
 
Assignment4
Assignment4Assignment4
Assignment4
 
Amth250 octave matlab some solutions (3)
Amth250 octave matlab some solutions (3)Amth250 octave matlab some solutions (3)
Amth250 octave matlab some solutions (3)
 
Amth250 octave matlab some solutions (2)
Amth250 octave matlab some solutions (2)Amth250 octave matlab some solutions (2)
Amth250 octave matlab some solutions (2)
 

Recently uploaded

4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEaurabinda banchhor
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsRommel Regala
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxRosabel UA
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 

Recently uploaded (20)

4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSE
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World Politics
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 

AMTH250 Assignment 5 Solutions

  • 1. AMTH250 Assignment 5 Solutions September 16, 2011 Question 1 Here is a script to generate the equations in matrix form: k = sqrt(2)/2; a = zeros(13,13); b = zeros(13,1); a(1,2) = 1; a(1,6) = -1; a(2,3) = 1; b(2) = 10; a(3,1) = k; a(3,4) = -1; a(3,5) = -k; a(4,1) = k; a(4,3) = 1; a(4,5) = k; a(5,4) = 1; a(5,8) = -1; a(6,7) = 1; a(7,5) = k; a(7,6) = 1; a(7,9) = -k; a(7,10) = -1; a(8,5) = k; a(8,7) = 1; a(8,9) = k; b(8) = 15; 1
  • 2. a(9,10) = 1; a(9,13) = -1; a(10,11) = 1; b(10) = 20; a(11,8) = 1; a(11,9) = k; a(11,12) = -k; a(12,9) = k; a(12,11) = 1; a(12,12) = k; a(13,13) = 1; a(13,12) = k; % Exact solution x0 =[-20*sqrt(2) 20 10 -30 10*sqrt(2) 20 0 -30 5*sqrt(2) 25 20 -25*sqrt(2) 25]’; (a) Solving in Octave: octave:> x = ab x = -28.28427 20.00000 10.00000 -30.00000 14.14214 20.00000 0.00000 -30.00000 7.07107 25.00000 20.00000 -35.35534 25.00000 The accuracy can be estimated using the condition number of the matrix: octave:> rerr =cond(a)*eps rerr = 2.3120e-15 (b) The actual error is octave:> err = norm(x-x0)/norm(x0) err = 1.3820e-16 2
  • 3. (c) octave:> eig(a) ans = -1.27279 + 0.00000i -0.49903 + 1.07138i -0.49903 - 1.07138i -0.52561 + 0.56675i -0.52561 - 0.56675i -0.12363 + 0.93904i -0.12363 - 0.93904i 1.14770 + 0.96283i 1.14770 - 0.96283i 0.87329 + 0.70838i 0.87329 - 0.70838i 0.72297 + 0.00000i 0.51150 + 0.00000i The matrix a has three real eigenvalues The real eigenvalues and their cor- responding eigenvectors are: octave:> [V L] = eig(a); octave:> real([L(1,1) L(12,12) L(13,13)]) ans = -1.27279 0.72297 0.51150 octave:> real([V(:,1) V(:,12) V(:,13)]) ans = 0.2707445 -0.2173918 -0.1703240 0.1057564 0.3980937 0.3917440 -0.1346055 0.2878090 0.2003763 -0.2821253 -0.1321592 -0.0946017 0.4274406 -0.3247553 -0.1814827 0.4503570 0.5552610 0.4788643 -0.5732094 0.4014359 0.2449382 0.2619164 0.1026285 -0.0017736 -0.0882485 -0.1380302 -0.1661952 0.0854298 0.1330010 0.3427691 -0.1087340 0.0961555 0.1753257 0.0864365 -0.0912040 -0.2955285 -0.0268920 0.2327925 0.4277776 3
  • 4. Question 2 (a) octave:> for n = 1:30 > chilb(n) = cond(hilb(n)); > end octave:> semilogy(chilb) 1020 15 10 1010 105 100 0 5 10 15 20 25 30 (b) This shows that the condition number grows exponentially with n up to about n = 12. After that it appears to to be fairly constant, but what has happened is that rounding errors have taken over and the results are unreliable. Note that the departure from linearity in the graph occurs at a condition number of about 1016 ≈ 1/εmach . (c) An estimate for relative error in the solution of a system of linear equations is Erel ≈ cond Hn × εmach Therefore to obtain a relative error less than 10−4 we require the condition number to be less than octave:20> 1e-4/eps ans = 4.5036e+11 octave:> chilb(8) ans = 1.5258e+10 octave:> chilb(9) ans = 4.9315e+11 So n ≤ 8. 4
  • 5. (d) Here is a script to compute the maximum and minimum eigenvalues: maxeig = zeros(30,1); mineig = zeros(30,1); for n = 1:30 eighilb = abs(eig(hilb(n))); maxeig(n) = max(eighilb); mineig(n) = min(eighilb); end 0 2 10 1.8 10-5 1.6 10-10 1.4 10-15 1.2 1 10-20 0 5 10 15 20 25 30 0 5 10 15 20 25 30 Figure 1: Maximum and minimum eigenvalues of Hn (n.b. minimum eigenvalues use semilog scale) The maximum eigenvalue grows slowly with n increasing from 1 at n = 1 to just less than 2 at n = 30. The minimum eigenvale decreases exponentially with n up to about n = 12. After that it appears to to be fairly constant, but again what has happened is that rounding errors have taken over and the results are unreliable. The departure from linearity in the graph occurs at a minimum eigenvalue of about 10−16 ≈ εmach . (e) Experimentation shows that the computed eigenvalues are all positive up to n = 12. For n ≥ 13 the computed eigenvalues contain some negative values. 5
  • 6. (f ) octave:> [chilb(1:12) maxeig(1:12) mineig(1:12) maxeig(1:12)./mineig(1:12)] ans = 1.0000e+00 1.0000e+00 1.0000e+00 1.0000e+00 1.9281e+01 1.2676e+00 6.5741e-02 1.9281e+01 5.2406e+02 1.4083e+00 2.6873e-03 5.2406e+02 1.5514e+04 1.5002e+00 9.6702e-05 1.5514e+04 4.7661e+05 1.5671e+00 3.2879e-06 4.7661e+05 1.4951e+07 1.6189e+00 1.0828e-07 1.4951e+07 4.7537e+08 1.6609e+00 3.4939e-09 4.7537e+08 1.5258e+10 1.6959e+00 1.1115e-10 1.5258e+10 4.9315e+11 1.7259e+00 3.4997e-12 4.9315e+11 1.6025e+13 1.7519e+00 1.0931e-13 1.6027e+13 5.2153e+14 1.7749e+00 3.4480e-15 5.1476e+14 1.6620e+16 1.7954e+00 1.0942e-16 1.6408e+16 λmax (Hn ) cond(Hn ) = λmin (Hn ) (g) Negative eigenvalues occur for n ≥ 13. The values of the condition number and minimum eigenvalue exhibit a change after n = 12. That these changes occurs when the condition number reaches 1/εmach and the minimum eigenvalue reaches εmach indicate that rounding error could well be the cause. Therefore it is reasonable to conclude that the results for the condition number and minimum eigenvalue are only reliable up to n = 12. There is no indication that the computation of the maximum eigenvalue is unreliable for any of the values of n we have looked at. 6
  • 7. Question 3 The formulation as a linear programming problem is: Variables: A, B, C, D, E — number of units of each product manufactured. Objective: Maximize the profit: c =10A + 9B + 10C + 9.5D + 5E 9 − (15A + 8B + 8C + 12D + 9E) 60 9 − (8A + 10B + 12C + 4D + 4E) 60 12 − (6A + 9B + 10C + 12D + 0E) 60 =5.35A + 4.5B + 5C + 4.7D + 3.05E Constraints: 15A + 8B + 8C + 12D + 9E ≤ 4800 8A + 10B + 12C + 4D + 4E ≤ 4800 6A + 9B + 10C + 12D + 0E ≤ 4800 Lower Bounds: A ≥ 0, B ≥ 0, C ≥ 20, D ≥ 30, E≥0 It is a little unclear whether this a linear programming problem or integer programming problem; i.e. whether fractions of a product can be produced and sold. Thefore we will solve both the LP and IP problems. Here is the Octave script to solve both problems obj = [5.35 4.5 5 4.7 3.05]’; vtype1 = "CCCCC"; vtype2 = "IIIII"; ptype = -1; cnstr=[15 8 8 12 9; 8 10 12 4 4; 6 9 10 12 0]; lb = [0 0 20 30 0]’; ub = []; rhs = [4800 4800 4800]’; ctype = "UUU"; [lx, lopt] = glpk(obj, cnstr, rhs, lb, ub, ctype, vtype1, ptype); [ix, iopt] = glpk(obj, cnstr, rhs, lb, ub, ctype, vtype2, ptype); 7
  • 8. The solutions are: octave:> lx, lopt lx = 0.00000 0.00000 334.88372 120.93023 74.41860 lopt = 2469.8 octave:> ix, iopt ix = 1 6 330 120 73 iopt = 2469 8