1
$\begingroup$

This question already has an answer here:

As shown in the picture, I get the data after using NDSolve. Now I want to get the x for cetain y, how can I do this?

The last three lines is the way I try to find x.

The code:

MH = 1.6726231*10^-27  / 2     ; 
c = 3*10^8;
Rau = 0.0529*10^(-9)  ;       
Eau = 27.2114*1.6*10^(-19);   


Ha1 = 0.10058   ; Hs1 = 0.69856  ; Hxc1 = 2.06479 ;    HD0 = -0.07879;
Ha2 = 1.00145  ;  Hs2 = 2.40274    ; Hxc2 = 1.02858;
Ha3 = -1.02324  ; Hs3 = 2.40624  ; Hxc3 = 1.01416;
E1[r_] := 
 Eau*(Ha1*(1 - E^(-Hs1*(r - Hxc1)))^2 + HD0 + 
    Ha2*(1 - E^(-Hs2*(r - Hxc2)))^2 + 
    Ha3*(1 - E^(-Hs3*(r - Hxc3)))^2)  
F1[r_] = D[-E1[r/Rau], r]       ; 



Net21 = NDSolve[{MH *r1''[t]*1/Sqrt[
      1 - (r1'[t])^2/
       c^2]*(1 + (r1'[t])^2/c^2*(1 - (r1'[t])^2/c^2)^-1) == F1[r1[t]],
     r1[0] == 1.42372*Rau, r1'[0] == Sqrt[2*(2.60457*10^-20)/MH]}, 
   r1, {t, 0, 2.*10^(-14)}];


sol = r1 /. First@Net21;
InverseFunction[sol][1.2*10^-10]
FindRoot[sol[t] == 1.2*10^-10, t]
$\endgroup$

marked as duplicate by xzczd differential-equations Oct 29 '18 at 9:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ I have already used the Inversefunction and Findroot, but it did't word $\endgroup$ – John Tu Oct 29 '18 at 5:21
  • $\begingroup$ How did you use InverseFunction and FindRoot? Please show us the complete code sample. (Note: don't use screenshot, show us the code text. ) $\endgroup$ – xzczd Oct 29 '18 at 6:37
  • $\begingroup$ I have already done that. Thanks for reminding~ $\endgroup$ – John Tu Oct 29 '18 at 8:47
  • $\begingroup$ As to the reason why your attempt fails: 1. The power of InverseFunction is limited. 2. Your syntax for FindRoot is incorrect, check the document of FindRoot for more information. $\endgroup$ – xzczd Oct 29 '18 at 9:29
  • $\begingroup$ I have some ideas. Thank u very much ! $\endgroup$ – John Tu Oct 29 '18 at 11:24