Answer to Question #205477 in Python for Reoma Alurd

Question #205477

1. Use matplotlib.pyplot.plot to produce a plot of the functions f(x) = e−x/10 sin(πx) and g(x) = xe−x/3 over the interval [0, 10]. Include labels for the x- and y-axes, and a legend explaining which line is which plot. 


1
Expert's answer
2021-06-13T00:03:59-0400
import matplotlib.pyplot as plt
import numpy as np

def main():

    x = np.arange(0.0, 10.0, 0.01)

    f = np.e - x / 10 * np.sin(x * np.pi)
    g = x * np.e - x / 3

    plt.plot(x, f)
    plt.plot(x, g)

    plt.show()

if __name__ == '__main__':
    main()

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