```
using DifferentialEquations
using Plots
function rotchain!(du, u, p, x)
# Differential equation of the rotating chain in 3D
w, g, μ = p # Unpack the parameters
du[1] = u[2]
du[2] = -u[2]/x + (μ * g) / (x * w^2) * sqrt(1 + u[2]^2)
end
function rotation!(du, u, p, t)
w = p[1]
x = u[1]
z = u[2]
du[1] = -w * sin(w * t)
du[2] = w * cos(w * t)
end
function rotchain_solve(L, w, g, μ, num_points)
xspan = (0.1, L)
u0 = [1.0, 1.0] # Initial values for u and du/dx at x=0
# Solving the differential equation
prob1 = ODEProblem(rotchain!, u0, xspan, [w, g, μ])
sol1 = solve(prob1, Tsit5(), saveat = L / (num_points - 1) * (0:num_points-1)) # saveat for
equally scattered points to compute the numerical u(x)
return sol1
end
function rotation_solve(w, L, num_points)
tspan = (0.1, L)
u0 = [1.0, 0.0]
prob2 = ODEProblem(rotation!, u0, tspan, [w])
sol2 = solve(prob2, Tsit5(), saveat = L / (num_points - 1) * (0:num_points-1))
return sol2
end
#x_values = sol1.t .* sol2[1, :]
#y_values = sol1[1, :]
#z_values = sol1.t .* sol2[2, :]
gr()
function plot_Rot_Chain_3D(sol1, sol2)
anim = @animate for i in 1:length(sol2.t)
x_vals = sol1.t[i] .* sol2[1, i]
y_vals = sol1[1, i]
z_vals = sol1.t[i] .* sol2[2, i]
plot([x_vals], [y_vals], [z_vals], mode="markers", name="Rotating Chain")
end
gif(anim, "rotating_chain.gif", fps = 5)
end
μ = 10
L = 1
w = π / 2
g = 9.81
num_points = 100
# Solution and plotting
sol1 = rotchain_solve(L, w, g, μ, num_points)
sol2 = rotation_solve(w, L, num_points)
plot_Rot_Chain_3D(sol1, sol2)
```

I wrote this code to solve the problem, in which we hang down a chain and rotate it qroud this axis(y-axis). At the end I tried to make an animation, in which the chain rotates around the y-axis, while its shape is determined, but the actual animation part did not really worked. For so much time I gave me different kind of errors, like Assertion or Method errors. Now it generates an animation, but it does not look like as it should. Acctually there is nothing on the plot. I would really appriciate if anyone could help me.

Thank you, in advance!