I've solved the DE:

$$a\cdot x(t)+b\cdot\ln\left(1+c\cdot x(t)\right)=-p\cdot x'(t)\tag1$$

Where $x(0)=k$

And I got the following solution:

$$t=\int_{x(t)}^k\frac{p}{a\cdot z+b\cdot\ln\left(1+c\cdot z\right)}\space\text{d}z\tag2$$

If I want to plot the solution in mathematica I get on the y-axis the time $t$ but I want time at the x-axis, how can I solve that?

The code is equal to:

      z + ((((5463/
              20) + (20))*(((138064852)/(100000000))*10^(-23))*(2))/((\
(16021766208)/(10000000000))*10^(-19)))*Log[1 + ((z)/(10^(-4)))]), {z,
    x, Pi}], {x, 0, 1}]

Only the axis needs to be swaped.

  • $\begingroup$ try ParametricPlot? $\endgroup$
    – kglr
    Commented Aug 27, 2019 at 18:22
  • $\begingroup$ @kglr How can I do that? $\endgroup$ Commented Aug 27, 2019 at 18:44
  • $\begingroup$ Jan, if you post the code that produced the plot you want changed, it will be easier for all to answer your question. $\endgroup$
    – kglr
    Commented Aug 27, 2019 at 19:01
  • 1
    $\begingroup$ @kglr I did what you asked. $\endgroup$ Commented Aug 27, 2019 at 19:11

1 Answer 1

int[x_?NumericQ] := NIntegrate[(5*10^(-3))/((78/10)*
     z + ((((5463/20) + (20))*(((138064852)/(100000000))*10^(-23))*(2))/
      (((16021766208)/(10000000000))*10^(-19)))* Log[1 + ((z)/(10^(-4)))]), 
  {z,  x, Pi}]

plot = Plot[int[x], {x, 0, 1} , 
   AspectRatio -> 1, Frame -> True, Axes -> False]

enter image description here


Quiet@ParametricPlot[{int[x], x}, {x, 0, 1}, 
    AspectRatio -> 1, Frame -> True, Axes -> False, 
    PlotRange -> Reverse[PlotRange[plot]]]

enter image description here


Alternatively, you can post-process plot to reverse the coordinates of Line objects:

Show[plot/. Line[x_] :> Line[Reverse /@ x], PlotRange -> All]

enter image description here


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.