Answer to Question #228539 in Python for parth

Question #228539

Define the following functions,

f(x) = 1 / 1 + x2

and g(x) = x − x2

Produce plots of the graphs of each of f ◦ g and g ◦ f. You should choose settings (eg domain, number of samples) to make a smooth plot which displays the key features - try experimenting with different settings to work out what looks good.


1
Expert's answer
2021-08-23T01:19:33-0400
  import matplotlib.pyplot as plt
  import numpy as np
  x = np.linspace(1,100,20)
  f = 1/(1+x**2)
  g = x - x**2
  h = 1/(1+(x-x**2)**2)
  s = (1/(1+x**2)) - (1/(1+x**2))**2
  plt.plot(x,h)
  plt.xlabel('x-axis')
  plt.ylabel('f o g')
  plt.plot(x,s) 
  plt.xlabel('x-axis')
  plt.ylabel('g o f')

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS