Here is an example of how to plot two equations within the same graph using Mathematica:
=
signs followed by the equation. For example:eqn1 = x^2 + 2x + 1
eqn2 = 2x + 1
Plot
function to graph the equations. Use curly brackets {}
to enclose the equations and separate them with a comma. Set the range of the x-axis using the PlotRange
option:Plot[{eqn1, eqn2}, {x, -5, 5}, PlotRange -> {-5, 25}]
This will plot both equations on the same graph with x ranging from -5 to 5 and y ranging from -5 to 25.
LabelStyle
, PlotLabel
, and PlotLegends
options:Plot[{eqn1, eqn2}, {x, -5, 5}, PlotRange -> {-5, 25}, LabelStyle -> {FontSize -> 14},
PlotLabel -> "Two equations", PlotLegends -> {"eqn1", "eqn2"}]
This will add a title to the graph, increase the font size of the labels, and add a legend showing which equation is which.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-06-09 11:00:00 +0000
Seen: 10 times
Last updated: Mar 02 '22
How can I turn a string of characters into a list using R?
What causes a syntax error in a for loop and array in Pine Script?
Investigate the usage of square brackets.
What is the process for constructing a dictionary using two columns from pandas DataFrame?
How can Google calendar events be generated on the server-side using Flutter?
How can the dataframe be transformed into a record list without including brackets?
How can brackets in a filepath be managed when it is passed as a variable in the pipeline in Bash?