# Trouble Solving a Diff Equation

1. Aug 24, 2011

### marcoaaguiar

Hi, i've been two weeks trying to solve this Diff Equation, but no success 'til now. I found your forum now, and I hope we can find a solution. I'm sorry if I'm posting this on the wrong section.
This problem looks simple, but due my formation (Engineering) and the fact that I've not used EDO for a while, makes this problem hard for me :)

It's a piece of a Control Engineering problem for a paper that I'm writing.
The equation is:

dy = (k + x)*(a/x+b/y)dx

The inital condition for y is a constant 'y0' and for x = 0. I need a analytic so I can prove some some properties of my controller.

2. Aug 24, 2011

### hunt_mat

I tried a few substitutions and I also tried maple and all came up a blank, what properties were you hoping to prove? They may well be proven without actually solving the equation.

3. Aug 24, 2011

### marcoaaguiar

ok, the full problem is:

the controller diff equation
dI/V = a*dg/g + b*dp/p

System dinamics:
System 1:
dV = dg
but the inital conditions for V is different from 0, a cst k
so V = (k + g)

System 2:
dg = I*dp/p
dp/p = dg/I

back to the controller DE,

dI/(k+g) = a*dg/g + b*dg/I
>> dI = (k+g)*(a/g + b/I)*dg

or

dI = (k+g)*(a*I+ b*g)/(g*I)*dg
>> g*I dI = (k+g)*(a*I + b*g) dg

I want to find I(t), so i can find g(t). Based in the input p(t).

4. Aug 24, 2011

### jackmell

Lemme' give it a shot in terms of I, g, and known p(t). You have:

$$\frac{I'}{k+g}=\frac{a g'}{g}+\frac{b g'}{I}$$

So that's a DE for the function I(g). Right? Not 100% sure but think so. Suppose for now, I'm ok with that. Then note g can't be zero since that's a singular point of the DE. So let's solve this in Mathematica numerically for the function I(g) (can't use big I in Mathematica as a variable name) with just all the constants set to one:

Code (Text):
myk = 1;
a = 1;
b = 1;
g0 = 1;
i0 = 1;
myp[t_] := 2 + t^2;

mysol = NDSolve[{g i[g] i'[g] == (myk + g) (a i[g] + b g),
i[g0] == i0}, i, {g, g0, 15}]
myi[g_] := Evaluate[i[g] /. mysol] // First
So now I have I(g) and I solve the other equation in g:

$$dg=\frac{Ip'}{p}$$

and for now, just let p(t)=2+t^2 and keep in mind I is a function of g. So I solve for g in Mathematica now letting g(0)=1:

Code (Text):
mygsol = NDSolve[{Derivative[1][g][t]/myi[g[t]] == (2*t)/(2 + t^2), g[0] == 1},
g, {t, 0, 2}]
myg[t_] := First[Evaluate[g[t] /. mygsol]]
Note how I specified i(g(t)) in that expression since previously I solved for i(g). So now I have g(t).

Now, let's back-substitute all that into the original DE an keep in mind that I solved for I(g) so to back-substitute into the DE in terms of t, I calculated:

$$\frac{dI}{dt}=\frac{dI}{dg}\frac{dg}{dt}$$

Code (Text):
In[149]:=
leftside = ((D[myi[g], g] /. g -> myg[1])*(D[myg[t], t] /. t -> 1))/(1 + myg[1])
rightside = (a*D[myg[x], x] /. x -> 1)/myg[1] + (b*D[myg[x], x] /. x -> 1)/myi[myg[1]]

Out[149]=
1.8982003067079452

Out[150]=
1.8981978130717898
That's a start since the left side is close to the right side. That may however not be what you want and I'm not sure everything is ok. May need to clean it up if it's close to what you want.

Last edited: Aug 24, 2011
5. Aug 25, 2011

### jackmell

I didn't initially think to just solve the system simultaneously:

. . . glad I'm not being tested on this stuff.