I want to plot f1[x] over 0 < x < L/2 and f2[x] over L/2 < x < L (i.e. so that f1[x] isn't displayed overL/2 < x < L, etc.). How do I do this?
|
|
||||
|
As b.gatessucks commented, use
Generally you should not use capital letters for variable names ( |
|||
|
|
|
Or without the use of piecewise:
Here is a more integrated version with it bundled up into a function which takes a list of functions to plot and an arbitrary number of ranges:
A selected plot with a single function:
A plot with multiple functions and ranges:
I did play with passing |
||||
|
|
We needn't use
Here are respective definitions :
or a sligtly different way :
we can do a similar construction in a more flexible way assuming e.g. dependence of the function on the parameter
to plot these functions we can make use of e.g.
In case of
We show here something more customized :
|
||||
|
|
|
(note the horizontal line for $x>2\pi$). One can avoid this by simply displaying a bigger range than has been plotted, as follows:
There is now nothing at $x>2\pi$. |
|||||||||
|










ConditionalExpressionis even more succinct than withPiecewise. – Alexey Popkov Jun 20 '12 at 14:58