cosmicos icon indicating copy to clipboard operation
cosmicos copied to clipboard

need real numbers

Open paulfitz opened this issue 11 years ago • 25 comments

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

paulfitz avatar Jun 30 '14 03:06 paulfitz

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?

alanfwilliams avatar Jul 08 '14 18:07 alanfwilliams

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.

paulfitz avatar Jul 08 '14 19:07 paulfitz

div works fine for me. Thanks.

alanfwilliams avatar Jul 08 '14 19:07 alanfwilliams

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

paulfitz avatar Aug 30 '14 01:08 paulfitz

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

alanfwilliams avatar Sep 30 '15 00:09 alanfwilliams

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

paulfitz avatar Oct 03 '15 20:10 paulfitz

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

alanfwilliams avatar Oct 05 '15 16:10 alanfwilliams

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

alanfwilliams avatar Oct 05 '15 16:10 alanfwilliams

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?

alanfwilliams avatar Oct 05 '15 21:10 alanfwilliams

That sounds like a pretty good start @aw1231!

paulfitz avatar Oct 11 '15 21:10 paulfitz

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?

alanfwilliams avatar Nov 12 '15 00:11 alanfwilliams

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.

paulfitz avatar Nov 12 '15 04:11 paulfitz

Will do. Would opening a documentation issue sound ok?

alanfwilliams avatar Nov 18 '15 19:11 alanfwilliams

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?

alanfwilliams avatar Nov 18 '15 20:11 alanfwilliams

+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.

paulfitz avatar Nov 19 '15 03:11 paulfitz

Here is my todo list as it stand right now:

  • add exponent function
  • add negative numbers

Possible way to add it to the source:

  • addition (existing)
  • subtraction (existing)
  • negative
  • multiplication (existing)
  • exponent

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 avatar Nov 19 '15 14:11 alanfwilliams

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 avatar Nov 30 '15 17:11 alanfwilliams

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

alanfwilliams avatar Nov 30 '15 17:11 alanfwilliams

Bump.

alanfwilliams avatar Jan 28 '16 19:01 alanfwilliams

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

alanfwilliams avatar Jul 01 '16 17:07 alanfwilliams

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.

paulfitz avatar Aug 23 '16 13:08 paulfitz

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.

alanfwilliams avatar Sep 29 '16 21:09 alanfwilliams

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

dmkunsman avatar Feb 14 '19 22:02 dmkunsman

That would be fine by me.

alanfwilliams avatar Feb 14 '19 22:02 alanfwilliams

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.

paulfitz avatar Oct 05 '19 18:10 paulfitz