In this answer on MathSE there are plots of a the solutions of the Burgers equation along certain characteristics, which is different from a slope field.

Since the answer's author has left the site, I want to ask how to recreate such plots here.

  • 1
    Right now this question is both unclear and a just-do-it-for-me question. Why are you asking on this site? (Where is the connection to (La)TeX?) What have you tried so far? Where are you stuck? Please ask a specific question for a single problem. – schtandard Sep 24 '19 at 8:43
  • Ok, let me reformulate: given a pde and the equation for the characteristics, what is an efficient way to plot the characteristics like in the answer linked? Is there a a special package or any premade i.e. tikz-code? – Viktor Glombik Sep 24 '19 at 8:47
  • Well, sure. You can use pgfplots or the (less extensive) datavisualization library for plotting. If you want to do any numerical analysis of your PDE though, TeX is not the right tool to use. Again, why do you want to do this with TeX in the first place? – schtandard Sep 24 '19 at 9:10
  • I want to have the plot of the characteristic curves for my typed up lecture notes. – Viktor Glombik Sep 24 '19 at 9:10

This is a LaTeX site. What I can offer is to generate a plot in which the intersections of the blue lines with the red curves get computed and used. I am pretty sure that my choices for the red curves are off. However, I fail to make sense of the explanations in the linked post. The good news is that if you replace the functions xl and xr by something more appropriate, the following will still work (unless you distort the curves so much that the intersections do no longer exist).

\begin{tikzpicture}[declare function={ft=0.1;
 \draw[-stealth] (-1,0) -- (5,0);
 \draw[-stealth] (0,0) -- (0,4);
 \draw[red,semithick,name path=pl] plot[variable=\t,domain=0:4,smooth] ({xl(\t)},{\t});
 \draw[red,semithick,name path=pr] plot[variable=\t,domain=0:4,smooth] ({xr(\t)},{\t});
 \begin{scope}[on background layer]
  \foreach \X in {-1,-0.8,...,-0.2}
   {\path[name path=l\X] (\X,0) -- ++ (4,4);
   \draw[blue,name intersections={of=pl and l\X}] (\X,0) 
   -- (intersection-1) -- (0,0-|intersection-1);}
   \clip  plot[variable=\t,domain=0:4,smooth] ({xl(\t)},{\t}) -| (-1,0);
   \foreach \X in {-4,-3.8,...,-1.2}
    {\draw[blue] (\X,0) -- ++ (4,4);}
  \foreach \X in {2.2,2.4,...,4}
   {\path[name path=r\X] (\X,0) -- ++ (0,4);
   \draw[blue,name intersections={of=pr and r\X}] (\X,0) 
   -- (intersection-1) -- (1,0);}

enter image description here

I hope this gives you enough mileage to produce the appropriate plots for your lectures.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.