paulfitz / cosmicos

Sending the lambda calculus into deep space
https://cosmicos.github.io/
GNU General Public License v2.0
137 stars 8 forks source link

need real numbers #3

Open paulfitz opened 10 years ago

paulfitz commented 10 years ago

@aw1231 mentions need for reals here: https://github.com/paulfitz/cosmicos/pull/2#issuecomment-47473166.

alanfwilliams commented 10 years ago

Also, this is needed to facilitate division. I thought about introducing division that leads to whole numbers, however the "/" symbol is already used for creating multiple parentheses (See http://cosmicos.github.io/ Statistics and Structure) Any ideas?

paulfitz commented 10 years ago

Can you just use another symbol, like div? If that's unappealing, I could substitute some other syntax for the role / currently plays - the human-readable symbols are arbitrary in any case.

alanfwilliams commented 10 years ago

div works fine for me. Thanks.

paulfitz commented 10 years ago

@aw1231 I recently freed up the / symbol. So it is available for division if you need it now. Or div is still fine.

alanfwilliams commented 9 years ago

Hi, I'm starting work again on this. But when I run make I get

mypath/transform/cosmicos/Vocab.hx:7: characters 12-45 : Class not found : Map
paulfitz commented 9 years ago

hey @aw1231, what version of haxe are you using? What does haxe -version report?

alanfwilliams commented 9 years ago

haXe Compiler 2.07 - (c)2005-2011 Motion-Twin

alanfwilliams commented 9 years ago

Oh wait...I need at least 3. My bad.

alanfwilliams commented 9 years ago

Ok, now that I got a working build, I'm going to write my ideas about this. Real numbers need to be shown to be "the same" as the number system we currently have. For example:

x=0=0.0

Once that is established, I think it would be good to run it through the normal list of addition, subtraction, multiplication and division with equations that will result in non-decimal answers. Then on top of that, we can show how decimals work. Anything else I should add?

paulfitz commented 9 years ago

That sounds like a pretty good start @aw1231!

alanfwilliams commented 9 years ago

Do you think a new file is best for the source? Also, how exactly should I add a new "type" of number into the parsing system?

paulfitz commented 9 years ago

Wow my code needs documentation... I think you'd want to add Floats here https://github.com/paulfitz/cosmicos/blob/master/transform/cosmicos/Evaluate.hx#L28 and you'd want to add a case just before here https://github.com/paulfitz/cosmicos/blob/master/transform/cosmicos/Parse.hx#L145 that checks for a decimal and parses the string as a float if so.

alanfwilliams commented 9 years ago

Will do. Would opening a documentation issue sound ok?

alanfwilliams commented 9 years ago

Question: what style would you like the result to be in? Would 3.2 be ok as:

111.11

,using whatever symbol we decide a decimal to be. Addendum: What symbol should a decimal be?

paulfitz commented 9 years ago

+1 for a documentation issue. About how to represent a decimal: the easiest first step is to represent it in the message as something like (. v1 v2) where . is an imagined function that take two integer arguments and returns a float. I'd lean towards a significand/exponent representation https://en.wikipedia.org/wiki/Floating_point but haven't thought about it very deeply.

alanfwilliams commented 9 years ago

Here is my todo list as it stand right now:

Possible way to add it to the source:

I'm looking for a good book that describes things like these in a method similar to Euclid's Elements. Principia Mathematica by Whitehead and Russell looks like a good start. I think the best way to do this is to never have a number like 5.6 but rather always have it in exponent form.

alanfwilliams commented 9 years ago

Here is a question that I have that can go into the documentation: how do you code a new function/symbol for that function?

alanfwilliams commented 9 years ago

I think I got representing floats ok. I just don't know how to say . for saying . 3 3

alanfwilliams commented 8 years ago

Bump.

alanfwilliams commented 8 years ago

Some ideas were added to the wiki: https://github.com/paulfitz/cosmicos/wiki#real-numbers

paulfitz commented 8 years ago

sorry for neglecting this issue @aw1231. The lesson plan sketched in the wiki seems plausible to me. So a start could be introducing floating point division, which can be done without having a way to directly represent floats in the message.

alanfwilliams commented 8 years ago

Hey @paulfitz! Sorry for neglecting on my end as well. (College makes programming hard) I'm going to build some lines of the message, run them by you, and then program them. (frac ...) is first. It's been while since I read LINCOS so I'm planning on seeing if that's implemented there, and then I should have a good plan of attack.

dmkunsman commented 5 years ago

Is this still happening? If not, I would like to pick this up.

alanfwilliams commented 5 years ago

That would be fine by me.

paulfitz commented 5 years ago

I did in the end need real numbers for a section about pi and e, so I put something together https://cosmicos.github.io/message.html#section18. There's still plenty of scope for adding material here.