Tools to Visualize Complex Curves

Sopan Thakre
3 min readJul 24, 2024

--

I always talk about visualization- a way to embrace Math and if it’s geometry, equations aren’t enough. For an abstract context, a curious mind always wonders- how does it look like? This story is about the tools that come handy for plotting complex curves. We will discuss AI- ChatGPT and an online tool- GeoGebra.

Problem Statement

Let’s begin with a curve:

Plot the locus of the incentre of a triangle with a fixed base and a fixed altitude.

Let’s simplify this by making some assumptions: fixed base- BC with B(-1, 0)and C(1, 0)and a fixed altitude of length 1 such that the third point (variable), A, lies on the line y = 1. So, coordinates of A are (x, 1) for x lying in the range [-5, 5].

Let’s plot this using different tools.

Plotting Curve

1. ChatGPT

In the age of AI, it is not difficult to get your complex tasks done. I asked ChatGPT 4o to plot curve for the above problem statement and it returned me a Python code. We will break it down here.

Importing necessary libraries:

import matplotlib.pyplot as plt
import numpy as np

Constants:

B = np.array([-1, 0])
C = np.array([1, 0])
altitude = 1
x_range = np.linspace(-5, 5, 1000)
y = altitude

Function to calculate incenter:

def incenter(A, B, C):
a = np.linalg.norm(B-C)
b = np.linalg.norm(C-A)
c = np.linalg.norm(A-B)
return (a*A + b*B + c*C)/(a + b + c)

Collecting incenter points:

incenters = []
for x in x_range:
A = np.array([x, y])
I = incenter(A, B, C)
incenters.append(I)
incenters = np.array(incenters)

Plotting locus:

plt.figure(figsize=(8, 4))
plt.scatter(incenters[:, 0], incenters[:, 1], c="blue", s=1, label="Incenter locus")
plt.scatter([B[0], C[0]], [B[1], C[1]], c="red", label="Fixed base points")
plt.scatter(x_range, np.full_like(x_vals, y), c="green", s=1, label="Third vertex locus")
plt.xlabel("x")
plt.ylabel("y")
plt.legend()
plt.title("Locus of Incenter of a triangle with fixed base points and a fixed altitude")
plt.grid(True)
plt.axis("equal")
plt.show()

This is how it looks like:

Fig 1. Locus of incenter of a triangle with fixed base points and a fixed altitude

You can get the code here.

2. GeoGebra

How about some controlled locus- something like a video? For that, we will use GeoGebra’s parametric equation plotter. So, let’s generate parametric equations for this curve first.

Fig. Parametric equations for incenter locus

You can find the derivation here.

Search for GeoGebra online parametric equation plotter. Then, you get a window as shown in Fig below. All you need to do is put parametric equations for x and y in the textboxes against them. Next, you fix limits for the parametric variable. All set! Now, just vary t and you can see the path traced by incenter.

Fig. Animated view of locus of incenter as parametric variable, t varies

You can also add points and other curves through the Input textbox below. Just type the equation like y = 2x or point like (-1,0).

I have one more problem statement for you: Plot the locus of incenter of a triangle with two of its vertices as focii of an ellipse and the third vertex lies on the ellipse. Can you tell me what is the curve obtained?

Conclusion

That’s it from this story. Try to experiment with different configurations and centers for a triangle or any polygon. The more you visualize, you realize how less you could. These tools are a great help when it comes to 3D. I will cover more of such tools in my upcoming stories. So, my mathophilics, follow me for more of such stories. Till then, goodbye!

--

--

Sopan Thakre

A curious mind that takes interest in Math and Programming and sometimes literature