how to obtain and export data



On 3/20/07, Robert Dodier <robert.dodier at gmail.com> wrote:
> expr : exp(x) + sin(x); /* or whatever */
> xx : makelist (i/10.0, i, 0, 100);
> yy : map (lambda ([x], ev (expr)), xx);
> M : transpose (matrix (xx, yy));
> load (numericalio);
> write_data (M, "/tmp/foo.data");
>
> makelist and map replace the for-loop, and the matrix replaces the array.
> These are somewhat subtle points and probably it works OK either way.
> Doubtless there are still other workable variations.

Or perhaps just

    expr: ***
    load(numericalio)$
    write_data( makelist( [x, ev(expr)] , x, makelist(i/10.0,i,0,100))
, **filename** )$

You could use ''expr instead of ev(expr), but that is perhaps harder to explain.

            -s