Computational Time for Forward Substitution

In the previous blog, we found the computatational time for back substitution. This is a blog that will show you how we can find the approximate time it takes to conduct forward substitution, while solving simultaneous linear equations. The blog assumes a AMD-K7 2.0GHz chip that uses 4 clock cycles for addition, subtraction and multiplication, while 16 clock cycles for division. Note that we are making reasonable approximations in this blog. Our main motto is to see what the computational time is proportional to – does the computational time double or quadruple if the number of equations is doubled.

Forward Substitution Time
Forward Substitution Time

The pdf file of the solution is also available.

This post is brought to you by

Subscribe to the blog via a reader or email to stay updated with this blog. Let the information follow you.

Computational Time for Back Substitution

This is a blog that will show you how we can find the approximate time it takes to conduct back substitution, while solving simultaneous linear equations using Gaussian elimination method. The blog assumes a AMD-K7 2.0GHz chip that uses 4 clock cycles for addition, subtraction and multiplication, and 16 clock cycles for division. Note that we are making reasonable approximations in this blog. Our main motto is to find how the computational time is related to the number of equations.

The pdf file of the solution is also available.

This post is brought to you by

Subscribe to the blog via a reader or email to stay updated with this blog. Let the information follow you.

Example: Solving First Order Linear ODE by Integrating Factor

I have a audiovisual digital lecture on YouTube that shows the use of Euler’s method to solve a first order ordinary differential equation (ODE).  To show the accuracy of Euler’s method,  I compare the approximate answer to the exact answer.  A YouTube viewer asked me: How did I get the exact answer?

In this blog, I use the integrating factor method to find the exact answer, because that is the method the viewer was using to solve the ODE exactly.  So here it is and in two future blogs, I will show the same example being solved by 1) Laplace transforms and 2) the classical (complementary + particular) solution techniques.
Solving First Order Linear ODE by Integrating Factor
Solving First Order Linear ODE by Integrating Factor

The pdf file of the solution is also available.

This post is brought to you by

Subscribe to the blog via a reader or email to stay updated with this blog. Let the information follow you.

2010 in review

The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here’s a high level summary of its overall blog health:

Healthy blog!

The Blog-Health-o-Meter™ reads Wow.

Crunchy numbers

Featured image

A helper monkey made this abstract painting, inspired by your stats.

The Louvre Museum has 8.5 million visitors per year. This blog was viewed about 79,000 times in 2010. If it were an exhibit at The Louvre Museum, it would take 3 days for that many people to see it.

In 2010, there were 13 new posts, growing the total archive of this blog to 89 posts. There were 3 pictures uploaded, taking up a total of 1mb.

The busiest day of the year was October 28th with 441 views. The most popular post that day was MATLAB code for bubble sort.

Where did they come from?

The top referring sites in 2010 were nm.mathforcollege.com, autarkaw.com, newtonexcelbach.wordpress.com, google.com, and en.wordpress.com.

Some visitors came searching, mostly for bubble sort matlab, polynomial interpolation matlab, matlab solve equation, interpolation matlab, and spline matlab.

Attractions in 2010

These are the posts and pages that got the most views in 2010.

1

MATLAB code for bubble sort November 2009
1 comment

2

How do I solve a nonlinear equation in MATLAB? April 2009
7 comments

3

How do I differentiate in MATLAB? March 2009
1 comment

4

A Matlab program for comparing Runge-Kutta methods August 2008
4 comments and 1 Like on WordPress.com,

5

How do I do polynomial interpolation in MATLAB June 2009
1 comment

Inverse error function using interpolation

In the previous post, http://autarkaw.wordpress.com/2010/09/01/using-int-and-solve-to-find-inverse-error-function-in-matlab/, we found the inverse error function by using the integral and solve MATLAB functions.  In this blog, we find the inverse error function by using interpolation.

The value of erf(x) is given at discrete data points of x, and we use spline interpolation to find the value of x at a given value of erf(x).  The given data points of (x,erf(x)) are (0,0), (0.1,0.1125), (0.25,0.2763), (0.75,0.7112), (1.0,0.8427), (1.5,0.9661), (2.0,0.9953), (5.0,1.000). 

It is better to download (right click and save target) the program as single quotes in the pasted version do not translate properly when pasted into a mfile editor of MATLAB or you can read the html version for clarity and sample output.

%% FINDING INVERSE ERROR FUNCTION
% In a previous blog at autarkaw.wordpress.com (Sep 1, 2010), we set up a
% nonlinear equation to find the inverse error function.
% In this blog, we will solve this equation
% by using interpolation.
% The problem is given at
% http://nm.mathforcollege.com/blog/inverseerror.pdf
% and we are solving Exercise 2 of the pdf file.

%% TOPIC
% Finding inverse error function

%% SUMMARY

% Language : Matlab 2008a;
% Authors : Autar Kaw;
% Mfile available at
% http://nm.mathforcollege.com/blog/inverse_erf_interp_matlab.m;
% Last Revised : October 4 2010
% Abstract: This program shows you how to find the inverse error function
% using interpolation
clc
clear all

%% INTRODUCTION

disp(‘ABSTRACT’)
disp(‘   This program shows you how to’)
disp(‘   find the inverse error function’)
disp(‘ ‘)
disp(‘AUTHOR’)
disp(‘   Autar K Kaw of http://autarkaw.wordpress.com’)
disp(‘ ‘)
disp(‘MFILE SOURCE’)
disp(‘ http://nm.mathforcollege.com/blog/inverse_erf_interp_matlab.m’)
disp(‘  ‘)
disp(‘PROBLEM STATEMENT’)
disp(‘ http://nm.mathforcollege.com/blog/inverseerror.pdf  Exercise 2′)
disp(‘ ‘)
disp(‘LAST REVISED’)
disp(‘   October 4, 2010’)
disp(‘ ‘)

%% INPUTS
% Value of error function
erfx=0.1125;
% Table of erf(x) vs x
xx=[0  0.1  0.25  0.75  1.0  1.5  2.0  5.0];
erfxx=[0  0.1125  0.2763  0.7112  0.8427  0.9661  0.9953  1.0000];

%% DISPLAYING INPUTS

disp(‘INPUTS’)
fprintf(‘ Inverse error function is to be found for= %g’,erfx)
disp(‘  ‘)
disp(‘ Given erf(x) vs x values’)
disp(‘_______________________’)
disp(‘    x          erfx  ‘)
disp(‘________________________’)
dataval=[xx;erfxx]’;
disp(dataval)

%% CODE
if erfx>1.0 | erfx<0
    disp(‘Invalid value. erf(x) only takes values in [0,1] range’)
else
inverse_erf=interp1(erfxx,xx,erfx,’cubic’);
%% DISPLAYING OUTPUTS

disp(‘OUTPUTS’)
fprintf(‘ Value of inverse error func from this mfile is= %g’,inverse_erf)
fprintf(‘ \n Value of inverse error func from MATLAB is    = %g’,erfinv(erfx))
disp(‘  ‘)
end

__________________________________________________

This post is brought to you by

Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://nm.mathforcollege.com,
the textbook on Numerical Methods with Applications available from the lulu storefront,
the textbook on Introduction to Programming Concepts Using MATLAB, and
the YouTube video lectures available at http://nm.mathforcollege.com/videos

Subscribe to the blog via a reader or email to stay updated with this blog. Let the information follow you.

Using int and solve to find inverse error function in MATLAB

In the previous post, http://autarkaw.wordpress.com/2010/08/24/finding-the-inverse-error-function/, we set up the nonlinear equation to find the inverse of error function.  Using the int and solve MATLAB commands, we write our own program to find the inverse error function.

It is better to download (right click and save target) the program as single quotes in the pasted version do not translate properly when pasted into a mfile editor of MATLAB or you can read the html version for clarity and sample output.

%% FINDING INVERSE ERROR FUNCTION
% In a previous blog at autarkaw.wordpress.com (August 24, 2010),
% we set up a nonlinear equation to find the inverse error function.
% In this blog, we will solve this equation.
% The problem is given at
% http://nm.mathforcollege.com/blog/inverseerror.pdf
% and we are solving Exercise 1 of the pdf file.

%% TOPIC
% Finding inverse error function

%% SUMMARY

% Language : Matlab 2010a;
% Authors : Autar Kaw;
% Mfile available at
% http://nm.mathforcollege.com/blog/inverse_erf_matlab.m;
% Last Revised : August 27, 2010
% Abstract: This program shows you how to find the inverse error function
clc
clear all

%% INTRODUCTION

disp(‘ABSTRACT’)
disp(‘   This program shows you how to’)
disp(‘   find the inverse error function’)
disp(‘ ‘)
disp(‘AUTHOR’)
disp(‘   Autar K Kaw of http://autarkaw.wordpress.com’)
disp(‘ ‘)
disp(‘MFILE SOURCE’)
disp(‘   http://nm.mathforcollege.com/blog/inverse_erf_matlab.m’)
disp(‘  ‘)
disp(‘PROBLEM STATEMENT’)
disp(‘   http://nm.mathforcollege.com/blog/inverseerror.pdf’)
disp(‘        Exercise 1’)
disp(‘ ‘)
disp(‘LAST REVISED’)
disp(‘   August 27, 2010’)
disp(‘ ‘)

%% INPUTS
% Value of error function
erfx=0.5;

%% DISPLAYING INPUTS

disp(‘INPUTS’)
fprintf(‘ The value of error function= %g’,erfx)
disp(‘  ‘)
disp(‘  ‘)

%% CODE
syms t x
inverse_erf=solve(int(2/sqrt(pi)*exp(-t^2),t,0,x)-erfx);
inverse_erf=double(inverse_erf);
%% DISPLAYING OUTPUTS

disp(‘OUTPUTS’)
fprintf(‘ Value of inverse error function from mfile is= %g’,inverse_erf)
fprintf(‘\n Value of inverse error function using erfinv is= %g’,erfinv(erfx))
disp(‘  ‘)

___________________________________________________

This post is brought to you by

Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://nm.mathforcollege.com,
the textbook on Numerical Methods with Applications available from the lulu storefront,
the textbook on Introduction to Programming Concepts Using MATLAB, and
the YouTube video lectures available at http://nm.mathforcollege.com/videos

Subscribe to the blog via a reader or email to stay updated with this blog. Let the information follow you.

Finding the inverse error function

Inverse Error Function

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://nm.mathforcollege.com, the textbook on Numerical Methods with Applications available from the lulu storefront, and the YouTube video lectures available at http://nm.mathforcollege.com/videos and http://www.youtube.com/numericalmethodsguy

Subscribe to the blog via a reader or email to stay updated with this blog. Let the information follow you.

A real-life example of having to solve a nonlinear equation numerically?

_______________________________________________

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://nm.mathforcollege.com, the textbook on Numerical Methods with Applications available from the lulu storefront, and the YouTube video lectures available at http://nm.mathforcollege.com/videos and http://www.youtube.com/numericalmethodsguy

Subscribe to the blog via a reader or email to stay updated with this blog. Let the information follow you.

Converting large numbers into floating point format by hand

__________________________________________________

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://nm.mathforcollege.com, the textbook on Numerical Methods with Applications available from the lulu storefront, and the YouTube video lectures available at http://nm.mathforcollege.com/videos and http://www.youtube.com/numericalmethodsguy

Subscribe to the blog via a reader or email to stay updated with this blog. Let the information follow you.

To prove that the regression model corresponds to a minimum of the sum of the square of the residuals

Many regression models when derived in books only show the first derivative test to find the formulas for the constants of a regression model.  Here we take a  simple example to go through the complete derivation.

Finding minimum of sum of square of residuals

Minimum of sum of square of residuals

_________________________________________________________

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://nm.mathforcollege.com, the textbook on Numerical Methods with Applications available from the lulu storefront, and the YouTube video lectures available at http://nm.mathforcollege.com/videos and http://www.youtube.com/numericalmethodsguy

Subscribe to the blog via a reader or email to stay updated with this blog. Let the information follow you.