Ideas and Docs

From: Squeak <>
Date: Sat, 8 May 1999 18:49:29 -0400 (EDT)

On Sat, 8 May 1999, George wrote:

> [CC'd the list to get some discussion there going]


What's docbook? :)

> the thing into proper DocBook and making it more readable. Maybe someone on
> the list wants to get the ball rolling on that. I'd probably be much more
> persuaded to write new docs if it was all nicely converted to docbook :)

> > Is there any help on writing extra builtin functions? (For speed).

> BTW: What do you mean by "For speed"?

I presume I could write c code that would do some things faster than gel
could, it being interpretted. Perhaps calculating the exponential function
on a matrix (power series of square matrices) might be an example.
Finding the first prime larger than n might be another one. In each there
are lots of known repeated steps on known good values that might be easier
to do with more powerful data structures, or simply faster due to the lack
of sanity checking or interpretation. Also adding bitwise and modular
operators might be nice.

You don't have modular division (difficult to do, 1/d mod n requires
gcd(d,n) =1), and you probably don't optimize (a ^ b) % c by repeated
square and take remainder method. I'd just do those as functions
add_mod(a,b,c) mul_mod(ab,c) exp_mod(a,b,c) etc.

Bitwise functions would definately be faster in C than in gel, due to c's
bitwise operators already existing (along with gmp's).

> Also note that passing matrices by value is actually a tiny bit faster then
> passing them by reference.

I was still learning how variables (local versus global) worked in gel, so
instead of returning values from functions I had them modify a matrix
passed to it.

Copy on write is very very good.

I had to hand in the program to someone who doesn't and won't learn to
write gel, so I figured the ; made the code easier to read.

";" at the end of a function declaration prevents echo'ing the function.
That might be nice to note in th README (if its not).

> > How bout symbolic math? maybe just scalar variables? I'd love to be able
> > to watch a variables propagation thru all these matrix operations. Dunno
> > if that'd be doable, probably would slow things down alot, but hey I can
> > always dream.
> Symbolic math is definately something that I want to add in the long run,
> though something that I'll probably need someone else to help me in that
> arena.

I have some ideas, but I'll wait a week until I finish reading your code
(and my exams) so I can make my ideas at least sound doable to me :)

> The idea so far would be this. You would write your expression and preceed it
> with a keyword "symbolic". Then the calculator would go in, and do it's work
> as a symbolic calculator.
> The problems here is, When should the symbolic evaluation engine enter a user
> function and when should it treat it as an entity.

Definately changeable at runtime. symboleval(function) sets some flag in
that functions structure that indicates to enter it.

I would for instance love my matrices to say sqrt(2) rather than 1.414...
but I would also eventually want to see the actual numbers.

Of course simplification would be the biggest deal after you got it
working. Noone wants to see "1*f(x) + sin(pi/2) - sqrt(2)/2*sqrt(2) -f(x)"
instead of "0".

Received on Sat May 08 1999 - 15:26:18 CDT

This archive was generated by hypermail 2.2.0 : Sun Apr 17 2011 - 21:00:02 CDT