Solve an ODE with Maple

69 Views Asked by At

I am studying numerical solutions of a certain ODE using the program Maple. In order to better understand the software, I simplified my ODE to reach the following system \begin{equation} y'(x)x|\ln(x)| - 2y(x) = 0 \quad \text{on }[0,1/2], \end{equation} which can be solved analytically and gives the class of solution $$y(x) = \frac{C}{|\ln(x)|^2},$$ for $C \in \mathbb R$.

Now, using Maple, I get essentially the same result: enter image description here However, the function given by the program is defined on $\mathbb R$ whereas I am only interested in what happens on a neighbourhood of $0$ (the choice of $1/2$ as an upper bound of the interval is arbitrary, any other value smaller than $1$ would be fine as well). Moreover, I cannot manipulate the function given by the program, e.g. when I evaluate it at a certain point it gives me this: enter image description here

I tried numerous things to circumvent the difficulty but I couldn't figure out a way to solve it and neither have I found an answer online to my question. Any help would be great.

1

There are 1 best solutions below

1
On BEST ANSWER

First, the solving you had:

restart;
ODE := {diff(y(x),x)*x*abs(ln(x))-2*y(x)=0}:
Sol_ODE := dsolve(ODE):
eval_Sol_ODE := eval(y(x), Sol_ODE):

Your eval_Sol_ODE is an expression. You can evaluate an expression at a point by using the eval command. For example,

eval(eval_Sol_ODE, x=1/2);

    c__1/ln(2)^2

eval(eval_Sol_ODE, x=2/3);

    c__1/ln(2/3)^2

You could also construct a re-usable operator (procedure) from your expression. You could then apply the operator to arguments. For example,

func_eval_Sol_ODE := unapply(eval_Sol_ODE, x):

func_eval_Sol_ODE(1/2);

    c__1/ln(2)^2

func_eval_Sol_ODE(2/3);

    c__1/ln(2/3)^2