[suby-talk] Symbolic Logic

TRANS transfire at gmail.com
Tue Oct 4 17:45:18 EDT 2005

```On 10/4/05, Peter Vanbroekhoven <calamitas at advalvas.be> wrote:
> On Sun, 25 Sep 2005, TRANS wrote:
>
> > Only that !, &&, || are not definable methods, but ~, &, | and ^ are.
>
> Ah, right. Something we should correct in Suby? It does not help for
> Nano/Mega, although I hope you will have a version of Nana and Mega that
> will make use of Suby's features! Well, some day :-)

If we can. I plan to port the choice parts of Nano/Mega to Suby. And I
hope to start doing some work on Suby here in a few weeks or so.

> >>>> This could possibly be extended to polynomial things, so "5 *
> >>>> :x * :y" would work too.
> >>>
> >>> Interesting. Hadn't though of that. Symbol could be Symbolic Formula?
> >>> Well, we do call it Symbolic Logic after all :-)
> >>
> >> Yup. So, another addition to Mega? I wouldn't mind trying to implement all
> >> this you know.
> >
> > Sure thing! That'd be great! In fact w/ your Prolog background I
> > imagine this is your cup of tea.
>
> Er... It does not have that much to do with Prolog. But it is my cup of
> tea.

Right. I just ment logic oriented.

> Actually I'll probably need this for the precision stuff. I have part of
> the implementation. For example I could do this:
>
>    1.to(5) # => a value with 3.0 as best guess ((1.0 + 5.0) / 2.0),
>            #    1.0 as minimum value and 5.0 as maximum value.
>            #    #to_s gives: 3.0 (1.0..5.0)
>    3.pm(2) # => same thing
>    3.pm(5) * 3.pm(5) # => 9.0 (-16.0..64.0)
>
> However what I have is not entirely accurate. For example
>
>    a = 3.pm(5) # => 3.0 (-2.0..8.0)
>    a * a # => 9.0 (-16.0..64.0)
>
> Note that a * a, or a squared, can never be negative. Yet my library says
> so because it sees both a's as separate values. They are not though, and
> it is not that easy to do this right in general. Hence I need to track
> the history of operations as a symbolic expression. Which is where the
> symbolic stuff comes in.

Cool. It will be interesting to see how this pans out. BTW I just
leraned an interesting knew method today:

Symbol.all_symbols

(There's a lot of em!)

T.

```