Trial function for ODE

In summary: There were 25 grams of salt in 50 litres of water so the concentration of salt in that water was 25/50= 1/2 gram/litre so there were 1/2(50)= 25 grams of salt in the 50 litres of water. But there are 50 litres of water there! In fact, since there is alwys 50 litres of water in tank B, the amount of salt in tank B can never go above 25 grams. The maximum value of B(t) is 25. That means that B(t) never goes above 25 grams. Now, when t= 0, there are
  • #1
584
0
Hi I've just got a quick question. For the following ODE what would be a useful trial function?

y'' + y + y = (sinx)^2

The RHS is sin(x) all squared.

The complimentary solution has trig terms with a root 3 in the arguments so for the trial function I don't need to worry about multiplying by x etc. Usually if I have any linear combination of sine and cosine on the RHS I use y_p(x) = Acos(x) + Bsin(x).

(BTW can I call the trial function the particular integral, seeing as A and B are constants which will be determined anyway.)

This time I have a square of sin(x). So should the trial function be (Acos(x) + Bsin(x))^2? Any help is appreciated.

Edit: Added extra question below.

Does the following question require knowledge of systems of DEs? If it doesn't can someone please help me get started with this one. It seems quite tricky and I haven't yet been able to think of a way to do it.

Q. Consider two tanks A and B, each holding 50 litres of liquid. Pipes connect the tanks with liquid flowing freely between the tanks. Initially, tank A contains 50 litres of salt solution with 25 grams of salt and tank B contains 50 litres of pure water. Pure water is pumped into tank A from an external source at a rate of 3 litres per minute. Salt solution is pumped out of tank B at a rate of 3 litres per minute. Liquid from tank A is pumped into tank B at a rate of 4 litres per minute, while liquid from tank B is pumped into tank A at a rate of 1 litre per minute. Assume that the solutions are well stirred.

(i) Find an expression for the mass of salt in each tank at any given time t.
(ii) What mass of salt will be present in tank A after 50 minutes?
 
Last edited:
Physics news on Phys.org
  • #2
trial function as used here is confusing
cos(2x)=1-2(sin(x))^2
So you want
A+Bcos(2x)+Csin(2x)
There is a method here.
You wish to solve
Ay=f
where y and f are sufficently differentiable functions and
Bf=0
where A and B are polynomial with constant coefficient in the differential operator.
then (A and B commute)
ABy=Bf=0
So find an operator to kill f
then use solution space(ABy=0)-solution space(Ay=0)
to get a particular solution (you could use solution space (ABy=0) but it often easier not to)
of course if 0 is the only thing solution space(Ay=0) and solution space(By=0) have in common then the difference is solution space(By)-0
in general if
Ag=Bg=0 then
ABxg=0
so in other words if A kills our function we beef it up a little so A leaves what B kills.
 
  • #3
sin2(x) is not of the type we would normally get as a solution to a linear equation with constant coefficients (exponential, sine or cosine, polynomial or product of those) so "undetermined coefficients" will not work here- there is no simple way to determine what function to use. I recommend "variation of parameters".

" Q. Consider two tanks A and B, each holding 50 litres of liquid. Pipes connect the tanks with liquid flowing freely between the tanks. Initially, tank A contains 50 litres of salt solution with 25 grams of salt and tank B contains 50 litres of pure water. Pure water is pumped into tank A from an external source at a rate of 3 litres per minute. Salt solution is pumped out of tank B at a rate of 3 litres per minute. Liquid from tank A is pumped into tank B at a rate of 4 litres per minute, while liquid from tank B is pumped into tank A at a rate of 1 litre per minute. Assume that the solutions are well stirred.

(i) Find an expression for the mass of salt in each tank at any given time t.
(ii) What mass of salt will be present in tank A after 50 minutes?"

Looks like a pretty standard "system of d.e.s" problem to me!

Let A(t), B(t) be the mass of the salt in each tank, in grams, respectively.

dA/dt is the rate at which salt goes in and out of tank A (notice that the units will be "grams per minute". Also notice that there are 3 litres of pure water coming into A every minute and 1 litre of salt water coming from B to A: a total of 4 litres of water coming into A every minute, exactly the amount of water going out of A every minute. Since water goes in and out at the same rate, there is always 50 litres of water in it.
The same thing happens with tank B: there is a total of 4 litres pumped out (1 litre back to A, 3 out of the system) every minute the amount of water in B is always 50 litres. That makes the problem easier!

The amount of salt in each litre of water in A is A(t)/50 and the amount of salt in each litre of water in B is B(t)/50. Since " Liquid from tank A is pumped into tank B at a rate of 4 litres per minute", there will be 4(A(t)/50)= 2A(t)/25 grams of salt leaving tank A each minute and going into B each minute. Since "liquid from tank B is pumped into tank A at a rate of 1 litre per minute", there will be 1(B(t)/50)= B(t)/50 grams of salt leaving tank B and goint into tank A each minute. There will also be 3B(t)/50 grams of salt leaving B each minute through that pipe that is taking liquid completely out of the system. That is:

Each minute a total of B(t)/50- 2A(t)/25 grams of salt goes in/out of tank A:
dA(t)/dt= B(t)/50- 2A(t)/25.
Each minute a total of 2A(t)/25- B(t)/50- 3B(t)/50 grams of salt goes in/out of tank B:
dB(t)/dt= 2A(t)/25- 4B(t)/50= 2A(t)/25- 2B(t)/25.

You also know that A(0)= 25 and B(0)= 0.
 
  • #4
y=(sin(x))^2
is a particular solution of
y'''+4y'=0
(sin(x))^2=sin(x)*sin(x) (product of functions)
(sin(x))^2=.5-.5cos(2x) (sum of functions)
 
Last edited:
  • #5
Thanks for the help lurflurf and HallsofIvy.

lurflurf - Your explanation seems to have used some linear algebra. I haven't done much of it yet, although my linear algebra book has a section on the linear algebra behind differential equations so I'll probably go back to that once I've done some more linear algebra. I'll save this page and have a look at it at a later date.

HallsofIvy - You mentioned variation of parameters. I've seen it and have used it a few times but I'm wondering if that method is related to the one where you are given a solution u(x) to the DE(with RHS = 0) and then you substitute y = v(x)u(x) into the DE. From what I've read in my book there's a method where if you know 'part' of the complimentary solution then the substitution y = u(x)v(x) allows you to solve the DE. However, I'm not sure when that method doesn't work.
 
  • #6
Benny said:
Thanks for the help lurflurf and HallsofIvy.

lurflurf - Your explanation seems to have used some linear algebra. I haven't done much of it yet, although my linear algebra book has a section on the linear algebra behind differential equations so I'll probably go back to that once I've done some more linear algebra. I'll save this page and have a look at it at a later date.

HallsofIvy - You mentioned variation of parameters. I've seen it and have used it a few times but I'm wondering if that method is related to the one where you are given a solution u(x) to the DE(with RHS = 0) and then you substitute y = v(x)u(x) into the DE. From what I've read in my book there's a method where if you know 'part' of the complimentary solution then the substitution y = u(x)v(x) allows you to solve the DE. However, I'm not sure when that method doesn't work.
well linear differential equations need a little linear algebra
I will try to be more clear
you want to solve
(D^2+D+1)y=(sin(x))^2
you know
(D^3+4D)(sin(x))^2=0
so
(D^3+4D)(D^2+D+1)y=0
has every solution your equation has
since
(D^3+4D)y=0
(D^2+D+1)y=0
have no solutions in common our particular solution is a solution of
(D^3+4D)y=0
(if they had something in common we need xy, x^2y type stuff)
so our particular solution is something from
A+Bcos(2x)+Csin(2x)
the general solution of
(D^3+4D)y=0
so that can be put into
(D^2+D+1)y=(sin(x))^2
to see what the coefficients should be.
the method you mention about y = u(x)v(x) is called reduction of orger it is very closely related to variation of parameters.
in variation of parameters you want to solve
Ly=f(x)
and can solve
Ly=0
y=a1*y1+...+an*yn
the ideal is to let the coefficent depend on x and solve
L[a1(x)*y1(x)+...+an(x)*yn(x)]=f(x)
for a1(x),...,an(x)
since
L[y1]=L[y2]=...=L[yn]=0 makes the equation take a nice form
this has more unknows than equations so extra equations are added usually with the intent of making things come out nicer
 
  • #7
Thanks for the help lurflurf.
 
  • #8
Thanks, Lurflurf. I missed the fact that sin2(x)= (1/2)(1- cos(2x)) so the square of sine is one of the types of solutions we would expect for a linear equation with constant coefficients. I was wrong.

Benny should look for a specific solution of the form A+ Bcos(2x)+ Csin(2x).
 

What is a trial function for ODE?

A trial function for ODE (ordinary differential equation) is a mathematical function that is used to approximate the solution to an ODE. It is usually chosen based on the form of the ODE and its boundary conditions.

Why is a trial function necessary for solving ODEs?

A trial function is necessary because it allows us to approximate the solution to an ODE, which may not have an exact analytical solution. This approximation can then be used to solve the ODE numerically.

How do you choose a trial function for a given ODE?

Choosing a trial function for a given ODE involves considering the form of the ODE and its boundary conditions. Often, trial functions are chosen based on their similarity to known solutions of similar ODEs.

Can a trial function be used for any type of ODE?

In theory, a trial function can be used for any type of ODE. However, the accuracy of the approximation depends on the choice of the trial function and the complexity of the ODE. In some cases, a trial function may not be able to accurately approximate the solution.

What are the advantages of using a trial function for ODE?

Using a trial function for ODE allows for the numerical solution of ODEs that do not have exact analytical solutions. It also allows for the exploration of a wide range of possible solutions, which can be helpful in understanding the behavior of the ODE and making predictions.

Suggested for: Trial function for ODE

Back
Top