Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Plot with several enhancements added for singularities, asymptotes, surd values and non-interval domains
|
ResourceFunction["EnhancedPlot"][f,{x,xmin,xmax}] returns a plot with several enhancements given by options. |
| "Asymptote" | { } | list of points where the function has vertical asymptotes |
| "AsymptoteStyle" | {{Red,Dashed}} | graphics directive to specify the style for each asymptote |
| "DrawPoint" | { } | list of points to add to the plot |
| "DrawPointStyle" | AbsolutePointSize[7] | graphics directives to specify style(s) for the points given with "DrawPoint" |
| "Exception" | { } | list of points where the function has discontinuities |
| "FindExceptions" | Automatic | whether to use ResourceFunction["FunctionDiscontinuities"] to find the discontinuities |
| "HorizontalAsymptote" | { } | list of points where horizontal asymptotes should be drawn |
| "HorizontalAsymptoteStyle" | {{Red,Dashed}} | graphics directive to specify the style for each horizontal asymptote |
| "PointStyle" | AbsolutePointSize[7] | graphics directive to specify the style for the point(s) where the function has a discontinuity; color directives are not allowed |
| "PowerBehavior" | Real | odd roots of negative real numbers are returned as negative real numbers |
| "ZeroToNull" | True | whether to change the default value of a piecewise function from zero to Null |
Find the discontinuities and plot a function:
| In[1]:= |
|
| Out[2]= |
|
Explicitly give the discontinuity:
| In[3]:= |
|
| Out[4]= |
|
Plot a function with a removable discontinuity:
| In[5]:= |
|
| Out[5]= |
|
Explicitly give the discontinuity:
| In[6]:= |
|
| Out[6]= |
|
Remove the discontinuity:
| In[7]:= |
|
| Out[7]= |
|
| In[8]:= |
|
| Out[9]= |
|
Remove the discontinuity but show the break point:
| In[10]:= |
|
| Out[11]= |
|
Plot a function with an asymptote at x=-1, a horizontal asymptote at y=0 , a jump discontinuity at x=2 and a removable discontinuity at x=3:
| In[12]:= |
|
| Out[14]= |
|
"FindAsymptote" misses the horizontal asymptote at y=0:
| In[15]:= |
|
| Out[17]= |
|
An example from the resource function FunctionDiscontinuities:
| In[18]:= |
|
| Out[19]= |
|
Plot the result using the Plot command and the option ExclusionsStyle:
| In[20]:= |
|
| Out[20]= |
|
Use EnhancedPlot to obtain a much better plot:
| In[21]:= |
|
| Out[21]= |
|
It is not necessary to call on the resource function Asymptotes to find the vertical asymptotes of the following function since they are among the discontinuities found by the resource function FunctionDiscontinuities:
| In[22]:= |
|
| Out[22]= |
|
Plot a function with asymptotes and a removable discontinuity:
| In[23]:= |
|
| Out[24]= |
|
| In[25]:= |
|
| Out[25]= |
|
Remove the singularity by appropriately defining the function at x=3 so that f(3)=limn→3f(x):
| In[26]:= |
|
| Out[26]= |
|
| In[27]:= |
|
| Out[28]= |
|
Explicitly list the jump point and add the asymptotes manually:
| In[29]:= |
|
| Out[30]= |
|
Plot a function with a jump discontinuity:
| In[31]:= |
|
| Out[31]= |
|
A function with an odd root over a domain consisting of two disjoint intervals with one interval containing negative numbers. Plot the function and its derivative:
| In[32]:= |
|
| Out[32]= |
|
Plot a function with two vertical asymptotes and apply a style to the asymptotes:
| In[33]:= |
|
| Out[33]= |
|
Plot a curve with a removable discontinuity and two points drawn off the curve:
| In[34]:= |
|
| Out[35]= |
|
Plot a curve with a removable discontinuity and several points drawn on the curve:
| In[36]:= |
|
| Out[37]= |
|
Create a plot with several exceptions: a removable discontinuity (at x=-1/2), a jump discontinuity (at x=-1) and an infinite discontinuity (at x=1):
| In[38]:= |
|
| Out[39]= |
|
Setting "FindAsymptotes"→True uses the resource function Asymptotes to find the asymptotes (one vertical and one oblique) of the following function:
| In[40]:= |
|
| Out[40]= |
|
Plot a function with asymptotes (vertical and other):
| In[41]:= |
|
| Out[41]= |
|
Setting "FindExceptions"→True uses the resource function FunctionDiscontinuities to find the discontinuities:
| In[42]:= |
|
| Out[43]= |
|
Plot two functions:
| In[44]:= |
|
| Out[45]= |
|
If a point is listed as an exception but isn’t an exception, then a solid point is plotted on the graph:
| In[46]:= |
|
| Out[46]= |
|
Plot a function with its horizontal asymptote:
| In[47]:= |
|
| Out[47]= |
|
| In[48]:= |
|
| Out[48]= |
|
Make the points bigger:
| In[49]:= |
|
| Out[50]= |
|
| In[51]:= |
|
| Out[52]= |
|
By default, the Wolfram Language returns the principal root of a number. If the number is real and negative and the root is odd, then the principal root is an imaginary number. Setting "PowerBehavior" to Real (the default) will force EnhancedPlot to plot the positive root:
| In[53]:= |
|
| Out[53]= |
|
By default, the Wolfram Language does not produce a correct plot of a piecewise function whose domain consists of disjoint intervals. The reason is that it uses 0 as the default value if none of the conditions apply:
| In[54]:= |
|
| Out[55]= |
|
A correct plot is obtained by manually setting the default value of the Piecewise to Null:
| In[56]:= |
|
| Out[57]= |
|
EnhancedPlot automatically sets the default value of Piecewise to Null:
| In[58]:= |
|
| Out[59]= |
|
Return default Plot behavior by setting the option "ZeroToNull" to False:
| In[60]:= |
|
| Out[61]= |
|
Note that with the option "ZeroToNull" set to False, "FindExceptions" will list the break points as jump discontinuities:
| In[62]:= |
|
| Out[62]= |
|
The resource function Asymptotes can be very slow:
| In[63]:= |
|
| Out[64]= |
|
This contributes a significant amount of time to EnhancedPlot if the setting "FindAsymptotes"→True is used:
| In[65]:= |
|
| Out[66]= |
|
On the other hand, "FindExceptions" is very fast:
| In[67]:= |
|
| Out[68]= |
|
The resource function Asymptotes can miss the asymptotes of some functions:
| In[69]:= |
|
| Out[70]= |
|
The resource function FunctionDiscontinuities will find the exceptions:
| In[71]:= |
|
| Out[72]= |
|
EnhancedPlot sometimes misses a removable discontinuity:
| In[73]:= |
|
| Out[73]= |
|
However, the discontinuity can be listed manually:
| In[74]:= |
|
| Out[74]= |
|
When a discontinuity denoted by a filled circle is overlapped by a empty circle, the filled circle is covered by the empty circle—that is, the empty circle is not really empty (see behavior at x=4):
| In[75]:= |
|
| Out[76]= |
|
This work is licensed under a Creative Commons Attribution 4.0 International License