I have been experimenting with writing a few little programs to perform numerical integration, in which I have been running into difficulties. I can do all the operations I need from the command line, but I run into problems when I try to bundle those commands into a program.
As a simple example, suppose I wanted a program to implement the two-point Gaussian rule, which approximates the integral of f(x) between -1 and 1 by f(-1/sqrt(3))+f(1/sqrt(3)).
On an interval other than [-1,1], we need a scaling transformation. So I might have a file called "gauss2.input" which contains one function:
gauss2(f,a,b)==
xs:LIST Float := [-1/sqrt(3),1/sqrt(3)]
g := (x:Float):Float +-> f((b-a)/2*x+(b+a)/2)
int2 := (b-a)/2*(g(xs.1) + g(xs.2))
return(int2)
However, the system clams up on the use of the scaling function g(x), and this gives no results.
I have two questions here: first, how do I get round this? and second, if I'm writing programs, should I be writing them in Aldor (that's the language of ".input" files, isn't it?), or SPAD?
For that matter, how do all the languages Aldor, SPAD, Lisp, Boot link up - which is used for which purpose, and why?
Thanks,
Alasdair