Investigation of the field of directions and isoclines of a differential equation
Introduction
Differential equations are a powerful tool for describing dynamic processes in nature, technology, and economics. However, their analytical solution is not always possible, and often not necessary to understand the general behavior of the system. In such cases, qualitative analysis methods come to the rescue, among which visualization of the fields of directions and isoclines occupies a special place.
In this example, we examine the equation using modern computing tools of the Julia language. We will not only build a mathematical model, but also create a visual visualization that allows us to intuitively understand the structure of solutions to this equation. Using the Plots libraries.jl and DifferentialEquations.jl demonstrates how modern computing technologies make complex mathematical concepts accessible and visual.
We will attach the necessary libraries.
using DifferentialEquations, LinearAlgebra
Definition of the function and initial conditions
Let's define the isocline function. This simple function defines a family of isocline curves of constant slope.
For the equation Isoclines are parabolas offset vertically.
function_inclines(x,R) = x.^2 .+R
Setting the boundaries of the plot area along the axes and .
We will also define the range of the parameter for isoclines, this will create a diverse family of curves.
x_min = -4.0
x_max = 4.0
y_min = -4.0
y_max = 4.0
R_min = -2
R_max = 2
Isoclines
Let's create the main canvas for our graph with convenient dimensions.
main_graph = plot(size=(800, 600), grid=true, legend=:best);
In this cycle, we will create the family of isoclines itself - each line corresponds to its own value. .
The denser the isoclines, the faster the slope of the solution changes in this area.
for R_flow in R_min:1:R_max
x_values = range(x_min, x_max, length=100)
y_values = function_lines(x_values, R_flow)
plot!(основной_график, x_значения, y_значения, linewidth=2, label="R = $R_flow")
end
Let's form a uniform grid of points along the axes and for building vectors.
These points will become the starting coordinates for the directions field.
grid_x = range(x_min, x_max, length=15)
grid_u = range(y_min, y_max, length=15)
The directions field
We will prepare arrays for storing vector data.
Each vector needs a starting point and the components of the direction .
x_vectors = Float64[]
y_vectors = Float64[]
and_components = Float64[]
v_components = Float64[]
In this double loop, we calculate the direction of each vector of the field.
for x in grid_x
for y in the grid
derivation_y = y - x^2
derivation_x = 1.0
length = norm([derivative x, derivative y])
if length > 0
push!(x_vectors, x)
push!(y_vectors, y)
push!(and_components, 0.4production_x/length)
push!(v_ components, 0.4production_u/length)
end
end
end
Let's add the directions field to our graph with red lines.
quiver!(main_graphics, x_vectors, y_vectors, quiver=(i_components, v_components),
color=:red, linewidth=1.5, label="The directions field");
The differential equation
Let's define a differential system - this is the core of our task.
The function returns the derivative at a point , defining the local behavior of solutions.
function of the system_od(variables, parameters, x)
y = variables[1]
return [y - x^2]
end
Let's define the initial conditions for integral curves.
For a better visual difference, we will assign each solution its own line color.
initial conditions = [-3.0, -1.0, 1.0, 3.0]
colors = [:green, :magenta, :cyan, :black]
line style = [:dash, :dash, :dash, :dash]
Solution and visualization
Let's numerically solve the ODE for each initial condition.
High computational accuracy guarantees smooth and accurate integral curves.
for (index, initial) in enumerate(initial conditions)
initial vector = [initial]
time interval = (x_min, x_max)
task = ODEProblem(system_ode, start vector, time interval)
solution = solve(problem, Tsit5(), reltol=1e-8, abstol=1e-8)
end
Let's build the resulting graph.
xlabel!("x")
ylabel!("y")
title!("The field of directions and isoclines of the equation dy/dx = y - x2")
xlims!(x_min - 0.5, x_max + 0.5)
ylims!(y_min - 0.5, y_max + 0.5)
plot!(top_margin = 8Plots.mm)
display(main_graph)
The final result shows the beauty and structure of the differential equation.
Conclusion
The conducted research clearly demonstrates visual methods in the analysis of differential equations. The constructed field of directions, combined with the family of isoclines, forms a kind of "terrain map" that allows predicting the behavior of solutions without explicitly finding them. The integral curves calculated by numerical methods confirm the correctness of the qualitative analysis and show how different initial conditions lead to different trajectories in the phase space.
Of particular value is the practical implementation of the method in the Engee environment, which combines computational efficiency and simplicity of Julia syntax. The resulting visualization serves as an excellent educational material, demonstrating the unity of analytical and numerical methods in modern mathematics. This approach opens up new opportunities for presenting complex mathematical concepts and conducting research in various scientific fields where differential equations serve as the main modeling tool.