# Numerical solution ODE

1. Nov 21, 2014

### Vrbic

Hello,
can someone advise me how to solve numerically ODE which consist of function with "critical point" (Im not sure if it is good definition)? I mean for example this one:
$y'(x)=\frac{\sin{x}}{x}$, where in x=0 has function a "problem". I know that limit ->1 but in numerical solutions it blows up.
I know that for example Mathematica can do that analytically but I would like to know general procedure for this issue.

2. Nov 21, 2014

### zoki85

Writting polynomial expansion of sin x , than integrating term by term is one way.

3. Nov 21, 2014

### Vrbic

Ou, nice and easy idea :) Can you think of another way?
I have system of two eq. and problem is coming from zero in denominator subtracting these unknowns... $x'(r)=\frac{f(x(r),y(r),r)}{x(r)-y(r)}, y'(r)=\frac{g(x(r),y(r),r)}{x(r)-y(r)}$. Any idea? :)
And thank you for reply ;)

4. Nov 21, 2014

### zoki85

I'm affraid I don't understand meaning of notation you used here. Why don't you write instead of f(x(r),y(r),r) and g(x(r),y(r),r) just f(r) and g(r)?

5. Nov 21, 2014

### Vrbic

I wanted to emphasize that there are unknown functions and Im not able to carry any trick like expansion. Exact form of equation is here https://www.physicsforums.com/threa...umerical-solution-with-critical-point.783090/ but no comments. I wrote it probably in wrong way so Im trying step by step find how to solve it.

6. Nov 21, 2014

### the_wolfman

The word you're are looking for is "singular point."

The integrand $\frac{\sin{x}}{x}$ has a removable singularity. We can get around it by defining $\frac{\sin{x}}{x} =1$ for x=0 . This insight comes from observing the limiting behavior for small $x$ . Integrating the Taylor series term by term works for small x but fails miserably for x>1.

What are the functions $f\left(x,y,r\right)$ and $g\left(x,y,r\right)$. There are a number of "tricks" that allow you to treat different kinds of singularities. But different tricks work for different kinds of singular points.

7. Nov 21, 2014

### Vrbic

Ah, yes it is clear. Thank you for a comment.

$u'=\frac{D_1}{D}$
$\rho'=\frac{D_2}{D}$, where $D_1=\frac{2a^2/r-\alpha/r^2}{\rho}$, $D_2=\frac{2u^2/r-\alpha/r^2}{u}$ and $D=\frac{u^2-a^2}{\rho u}$, where $a(r)=a_0\big(\frac{\rho(r)}{\rho_0}\big)^{(\Gamma-1)/2}$, $\rho(r)$ and $u(r)$ are function of r and $\Gamma, a_0, \rho_0, \alpha$ are constant.

This is the system. Here is described all this problem: https://www.physicsforums.com/threa...umerical-solution-with-critical-point.783090/
Thank you again.

8. Nov 22, 2014

### zoki85

Ok then. Without getting into mess of other thread, here is what I can say. This is a system of differential equation (generally, a nonlinear one):

dx/dr = G(x,y,r)/z(x,y)
dy/dr = F(x,y,r)/z(x,y)
where z(x,y)= x-y

For behaviour near singularity you must specify or explore what's going on when z(x,y) → 0. Also explore if there is a stability issue for solutions to the system ( for instance, check Lyapunov's criteria etc). And for z(x,y) ≠ 0 the system yields equation F(x,y,r)⋅dx - G(x,y,r)⋅dy = 0 which is a special case of well known Pfaff's PDE in 3D: P(x,y,z)⋅dx + Q(x,y,z)⋅dy +T(x,y,z)⋅dz =0

Regards

Last edited: Nov 22, 2014
9. Nov 22, 2014

### Vrbic

Ou thank you very much. And what about z(x,y)=0. What possibilities are? And could you give me a reference to literature which concern in this problems or something like that. Thank you very very much ;)

10. Nov 22, 2014

### zoki85

For z(x,y)=0 you have to explore at line y=x : If G≠0,F≠0 than "asymptotic" cases. If G=0 or/and F=0 than "0/0" cases to check .
Since you can't exactly solve your nonlinear system you should linearize it. Here is instructional video how to do it.
And for probing system stability see this paper . Treating all the variables like they are independent (via Pfaffian) sometimes may help to explore behaviour of system too . Many things depend on form of the functions F, G.

11. Nov 22, 2014

### Vrbic

Thank you again, understand.
Im looking for solution which is in "0/0". In my def. of function Im looking specially for case when "my" D=D1=D2=0 and (I mean) it is "smooth" solution.