Graphing Calculator - Build a Graphing Calculator

I do not know how i should do with “display the graph and a table of values for any y= equation input” and how i can input any equation and change the x for various numbers

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Edg/117.0.2045.60

Challenge: Graphing Calculator - Build a Graphing Calculator

Link to the challenge:

Hi, welcome to the forum!

Can you show your code so far? Is it the graph or table that’s the problem?

You can review Step 15 to see how to graph an equation and input values.

You can review Step 22 to see how to create a table of values for an equation.


hi thank you , i have problems with the input
i review the 15 step but i am confused, in the exercise i need to do a code that input a ecuation and sustitue the x for each of the value of x in the table and insert the values of y in the table? My language is not English excuse me the errors.
In the 15 step is a system of ecuation and just solve the ecuation but not sustitue the x for diferents values.

I’m not able to read the code in this screenshot.

Can you please post it into a comment using the “code” button to enclose it in triple backticks to preserve formatting?

from numpy.linalg.linalg import solve
import matplotlib.pyplot as plt
import numpy as np
from sympy import symbols, Eq

x = symbols('x')
y = input('Enter a value for x: ')
xmin = -10
xmax = 10
ymin = -10
ymax = 10

fig, ax = plt.subplots()
plt.axis([xmin,xmax,ymin,ymax]) # window size
plt.plot([xmin,xmax],[0,0],'b') # blue x axis
plt.plot([0,0],[ymin,ymax], 'b') # blue y axis

for x in range(10):
    plt.plot([x],[y], 'ro')

plt.show()

ax = plt.subplot()
ax.set_axis_off()
title = y
cols = ('x', 'y')
rows = [[0,0]]

for x in range(1,10):
    resultado = ([x,y])
    rows.append(resultado)

ax.set_title(title)
plt.table(cellText=rows, colLabels=cols, cellLoc='center', loc='upper left')

i do not know which is the code button but this is de code it display the graph and the table but not calculate the ecuation with different values of x

Which step are you on, 24?

Yes, you are right. Step 15 is about solving and graphing a system of 2 linear equations, where the 2 equations are written in the code. The code shows how to use np.linspace to generate a series of values for x, then calculate the corresponding values of y and plot them. Step 22 does similar thing, but uses for loop instead and displays a table of values.

So now your problem is how to get any equation of y in terms of x from input and calculate the y values from different values of x. Well, this step is not demonstrated exactly in the teaching materials. There are demonstrations showing getting input of any equation in terms of x and solve for x. To tackle this task, you may consult the documentation of SymPy, in this section there are discussions about how to convert strings into SymPy expressions and evaluate the values for different values of x.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.