Skip to content

Instantly share code, notes, and snippets.

@louismeunier
Created August 5, 2025 17:37
Show Gist options
  • Select an option

  • Save louismeunier/20648b8f4c9d237296536893f8995026 to your computer and use it in GitHub Desktop.

Select an option

Save louismeunier/20648b8f4c9d237296536893f8995026 to your computer and use it in GitHub Desktop.
begin
using Plots, LaTeXStrings; pyplot()
# initial condition
x_0 = 8
y_0 = -2
# the "concentration of blood" on the surface of the water
C(x,y) = ℯ^(-(x^2+2y^2)/(10^4))
x_range = -10:0.1:10
y_range = -10:0.1:10
C_range = [C(x,y) for x in x_range, y in y_range]
contourf(
x_range,
y_range,
C_range,
color=:vikO,
levels=20,
dpi=300
)
t(x) = (y_0/(x_0)^2)*x^2
t_range = t.(x_range)
z_path_range = C.(x_range, t_range)
plot!(
x_range,
t_range,
color=:gray,
linewidth = 2,
label=L"T(x)"
)
plot!(
[x_0],
[y_0],
color = :black,
markersize = 4,
marker = :circle,
label = L"P(x_0, y_0)"
)
xlims!(-10,10)
ylims!(-10,10)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment