Sei sulla pagina 1di 12

Solving ODE through least squares

FEM: Introduction
Suddhasheel Ghosh, PhD
Department of Civil Engineering
Jawaharlal Nehru Engineering College
N-6 CIDCO, 431003

Series on Advanced Numerical Methods

shudh (JNEC)

Concepts

MEStru2k1617

1 / 12

DiffEq1

Introduction to terminology

Given a differential equation

d2 y dy

, , y, x = 0,
dx2 dx

and the initial conditions,

dy
F1
, y, x = a = 0
dx

F2

(1)

dy
, y, x = b = 0
dx

So, given the points a and b, it is desired to find the solution of the
differential equation using the least squares technique.

shudh (JNEC)

Concepts

MEStru2k1617

2 / 12

DiffEq1

A second-order Boundary Value Problem

A boundary value problem is given as follows:


d2 y
dx
+ P(x) + Q(x)y = R(x)
dx2
dy
along with the conditions
y(x1 ) = A,

shudh (JNEC)

y(xn+1 ) = B

Concepts

MEStru2k1617

3 / 12

Least squares method

Recalling least squares


Least squares method

Least squares means that the sum of squares has to be minimised. The
minimization will happen at the internal points.

shudh (JNEC)

Concepts

MEStru2k1617

4 / 12

Least squares method

Formulation I
Least squares method

From the earlier computations, for x = x1 ,


0 + 1 x1 + 2 x12 + + n x1n = A,

(2)

2
n
0 + 1 xn+1 + 2 xn+1
+ + n xn+1
= B,

(3)

and for x = xn+1 ,

From an earlier computation, we have obtained:


n
X

h
i
i i(i 1)xi2 + ixi1 P(x) + xi Q(x) = R(x)

i=0

Thus, for every xj , j = 2, . . . , n, we have


"
#

n
X
i2
i1
i
(x) =
i i(i 1)x + ix P(xj ) + x Q(x) R(x)

(4)

i=0
shudh (JNEC)

Concepts

MEStru2k1617

5 / 12

Least squares method

Formulation II
Least squares method

For the least squares issue, we have to compute


b

F=

[(x)]2 dx =

Z
a

"

n
X

#2

i i(i 1)xi2 + ixi1 P(xj ) + xi Q(x) R(x)

dx

i=0

Therefore,
F
=
i

Z
a

"

n
X

i2
i1
i
i i(i 1)x + ix P(x) + x Q(x) R(x)

i=0

i(i 1)xi2 + ixi1 P(x) + xi Q(x) dx = 0

This, and the equations generated by the boundary conditions can be


solved by using Linear Algebra.
shudh (JNEC)

Concepts

MEStru2k1617

6 / 12

Least squares method

Example I
Least squares method

Problem: Use the least squares method to solve the following differential
equation:
d2 y
y = x
dx2
Use the boundary conditions y(x = 0) = 0 and y(x = 1) = 0. (Desai, Eldho,
Shah)
Solution: Let us assume that the solution is in the cubic form
y = 0 + 1 x + 2 x2 + 3 x3 .

shudh (JNEC)

Concepts

MEStru2k1617

7 / 12

Least squares method

Example II
Least squares method

Then, we will have


dy
= 1 + 22 x + 33 x2
dx
d2 y
= 22 + 63 x
dx2

(5)

Substituting these into the given differential equation, we have


(22 + 63 x) (0 + 1 x + 2 x2 + 3 x3 )
= 0 1 x + (2 x2 )2 + (6x x3 )3

=x
=x

We can therefore frame the error term as follows:


(x) = 0 1 x + (2 x2 )2 + (6x x3 )3 x
shudh (JNEC)

Concepts

MEStru2k1617

8 / 12

Least squares method

Example III
Least squares method

And therefore

2
((x))2 = 0 1 x + (2 x2 )2 + (6x x3 )3 x

(6)

From the boundary conditions, we will have the following


0 = 0

(7)

0 + 1 + 2 + 3 = 0

(8)

Therefore, we have
3 = 2 1
Substituting these in (6), we have

2
F = ((x))2 = 1 x + (2 x2 )2 + (x3 6x)(1 + 2 ) x
shudh (JNEC)

Concepts

MEStru2k1617

9 / 12

Least squares method

Example IV
Least squares method

Therefore,

F
= 1 x + (2 x2 )2 + (x3 6x)(1 + 2 ) x x3 7x
1

= 1 (x3 7x) + 2 (x3 x2 6x + 2) x (x3 7x)


(9)

F
= 1 x + (2 x2 )2 + (x3 6x)(1 + 2 ) x x3 6x x2 + 2
2

= 1 (x3 7x) + 2 (x3 x2 6x + 2) x x3 x2 6x + 2


(10)

Now,
F
dx = 0 = 13.67621 + 6.62622
0 1
Z 1
F
dx = 0 = 6.62621 + 4.27622
0 2
Z

shudh (JNEC)

Concepts

= 2.1333

(11)

= 1.05

(12)

MEStru2k1617

10 / 12

Least squares method

Example V
Least squares method

Thus, we can obtain 1 and 2 using the following

13.6762 6.6262 1
2.1333
=
6.6262 4.2762 2
1.05

(13)

Thus giving 0 = 0, 1 = 0.1485, 2 = 0.0154, and 3 = 0.1639 (since


1 + 2 + 3 = 0).

shudh (JNEC)

Concepts

MEStru2k1617

11 / 12

Least squares method

Thank you!

shudh (JNEC)

Concepts

MEStru2k1617

12 / 12

Potrebbero piacerti anche