User:Eml5526.s11.team6.joglekar/hwk3

Given
General one dimensional Model 1.0/Data set 2 on page 1 of Mtg 12:

where $${a_2} = 2$$,  f = 3

Consider $$ {b_j}\left( x \right) = (x+k)^j $$ and k=1 to avoid $${b_j}'\left( 0 \right)=0 $$

Find
A) If n=2, What is the D.O.F. of this problem?

B) Find two equations that enforce boundary conditions for $$ {u^h}\left( x \right) = \sum\limits_{j = 0}^n $$

C) Find one more equation to solve for $$ {\mathbf{d}} = {\left\{ \right\}_{3 \times 1}} $$ by projecting the residue $$ {\mathbf{P}}\left(  \right) $$ on a basis function $$ b_k\left( x \right)     $$ with  k = 0,1,2 such that the additional equation is linear independent from the equations found in the solution of the (B)

D) Display 3 equations in matrix form $$ {\mathbf{Kd}} = {\mathbf{F}} $$ and observe symmetric property of $$ {\mathbf{K}} $$

E) Solve for $$ {\mathbf{d}} $$

F) Construct $$ u_n^h\left( x \right) $$ and plot $$ u_n^h\left( x \right) \ vs \ u\left( x \right) $$ ....(where $$ u\left( x \right) $$ is the exact solution)

G) Repeat (A) to (F) for n=4 and n=6

H) Compare $$ u_n^h\left( {x = 0.5} \right)   for n = 2,4,6 $$

If error $$ {e_n}\left( {0.5} \right) = u\left( {0.5} \right) - {u^h}\left( {0.5} \right) $$ ,Plot $$ {e_n}\left( {0.5} \right) \ vs \ n $$

A
A) Since for this problem,'n' starts from 0;

D.O.F.=n+1

D.O.F.=3

B
B) From (Eq 3.1.2) we can get $$ \sum\limits_{j = 0}^2 {{d_j}{b_j}\left( 1 \right)} = 0 $$

Then rewrite the above equation in matrix form:

where

From (3.1.3) we can get $$ \sum\limits_{j = 0}^2 {{d_j}b_j^{\left( 1 \right)}\left( 0 \right)} =  - 4 $$

Then rewrite the above equation in matrix form:

where

Equations 3.1.4 and 3.1.6 are the two equations that enforce the boundary conditions for $$ {u}^h\left( x \right) $$

c
C) Because the residue $$ P = \frac{d}\left( {{a_2}\frac{d}{b_j}\left( x \right)} \right) - f\left( x \right)$$, after projecting the residue we get:

$$ \sum\limits_{j = 0}^2 {\left\{ {\int_0^1 {{b_k}\left( x \right)\left[ {\frac{d}\left( {{a_2}\frac{d}{b_j}\left( x \right)} \right)} \right]dx} } \right\}} {d_j} = - \int_0^1 {{b_k}\left( x \right)f\left( x \right)dx} $$

Then rewrite the above equation in matrix form:

where

$$ {K_{kj}} = 2\int_0^1 {{b_k}\left( x \right)b_j^{\left( 2 \right)}\left( x \right)dx} $$

$$         = 2\int_0^1 (x+1)^k. j.(j-1).(x+1)^{j-2} dx $$

It is clear that matrix K is not symmetric.

D
In order to simplify the computation, the following fortran code was used based on equations (3.1.8),(3.1.9) and (3.1.10) for n=1-10

Using the above codes we can get solutions for all the possible inputs as follows:

The exact solution of eq.3.1.1 by enforcing the boundary condition is

$$ u(x)= -\frac{3x^2}{2}-8x+\frac{19}{2} $$

The results are compared with the exact solution as following:



From the above figure it can be seen that the approximate solution almost equals to exact solution for n=4 and above.



The above figure shows the value of error function with respect to value of n.

From the figure it is clear that error function follows random path for lower values on n and for higher values error function decreases with increase in n.

Solution can be considered to be converging after n=8.

Given
General one dimensional Model 1.0/Data set 2 on page 1 of Mtg 12:

where $${a_2} = 2$$,  f = 3

Consider $$ {b_j}\left( x \right) = (x+k)^j $$ and k=0

A
A) Since for this problem,'n' starts from 0;

D.O.F.=n+1

D.O.F.=3

B) From (Eq 2.9.2) we can get $$ \sum\limits_{j = 0}^2 {{d_j}{b_j}\left( 1 \right)} = 0 $$

Then rewrite the above equation in matrix form:

where

From (3.1.3) we can get $$ \sum\limits_{j = 0}^2 {{d_j}b_j^{\left( 1 \right)}\left( 0 \right)} =  - 4 $$

Then rewrite the above equation in matrix form:

where

Equations 3.1.4 and 3.1.6 are the two equations that enforce the boundary conditions for $$ {u}^h\left( x \right) $$

Integration can be obtained using following matlab code:

Given
General one dimensional Model 1.0/Data set 2 on page 1 of Mtg 12:

where $${a_2} = 2$$,  f = 3

Consider $$ {b_j}\left( x \right) = 1+{a_j}cos(jx)+{b_j}sin(jx) $$

To find
A) If n=2, What is the D.O.F. of this problem?

B) Find two equations that enforce boundary conditions for $$ {u^h}\left( x \right) = \sum\limits_{j = 0}^n $$

C) Find one more equation to solve for $$ {\mathbf{d}} = {\left\{ \right\}_{3 \times 1}} $$ by projecting the residue $$ {\mathbf{P}}\left(  \right) $$ on a basis function $$ b_k\left( x \right)     $$ with  k = 0,1,2 such that the additional equation is linear independent from the equations found in the solution of the (B)

D) Display 3 equations in matrix form $$ {\mathbf{Kd}} = {\mathbf{F}} $$ and observe symmetric property of $$ {\mathbf{K}} $$

E) Solve for $$ {\mathbf{d}} $$

F) Construct $$ u_n^h\left( x \right) $$ and plot $$ u_n^h\left( x \right) \ vs \ u\left( x \right) $$ ....(where $$ u\left( x \right) $$ is the exact solution)

G) Repeat (A) to (F) for n=4 and n=6

H) Compare $$ u_n^h\left( {x = 0.5} \right)   for n = 2,4,6 $$

If error $$ {e_n}\left( {0.5} \right) = u\left( {0.5} \right) - {u^h}\left( {0.5} \right) $$ ,Plot $$ {e_n}\left( {0.5} \right) \ vs \ n $$

Solution
A) Since for this problem,'n' starts from 0;

D.O.F.=n+1

D.O.F.=3

B) From (Eq 2.9.2) we can get $$ \sum\limits_{j = 0}^2 {{d_j}{b_j}\left( 1 \right)} = 0 $$

Then rewrite the above equation in matrix form:

where

From (3.1.3) we can get $$ \sum\limits_{j = 0}^2 {{d_j}b_j^{\left( 1 \right)}\left( 0 \right)} =  - 4 $$

Then rewrite the above equation in matrix form:

where

Equations 3.1.4 and 3.1.6 are the two equations that enforce the boundary conditions for $$ {u}^h\left( x \right) $$

Following matlab code is used to compute integration



The above figure compares the exact solution and the approximated solution

It can be seen that at n=5, approximate solution almost equals exact solution



The above figure compares error between the exact and approximate solution at x=0.5