# The problem of solutions of ordinary differential equations

I am using MMA to compute the solution of a system of ordinary differential equations, they are as follows,

Clear["*"]
DSolve[{(
g[r] + G1[r])*(1/r^2 +
1/r ( Derivative[1][g][r] + Derivative[1][G1][r])/(
g[r] + G1[r])) ==
g[r]*(1/r^2 + 1/r Derivative[1][g][r]/g[r]), (
g[r] + G1[r])*(1/r^2 +
1/r ( Derivative[1][f][r] + Derivative[1][F1][r])/(
f[r] + F1[r])) == g[r]*(1/r^2 + 1/r Derivative[1][f][r]/f[r]),
G1[1] == -1}, {G1[r], F1[r]}, r]


I want to obtain the solutions of them, but I don't quite understand our these results. And my try of solutions are as follow,

I would appreciate it if you can help me. Thank you again for your help!

• There is no pde's here. Just two coupled ode equations. Mathematica solved it. The unresolved integrals in the result you see is because it does not how to integrate the functions $g'(r)$ and $f'(r)$ you have there. That is all. It uses K[1],K[2] for integration variables. !Mathematica graphics Jun 21, 2023 at 8:26
• Also on closer look, notice that the first ODE in $G(r)$ does not depend on $F(r)$ at all. So all what you need to do is just solve the first ode for $G(r)$ on its own. Then plugin that solution in the second ode and solve for $F(r)$. So what you really have is basically 2 separate first order ode's. Jun 21, 2023 at 8:36
• Thanks for your tips, I've edited the relevant description of the problem. According to your second comment, the problem can be solved efficiently. In other words, it seems to be more convenient to calculate manually than mma. Actually, I also calculated the result manually, I want to verify this result on mma, but its display prevents me from comparing with the result at hand. So, the question this time is to find a way to get a more general solution, which may be compared with the result of manual calculation. Jun 21, 2023 at 9:01

It is just that Mathematica uses definite integrals $$\int_{1}^{r}$$ and uses K[1] and K[2] for integration variables, it makes it little hard to see.

But you can see it is same solution as by hand.

ClearAll["Global*"]
ode1=(g[r]+G1[r])*(1/r^2+1/r (Derivative[1][g][r]+Derivative[1][G1][r])/(g[r]+G1[r]))==g[r]*(1/r^2+1/r Derivative[1][g][r]/g[r])
ode2=(g[r]+G1[r])*(1/r^2+1/r (Derivative[1][f][r]+Derivative[1][F1][r])/(f[r]+F1[r]))==g[r]*(1/r^2+1/r Derivative[1][f][r]/f[r])


Solve the first ode for $$G(r)$$ and plug the solution into second ode

solG=DSolve[ode1,G1[r],r][[1,1]]


ode2/.solG


This is Mathematica's solution for the above

 DSolve[%, F1[r], r] // Simplify


Let solve it by hand and compare

ode3=F1'[r]==Solve[%%,F1'[r]][[1,1,2]]


ode3=Collect[ode3,{F1'[r],F1[r]}]
ode4=SubtractSides[ode3,ode3[[2,2]]]


So this is linear first ode. The integration factor is

 mu=Exp[Integrate[-( (-C[1] f[r]+r^2 g[r] f'[r])/(r f[r] (C[1]+r g[r]))),r]]


Multiplying both sides of ode4 by this $$\mu$$ and integrating both sides gives (and remember to add new constant $$c_2$$ gives

 sol=F1[r]==1/mu*(Integrate[mu*ode4[[2]],r]+C[2])


You see, it is same as Mathematica' but using indefinite integrals which makes it easier to read.

## All code in one block

ClearAll["Global*"]
ode1=(g[r]+G1[r])*(1/r^2+1/r (Derivative[1][g][r]+Derivative[1][G1][r])/(g[r]+G1[r]))==g[r]*(1/r^2+1/r Derivative[1][g][r]/g[r])
ode2=(g[r]+G1[r])*(1/r^2+1/r (Derivative[1][f][r]+Derivative[1][F1][r])/(f[r]+F1[r]))==g[r]*(1/r^2+1/r Derivative[1][f][r]/f[r])
solG=DSolve[ode1,G1[r],r][[1,1]]
ode2/.solG
DSolve[%,F1[r],r]//Simplify
ode3=F1'[r]==Solve[%%,F1'[r]][[1,1,2]]
ode3=Collect[ode3,{F1'[r],F1[r]}]
ode4=SubtractSides[ode3,ode3[[2,2]]]
mu=Exp[Integrate[-( (-C[1] f[r]+r^2 g[r] f'[r])/(r f[r] (C[1]+r g[r]))),r]]
sol=F1[r]==1/mu*(Integrate[mu*ode4[[2]],r]+C[2])
`
• Thank you very much for your enthusiastic help, and the calculation process you provided is very detailed. I think these results you have provided meet my expectations. At the same time, it will take some time for me to understand and learn this solution. Looking forward to discussing with you next time, thanks again for your help. Jun 21, 2023 at 10:54