# How to solve this equations? Explicit or implicit?

1. Jul 18, 2011

### hoomanya

Hi,

I am trying to write a code for an equation which looks like this:
$\frac{\partial{y}}{\partial{t}}$=f(x,y,t) -y(x$^{n+1}$-x$^{n}$)

where n is the time step number. I have no idea how I can go on about solving (approximating the solution) to this problem. Any hints would be appreciated.

2. Jul 18, 2011

### pmsrw3

That doesn't look quite right to me. You have dy/dt on the left, and you also have it on the right (as a finite difference approximation). Could you give us the original DE you're trying to solve?

In response to the question in your subject, implicit methods are usually more stable than implicit. A lot depends on the nature of f.

3. Jul 18, 2011

### hoomanya

This is the equation I have:

dy/dt = f(x,y,t) - (y/x) (dx/dt)

I am guessing that a way to solve this would be to leave dx/dt as it is to being with. So say for example if I was going to solve it explictily:

y$^{n+1}$ =h[ f(x,y,t)$^{n}$ - (y/x)$^{n}$(dx/dt)$^{n}$] +y$^{n}$

But then I am not sure what to do with the dx/dt ?

Thanks!

4. Jul 18, 2011

### pmsrw3

Ah, I see. You have two functions of time x(t) and y(t). What confused me was that you wrote y(xn+1-xn), which looked to me like y evaluated at xn+1-xn, not a multiplication.

What happen to the 1/x factor? Your DE says (y/x)(dx/dt), but the FDE in your first post lost the 1/x.

Is there a reason why you have an h in this new FDE, but not in the original one?

You can't solve this as stated. It is incomplete. You need another equation. You have two functions of time, x, and y, and only one equation.

If I misunderstand this, please clarify.

5. Jul 18, 2011

### hoomanya

Hi,

There is definitely a 1/x in the equation. So the 2nd equation is correct.

The h is the time step and I'm sorry it should not be there.

I think you're right anyway. I might have the other equation so I think I will continue the thread again once I've sorted that out and I would appreciate you reply then.

Thanks very much.

6. Jul 21, 2011

### hoomanya

Hi again,

I have changed my equations a bit and have an extra equation but not sure if that would help at all. So my equations are:

$\partial$(yv)/$\partial$t=f(y,v,t)
where v is velocity = dx/dt, and y is a material property.

$\partial$v/$\partial$x = constant

I hope this is a bit better...

Is it possible to solve these?

Many Thanks!

7. Jul 21, 2011

### pmsrw3

So, let me make sure I understand this. In your first equation, you're differentiating the product of y and v with respect to time:

$$\begin{eqnarray*} f(y,v,t) & = & \frac{\partial yv}{\partial t} \\ & = & y\frac{\partial v}{\partial t}+v\frac{\partial y}{\partial t} \\ & = & y\frac{\partial^2 x}{\partial t^2}+\frac{\partial x}{\partial t}\frac{\partial y}{\partial t} \\ \end{eqnarray*}$$

$$\frac{\partial v}{\partial x} = C$$

I'm having some trouble understanding that second equation. It's not clear to me how we regard v as a function of x so as to take the derivative. But here's my attempt. I'm picturing this as a particle moving in the +x direction under the influence of some sort of force. Let's assume it starts off at x=0, and that it has velocity v0. (It has to have some velocity to start with, or it'll never move away from its starting point.) Then it's going to move in the positive direction with increasing velocity, the velocity at time t always equal to v0 + C x(t). to get from x to x(t)+dx will take time $dt=\frac{dx}{v_0+C x(t)}$, giving the following DE for x(t):

$$\frac{dx}{dt}=v_0+C x(t)$$

with initial condition x(0) = 0.

This has solution

$$\begin{eqnarray*} x(t) & = & \frac{v_0}{C}\left(e^{Ct}-1\right) \\ v(t) & = & v_0 e^{Ct} \end{eqnarray*}$$

I'll pause there to ask if this looks right. Also, could you explain what the Hell this is? It would really help to have an idea where the equations come from.

Last edited: Jul 21, 2011
8. Jul 22, 2011

### hoomanya

Thanks. I'm sorry if I'm not being clear enough. Here's another attempt to clarify.

v is mesh velocity and in the second equation when I said ∂v/∂x = constant, I meant ∂v/∂h = constant, where h could be thought of as an element length in finite element analysis. I'm not sure if that would make a difference now.

y is a material property, in this case could be density. and I am trying to solve for y and v at each time step.

Thank you very much.

9. Jul 22, 2011

### pmsrw3

I think you need to explain more thoroughly. Here are some questions:

(1) What is "mesh velocity"? Is this a fluid flow problem?

(2) You said before that v is dx/dt. How is that consistent with its being mesh velocity?

(3) What is x?

(4) Why is x a function of time?

(5) "∂v/∂h = constant" means that if you change h by a certain amount, v changes by a constant times that amount. Why does v depend on your mesh size?

(6) Why do you have a mesh, and why do you talk of finite element analysis, when you're solving an ODE?

(7) You said before that y is s function of time. Why is it that, at a given time, y is just a single number? Is it constant everywhere in your material?

The reason I ask all these question is that I think you have set the problem up wrong in a fundamental way. I suspect you actually want a partial differential equation.

Could you describe the problem? I mean REALLY describe the problem, not just give a few confusing little hints. What's the material? What's the property? What is x? What is v? Why does x change in time? Why does y change in time? Is there a relationship between x and y? If so, what is it?

10. Jul 22, 2011

### hoomanya

I am trying to use the ALE method in an analysis. The reason I have not explained everything here is because I need help with the mathematics of the equation , which is also the reason why I have posted the question in the general math section and tried to simplify the equations...
I think I will post the equation in a different forum or section now that I know I won't get anywhere with just the maths .... Thanks for your help anyways.