Have you ever had a feeling you need to solve an inequality like this one ((x+6)^3)/(7-x)^5>0 and you did not know how to start?
In the video at the bottom of the page I am showing the few steps needed, in order to find the range of solutions, to which
X
belongs.This is the paper, that was used in the video:
The code, used for the Jupyter notebook is here:
1 2 3 4 5 6 |
import numpy as np import matplotlib.pyplot as plt # Function definition def f(x): return ((x + 6)**3 * (x - 4)) / ((7 - x)**7) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# Define x values, avoiding division by zero at x = 7 x_values = np.linspace(-10, 10, 1000) x_values = x_values[x_values != 7] # Exclude x=7 to avoid division by zero y_values = f(x_values) # Plot the function plt.figure(figsize=(12, 8)) plt.plot(x_values, y_values, label="(x+6)^3 * (x-4) / (7-x)^7", linewidth=2, color='black') # Highlight the solution intervals: (-∞, -6) and (4, 7) plt.fill_betweenx([-200, 200], -10, -6, color='green', alpha=0.3, label="Solution Interval (-∞, -6)") plt.fill_betweenx([-200, 200], 4, 7, color='blue', alpha=0.3, label="Solution Interval (4, 7)") # Mark critical points and undefined regions plt.axvline(-6, color='red', linestyle='--', linewidth=1, label="x=-6 (root, not included)") plt.axvline(4, color='red', linestyle='--', linewidth=1, label="x=4 (root, not included)") plt.axvline(7, color='purple', linestyle='--', linewidth=1, label="x=7 (undefined)") plt.axhline(0, color='black', linestyle='--', linewidth=1, label="y=0 (x-axis)") # Add titles, labels, and legend plt.title("Solution of the Inequality (x+6)^3 * (x-4) / (7-x)^7 > 0", fontsize=16) plt.xlabel("x", fontsize=14) plt.ylabel("f(x)", fontsize=14) plt.ylim(-200, 200) plt.legend(fontsize=12) plt.grid(True) # Show the plot plt.show() |
Btw, if after watching the video you are wondering how to write this formula in Jupyter Notebook:
The answer is the following:
- Change the cell type to Markdown (Shortcut “M”)
- Paste that:
1 2 3 4 |
Solving for: $$ \frac{(x+6)^3(x-4)}{(7-x)^7} > 0 $$ |
🙂