Version 1 of mathemaTcl

Updated 2017-02-10 21:17:21 by dkf

Arjen Markus (10 february 2017) MathemaTcl is the name I chose for a collection of mathematical libraries (mostly from Netlib) that can be accessed from Tcl.

You can find the code here: [L1 ].

To build it (or parts of it) you need a C and possibly a Fortran compiler that can build extensions for your version of Tcl.

More to follow, just a placeholder for the moment.


Demo

# demo_fftpack.tcl --
#     Demonstration of the FFTPACK wrapper
#
#     Note: the transform is not normalised, hence the factor "size"
#
package require tcl_fftpack

set size 101

set transform [::fftpack::createTransform1D $size]

set PI [expr {acos(-1.0)}]

for {set i 0} {$i < $size} {incr i} {
    lappend values [expr {0.4+cos(2.0*$PI*$i/100.0)+sin(4.0*$PI*$i/100.0)}]
}

set oldvalues $values

set transformed [$transform forward $values]

puts "Transform:"
for {set i 0} {$i < $size/2+1} {incr i} {
    puts [format "%12.4f %12.4f" [lindex $transformed $i 0] [lindex $transformed $i 1]]
}

set reconstructed [$transform backward $transformed]

puts "Reconstructed and old values (unnormalised):"
for {set i 0} {$i < $size} {incr i} {
    puts [format "%12.4f %12.4f" [lindex $reconstructed $i] [expr {$size*[lindex $oldvalues $i]}]]
}