Error processing request
Parameters
CONTENT_LENGTH | 0 |
REQUEST_METHOD | GET |
REQUEST_URI | /revision/Bernoulli?V=5 |
QUERY_STRING | V=5 |
CONTENT_TYPE | |
DOCUMENT_URI | /revision/Bernoulli |
DOCUMENT_ROOT | /var/www/nikit/nikit/nginx/../docroot |
SCGI | 1 |
SERVER_PROTOCOL | HTTP/1.1 |
REMOTE_ADDR | 172.69.59.80 |
REMOTE_PORT | 11064 |
SERVER_PORT | 8888 |
SERVER_NAME | wiki.tcl-lang.org |
HTTP_HOST | wiki.tcl-lang.org |
HTTP_CONNECTION | Keep-Alive |
HTTP_ACCEPT_ENCODING | gzip |
HTTP_X_FORWARDED_FOR | 18.227.46.229 |
HTTP_CF_RAY | 888fc8920da01044-ORD |
HTTP_X_FORWARDED_PROTO | http |
HTTP_CF_VISITOR | {"scheme":"http"} |
HTTP_ACCEPT | */* |
HTTP_USER_AGENT | Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected]) |
HTTP_CF_CONNECTING_IP | 18.227.46.229 |
HTTP_CDN_LOOP | cloudflare |
HTTP_CF_IPCOUNTRY | US |
Body
Error
Unknow state transition: LINE -> END
-code
1
-level
0
-errorstack
INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit Bernoulli {[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 (second) 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).
The version below defines a number of commands and can actually integrate systems of ODEs using the
Tclode extension. No neat user-interface yet, just the basics. See the example at the end for how to
use the commands. (The plotnow command simply plots one variable as function of the other after a
computation has been done. Each time a new plot is created)
----
======
Where is tclode extension? [GWM] There is no other page referring to this extension (yet).
I have had the temerity to make my own version using the math::calculus to solve a system of ODEs [Bernoulli using math::calculus]
======
# bernoulli.tcl --
# Integrate systems of ordinary differential equations
#
package require Tk
package require Plotchart
if {0} {
set dir tclode1.0
source $dir/pkgIndex.tcl
}
package require Tclode
# namespaces --
# Create a number of private namespaces
#
namespace eval ::time {
variable steps 100
variable tmin 0.0
variable tmax 1.0
variable statevars {t}
}
namespace eval ::series {}
namespace eval ::init {}
namespace eval ::deriv {}
# 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)
#
# Result:
# None
#
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
}
}
# plotnow --
# Convenience procedure to plot one variable as function of the other
#
# Arguments:
# xvar Variable on the x-axis
# yvar Variable on the y-axis
#
# Result:
# None
#
proc plotnow {xvar yvar} {
if { ![winfo exists .c] } {
pack [canvas .c]
} else {
.c delete all
}
set xvalues [set ::series::$xvar]
set yvalues [set ::series::$yvar]
set xmin {}
set xmax {}
set ymin {}
set ymax {}
foreach x $xvalues y $yvalues {
if { $xmin == {} || $x < $xmin } {
set xmin $x
}
if { $xmax == {} || $x > $xmax } {
set xmax $x
}
if { $ymin == {} || $y < $ymin } {
set ymin $y
}
if { $ymax == {} || $y > $ymax } {
set ymax $y
}
}
set xscale [::Plotchart::determineScale $xmin $xmax]
set yscale [::Plotchart::determineScale $ymin $ymax]
set p [::Plotchart::createXYPlot .c $xscale $yscale]
foreach x $xvalues y $yvalues {
$p plot function $x $y
}
}
# timeframe --
# Define the time frame for the next computation
#
# Arguments:
# tmin Minimum time
# tmax Maximum time
#
# Result:
# None
#
proc timeframe {tmin tmax} {
set time::tmin $tmin
set time::tmax $tmax
}
# init --
# Define the initial value of a variable
#
# Arguments:
# varname Name of the (state) variable
# value Initial value
#
# Result:
# None
#
proc init {varname value} {
set init::$varname $value
}
# deriv --
# Register the expression that determines the derivative
#
# Arguments:
# varname Name of the (state) variable
# expression Expression to be used
#
# Result:
# None
#
proc deriv {varname expression} {
if { [lsearch $::time::statevars $varname] < 0 } {
lappend ::time::statevars $varname
}
set deriv::$varname $expression
}
# go --
# Do the computation
#
# Arguments:
# None
#
# Result:
# None
#
proc go {} {
#
# Time administration and initial values
#
set t $::time::tmin
set ::time::dt [expr {($::time::tmax-$t)/double($::time::steps)}]
set args {}
foreach v [lrange $::time::statevars 1 end] {
lappend args $v [set ::deriv::$v]
set $v [set ::init::$v]
}
#
# Construct the ODE solver
#
set ::time::solver [::tclode::odesolv -atol 1.0e-6 -rtol 1.0e-6 $args]
#
# Run the computation
#
$::time::solver run $t
for {set ::time::i 0} {$::time::i <= $::time::steps} {incr ::time::i} {
set ::time::tnext [expr {$::time::tmin + $::time::dt * $::time::i}]
$::time::solver continue $::time::tnext
foreach v $::time::statevars {
lappend ::series::$v [set $v]
}
}
}
# 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
#}
init s 0.0
init c 1.0
init x 0.0
deriv s {$c}
deriv c {-$s}
deriv x {1}
timeframe 0.0 10.0
go
catch {
console show
}
foreach t $::series::t s $::series::s c $::series::c x $::series::x {
puts [format "%10.4f %10.4f %10.4f %10.4f" $t $s $c $x]
}
plotnow t c
======
----
!!!!!!
%| [Category Mathematics] |%
!!!!!!} regexp2} CALL {my render Bernoulli {[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 (second) 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).
The version below defines a number of commands and can actually integrate systems of ODEs using the
Tclode extension. No neat user-interface yet, just the basics. See the example at the end for how to
use the commands. (The plotnow command simply plots one variable as function of the other after a
computation has been done. Each time a new plot is created)
----
======
Where is tclode extension? [GWM] There is no other page referring to this extension (yet).
I have had the temerity to make my own version using the math::calculus to solve a system of ODEs [Bernoulli using math::calculus]
======
# bernoulli.tcl --
# Integrate systems of ordinary differential equations
#
package require Tk
package require Plotchart
if {0} {
set dir tclode1.0
source $dir/pkgIndex.tcl
}
package require Tclode
# namespaces --
# Create a number of private namespaces
#
namespace eval ::time {
variable steps 100
variable tmin 0.0
variable tmax 1.0
variable statevars {t}
}
namespace eval ::series {}
namespace eval ::init {}
namespace eval ::deriv {}
# 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)
#
# Result:
# None
#
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
}
}
# plotnow --
# Convenience procedure to plot one variable as function of the other
#
# Arguments:
# xvar Variable on the x-axis
# yvar Variable on the y-axis
#
# Result:
# None
#
proc plotnow {xvar yvar} {
if { ![winfo exists .c] } {
pack [canvas .c]
} else {
.c delete all
}
set xvalues [set ::series::$xvar]
set yvalues [set ::series::$yvar]
set xmin {}
set xmax {}
set ymin {}
set ymax {}
foreach x $xvalues y $yvalues {
if { $xmin == {} || $x < $xmin } {
set xmin $x
}
if { $xmax == {} || $x > $xmax } {
set xmax $x
}
if { $ymin == {} || $y < $ymin } {
set ymin $y
}
if { $ymax == {} || $y > $ymax } {
set ymax $y
}
}
set xscale [::Plotchart::determineScale $xmin $xmax]
set yscale [::Plotchart::determineScale $ymin $ymax]
set p [::Plotchart::createXYPlot .c $xscale $yscale]
foreach x $xvalues y $yvalues {
$p plot function $x $y
}
}
# timeframe --
# Define the time frame for the next computation
#
# Arguments:
# tmin Minimum time
# tmax Maximum time
#
# Result:
# None
#
proc timeframe {tmin tmax} {
set time::tmin $tmin
set time::tmax $tmax
}
# init --
# Define the initial value of a variable
#
# Arguments:
# varname Name of the (state) variable
# value Initial value
#
# Result:
# None
#
proc init {varname value} {
set init::$varname $value
}
# deriv --
# Register the expression that determines the derivative
#
# Arguments:
# varname Name of the (state) variable
# expression Expression to be used
#
# Result:
# None
#
proc deriv {varname expression} {
if { [lsearch $::time::statevars $varname] < 0 } {
lappend ::time::statevars $varname
}
set deriv::$varname $expression
}
# go --
# Do the computation
#
# Arguments:
# None
#
# Result:
# None
#
proc go {} {
#
# Time administration and initial values
#
set t $::time::tmin
set ::time::dt [expr {($::time::tmax-$t)/double($::time::steps)}]
set args {}
foreach v [lrange $::time::statevars 1 end] {
lappend args $v [set ::deriv::$v]
set $v [set ::init::$v]
}
#
# Construct the ODE solver
#
set ::time::solver [::tclode::odesolv -atol 1.0e-6 -rtol 1.0e-6 $args]
#
# Run the computation
#
$::time::solver run $t
for {set ::time::i 0} {$::time::i <= $::time::steps} {incr ::time::i} {
set ::time::tnext [expr {$::time::tmin + $::time::dt * $::time::i}]
$::time::solver continue $::time::tnext
foreach v $::time::statevars {
lappend ::series::$v [set $v]
}
}
}
# 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
#}
init s 0.0
init c 1.0
init x 0.0
deriv s {$c}
deriv c {-$s}
deriv x {1}
timeframe 0.0 10.0
go
catch {
console show
}
foreach t $::series::t s $::series::s c $::series::c x $::series::x {
puts [format "%10.4f %10.4f %10.4f %10.4f" $t $s $c $x]
}
plotnow t c
======
----
!!!!!!
%| [Category Mathematics] |%
!!!!!!}} CALL {my revision Bernoulli} CALL {::oo::Obj2533250 process revision/Bernoulli} CALL {::oo::Obj2533248 process}
-errorcode
NONE
-errorinfo
Unknow state transition: LINE -> END
while executing
"error $msg"
(class "::Wiki" method "render_wikit" line 6)
invoked from within
"my render_$default_markup $N $C $mkup_rendering_engine"
(class "::Wiki" method "render" line 8)
invoked from within
"my render $name $C"
(class "::Wiki" method "revision" line 31)
invoked from within
"my revision $page"
(class "::Wiki" method "process" line 56)
invoked from within
"$server process [string trim $uri /]"
-errorline
4