I am trying to solve a system of coupled differential equations using NDSolve, but I am not able to. I am not familiar with NDSolve at all, so I am probably making a silly mistake somewhere. I tried looking for help in questions other people have asked but I haven't been able to solve this yet. Any help is appreciated.

I also tried giving it initial conditions instead of b.c but it still didn't work. As I'm new to stackexchange too, I hope I have formatted this the right way.

k = 1;
sol1 = First@
  NDSolve[{{Sqrt[r'[t]^2 + 
  z'[t]^2] - (r'[t]^2/Sqrt[r'[t]^2 + z'[t]^2] + (r[t] r''[t])/
  Sqrt[r'[t]^2 + z'[t]^2] - (r[t] r'[t] (2 r'[t] r''[t] + 
  2 z'[t] z''[t]))/(2 (r'[t]^2 + z'[t]^2)^(3/2))) - 
  k*r[t]*z'[t] == 0, 
  -((r'[t] z'[t])/Sqrt[r'[t]^2 + z'[t]^2] + (r[t] z''[t])/
  Sqrt[r'[t]^2 + z'[t]^2] - (r[t] z'[t] (2 r'[t] r''[t] + 
  2 z'[t] z''[t]))/(2 (r'[t]^2 + z'[t]^2)^(3/2))) - 
  k*r[t]*r'[t] == 0},
  r[0] == 0, r[1] == 1, z[0] == 1, z[1] == 0}, {r, z}, {t, 0, 1}]
  • 2
    $\begingroup$ You can check the formatting of your code by copying and pasting it back into Mathematica and running it (preferably with a fresh kernel). You need to copy it in InputForm. You may find the meta Q&A, How to copy code from Mathematica so it looks good on this site, helpful. (I don't know why Mma pastes OutputForm second derivatives as (z^\[Prime]\[Prime]), which is a syntax error when you paste it back into Mma. It should be considered a bug, imo, but it's been that way forever.) $\endgroup$
    – Michael E2
    Commented Aug 20, 2022 at 18:19
  • 5
    $\begingroup$ When things don't work, a good way to start analyzing the problem is to set the ODEs and BCs to variables, e.g. ode = {...} and bcs = {...}, where you paste in your equations where I put .... If you do that, then Solve[ode, D[Through[{r, z}[t]], t, t]] returns {}, which means the ODEs are (algebraically) inconsistent. That suggests you made a mistake in setting up the problem, but you're the only who can figure that out, I think. $\endgroup$
    – Michael E2
    Commented Aug 20, 2022 at 18:22
  • 1
    $\begingroup$ As the error message says, it can only solve such equations when initial conditions are specified. $\endgroup$
    – mikado
    Commented Aug 20, 2022 at 18:32
  • 1
    $\begingroup$ @juv95 welcome to SE MMA. Congrats on first post. Well done for first post . Title too verbose. so i trimmed it to core of the problem. Very well done on body explaining problem and what you attempted. Always add all related tags so post gets more attention especially from users following those particular tags. these are the coveted members who are actively searching for posts like yours to answer . generously including all 5 related tags will help them find you. `that's why I added a few tags that might be related. If you feel they are not please feel free to remove or change them. :-) $\endgroup$ Commented Aug 21, 2022 at 22:26
  • $\begingroup$ Thank you so much for all the comments! So, I suppose my equations are inconsistent, as @MichaelE2 mentioned. I will redo my math and see if I obtain different equations. I'd like to upvote the comments too, but I don't see a button for that yet. I'm assuming I can do that later. $\endgroup$
    – juv95
    Commented Aug 22, 2022 at 8:54


Your Answer

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