 CoCalc Public Filesintro_to_numerical_analysis.slides.html
Author: Anonymous User-1597356567
Views : 56
Compute Environment: Ubuntu 18.04 (Stable)
intro_to_numerical_analysis slides

# ISW2101 Métodos Numéricos¶

Prof. Mario González, Ph.D. en Informática Web page

# Welcome to numerical analysis in Octave and Python¶

• What is numerical analysis?
• Have you perform any type of numerical analysis?
• Have you used an old school calculator?
• What was the accuracy?
• Examples of numerical anaylsis.

# Numerical Analysis¶

Numerical Analysis: refers to the analysis of mathematical problems by numerical means, especially mathematical problems arising from models based on calculus.

## Definition and requirements¶

Numerical Analysis: refers to the analysis of mathematical problems by numerical means, especially mathematical problems arising from models based on calculus.

Effective numerical analysis requires several things:

• An understanding of the computational tool being used, be it a calculator or a computer.
• An understanding of the problem to be solved.
• Construction of an algorithm which will solve the given mathematical problem to a given desired accuracy and within the limits of the resources (time, memory, etc) that are available.

## Theoretical, experimental and computational approaches¶

• Traditionally, engineering and science had a two-sided approach to understanding a subject: the theoretical and the experimental. More recently, a third approach has become equally important: the computational.
• Traditionally we would build an understanding by building theoretical mathematical models, and we would solve these for special cases.
• But more practical situations could seldom be handled by direct means, because the needed equations could be too difficult to solve.
• Thus we also used the experimental approach to obtain better information about the system we want to study.
• The theory would suggest ideas to be tried in the laboratory, and the experimental results would often suggest directions for a further development of theory.

### Computational Science¶

• With the rapid advance in powerful computers, we now can augment the study of a problem by directly solving the theoretical models of its domain applied to more practical situations; and this area is often referred to as computational science.
• At the heart of computational science is numerical analysis; and to effectively carry out a computational science approach to studying a physical problem, we must understand the numerical analysis being used, especially if improvements are to be made to the computational techniques being used.

### Computational X¶

• Computational Mathematics
• Computational Physics
• Computational Biology
• Computational Neuroscience
• Computational Finances
• Computational Managemet Science
• Computational Social Science

# Why study numerical methods?¶

• Critical Loads for Buckling a Column.

• Static Analysis of a Scaffolding

• Analysis of Natural Frequencies of a Vibrating Bar.

• Stability of frameworks under external forces (bridges, houses, ...). Mostly numerical linear algebra, sometimes differential equations are solved.

• Communication/power: (i) Network simulation and (ii) Train and traffic networks.

See:

## Why Am I in this course? For SE, TI students.¶

We will improve our:

• Problem solving abilities.
• Learn languages for numerical computation, will be helpful for AI/Data Science applications.
• Do some computer science. Plotting a random series in:

## Example¶

• A cross section of a river with measurements of its depth at intervals of 40 ft is shown in the figure. Use numerical integration to estimate the cross-sectional area of the river. # Topics to be covered¶

• Within this course, we attempt to show the spirit of the subject.
• Most of our time will be taken up with looking at algorithms for solving basic problems such as:
• matrix algebra and linear systems,
• rootfinding,
• interpolation,
• and differential equations;
• but we will also look at the structure of computers and the implications of using them in numerical calculations.
• We will aim linking at the relationship of numerical analysis to the larger world of science and engineering.

# A simple example¶

• A mathematical model is a mathematical description of a physical situation.
• By means of studying the model, we hope to understand more about the physical situation. Such a model might be very simple. For example, $A=4 \pi R_e^2,\ R_e \approx 6.371km$ is a formula for the surface area of the earth. How accurate is it?
1. First, it assumes the earth is sphere, which is only an approximation. At the equator, the radius is approximately 6,378 km; and at the poles, the radius is approximately 6,357 km.

2. Next, there is experimental error in determining the radius; and in addition, the earth is not perfectly smooth.

• Therefore, there are limits on the accuracy of this model for the surface area of the earth.
In :
Year = 1790:10:1870;

Censo = [3929214 5308483 7239881 9638453 12866020 17069453 23191876 31433321 39818449];

Model(1) = 3929214;
for i=2:9
Model(i) = Model(i-1)*1.349;
endfor

[Year' Censo' Model' abs(1 - Model./Censo)'*100]

ans =

1790.00000    3929214.00000    3929214.00000          0.00000
1800.00000    5308483.00000    5300509.68600          0.15020
1810.00000    7239881.00000    7150387.56641          1.23612
1820.00000    9638453.00000    9645872.82709          0.07698
1830.00000   12866020.00000   13012282.44375          1.13681
1840.00000   17069453.00000   17553569.01662          2.83615
1850.00000   23191876.00000   23679764.60341          2.10370
1860.00000   31433321.00000   31944002.45001          1.62465
1870.00000   39818449.00000   43092459.30506          8.22235


In :
plot(Year, Censo, '--o');
hold on;
plot(Year, Model, ':s');
legend('Censo','Model')

Out: Solution of Discrete Growth Model

There are not many discrete models that have an explicit solution. However, it is easy to solve the discrete Malthusian growth model. From the model above, we see that:

$P_1 = (1 + r)P_0,\ P_2 = (1 + r)P_1 = (1 + r)^2P_0, \dots, P_n = (1 + r)P_{n-1} = (1 + r)^nP_0.$$P_n = (1 + r)^nP_0$

This shows why Malthusian growth is also known as exponential growth. The solution to the model that is given by the equation above is an exponential function with a base of $1+r$ and power $n$ representing the number of iterations after the initial population is given.

In :
P0 = 3929214;

r = 0.349;

for n=0:8
Model(n+1) = (1 + r)^n*P0;
endfor

plot(Year, Censo, '--o');
hold on;
plot(Year, Model, ':s')
legend('Censo','Model')

Out: ## More examples:¶

How do you plot (on a graph notebook) $y = x^2$

What is the limit of $\lim_{n \rightarrow \infty} \left(\frac{n}{n+1} \right).$

What is the limit of

$\lim_{n \rightarrow \infty} \left(1 - \frac{1}{n} \right)^n.$

Questions?