codecademy.com looks promising

codecademy.com is offering promising free online courses to non-CS programmers.  It is an interactive way of learning how to program and it also assesses your learning gains via badges.  Go and give it a try.  You can get a quick glimpse of what they are trying to do by watching a CNN news clip.

__________________________________

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 athttp://nm.mathforcollege.com/videos.  Subscribe to the blog via areader or email to stay updated with this blog. Let the information follow you.

Numerical Methods YouTube Video Progress

Since January 2009, I have been videotaping numerical methods course lectures in the Educational Outreach studio of University of South Florida, Tampa. Videos are made in 10-minute segments, not just because that is the limit of the length of YouTube videos, but because we firmly believe in making our resources pedagogically neutral. Ten minute videos allow an instructor to pick and choose what, when and how he or she wants the students to learn.

But some people have asked me – Why YouTube – why not put the same 10-minute videos on your own website. We do have the links to the YouTube videos on our own website, but there are many good reasons to go the YouTube route. The list of reasons below may be obvious to some, while others may not have thought about some of them.

1. Use YouTube’s storage space for the videos.

2. Use YouTube’s compression technology to make the videos stream faster on slow connections.

3. Use the power of Google and YouTube to tag and search the videos.

4. Use YouTube’s bandwidth as opposed to that of my school. My school’s IT department most probably would start screaming when the downloads pick up pace.

5. Use YouTube’s editing facilities to add annotations, links, and play lists.

6. Use the ubiquity of YouTube to reach a large audience.

7. Simple one stop process to let others embed the videos on their website.

8. Have open discussion on the videos via comments.

9. Get the videos rated so that we can judge their quality.

10. Use the “insight” tool of YouTube to analyze who is watching the videos.

______________________________________________________________________

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.

Is a square matrix strictly diagonally dominant?

A square matrix A is strictly diagonally dominant if for all rows the absolute value of the diagonal element in a row is strictly greater than than the sum of absolute value of the rest of the elements in that row.

In this posting, I show a MATLAB program that finds whether a square matrix is strictly diagonally dominant by using two different methods. These are academic ways to reinforce programming skills in a student.

The MATLAB program can be downloaded as a Mfile (better to download it, as single quotes from the web-post do not translate correctly with the MATLAB editor). The html file showing the mfile and the command window output is also available.

%% IS A GIVEN SQUARE MATRIX STRICTLY DIAGONALLY DOMINANT?
% Language : Matlab 2007a
% Authors : Autar Kaw
% Last Revised : November 25, 2008
% Abstract: This program shows you two ways of finding out
% if a square matrix is diagonally dominant. A square matrix is
% diagonally dominant if for all rows the absolute value of the
% diagonal element in a row is strictly greater than than the sum
% of absolute value of the rest of the elements in that row
clc
clear all
disp(‘This program shows you two ways of finding out’)
disp(‘if a square matrix is diagonally dominant. A square matrix is’)
disp(‘diagonally dominant if for all rows the absolute value of the’)
disp(‘diagonal element in a row is strictly greater than than the sum’)
disp(‘of absolute value of the rest of the elements in that row’)
disp(‘ ‘)
%% INPUTS
% The square matrix
A=[-12 1 -7 2;1 3.4 1.1 1.1; 1 0 -4.5 0;10 1 1 10];
disp (‘INPUTS’)
disp(‘Here is the square matrix’)
A
disp(‘ ‘)

%% FIRST SOLUTION
% This is based on finding for how many rows the condition
% the absolute value of the diagonal element in a row is
% strictly greater than than the sum of absolute value
% of the rest of the elements in that row.

%size gives how many rows and columns in the A matrix
rowcol=size(A);
n=rowcol(1);
% count = for how many rows is the inequality met that
% the absolute value of the diagonal element in a row is
% strictly greater than than the sum of absolute value
% of the rest of the elements in that row
count=0;
for i=1:1:n
sumrow=0;
for j=1:1:n
if i~=j
sumrow=sumrow+abs(A(i,j));
end
end
if abs(A(i,i))>sumrow
count=count+1;
end
end
disp(‘FIRST WAY’)
if count==n
disp(‘Matrix is strictly diagonal dominant’)
else
disp(‘Matrix is NOT strictly diagonal dominant’)
end

%% SECOND SOLUTION
% This is based on finding for if for any row the condition
% the absolute value of the diagonal element in a row is
% strictly greater than than the sum of absolute value
% of the rest of the elements in that row is NOT met

%size gives how many rows and columns in the A matrix
rowcol=size(A);
n=rowcol(1);
% flag = keeps track if the condition is not met
% flag = 1 if matrix is strictly diagonally dominant
% flag = 2 if matrix is not strictly diagonally dominant

% Assuming matrix is strictly diagonally dominant
flag=1;
for i=1:1:n
sumrow=0;
for j=1:1:n
if i~=j
sumrow=sumrow+abs(A(i,j));
end
end
% As soon as the condition is not met, it is not a strictly
% diagonally dominant matrix
if abs(A(i,i))<=sumrow
flag=2;
break;
end
end
disp(‘ ‘)
disp(‘SECOND WAY’)
if flag==1
disp(‘Matrix is strictly diagonal dominant’)
else
disp(‘Matrix is NOT strictly diagonal dominant’)
end

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://nm.mathforcollege.com and the textbook on Numerical Methods with Applications available from the lulu storefront.

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

A better way to show conversion of decimal fractional number to binary

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://www.youtube.com/numericalmethodsguy.  

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

Finding height of atmosphere using nonlinear regression

Here is an example of finding the height of the atmosphere using nonlinear regression of the mass density of air vs altitude above sea level.

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://nm.mathforcollege.com.

An abridged (for low cost) book on Numerical Methods with Applications will be in print (includes problem sets, TOC, index) on December 10, 2008 and available at lulu storefront.

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

A better way to show decimal to binary conversion

Decimal to binary conversion of an integer
Decimal to binary conversion of an integer

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://nm.mathforcollege.com.

An abridged (for low cost) book on Numerical Methods with Applications will be in print (includes problem sets, TOC, index) on December 10, 2008 and available at lulu storefront.

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

Accuracy of Taylor series

So how many terms should I use in getting a certain pre-determined accuracy in a Taylor series. One way is to use the formula for the Taylor’s theorem remainder and its bounds to calculate the number of terms. This is shown in the example below.

Taykor series accuracy

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://nm.mathforcollege.com.

An abridged (for low cost) book on Numerical Methods with Applications will be in print (includes problem sets, TOC, index) on December 10, 2008 and available at lulu storefront.

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

Taylor series example

If Archimedes were to quote Taylor’s theorem, he would have said, “Give me the value of the function  and the value of all (first, second, and so on) its derivatives at a single point, and I can give you the value of the function at any other point”.

It is very important to note that the Taylor’s theorem is not asking for the expression of the function and its derivatives, just the value of the function and its derivatives at a single point.

Now the fine print: Yes, all the derivatives have to exist and be continuous between x and x+h, the point where you are wanting to calculate the function at. However, if you want to calculate the function approximately by using the nth order Taylor polynomial, then 1st, 2nd,…., nth derivatives need to exist and be continuous in the closed interval [x,x+h], while the (n+1)th derivative needs to exist and be continuous in the open interval (x,x+h).

Taylor Series Revisited

Taylor series is a very important concept that is used in numerical methods. From the concept of truncation error to finding the true error in Trapezoidal rule, having a clear understanding of Taylor series is extremely important. Other places in numerical methods where Taylor series concept is used include: the derivation of finite difference formulas for derivatives, finite difference method of solving differential equations, error in Newton Raphson method of solving nonlinear equations, Newton divided difference polynomial for interpolation, etc.

I have written a short chapter on Taylor series. After reading the chapter, you should be able to:

1. understand the basics of Taylor’s theorem,

2. see how transcendental and trigonometric functions can be written as Taylor’s polynomial,

3. use Taylor’s theorem to find the values of a function at any point, given the values of the function and all its derivatives at a particular point,

4. errors and error bounds of approximating a function by Taylor series,

5. revisit the chapter whenever Taylor’s theorem is used to derive or explain numerical methods for various mathematical procedures.

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://nm.mathforcollege.com.

An abridged (for low cost) book on Numerical Methods with Applications will be in print (includes problem sets, TOC, index) on December 10, 2008 and available at lulu storefront.

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

Runge-Kutta 2nd order equations derived

In my class, I present the 2nd order Runge-Kutta method equations without proof. Although I do discuss where the equations come from, there are still students who want to see the proof. So here it is.

_____________________________________________________

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://nm.mathforcollege.com

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