[Arjen Markus] (5 march 2009) Yesterday I spoke with [Kevin Kenny] and [Cameron Laird] about the possibilities of developing an application a la XPPAUT ([http://www.math.pitt.edu/~bard/xpp/xpp.html]). The idea is to use such packages as [Tclode] and [Plotchart] to solve systems of ordinary differential equations and plot the results. These equations should be definable in a very similar way as XPPAUT allows. The user-interface should be much more modern though. Anyway, here is a very first (or should I say zeroth) shot at something like that. I have called it "Bernoulli" in honour of those great 17th-century mathematicians, Johan, Jacob and Daniel. (it is also a bit of nostalgia for me, as some 15-20 years ago I developed a similar program, also called bernoulli). All it does now is present the graph of a function you define as an expression ... ---- ====== # bernoulli.tcl -- # Integrate systems of ordinary differential equations # #package require Tcl 8.5 package require Tk package require Plotchart # plotf -- # Convenience procedure to plot a function of one variable # # Arguments: # range Range over which to plot the function (x-axis) # expression Expression by which the function is defined # (independent variable: t) # proc plotf {range expression} { # Very simple for now: no parameters foreach {tmin tmax} $range {break} set nosteps 100 set tstep [expr {($tmax-$tmin)/double($nosteps)}] if { ![winfo exists .c] } { pack [canvas .c] } else { .c delete all } set tvalues {} set xvalues {} set xmin {} set xmax {} for {set i 0} {$i < $nosteps+1} {incr i} { set t [expr {$tmin + $i*$tstep}] set x [expr $expression] lappend tvalues $t lappend xvalues $x if { $xmin == {} || $x < $xmin } { set xmin $x } if { $xmax == {} || $x > $xmax } { set xmax $x } } set tscale [::Plotchart::determineScale $tmin $tmax] set xscale [::Plotchart::determineScale $xmin $xmax] set p [::Plotchart::createXYPlot .c $tscale $xscale] foreach t $tvalues x $xvalues { $p plot function $t $x } } # main -- # Test the stuff # plotf {0 10} {exp(-$t)*cos(2.0*$t)} after 3000 { plotf {0.0001 100} {sin($t)/$t} ;# Avoid t=0 of course } ====== ---- !!!!!! %| [Category Mathematics] |% !!!!!!