Math Assignment-1
Math Assignment-1
Introduction:
This study focuses on analyzing a quadratic equation represented by a second-
degree polynomial.
Ax2+2Hxy+By2+2Gx+2Fy+C= 0
Purpose:
Task 1:
Δ=ABC+2FHG−AF2−BG2−CH2
Let ,
A = 6, B = -4, H = 2.5, G = 3.5, F = 6.5, C = -3
After calculating,
(Ax+By+F)(Cx+Dy+G)=0
Task 2:
x′=x−x0, y′=y−y0
Substitute:
x=x′cosθ−y′sinθ, y=x′sinθ+y′cosθ
Code:
import numpy as np
import matplotlib.pyplot as plt
from sympy import symbols, Eq, solve, cos, sin
import tkinter as tk
from tkinter import messagebox
rotation_rad = np.deg2rad(rotation_deg)
if verify_straight_lines(A, B, H, G, F, C):
initial_lines = extract_lines(A, H, B, G, F, C)
plt.show()
else:
messagebox.showinfo("Result", "The input does not correspond to a pair of straight
lines.")
except ValueError:
messagebox.showerror("Error", "Invalid input. Please provide valid numeric values.")
# GUI configuration
root = tk.Tk()
root.title("Straight Line Pair Transformation")
root.mainloop()
Visualization:
Results and Observations
Initial Input:
Coefficients A = 6, B = -4, H = 2.5, G = 3.5, F = 6.5, C = -3
Transformation Parameters:
Shift: x0 = 2, y0= 3
Rotation: θ = 0∘
Outputs:
Before Transformation: Equations of the original pair of lines:
y1 = 0.25 - 0.75x, y2 = 2.0x + 3.0
After Transformation: Transformed equations:
y1 = 4.75 - 0.75x, y2 = 2.0x + 2.0
Conclusion:
This assignment successfully achieved the following:
Verified whether the given input equation represents a pair of straight lines.
Performed extraction and applied transformations to the equations through
translation and rotation.
Visualized the equations both before and after the transformations to
illustrate the changes.
Purpose:
1. Input the equation of a plane (normal vector) and a straight line (direction
vector and a point on the line).
2. Visualizing the plane and the straight line in 3D space.
3. Computing the direction ratios of the line.
4. Determining and visualize relationships such as intersection, parallelism, or
angle between the plane and line.
Task 1:
Plane Equation:
Where:
A,B,C are the direction ratios (normal vector) to the plane.
D is the constant term.
User Input:
x=x0+at
y=y0+bt
z=z0+ct
Where:
(x0,y0,z0) is a point on the line.
(a,b,c) are the direction ratios of the line.
t is the parameter.
User Input:
Task 2:
Mathematical Concepts
For a line with direction vector (dx, dy, dz), the direction ratios are
proportional to the vector components.
2. Plane Equation
The plane's equation is derived from its normal vector (nx, ny, nz) and
a point on the plane:
Task 3:
Input the normal vector for the plane and direction vector for the line.
Compute the equation of the plane and generate the line points.
Visualize both the plane and the line in a 3D plot.
Code:
# Plotting
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(x_vals, y_vals, z_vals, color='cyan', alpha=0.6)
# Line calculation
line_points = np.array([point_on_line + t * direction_vector for t in np.linspace(-10, 10, 200)])
print(f"Line Coordinates: {line_points}") # Debugging output
ax.plot(line_points[:, 0], line_points[:, 1], line_points[:, 2], color='magenta')
# Labels
ax.set_xlabel('X Axis')
ax.set_ylabel('Y Axis')
ax.set_zlabel('Z Axis')
plt.show()
# GUI Setup
window = tk.Tk()
window.title("3D Plane and Line Plotter")
window.mainloop()
Task 4:
Graphical Visualization
The Matplotlib 3D toolkit is used to plot the plane and the line.
Visualization:
Results and Observations
Initial Input:
Outputs:
Graphs demonstrate the plane and the line intersecting at a single point.
Conclusion:
This task offered an in-depth understanding of: