Message Boards Message Boards

0
|
20105 Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Plot a one variable function with different values for a constant?

Hello, fellow scientists and students. My question might be very simple to answer: How do I plot the following function

f[x_] := x^4 + a*x^2

where a is a real valued constant for three different values of a? I want to declare this function and then plot a graph with 3 different values for my constant a. Any thoughts? Thanks in advance.

Luciano

POSTED BY: Luciano Pinheiro
4 Replies

When you get more elaborate, the order of evaluation matters. Plot apparently needs to peek at complicated arguments to understand what to do. So, this works:

Plot[Evaluate[Table[Labeled[f[x], a], {a, {1, 30, 100}}]], {x, 0, 3}]
POSTED BY: John Doty

It literally solved all my questions. Thank you so much

POSTED BY: Luciano Pinheiro

Something like:

Plot[Table[f[x], {a, {1, 30, 100}}], {x, 0, 3}]
POSTED BY: John Doty

Thank you, it worked. I am trying to plot the legends alongside the curves, but it's not working since it seems Mathematica interprets like only one function plotted three times. Is there anyway I can plot legends for the constants I am using?

POSTED BY: Luciano Pinheiro
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract