%%% ************************************************************* %%% Copyright (C) 2004-2005 Torsten Anders (t.anders@qub.ac.uk) %%% This program is free software; you can redistribute it and/or %%% modify it under the terms of the GNU General Public License %%% as published by the Free Software Foundation; either version 2 %%% of the License, or (at your option) any later version. %%% This program is distributed in the hope that it will be useful, %%% but WITHOUT ANY WARRANTY; without even the implied warranty of %%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %%% GNU General Public License for more details. %%% ************************************************************* /** %% This functor defines means to specify lists of floats. Fenv stands for 'function envelopes': the idea is to define envelopes by numeric functions. %% %% NB: this functor is a stub. Extensions to transform and combine numerical functions as well as means to plot them are planned (see my func-env and plot Lisp packages). %% */ functor import LUtils at 'x-ozlib://anders/strasheela/ListUtils.ozf' export SampleFun SampleFun01 MakeConstantFun Scale ScaleFun ScaleFun01 % ScaleList FullSinoid HalveSinoid Triangle define %% %% 'outputting' functions: sampling into lists %% /** %% SampleFun samples the unary numerical function Fn. SampleFun returns a list of length N with the y-values of Fn for the N evenly spaced x-values in the interval [Min, Max]. Fn expects and returns a float, N is an integer, Min and Max are Floats %% */ fun {SampleFun Fn N Min Max} %% this for loop buggy: length of list returned by Fenv.sampleFun for some even Ns to small -- typical float-precision problem % StepSize = (Max-Min) / {IntToFloat N-1} % in % for I in (Min; I=