Skip to content

Commit

Permalink
feat: ✨ Add Lu Chen attractor
Browse files Browse the repository at this point in the history
  • Loading branch information
TeddyHuang-00 committed Feb 14, 2024
1 parent d2a2c11 commit ae1c185
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ A web application for visualizing strange attractors using TresJS.
\dot{z} &= \sin(x) - \beta z \\
\end{aligned}
$$
- [ ] Aizawa Attractor ($\alpha = 0.095, \beta = 0.7, \gamma = 0.65, \delta = 3.5, \varepsilon = 0.1$)
- [x] Lu Chen Attractor ($\alpha = 36, \beta = 3, \gamma = 20, \upsilon = -15.15$)
$$
\begin{aligned}
\dot{x} &= (z - \beta)x - \delta y \\
\dot{y} &= \delta x + (z - \beta)y \\
\dot{z} &= \gamma + \alpha z - \frac{z^3}{3} + \varepsilon z x^3 \\
\dot{x} &= \alpha(y - x) \\
\dot{y} &= x(1 - z) + \gamma y + \upsilon \\
\dot{z} &= x y - \beta z \\
\end{aligned}
$$

Expand Down
4 changes: 4 additions & 0 deletions components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ const attractors: { value: nameAttractor; label: string }[] = [
value: "thomas",
label: "Thomas",
},
{
value: "luchen",
label: "Lu Chen",
},
];
const selectedAttractor = useState(
"choiceAttractor",
Expand Down
15 changes: 15 additions & 0 deletions utils/AttractorFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export function getAttractor(name: nameAttractor): Attractor {
return rosslerAttractor();
case "thomas":
return thomasAttractor();
case "luchen":
return luChenAttractor();
default:
return lorenzAttractor();
}
Expand Down Expand Up @@ -40,3 +42,16 @@ function thomasAttractor(beta: number = 0.208186): Attractor {
-beta * z + Math.sin(x),
];
}

function luChenAttractor(
a: number = 36,
b: number = 3,
c: number = 20,
u: number = -15.15,
): Attractor {
return ([x, y, z]: Vec3D) => [
a * (y - x),
(1 - z) * x + c * y + u,
x * y - b * z,
];
}
2 changes: 1 addition & 1 deletion utils/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export type Vec3D = [number, number, number];
export type Attractor = (x: Vec3D) => Vec3D;
export type nameAttractor = "lorenz" | "rossler" | "thomas";
export type nameAttractor = "lorenz" | "rossler" | "thomas" | "luchen";

0 comments on commit ae1c185

Please sign in to comment.