# Numerical solution to a 3rd order D.E. - "use computer to solve"

• Engineering
• rudy
In summary: So you see that y2 converges on 1 for a guess of 0.33, as I said in the first place.In summary, the conversation discusses a problem from boundary layer theory in fluid mechanics, which is being studied in the context of heat transfer. The suggested approach to solving the problem numerically involves replacing the third boundary condition and guessing a constant, then checking if this constant allows for the convergence of a certain function. The conversation also covers different approaches to solving the problem, including solving it analytically and using numerical methods such as Euler's Method. Ultimately, the conversation ends with one of the participants successfully using Euler's Method to verify the suggested guess for the constant.
rudy
Homework Statement
"Use a computer" to solve the third order differential equation by modifying the boundary conditions (see picture of problem).
Relevant Equations
f*(d^2f/dn^2) + 2*(d^3f/dn^3) = 0

f = 0 @ n = 0
f' = 0 @ n = 0
f' = 1 @ n = inf -or- f" = Constant @ n = 0 (see note)
Hello,

This problem comes from boundary layer theory in fluid mechanics, but we are studying it in heat transfer.

note: Since we are solving this numerically is has been suggested to replace the third boundary condition with f" = constant and then guess a constant. Then we are to check that using that constant f' converges at 1.

They even tell us the value of the constant (0.3321), however I have no clue how to check this answer. If f(n) is an undetermined function how can I solve this numerically?

If there is any information that would help let me know I will do my best to provide. I realize I haven't done much of an attempt at a solution, but I really don't know what to take for a first step! Any tips or suggestions appreciated.

-Rudy

#### Attachments

• Screen Shot 2020-03-25 at 3.08.54 PM.png
2.2 KB · Views: 136
• Screen Shot 2020-03-25 at 3.14.53 PM.png
8.6 KB · Views: 130
• Screen Shot 2020-03-25 at 3.15.27 PM.png
56.9 KB · Views: 119
Do you have any idea where to start?

Hi Chester,

Starting with the first bullet-point suggested in the question I will guess f" = 1 at n = 0.

(They say later in the question that this is incorrect but they suggest it as a starting point so I'll go with it)

But that's only one point, I can't get f' using that. I have two more boundary conditions to work with, so I'm thinking I integrate f". That gives f' = [function of n] + C , where C = arbitrary constant and the [function of n] is the integral of f".

Using the second boundary condition I know that [function of n] + C = 0 at n = 0, but what is the function?!

Keep going, integrate f'. Then I know f = [another function of n] + C_2n + C = 0. Not very helpful either...

I think this is the wrong approach since the book says to solve it numerically. I am trying to solve analytically. I still don't know how to start this using a numerical approach. Hopefully that shows you what I've been doing thus far.

Let $$y_1=f$$
$$y_2=f'$$
$$y_3=f''$$
Then:
$$\frac{dy_1}{d\eta}=y_2$$
$$\frac{dy_2}{d\eta}=y_3$$
$$\frac{dy_3}{d\eta}=-\frac{y_1y_3}{2}$$
3 simultaneous 1st order ODEs

rudy and Mark44
That was very helpful, thank you! However, I appear to be hitting another snag.

I got an equation for y3 which will not ever approach 1 as n goes to infinity. I will attach a picture of my work, in the end y3 = 6 / (n^3 + C), which approaches zero no matter what C is. Don't I want this to approach 1?

I attached my work, I don't know what I am doing wrong... I also tried plugging y3 back into the equation for y2, but that also approaches zero no matter what the constant is.

Thank you for any help

#### Attachments

• Attempt.jpg
32.9 KB · Views: 117
• W.A..png
24.4 KB · Views: 128
I don't understand what you are doing. You are supposed to be solving this numerically as an initial value problem. You guess an initial value of f'', and then you integrate to large eta (say eta = 10). If you guessed the correct initial value, y2 will approach 1. Do you know how to numerically integrate a set of simultaneous first order ODEs as an initial value problem?

Hi Chester-

Went back and reviewed my D.E. textbook on Euler's Method for solving systems. Sorry if it looked like I was looking for a free lunch, I really don't have much experience doing numerical techniques and I didn't recall this method. After reviewing the method I was able to verify that ~0.33 is the correct guess to make y2 converge on 1.

I included a screenshot of my code and output. In the output y2 overshoots 1, but it gets closer as I decrease the step size.

Thanks for your pointers and help setting up the system!

rudy

Matlab:
clear;
clc;
dn = 0.5;

%initial conditions

Guess = 0.330;
y1 = 0;
y2 = 0;
y3 = Guess;

fprintf("        y1        y2        y3        m        n        p\n\n");

for i = 1:15
m = y2;
n = y3;
p = -0.5*y1*y3;
M = [m n p];
Y = [y1 y2 y3];
P = [Y M];
disp(P);
y1 = y1 + m*dn;
y2 = y2 + n*dn;
y3 = y3 + p*dn;
end

Code:
        y1        y2        y3        m        n        p

0         0    0.3300         0    0.3300         0

0    0.1650    0.3300    0.1650    0.3300         0

0.0825    0.3300    0.3300    0.3300    0.3300   -0.0136

0.2475    0.4950    0.3232    0.4950    0.3232   -0.0400

0.4950    0.6566    0.3032    0.6566    0.3032   -0.0750

0.8233    0.8082    0.2657    0.8082    0.2657   -0.1094

1.2274    0.9410    0.2110    0.9410    0.2110   -0.1295

1.6979    1.0465    0.1463    1.0465    0.1463   -0.1242

2.2212    1.1197    0.0842    1.1197    0.0842   -0.0935

2.7810    1.1617    0.0374    1.1617    0.0374   -0.0520

3.3619    1.1805    0.0114    1.1805    0.0114   -0.0192

3.9521    1.1862    0.0018    1.1862    0.0018   -0.0036

4.5452    1.1871    0.0000    1.1871    0.0000   -0.0000

5.1387    1.1871   -0.0000    1.1871   -0.0000    0.0000

5.7323    1.1871    0.0000    1.1871    0.0000   -0.0000

Last edited:
Chestermiller
@rudy, both your code and its output are text, so it would be better to post them directly in the input pane, rather than as png images.

For the code, use code tags, like so
[ code=matlab]<your code goes here>[ /code] -- don't include the spaces that I've added.

For the output, use code tags as well, but without the '=matlab' attribute.

rudy
Thanks Mark - reformatted

rudy said:
Thanks Mark - reformatted
Much better -- thanks!

## 1. What is a 3rd order differential equation?

A 3rd order differential equation is an equation that involves the third derivative of a function. It is a type of mathematical equation that is commonly used to model physical phenomena in various fields such as physics, engineering, and economics.

## 2. Why is it important to use a computer to solve a 3rd order differential equation?

3rd order differential equations can be very complex and difficult to solve by hand. Using a computer to solve them allows for more accurate and efficient solutions, as well as the ability to handle larger and more complicated equations.

## 3. What is numerical solution and how does it relate to 3rd order differential equations?

Numerical solution is a method of solving equations using numerical values instead of exact algebraic solutions. It is particularly useful for solving 3rd order differential equations as they often cannot be solved analytically.

## 4. What are some commonly used methods for numerical solution of 3rd order differential equations?

Some commonly used methods include Euler's method, Runge-Kutta methods, and finite difference methods. These methods involve approximating the solution by breaking the problem down into smaller, more manageable parts.

## 5. Are there any limitations to using a computer to solve 3rd order differential equations?

While computers are very powerful tools for solving equations, there are some limitations. For example, if the equation has a singularity or discontinuity, the computer may not be able to accurately solve it. Additionally, the accuracy of the solution depends on the precision of the computer's calculations.

• Special and General Relativity
Replies
5
Views
925
• Programming and Computer Science
Replies
63
Views
3K
• Engineering and Comp Sci Homework Help
Replies
2
Views
1K
• Engineering and Comp Sci Homework Help
Replies
2
Views
2K
• Electromagnetism
Replies
1
Views
1K
• Engineering and Comp Sci Homework Help
Replies
13
Views
2K
• Quantum Physics
Replies
6
Views
811
• Engineering and Comp Sci Homework Help
Replies
7
Views
840
• Differential Equations
Replies
1
Views
2K
• Programming and Computer Science
Replies
4
Views
4K