How to turn a dot into simple scaler expressions for nonlinear optimization using JUMP

I want to turn the dot notation in this code to simple scaler operations for NLconstraint.
I’ve checked the examples in JUMP’s documentation, but I could not get it to work.
The following is the part that’s causing the issue.

    @NLobjective(model, Min, 
    100 * sum(position[:, end].^2)+ sum(velocity[:, end].^2))

    # Initial conditions:
    @NLconstraint(model, position[:, 1] .== initial_position)
    @NLconstraint(model, velocity[:, 1] .== initial_velocity)
    @NLconstraint(model, angle[1] .== initial_angle)

    optimize!(model)
    return value.(position), value.(velocity), value.(acceleration), value.(angle)

Here’s the entire optimizer function.

function run_mpc(initial_position, initial_velocity, initial_angle)
    
    model = Model(Ipopt.Optimizer)

    Δt = 0.1
    num_time_steps = 20 # Change this -> Affects Optimization
    max_acceleration_Thr = 10 # Max Thrust / Mass
	max_pitch_angle = 90
	accel_g = 1.635 # 1/6 of Earth G

    @variables model begin
        position[1:2, 1:num_time_steps]
        velocity[1:2, 1:num_time_steps]
		acceleration[1:2, 1:num_time_steps]
		-max_pitch_angle <= angle[1:num_time_steps] <= max_pitch_angle
		-max_acceleration_Thr <= accel_Thr[1:num_time_steps] <= max_acceleration_Thr
    end

    # Dynamics constraints
	@NLconstraint(model, [i=2:num_time_steps, j=[1]], acceleration[j, i] == accel_Thr[i-1]*sind(angle[i-1]))
	
	@NLconstraint(model, [i=2:num_time_steps, j=[2]], acceleration[j, i] == accel_Thr[i-1]*cos(angle[i-1])-accel_g)
	
    @NLconstraint(model, [i=2:num_time_steps, j=1:2],
                velocity[j, i] == velocity[j, i - 1] + (acceleration[j, i - 1]) * Δt)
    @NLconstraint(model, [i=2:num_time_steps, j=1:2],
                position[j, i] == position[j, i - 1] + velocity[j, i - 1] * Δt)


    # Cost function: minimize final position and final velocity
	# For Moving to [-2,0] with min. vertical velocity,
	# sum(([-2,0]-position[:, end]).^2)+ sum(velocity[[2], end].^2)
    @NLobjective(model, Min, 
        100 * sum(position[:, end].^2)+ sum(velocity[:, end].^2))

    # Initial conditions:
    @NLconstraint(model, position[:, 1] .== initial_position)
    @NLconstraint(model, velocity[:, 1] .== initial_velocity)
	@NLconstraint(model, angle[1] .== initial_angle)

    optimize!(model)
    return value.(position), value.(velocity), value.(acceleration), value.(angle)
end;

If the constraint is linear or quadratic, you can use @constraint. That should work for these cases.

Otherwise you need an explicit sum like sum(position[i, num_time_steps] for i in 1:2).

For the last part, use a collection

@constraint(model, [i=1:2], position[i, 1] == initial_position[i])