#!/bin/sh # Beispiel für ::math::calculus und Plotchart \ exec wish $0 $@ package require  math::calculus # Zustandsvektor xvec enthält x und x' (v) set xvec  {0.0  0.0} set t      0.0 set tstep  0.25 set steps  200 set abzisse   {} set xordinate {} set vordinate {} proc schwinger {t xvec} {   set x  [lindex $xvec 0]   set x1 [lindex $xvec 1]   return [list $x1 [expr {-0.2*$x1 - $x + 0.1*cos($t)}]] } # Schritte mit Euler berechnen for {set i 0} {$i < $steps} {incr i} {   set result [::math::calculus::rungeKuttaStep \     $t $tstep $xvec schwinger]   lappend abzisse $t   lappend xordinate [lindex $result 0]   lappend vordinate [lindex $result 1]   set t     [expr {$t+$tstep}]   set xvec  $result } # # Ausgabe mit Plotchart # package require Plotchart canvas .c -background white -width 400 -height 200 pack   .c -fill both set xyDia [::Plotchart::createXYPlot .c \   {0.0 50 10} {-1.5 1.5 0.5}] $xyDia dataconfig v -colour  "red" for {set i 0} {$i < [llength $abzisse]} {incr i } {   $xyDia plot x [lindex $abzisse $i] [lindex $xordinate $i]   $xyDia plot v [lindex $abzisse $i] [lindex $vordinate $i] }