Contents

Aaron Klapheck

% In class 19-Feb-2008
clear, clc, home
fprintf('The date and time: %s \n', datestr(now))
The date and time: 19-Feb-2008 13:33:09 

Numerical Methods (Notes)

% Techniques by which math problems are formulated and solved on a computer.
%
% Engineers apply numirical methods in cases that involve for example:
%   Lare systems of equations
%   Non-linearities
%   Complicated Geometries
%   non-analytic solutions avaliable
%   Graphical solutions
% In all of these cases algorithms must be generated.
%
% Steps in solving these types of problems in 4 steps
%   1) State problem clearly
%   2) Develope a mathematical model
%   3) Solve equations which result as a consequence of 2)
%   4) Carefully interpret the numerical results in 3)
%
% If an algorithm fails; it may be due to errors.
% Tpes of errors:
%   Human errors: syntax errors.
%       ex: typing sine instead of sin
%       Hint: type exist to see if function exist. exist('fuction')
%   Run-time errors: Logic errors.
%       ex: tpe a > b instead of b > a
%   Approximations errors 3 types
%       1. Machine Precision
%           controled by matchines
%       2. Round off errors
%           controled by matchines
%           ex: 1.234567 round to 3 decimals 1.235
%       3. Truncation errors
%           dropping the last terms in the Talior series expantion
%
% To illistrate the acceptance of errors we consider the terms:
%   1) Absolute error = Teacher: below *100
%       |(True value) - (Calculated vaue)|
%   2) Relative error = Teacher: below w/out *100
%       (Absolute error)/(True value)*100
%
% Read for Thursday Ch.5 and Ch.8

Symbolic Opporations

% Purpose: to demonstate Symbolic Opporations.

syms x b  % declare variables x and b symbolic

y = x^2

intigrate_x = int(x)
intigrate_y = int(y)

disp('Pretty form of the above')
pretty(int(x))
pretty(int(y))

diff(sin(x^2))

% The version of Matlab we are using can't do partial differentiation.


[x,y] = solve('x^2 + x*y + y = 3','x^2 - 4*x + 3 = 0')
% this program converst the strings to numbers, solves the system
% using gaussian elimination, then returns the answers in symbolic form.
 
y =
 
x^2
 
 
 
intigrate_x =
 
1/2*x^2
 
 
 
intigrate_y =
 
1/3*x^3
 
 
Pretty form of the above
 
                                         2
                                    1/2 x
 
                                         3
                                    1/3 x
 
ans =
 
2*cos(x^2)*x
 
 
 
x =
 
 1
 3
 
 
 
y =
 
    1
 -3/2