2
$\begingroup$

I am trying to find the solution to a homogenous differential equation of 2rd order. For that I use DSolve[]. What I get is a single expression, which should be the solution. But I am asked to find all the solutions of it. Is there a way in Mathematica to find all the solutions and not simplify all of them into one general solution?

My equation is:

f''[x] - (2*(2x^2 - 1))/(x(x^2 - 1))f'[x] + (4/(x^2 - 1))f[x] = HPL[{4}, x]/(x(1 - x)(1 + x))

I do:

DSolve[f''[x] - (2*(2*x^2 - 1))/(x*(x^2 - 1))*
f'[x] + (4/(x^2 - 1))f[x] == 0, f[x], x]

The result is:

    {{f[x] -> 
   C[2] + 1/
     15 (x^2 (-24 + 18 x^2 + 5 x C[1] - 3 x^3 C[1]) + 
       3 (2 - 5 x^3 + 3 x^5) Log[1 - x] + (6 + 15 x^3 - 9 x^5) Log[
         1 + x])}}

I have one solution, but since this is a differential equation of order 2, I need two solutions. How can I do that?

$\endgroup$
13
  • $\begingroup$ There are infinite many solutions depending on the C[i], however, only 3 at a time can be independent. You can pick out solutions by specifying initial values. $\endgroup$ Jan 22, 2023 at 14:43
  • $\begingroup$ Why do you have f'[3] in there? The ode is of degree 1. Why do you expect more than one general solution? since this is a differential equation of order 3, the order is 2, not 3. $\endgroup$
    – Nasser
    Jan 22, 2023 at 14:44
  • $\begingroup$ @Nasser it was a typo. I edit and fixed it $\endgroup$
    – imbAF
    Jan 22, 2023 at 14:46
  • $\begingroup$ @DanielHuber And If I do not have initial values and I am trying to execute the following equation, so that I find the particular solution: $$f_p(x)=\sum_{i=1}^n f_{h,i}(x)\int \frac{g(y)W_i(y)}{W(y)}$$ how do I proceed ? $\endgroup$
    – imbAF
    Jan 22, 2023 at 14:48
  • 1
    $\begingroup$ Then you mean you are looking for the BASIS solutions. Not the general solution. ode of order 2 will have two linearly independent BASIS solutions. Think of it as vector space with 2 dimensions. The general solution is linear combination of the BASIS solutions. These BASIS solutions come from the solution of the homog. part of the ode. You can extract them by collecting on each constant of integration, The formula you have looks like the Variation of Parameters formula to find the particular solution, which requires knowing the BASIS solutions of the homog. part. $\endgroup$
    – Nasser
    Jan 22, 2023 at 15:03

1 Answer 1

2
$\begingroup$

First obtain the homog. solution in order to extract the basis functions $f_1,f_2$

odeHomog =   f''[x] - (2*(2*x^2 - 1))/(x*(x^2 - 1))*f'[x] + (4/(x^2 - 1)) f[x];
forcingFunction = x;
solH = DSolveValue[odeHomog == 0, f[x], x]

Mathematica graphics

f1 = First@Cases[solH, any_*C[1] :> any]
f2 = First@Cases[solH, any_*C[2] :> any]

Mathematica graphics

Now that we know the basis solution, find Wronskian

wronskian = Det[{{f1, f2}, {D[f1, x], D[f2, x]}}] // Simplify

Mathematica graphics

Find particular solution using the variation of parameters formula. The forcing function is $f(x)=x$ in this example. The formula is

enter image description here

yp=-f1*Integrate[f2*forcingFunction/wronskian,x]+f2*Integrate[f1*forcingFunction/wronskian,x]

Mathematica graphics

Add this to the homog. solution to find the general solution

 yg = C[1]*f1 + C[2]*f2 + yp

Mathematica graphics

Verify against Mathematica's

 solbyMMA = DSolveValue[odeHomog == forcingFunction, f[x], x]

Mathematica graphics

 solbyMMA == yg // FullSimplify

Mathematica graphics

$\endgroup$
7
  • $\begingroup$ Thank you! While I knew the theory, I didn't know how to implement it in mathematica. I have one question regarding your solution. How was mathematica able to solve the problem, meaning find the particular solution, once you substitute $g(y)$ (in the formula) with $PolyLog[4,x] = HPL[{4},x],$ without any Partial fraction decomposition. Because we need to simplify it, so that mathematica can solve it. $\endgroup$
    – imbAF
    Jan 22, 2023 at 15:43
  • $\begingroup$ @imbAF How was mathematica able to solve the problem I assume Mathematica also uses variation of parameters to find particular solutions (unless it detects undetermined coefficients can be used, which is not always the case). As for the rest of your question. I am sorry, I do not follow it. I do not know what HPL[4,x] is. I am using the ode you posted above. But may be someone else will have an idea and answer that part. $\endgroup$
    – Nasser
    Jan 22, 2023 at 15:48
  • $\begingroup$ $HPL[4,X]=Li_4(x)$ where i.e $Li_2(x)=-\int_0^x \frac{ln(1-x')}{x'}dx'$ and in general $Li_n(x)=\int_0^x \frac{Li_{n-1}(x')}{x'}dx'$. But thanks once again. $\endgroup$
    – imbAF
    Jan 22, 2023 at 15:54
  • $\begingroup$ I am trying to implement your code, but I get the following error: "DSolveValue::deqx: Supplied equations are not differential or integral equations of the given functions." $\endgroup$
    – imbAF
    Jan 22, 2023 at 16:58
  • $\begingroup$ @imbAF you must have some error in input. Can you post complete code you used? looks like you used different dependent variable in the call to DSolve than the one in the ode itself $\endgroup$
    – Nasser
    Jan 22, 2023 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.