User:EML5526.S11.Team1.HS/HW5

=5.2=

Given
Solve the differential equation $$ \frac{d}{dx} \left[ \left(2+3x \right)  \frac{du}{dx} \right]+5x = 0 $$ in the interval (0,1) with the boundary conditions

$$ u\left(1 \right)= 4 ; \frac{du}{dx} \left(0 \right)= -6 $$

The weak form was obtained in the latter section:

As we do not know $$ \frac{du}{dx} \left(1\right) $$ then we chose $$ w \left(1 \right) = 0 $$ ; moreover $$ u^h \left(1 \right)= 4 $$

1) Polynomial Basis Function
Polynomial basis functions To follows the constrain braking solution, we chose:

Clearly $$ b_1=1 $$, and as we need that $$ b_i \left(1 \right) = 0, i = 1,2,... $$;we chose $$ \beta=1 $$. Then we have $$ U^h \left(x\right)= a_0+a_1 \left(x-1 \right)+a_2 \left(x-1\right)^2+... $$

From the essential boundary condition we have: $$ U^h \left(1 \right)= 4= a_0 $$

Therefore:

In a similar way we have

With the condition: $$ w \left(1 \right)= 0= c_0 $$

Therefore:

The derivative of U and w are:

Replacing in the weak form we have:

Canceling $$ c_i $$ and Organizing we obtain:

Performing the integration we obtain:

From the latter equation the coefficients $$ a_j $$ can be obtained.

The analytical general solution is:

With the boundary conditions we obtain the constants:





 Matlab Code: 

2) Fourier Basis Function
Now the differential equation is solved using Fourier basis function and the boundary conditions:

To follow the constrain braking solution we chose:

For Cosine Clearly $$ b_1=1 $$, and as we need that $$ b_j \left(1 \right) = 0,j=0,1,2,... ~$$ ; we chose $$ \beta = 1  $$.

For Sine Clearly $$ b_1=1 $$, and as we need that $$ b_k \left(1 \right) = 0,k=1,2,... ~$$ ; we chose $$ \beta = 1  $$.

Then we have $$ U^h \left(x \right)= a_0 cos \left(x-1 \right)-1 + a_1 cos2 \left( x -1 \right)-1 ... $$

$$ U^h \left(x \right)= a_1 sin \left(x-1 \right) + a_2 sin2 \left( x -1 \right) ... $$

From the essential boundary condition we have: $$ U^h \left(1 \right)= 4=a_0 $$

Therefore:

By constructing a Stiffness & Force Matrices as follows.

Here the first equation gets satisfied for even values of i & j,

Whereas 2nd equation is satisfied for odd values of i & j,

further 3rd equation is satisfied for remaining combinations of i & j.

Here the first equation gets satisfied for even values of i & j,

Whereas 2nd equation is satisfied for odd values of i & j,

We developed a MATLAB code to generate the Force and the stiffness Matrix and We get the following values.

We can now use the relationship which is, $$\displaystyle Kd=F$$ to solve for $$\displaystyle d$$.

Thus the trial solution is:



 Matlab Code: 

3) Exponential Basis Function
Now the differential equation is solved using exponential basis function and the boundary conditions:

To follow the constrain braking solution we chose:

Clearly $$ b_1=1 $$, and as we need that $$ b_i \left(1 \right) = 0,i=1,2,... ~$$ ; we chose $$ \beta =1 $$.

Then we have $$ U^h \left(x \right)= a_0+a_1 \left(e^{\left(x-1 \right)}-1\right)+a_2 \left(e^{2\left(x-1\right)}-1\right)+... $$

From the essential boundary condition we have: $$ U^h \left(1 \right)= 4=a_0 $$

Therefore:

In similar way we have:

With the condition: $$ w(1) = 0 = c_1 $$

Therefore:

The derivative of U and w are:

Replacing in the weak form we have:

Canceling $$ c_i $$ and organizing we obtain:

Performing the integration we obtain:

The following figure shows the exact and numerical solutions. Although good approximation was obtained at $$ n = 3 $$, the convergence for an error of order $$10^{-6} $$ was only achieved with $$ n=29 $$ and to $$n $$ greater than $$ 8 $$, a bad-conditioned (close to singular) stiffness matrix was obtained. Figure 2.4 shows the error.

This results shows that polynomial is better basis function because the convergence is obtained faster; moreover for other problems, the integration may not be possible to perform analytically as in this case, making necessary that the program perform the integration numerically which will increase the time of numerical calculations and decrease the accuracy.



 Matlab Code: