2

I'm new to LaTeX and looking to create a slope field that matches the following description.

The slope field of $\dfrac{dx}{dt} = x^2 - t^2$ along with three solution curves. The top curve is the solution that goes through $(t, x) = (0, 1)$. The middle curve is the solution that goes through the curve $(t, x) = (0, 0)$. The bottom curve is the solution that goes through the curve $(t, x) = (0, -1)$.

I have tried using the template provided in the following question, but it is too complicated for me to reproduce. How to draw slope fields with all the possible solution curves in latex

I would appreciate it if someone could provide a template for these types of LaTeX plots. This way, I can also reproduce these plots in the future for other differential equations.

Thank you.

  • 5
    Welcome to the site! Take a look at http://tex.stackexchange.com/q/139114/2552, the answers to that question show more flexible ways of plotting the solutions to differential equations. – Jake Oct 13 '16 at 17:12
  • Did the link from Jake help you to solve your problem? – Stefan Pinnow Oct 16 '16 at 12:30
  • Ok, but before adapting AlexG's solution to your needs: Can you reproduce the output of AlexG, i.e. can you create the PDF including the shown image? – Stefan Pinnow Oct 19 '16 at 05:32
  • If I were I would use Matlab to generate the plot, then generate the tikz output (search net for Matlab code) then put it in the document – Hamid Oct 20 '16 at 18:48
  • @StefanPinnow In attempting to reproduce the first block, I get an error which tells me that I must first run: latex myfile dvips myfile ps2pdf -dNOSAFER myfile.ps. How do I include this code in my LaTeX file so that it runs? – The Pointer Oct 20 '16 at 20:00
  • Then you are running pdflatex instead of latex on the file. How you switch is depending on the editor.
    But then you have to run the other two commands which I think is difficult from within the editor. So the easiest I think is to just run them (all three) from the command line. Can you do this?
    – Stefan Pinnow Oct 20 '16 at 20:48
  • @StefanPinnow What steps do I take to do so? – The Pointer Oct 20 '16 at 20:51
  • So if you don't have a clue what I am talking about then have a look at How to use the Window command line (DOS), especially at the sections Get into the Windows command line, Moving into a directory, and Switching drives. With that help you can hopefully manage to open the Windows Command Line and go the the directory where your main LaTeX file is stored. In there run the three given commands from http://tex.stackexchange.com/a/139140/95441 twice. Replace myfile with the filename of your TEX file without extension. – Stefan Pinnow Oct 20 '16 at 21:02
  • Then compile the TEX document from within your editor again (using pdflatex). – Stefan Pinnow Oct 20 '16 at 21:05
  • What did you try exactly? You said you tried to adapt the code, but it seems that you could not compile the unmodified code, which is surely the first step to take. So I'm confused. But hopefully the help you've received above has enabled you to solve this. (You haven't said otherwise or reported any sticking points, so we can only assume.) Duplicating a question because you don't feel you received the attention you deserve is rarely wise or constructive. Improving your original question or asking a better follow-up would probably be more fruitful strategies. – cfr Oct 22 '16 at 22:27

0 Answers0