Use matplotlib to plot the functions $y = x^3 + 3x^2 - x + 0.3 $ and $y = sin x$ [closed] The 2019 Stack Overflow Developer Survey Results Are InHow to plot logarithm functions on Google search graphing toolShape of graph and plotHow to plot bivariate function involving modulus and floor functions?How to make a good “infinity plot”?Help finding turning points to plot quartic and cubic functionsWhat free tools can I use to plot complex functions on the complex plane?How to plot these functions? (Utility functions)Verify the Riemann Hypothesis for first 1000 zeros.Plot Products of Airy FunctionsPlot 2 or more parametric functions MAXIMA

Can a rogue use sneak attack with weapons that have the thrown property even if they are not thrown?

Why isn't airport relocation done gradually?

Ubuntu Server install with full GUI

Looking for Correct Greek Translation for Heraclitus

Is "plugging out" electronic devices an American expression?

How to support a colleague who finds meetings extremely tiring?

Why do we hear so much about the Trump administration deciding to impose and then remove tariffs?

Multiply Two Integer Polynomials

How technical should a Scrum Master be to effectively remove impediments?

Why was M87 targetted for the Event Horizon Telescope instead of Sagittarius A*?

Who coined the term "madman theory"?

Is a "Democratic" Oligarchy-Style System Possible?

How to deal with fear of taking dependencies

Can one be advised by a professor who is very far away?

How to answer pointed "are you quitting" questioning when I don't want them to suspect

If I score a critical hit on an 18 or higher, what are my chances of getting a critical hit if I roll 3d20?

What do the Banks children have against barley water?

Can a flute soloist sit?

Am I thawing this London Broil safely?

Is there a symbol for a right arrow with a square in the middle?

Protecting Dualbooting Windows from dangerous code (like rm -rf)

Worn-tile Scrabble

A poker game description that does not feel gimmicky

FPGA - DIY Programming



Use matplotlib to plot the functions $y = x^3 + 3x^2 - x + 0.3 $ and $y = sin x$ [closed]



The 2019 Stack Overflow Developer Survey Results Are InHow to plot logarithm functions on Google search graphing toolShape of graph and plotHow to plot bivariate function involving modulus and floor functions?How to make a good “infinity plot”?Help finding turning points to plot quartic and cubic functionsWhat free tools can I use to plot complex functions on the complex plane?How to plot these functions? (Utility functions)Verify the Riemann Hypothesis for first 1000 zeros.Plot Products of Airy FunctionsPlot 2 or more parametric functions MAXIMA










0












$begingroup$


I'm new to Python coding and wondered if someone could give me the coding to plot these two graphs on the same program.



This is what I have so far, exactly as typed on Python, however I know that parts are incorrect.



from matplotlib import pyplot as plt

x = [float(i)/100 for i in range(0,101)]
y = [sin(x)]

plt.plot(x,y)









share|cite|improve this question











$endgroup$



closed as unclear what you're asking by Somos, Javi, Leucippus, YiFan, Alex Provost Mar 24 at 14:15


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






















    0












    $begingroup$


    I'm new to Python coding and wondered if someone could give me the coding to plot these two graphs on the same program.



    This is what I have so far, exactly as typed on Python, however I know that parts are incorrect.



    from matplotlib import pyplot as plt

    x = [float(i)/100 for i in range(0,101)]
    y = [sin(x)]

    plt.plot(x,y)









    share|cite|improve this question











    $endgroup$



    closed as unclear what you're asking by Somos, Javi, Leucippus, YiFan, Alex Provost Mar 24 at 14:15


    Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.




















      0












      0








      0


      0



      $begingroup$


      I'm new to Python coding and wondered if someone could give me the coding to plot these two graphs on the same program.



      This is what I have so far, exactly as typed on Python, however I know that parts are incorrect.



      from matplotlib import pyplot as plt

      x = [float(i)/100 for i in range(0,101)]
      y = [sin(x)]

      plt.plot(x,y)









      share|cite|improve this question











      $endgroup$




      I'm new to Python coding and wondered if someone could give me the coding to plot these two graphs on the same program.



      This is what I have so far, exactly as typed on Python, however I know that parts are incorrect.



      from matplotlib import pyplot as plt

      x = [float(i)/100 for i in range(0,101)]
      y = [sin(x)]

      plt.plot(x,y)






      graphing-functions math-software python






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Mar 24 at 3:05









      Lee David Chung Lin

      4,47841242




      4,47841242










      asked Mar 23 at 18:55









      BrookeBrooke

      63




      63




      closed as unclear what you're asking by Somos, Javi, Leucippus, YiFan, Alex Provost Mar 24 at 14:15


      Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









      closed as unclear what you're asking by Somos, Javi, Leucippus, YiFan, Alex Provost Mar 24 at 14:15


      Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






















          1 Answer
          1






          active

          oldest

          votes


















          1












          $begingroup$

          First, you need a larger range for $x$ to see a nice sinusoid, say from $0$ to $2pi$.
          Second, specify $y$ as a list comprehension, too:



          from matplotlib import pyplot as plt
          import math

          x = [float(i)/100 for i in range(0, 628)]
          y = [math.sin(z) for z in x]

          plt.plot(x,y)


          enter image description here




          If you want to plot both graphs one over the other (what isn't generally a good idea because those 2 function are so different, that in the default settings the sine function will appear as to coincide with the x-axis), the code may be as follows (I extended the range for $x$, and set limits for $y$-axes):



          from matplotlib import pyplot as plt
          import math

          BOUND = 1000

          x = [float(i)/100 for i in range(-BOUND, +BOUND)]
          y = [math.sin(z) for z in x]
          w = [z**3 + 3*z**2 - z + 0.3 for z in x]


          plt.ylim(-7,+7)
          plt.plot(x, y)
          plt.plot(x, w)


          enter image description here






          share|cite|improve this answer











          $endgroup$












          • $begingroup$
            Ah I see, so how would I add the second y graph onto this?
            $endgroup$
            – Brooke
            Mar 23 at 19:16










          • $begingroup$
            Do you mean to overlay this graph, or to create other one (in the other window)?
            $endgroup$
            – MarianD
            Mar 23 at 19:30










          • $begingroup$
            They will both be on the same axis so it will over lay it and show both
            $endgroup$
            – Brooke
            Mar 23 at 19:38










          • $begingroup$
            It's not a good idea, because there is such difference between the 2 functions that the sine function will appear to coincident with x axis. See: $sin(5pi /2) = 1$, while $x^3 + 3x^2 - x + 0.3$ will be for the same $x =5pi /2$ approximately $662$.
            $endgroup$
            – MarianD
            Mar 23 at 20:01











          • $begingroup$
            That what the assignment question is asking me to do as I am to find the real solutions of the graphs.
            $endgroup$
            – Brooke
            Mar 23 at 20:10

















          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1












          $begingroup$

          First, you need a larger range for $x$ to see a nice sinusoid, say from $0$ to $2pi$.
          Second, specify $y$ as a list comprehension, too:



          from matplotlib import pyplot as plt
          import math

          x = [float(i)/100 for i in range(0, 628)]
          y = [math.sin(z) for z in x]

          plt.plot(x,y)


          enter image description here




          If you want to plot both graphs one over the other (what isn't generally a good idea because those 2 function are so different, that in the default settings the sine function will appear as to coincide with the x-axis), the code may be as follows (I extended the range for $x$, and set limits for $y$-axes):



          from matplotlib import pyplot as plt
          import math

          BOUND = 1000

          x = [float(i)/100 for i in range(-BOUND, +BOUND)]
          y = [math.sin(z) for z in x]
          w = [z**3 + 3*z**2 - z + 0.3 for z in x]


          plt.ylim(-7,+7)
          plt.plot(x, y)
          plt.plot(x, w)


          enter image description here






          share|cite|improve this answer











          $endgroup$












          • $begingroup$
            Ah I see, so how would I add the second y graph onto this?
            $endgroup$
            – Brooke
            Mar 23 at 19:16










          • $begingroup$
            Do you mean to overlay this graph, or to create other one (in the other window)?
            $endgroup$
            – MarianD
            Mar 23 at 19:30










          • $begingroup$
            They will both be on the same axis so it will over lay it and show both
            $endgroup$
            – Brooke
            Mar 23 at 19:38










          • $begingroup$
            It's not a good idea, because there is such difference between the 2 functions that the sine function will appear to coincident with x axis. See: $sin(5pi /2) = 1$, while $x^3 + 3x^2 - x + 0.3$ will be for the same $x =5pi /2$ approximately $662$.
            $endgroup$
            – MarianD
            Mar 23 at 20:01











          • $begingroup$
            That what the assignment question is asking me to do as I am to find the real solutions of the graphs.
            $endgroup$
            – Brooke
            Mar 23 at 20:10















          1












          $begingroup$

          First, you need a larger range for $x$ to see a nice sinusoid, say from $0$ to $2pi$.
          Second, specify $y$ as a list comprehension, too:



          from matplotlib import pyplot as plt
          import math

          x = [float(i)/100 for i in range(0, 628)]
          y = [math.sin(z) for z in x]

          plt.plot(x,y)


          enter image description here




          If you want to plot both graphs one over the other (what isn't generally a good idea because those 2 function are so different, that in the default settings the sine function will appear as to coincide with the x-axis), the code may be as follows (I extended the range for $x$, and set limits for $y$-axes):



          from matplotlib import pyplot as plt
          import math

          BOUND = 1000

          x = [float(i)/100 for i in range(-BOUND, +BOUND)]
          y = [math.sin(z) for z in x]
          w = [z**3 + 3*z**2 - z + 0.3 for z in x]


          plt.ylim(-7,+7)
          plt.plot(x, y)
          plt.plot(x, w)


          enter image description here






          share|cite|improve this answer











          $endgroup$












          • $begingroup$
            Ah I see, so how would I add the second y graph onto this?
            $endgroup$
            – Brooke
            Mar 23 at 19:16










          • $begingroup$
            Do you mean to overlay this graph, or to create other one (in the other window)?
            $endgroup$
            – MarianD
            Mar 23 at 19:30










          • $begingroup$
            They will both be on the same axis so it will over lay it and show both
            $endgroup$
            – Brooke
            Mar 23 at 19:38










          • $begingroup$
            It's not a good idea, because there is such difference between the 2 functions that the sine function will appear to coincident with x axis. See: $sin(5pi /2) = 1$, while $x^3 + 3x^2 - x + 0.3$ will be for the same $x =5pi /2$ approximately $662$.
            $endgroup$
            – MarianD
            Mar 23 at 20:01











          • $begingroup$
            That what the assignment question is asking me to do as I am to find the real solutions of the graphs.
            $endgroup$
            – Brooke
            Mar 23 at 20:10













          1












          1








          1





          $begingroup$

          First, you need a larger range for $x$ to see a nice sinusoid, say from $0$ to $2pi$.
          Second, specify $y$ as a list comprehension, too:



          from matplotlib import pyplot as plt
          import math

          x = [float(i)/100 for i in range(0, 628)]
          y = [math.sin(z) for z in x]

          plt.plot(x,y)


          enter image description here




          If you want to plot both graphs one over the other (what isn't generally a good idea because those 2 function are so different, that in the default settings the sine function will appear as to coincide with the x-axis), the code may be as follows (I extended the range for $x$, and set limits for $y$-axes):



          from matplotlib import pyplot as plt
          import math

          BOUND = 1000

          x = [float(i)/100 for i in range(-BOUND, +BOUND)]
          y = [math.sin(z) for z in x]
          w = [z**3 + 3*z**2 - z + 0.3 for z in x]


          plt.ylim(-7,+7)
          plt.plot(x, y)
          plt.plot(x, w)


          enter image description here






          share|cite|improve this answer











          $endgroup$



          First, you need a larger range for $x$ to see a nice sinusoid, say from $0$ to $2pi$.
          Second, specify $y$ as a list comprehension, too:



          from matplotlib import pyplot as plt
          import math

          x = [float(i)/100 for i in range(0, 628)]
          y = [math.sin(z) for z in x]

          plt.plot(x,y)


          enter image description here




          If you want to plot both graphs one over the other (what isn't generally a good idea because those 2 function are so different, that in the default settings the sine function will appear as to coincide with the x-axis), the code may be as follows (I extended the range for $x$, and set limits for $y$-axes):



          from matplotlib import pyplot as plt
          import math

          BOUND = 1000

          x = [float(i)/100 for i in range(-BOUND, +BOUND)]
          y = [math.sin(z) for z in x]
          w = [z**3 + 3*z**2 - z + 0.3 for z in x]


          plt.ylim(-7,+7)
          plt.plot(x, y)
          plt.plot(x, w)


          enter image description here







          share|cite|improve this answer














          share|cite|improve this answer



          share|cite|improve this answer








          edited Mar 23 at 21:22

























          answered Mar 23 at 19:15









          MarianDMarianD

          2,2611618




          2,2611618











          • $begingroup$
            Ah I see, so how would I add the second y graph onto this?
            $endgroup$
            – Brooke
            Mar 23 at 19:16










          • $begingroup$
            Do you mean to overlay this graph, or to create other one (in the other window)?
            $endgroup$
            – MarianD
            Mar 23 at 19:30










          • $begingroup$
            They will both be on the same axis so it will over lay it and show both
            $endgroup$
            – Brooke
            Mar 23 at 19:38










          • $begingroup$
            It's not a good idea, because there is such difference between the 2 functions that the sine function will appear to coincident with x axis. See: $sin(5pi /2) = 1$, while $x^3 + 3x^2 - x + 0.3$ will be for the same $x =5pi /2$ approximately $662$.
            $endgroup$
            – MarianD
            Mar 23 at 20:01











          • $begingroup$
            That what the assignment question is asking me to do as I am to find the real solutions of the graphs.
            $endgroup$
            – Brooke
            Mar 23 at 20:10
















          • $begingroup$
            Ah I see, so how would I add the second y graph onto this?
            $endgroup$
            – Brooke
            Mar 23 at 19:16










          • $begingroup$
            Do you mean to overlay this graph, or to create other one (in the other window)?
            $endgroup$
            – MarianD
            Mar 23 at 19:30










          • $begingroup$
            They will both be on the same axis so it will over lay it and show both
            $endgroup$
            – Brooke
            Mar 23 at 19:38










          • $begingroup$
            It's not a good idea, because there is such difference between the 2 functions that the sine function will appear to coincident with x axis. See: $sin(5pi /2) = 1$, while $x^3 + 3x^2 - x + 0.3$ will be for the same $x =5pi /2$ approximately $662$.
            $endgroup$
            – MarianD
            Mar 23 at 20:01











          • $begingroup$
            That what the assignment question is asking me to do as I am to find the real solutions of the graphs.
            $endgroup$
            – Brooke
            Mar 23 at 20:10















          $begingroup$
          Ah I see, so how would I add the second y graph onto this?
          $endgroup$
          – Brooke
          Mar 23 at 19:16




          $begingroup$
          Ah I see, so how would I add the second y graph onto this?
          $endgroup$
          – Brooke
          Mar 23 at 19:16












          $begingroup$
          Do you mean to overlay this graph, or to create other one (in the other window)?
          $endgroup$
          – MarianD
          Mar 23 at 19:30




          $begingroup$
          Do you mean to overlay this graph, or to create other one (in the other window)?
          $endgroup$
          – MarianD
          Mar 23 at 19:30












          $begingroup$
          They will both be on the same axis so it will over lay it and show both
          $endgroup$
          – Brooke
          Mar 23 at 19:38




          $begingroup$
          They will both be on the same axis so it will over lay it and show both
          $endgroup$
          – Brooke
          Mar 23 at 19:38












          $begingroup$
          It's not a good idea, because there is such difference between the 2 functions that the sine function will appear to coincident with x axis. See: $sin(5pi /2) = 1$, while $x^3 + 3x^2 - x + 0.3$ will be for the same $x =5pi /2$ approximately $662$.
          $endgroup$
          – MarianD
          Mar 23 at 20:01





          $begingroup$
          It's not a good idea, because there is such difference between the 2 functions that the sine function will appear to coincident with x axis. See: $sin(5pi /2) = 1$, while $x^3 + 3x^2 - x + 0.3$ will be for the same $x =5pi /2$ approximately $662$.
          $endgroup$
          – MarianD
          Mar 23 at 20:01













          $begingroup$
          That what the assignment question is asking me to do as I am to find the real solutions of the graphs.
          $endgroup$
          – Brooke
          Mar 23 at 20:10




          $begingroup$
          That what the assignment question is asking me to do as I am to find the real solutions of the graphs.
          $endgroup$
          – Brooke
          Mar 23 at 20:10



          Popular posts from this blog

          Lowndes Grove History Architecture References Navigation menu32°48′6″N 79°57′58″W / 32.80167°N 79.96611°W / 32.80167; -79.9661132°48′6″N 79°57′58″W / 32.80167°N 79.96611°W / 32.80167; -79.9661178002500"National Register Information System"Historic houses of South Carolina"Lowndes Grove""+32° 48' 6.00", −79° 57' 58.00""Lowndes Grove, Charleston County (260 St. Margaret St., Charleston)""Lowndes Grove"The Charleston ExpositionIt Happened in South Carolina"Lowndes Grove (House), Saint Margaret Street & Sixth Avenue, Charleston, Charleston County, SC(Photographs)"Plantations of the Carolina Low Countrye

          random experiment with two different functions on unit interval Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)Random variable and probability space notionsRandom Walk with EdgesFinding functions where the increase over a random interval is Poisson distributedNumber of days until dayCan an observed event in fact be of zero probability?Unit random processmodels of coins and uniform distributionHow to get the number of successes given $n$ trials , probability $P$ and a random variable $X$Absorbing Markov chain in a computer. Is “almost every” turned into always convergence in computer executions?Stopped random walk is not uniformly integrable

          How should I support this large drywall patch? Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?How do I cover large gaps in drywall?How do I keep drywall around a patch from crumbling?Can I glue a second layer of drywall?How to patch long strip on drywall?Large drywall patch: how to avoid bulging seams?Drywall Mesh Patch vs. Bulge? To remove or not to remove?How to fix this drywall job?Prep drywall before backsplashWhat's the best way to fix this horrible drywall patch job?Drywall patching using 3M Patch Plus Primer