Visualizing Thomas Attractor

Been trying to recreate popular attractors like Lorenz, Thomas and Halvorsen. I have successfully recreated Lorenz, but occasionally some of the parts that are following the attractor’s trajectory simply fly away into infinity but I have managed to constrain the parameters to prevent it from flying too far away.
After making the lorenz attractor I attempted the Thomas attractor and can’t get it to work, same with the Halvorsen attractor.

local runService = game:GetService("RunService")
local part = game:GetService("ReplicatedStorage").Part
local x,y,z =part.Position.X,part.Position.Y,part.Position.Z
local minChange = 1
local maxChange = 1
local posMinChange = 1
local posMaxChange = 1
local GlobalA =	1.4
local GlobalB = 0.208186
local GlobalC = (8/3) * 0.5

local constants = {}

for count = 1,2 do
	local clone = part:Clone()
	clone.Name = count
	clone.Parent = workspace.Attractors
	clone.Position = Vector3.new(math.random(posMinChange,posMaxChange),math.random(posMinChange,posMaxChange),math.random(posMinChange,posMaxChange))
	constants[count] = {a = GlobalA + math.random(minChange,maxChange), b = GlobalB + math.random(minChange,maxChange), c = GlobalC}
end

print(constants)
function lorenzStep(dt, a, b, c, v)
	local x = v.X
	local y = v.Y
	local z = v.Z
	local dx = (a * (y-x)) * dt
	local dy = (x * (b - z) - y) * dt
	local dz = (x * y - c * z) * dt
	x = x + dx 
	y = y + dy 
	z = z + dz 
	return x,y,z
end


function thomasStep(dt, a, b, c, v)
	local x = v.X
	local y = v.Y
	local z = v.Z
	local dx = math.sin(y)-b*x * dt
	local dy = math.sin(z)-b*y * dt
	local dz = math.sin(x)-b*z * dt
	x = x + dx 
	y = y + dy 
	z = z + dz 
	return x,y,z
end

function halvorsenStep(dt, a, b, c, v)
	local x = v.X
	local y = v.Y
	local z = v.Z
	local dx = -a*x-4*y-4*z-y^2 * dt
	local dy = -a*y-4*z-4*x-z^2 * dt
	local dz = -a*z-4*x-4*y-x^2 * dt
	x = x + dx 
	y = y + dy 
	z = z + dz 
	return x,y,z
end



runService.Heartbeat:Connect(function(dt)
	for i,v in ipairs(workspace.Attractors:GetChildren()) do
		local a = constants[i]["a"]

		local b = constants[i]["b"]

		local c = constants[i]["c"]

		local x,y,z = halvorsenStep(dt,a,b,c, v.Position)
		
		game.Workspace.Attractors[v.Name].Position = Vector3.new(x,y,z)
	end
	
end)

Here is the working Lorenz attractor, to get it to work with my code set the following variables

GlobalA = 10 * 0.5
GlobalB = 28 * 0.5
GlobalC = (8/3) * 0.5

Lorenz:

Thomas:


Attractors.rbxl (34.6 KB)

It sort of looks like you just need parentheses around your terms:

local dx = (math.sin(y)-b*x) * dt
local dy = (math.sin(z)-b*y) * dt
local dz = (math.sin(x)-b*z) * dt

Same issue with halvorsen

Cant believe I missed such a stupid mistake, thanks a ton.