Answer to Question #269097 in C++ for joey

Question #269097

Write a program to plot a graph of function f(x) = x

n + xn-1

. Your program should take a maximum

absolute value of x as well as a positive integer n as input. You will plot a graph for the range [0, x]. You

should label the y-axis according to the maximum value of x.


1
Expert's answer
2021-11-20T09:49:41-0500
import matplotlib.pyplot as plt


x = 4
list1 = [i for i in range(0,x)]
n = 4
list2 = []
for i in list1:
    list2.append( n + i * n -1)
    
plt.plot(list1,list2)
plt.title('title name')
plt.xlabel('X')
plt.ylabel('n + i * n -1')

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
New on Blog
APPROVED BY CLIENTS