Draw a function given by a system of equations involving an implicit function

Viewed 83

I need to draw a graph of a function like this:

enter image description here

What is the most elegant way to do it?

1 Answers

You could use the substitution x = cos(t) to parameterise your set of equations for t ∈ [0, 2π) as x = cos(t), y = sin(t), z = 2x.

In Julia, you can use Plots.jl to plot this as follows:

using Plots
t = 0:0.01:2*pi
x = cos.(t)
y = sin.(t)
z = 2 .* x

plot(x, y, z)

A slightly neater trick is to use parametric plotting, where we can just pass functions (x(t), y(t), z(t)) and specify the range of the parameter t:

plot(cos, sin, x -> 2 * cos(x), 0, 2π, xlabel="x", ylabel="y", zlabel="z", label="f")
Related