Annotation of OpenXM/src/cfep/tests/lorentz.rr, Revision 1.1
1.1 ! takayama 1: import("glib");
! 2:
! 3: def lorentz() {
! 4: glib_window(-25,-25,25,25);
! 5: A=10; B=20; C=2.66;
! 6: P1=0; P2 = 3; P3 = 0;
! 7: Dt = 0.004; T = 0;
! 8: while (T <50) {
! 9: Q1=P1+Dt*(-A*P1+A*P2);
! 10: Q2=P2+Dt*(-P1*P3+B*P1-P2);
! 11: Q3=P3+Dt*(P1*P2-C*P3);
! 12: glib_putpixel(Q1,Q2); glib_flush();
! 13: T=T+Dt;
! 14: P1=Q1; P2=Q2; P3=Q3;
! 15: }
! 16: }
! 17:
! 18: /* glib_clear(); glib_flush(); */
! 19:
! 20: /* こちらは軌跡ではなく, 点が移動する. wait をいれてなくてもいいのが
! 21: 遅い. もうすこし早くできるといいが... */
! 22: def lorentz2() {
! 23: glib_window(-25,-25,25,25);
! 24: glib_clear();
! 25: glib_line(0,0,25,0 | color=0x0000ff);
! 26: glib_line(0,0,0,25 | color=0x0000ff);
! 27: glib_set_pixel_size(4.0);
! 28: A=10; B=20; C=2.66;
! 29: P1=0; P2 = 3; P3 = 0;
! 30: Dt = 0.004; T = 0;
! 31: glib_flush(); glib_flush(); /* two dummy */
! 32: while (T <50) {
! 33: glib_remove_last(); glib_remove_last();
! 34: Q1=P1+Dt*(-A*P1+A*P2);
! 35: Q2=P2+Dt*(-P1*P3+B*P1-P2);
! 36: Q3=P3+Dt*(P1*P2-C*P3);
! 37: glib_putpixel(Q1,Q2 | color=0xff0000); glib_flush();
! 38: T=T+Dt;
! 39: P1=Q1; P2=Q2; P3=Q3;
! 40: }
! 41: }
! 42:
! 43: end$
! 44:
! 45:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>