import matplotlib.pyplot as plt
import numpy as np
"""
a.) see get_values()
b.) see plot_values
c.)
Due to lack of parentheses is it unclear whether your last term is
-1/(12*x) OR (-1/12)*x
The former does not converge as x->0 as -1/(12*x)-> +infinity
as x->0 through negative values, and -1/(12*x)-> -infinity as
x->0 through postive values.
In the latter your function is continuous everywhere, and our
limit as x->0 is just f(0) = 3^(3*0)-(1/12)*0 = 1
(former part c is no value, latter part
I will be assuming the latter.
"""
def get_values():
x_values_pos = [.1, .01, .001, .0001]
x_values_neg = [-.1, -.01, -.001, -.0001]
y = lambda x: 3 ** (3 * x) - (1 / 12)*x
y_values_pos = [y(x) for x in x_values_pos]
y_values_neg = [y(x) for x in x_values_neg]
print(f"Values for x={str(x_values_pos)[1:-2]} are y={str(y_values_pos)[1:-2]}")
print(f"Values for x={str(x_values_neg)[1:-2]} are y={str(y_values_neg)[1:-2]}")
def plot_values():
x = np.arange(-1.0, 1.0, 0.01)
y = 3**(3*x)-(1/12)*x
fig, ax = plt.subplots()
ax.plot(x, y)
ax.grid()
fig.savefig("plot00.png")
plt.show()
get_values()
plot_values()