import numpy as np
import matplotlib.pyplot as plt
def gnu_plot( a, b, x_min, x_max) :
"""
Plots the function ax^2 + bx using Matplotlib.
Args:
a: Coefficient of the x^2 term.
b: Coefficient of the x term.
x_min: Minimum value of x for the plot.
x_max: Maximum value of x for the plot.
"""
x = np.linspace ( x_min, x_max, 100 ) # Generate 100 points between x_min and x_max
y = a * x**2 + b * x
plt.plot ( x, y)
plt.xlabel ( 'x' )
plt.ylabel ( 'y' )
plt.title ( 'GNU Plot of ax^2 + bx' )
plt.grid ( True )
plt.show ( )
# Example usage:
a = 2
b = -5
x_min = -3
x_max = 3
gnu_plot( a, b, x_min, x_max)
aW1wb3J0IG51bXB5IGFzIG5wCmltcG9ydCBtYXRwbG90bGliLnB5cGxvdCBhcyBwbHQKCmRlZiBnbnVfcGxvdChhLCBiLCB4X21pbiwgeF9tYXgpOgogICAgIiIiCiAgICBQbG90cyB0aGUgZnVuY3Rpb24gYXheMiArIGJ4IHVzaW5nIE1hdHBsb3RsaWIuCgogICAgQXJnczoKICAgICAgICBhOiBDb2VmZmljaWVudCBvZiB0aGUgeF4yIHRlcm0uCiAgICAgICAgYjogQ29lZmZpY2llbnQgb2YgdGhlIHggdGVybS4KICAgICAgICB4X21pbjogTWluaW11bSB2YWx1ZSBvZiB4IGZvciB0aGUgcGxvdC4KICAgICAgICB4X21heDogTWF4aW11bSB2YWx1ZSBvZiB4IGZvciB0aGUgcGxvdC4KICAgICIiIgoKICAgIHggPSBucC5saW5zcGFjZSh4X21pbiwgeF9tYXgsIDEwMCkgICMgR2VuZXJhdGUgMTAwIHBvaW50cyBiZXR3ZWVuIHhfbWluIGFuZCB4X21heAogICAgeSA9IGEgKiB4KioyICsgYiAqIHgKCiAgICBwbHQucGxvdCh4LCB5KQogICAgcGx0LnhsYWJlbCgneCcpCiAgICBwbHQueWxhYmVsKCd5JykKICAgIHBsdC50aXRsZSgnR05VIFBsb3Qgb2YgYXheMiArIGJ4JykKICAgIHBsdC5ncmlkKFRydWUpCiAgICBwbHQuc2hvdygpCgojIEV4YW1wbGUgdXNhZ2U6CmEgPSAyCmIgPSAtNQp4X21pbiA9IC0zCnhfbWF4ID0gMwoKZ251X3Bsb3QoYSwgYiwgeF9taW4sIHhfbWF4KQo=
stdin
aW1wb3J0IG51bXB5IGFzIG5wCmltcG9ydCBtYXRwbG90bGliLnB5cGxvdCBhcyBwbHQKCmRlZiBnbnVfcGxvdChhLCBiLCB4X21pbiwgeF9tYXgpOgogICAgJnF1b3Q7JnF1b3Q7JnF1b3Q7CiAgICBQbG90cyB0aGUgZnVuY3Rpb24gYXheMiArIGJ4IHVzaW5nIE1hdHBsb3RsaWIuCgogICAgQXJnczoKICAgICAgICBhOiBDb2VmZmljaWVudCBvZiB0aGUgeF4yIHRlcm0uCiAgICAgICAgYjogQ29lZmZpY2llbnQgb2YgdGhlIHggdGVybS4KICAgICAgICB4X21pbjogTWluaW11bSB2YWx1ZSBvZiB4IGZvciB0aGUgcGxvdC4KICAgICAgICB4X21heDogTWF4aW11bSB2YWx1ZSBvZiB4IGZvciB0aGUgcGxvdC4KICAgICZxdW90OyZxdW90OyZxdW90OwoKICAgIHggPSBucC5saW5zcGFjZSh4X21pbiwgeF9tYXgsIDEwMCkgICMgR2VuZXJhdGUgMTAwIHBvaW50cyBiZXR3ZWVuIHhfbWluIGFuZCB4X21heAogICAgeSA9IGEgKiB4KioyICsgYiAqIHgKCiAgICBwbHQucGxvdCh4LCB5KQogICAgcGx0LnhsYWJlbCgneCcpCiAgICBwbHQueWxhYmVsKCd5JykKICAgIHBsdC50aXRsZSgnR05VIFBsb3Qgb2YgYXheMiArIGJ4JykKICAgIHBsdC5ncmlkKFRydWUpCiAgICBwbHQuc2hvdygpCgojIEV4YW1wbGUgdXNhZ2U6CmEgPSAyCmIgPSAtNQp4X21pbiA9IC0zCnhfbWF4ID0gMwoKZ251X3Bsb3QoYSwgYiwgeF9taW4sIHhfbWF4KQo=
import numpy as np
import matplotlib.pyplot as plt
def gnu_plot(a, b, x_min, x_max):
"""
Plots the function ax^2 + bx using Matplotlib.
Args:
a: Coefficient of the x^2 term.
b: Coefficient of the x term.
x_min: Minimum value of x for the plot.
x_max: Maximum value of x for the plot.
"""
x = np.linspace(x_min, x_max, 100) # Generate 100 points between x_min and x_max
y = a * x**2 + b * x
plt.plot(x, y)
plt.xlabel('x')
plt.ylabel('y')
plt.title('GNU Plot of ax^2 + bx')
plt.grid(True)
plt.show()
# Example usage:
a = 2
b = -5
x_min = -3
x_max = 3
gnu_plot(a, b, x_min, x_max)