Using piecewise functions to draw streamlines in Mathematica

Using piecewise functions to draw streamlines in Mathematica

Mathematic has a built-in function "StreamPlot" for drawing streamline graphs. When the author uses this function to draw a streamline diagram here, he finds that "StreamPlot" does not support the piecewise function created with "Piecewise":

insert image description here
insert image description here
So here is another way to represent the piecewise function:
insert image description here
in this way, we can use the piecewise function to draw the streamline diagram. If the piecewise function has only two sections, you can also use "If" to express it.
Since it is not clear whether logical expressions can be used to express piecewise functions in Mathematica, for example, in Fortran, g can be expressed as:

  g=-v*(u<=0.3333333)+(1-6.75*u*(u-1)**2-v)*(u<=1.and.u>=0.333333)+(1-v)*(u>1)

So this method was adopted.

Please point out if there are mistakes

Guess you like

Origin blog.csdn.net/qq_45772881/article/details/115959437