# mayation_

## Lorenz attractor

Posted in MEL script by A. Benjasem on September 3, 2009

Parametric forms are created using mathematical formulas. Those formulas could be as simple as x + y = 22, or they could be generated from complex mathematical systems that have already been set by scientists and mathematicians. In this post, we’re exploring a system initiated by Edward Lorenz who was studying the movement and behavior of gaseous systems. He came up with the following formula that can be used to draw and trace the path of the gas molecules.

dx = delta * (y – x)

dy = r * x – y – x * z

dz = x * y - beta * z global proc Lorenz() {
\$iterations = 2000;
float \$x = 1.0;
float \$y = 1.0;
float \$z = 1.0;
float \$newdx;
float \$newdy;
float \$newdz;
int \$i = 0;
curve -n Lorenz -d 3 -p \$x \$y \$z;
do {
\$newdx = dx(\$x, \$y, \$z);
\$newdy = dy(\$x, \$y, \$z);
\$newdz = dz(\$x, \$y, \$z);
\$x = \$x + (0.01 * \$newdx);
\$y = \$y + (0.01 * \$newdy);
\$z = \$z + (0.01 * \$newdz);
curve -a -p \$x \$y \$z Lorenz;
\$i++;
} while (\$i < \$iterations);
}
global proc float dx(float \$x, float \$y, float \$z) {
float \$delta = 11.0;
return \$delta * (\$y – \$x);
}
global proc float dy(float \$x, float \$y, float \$z){
float \$r = 50.0;
return -1 * \$x * \$z + \$r * \$x – \$y;
}

global proc float dz(float \$x, float \$y, float \$z){
float \$beta = 4.0;
return \$x * \$y – \$beta * \$z;
}