ALine 16 Posted January 8 So I was sitting there on my thinking chair, metaphorically, and I was thinkin to my self. if you could represent 1*3 = 3 as 1+1+1 = 3 then could you represent 1-1-1 with a symbol just as how 1+1+1 has the * symbol? ex usage of the concept: 1|1 = 1-1 1|4 = 1-1-1-1 or 4 2|6 = 2-2-2-2-2-2 or 6-6 in contrast to 1x1 = 1 1x4 = 1+1+1+1 or 4 2x6 = 2+2+2+2+2+2 or 6+6 0 Share this post Link to post Share on other sites

uncool 224 Posted January 8 1) Wouldn't 1-1 be 1|2? 2) What do you mean by 1-1-1-1? Is the dash meant to be a minus sign? 1 Share this post Link to post Share on other sites

Eise 409 Posted January 8 Seems to me you are at the brink of an important discovery, namely that of division. First, I would plead to write 1 + 1 + 1 as 3 * 1, not as 1 * 3. In words: add 1 3 times. So where 2 * 3 and 3 * 2 have the same result, the operations are slightly different: 2 * 3 means 3 + 3, and 3 * 2 means 2 + 2 + 2. It is a mathematical proof that these different meanings always lead to the same result. Now the opposite question is: how many 1s do you need if you want to reach 0? So take 3, and count how many 1s you can subtract until you get at 0: 3 -1 -1 -1 = 0. count the 1s: there are 3 of them. This works for all natural numbers. As you see yourself, your '|' operator leads to ambiguous results: 1|4 = 1 -1 -1 -1 = -3, or 4. Who would need such an operator? 0 Share this post Link to post Share on other sites

studiot 1803 Posted January 8 9 hours ago, ALine said: So I was sitting there on my thinking chair, metaphorically, and I was thinkin to my self. if you could represent 1*3 = 3 as 1+1+1 = 3 then could you represent 1-1-1 with a symbol just as how 1+1+1 has the * symbol? ex usage of the concept: 2 hours ago, Eise said: Seems to me you are at the brink of an important discovery, namely that of division. First, I would plead to write 1 + 1 + 1 as 3 * 1, not as 1 * 3. In words: add 1 3 times. So where 2 * 3 and 3 * 2 have the same result, the operations are slightly different: 2 * 3 means 3 + 3, and 3 * 2 means 2 + 2 + 2. It is a mathematical proof that these different meanings always lead to the same result. Now the opposite question is: how many 1s do you need if you want to reach 0? So take 3, and count how many 1s you can subtract until you get at 0: 3 -1 -1 -1 = 0. count the 1s: there are 3 of them. This works for all natural numbers. As you see yourself, your '|' operator leads to ambiguous results: 1|4 = 1 -1 -1 -1 = -3, or 4. Who would need such an operator? I am suprised no-one has mentioned fractional quantities (since division itself was mentioned). This is the standard bugbear of the view of multiplication as repeated addition and division as repeated subtraction. This issue has at least partly been addressed in mathematics by the 'shift operator' which allows one to move forwards or backwards along a table of values (integer or fractional) one entry at a time. Unfortunately I could quickly find a simple reference, Wikipedia launches straight into higher maths in this instance, but the technique has been used for years in numerical methods, quantum mechanics and many other situations. 0 Share this post Link to post Share on other sites

Sensei 922 Posted January 8 (edited) The simplest brute-force dividing algorithm in C/C++ would look like: int quotient = 0; while( dividend >= divisor ) { dividend -= divisor; quotient++; } int reminder = dividend; // subtraction failed "subtract divisor from dividend until dividend is greater than or equal to divisor". The number of repetitions on the loop will be O(quotient) The more sophisticated version could left-shift divisor prior subtraction from dividend. Each binary left-shift operation is multiplication by 2. At the same time value added to quotient should be multiplied by 2. (In binary numeral system left-shift is equivalent of multiplication by 2, move the all bits one position to the left and make room for 0 at the end for the least significant bit) So e.g. division of 1000 by 50 will look like: temporary_quotient = 1; 1000 > 50 (true) 50*2 = 100, temporary_quotient*2 =2 1000 > 100 (true) 100*2=200, temporary_quotient*2=4 1000>200 (true) 200*2=400, temporary_quotient*2 =8 1000>400 (true) 400*2=800, temporary_quotient*2=16 1000>800 (true) 800*2=1600, temporary_quotient*2=32 1000>1600 (false! We are using previous values and subtract it from 1000! i.e. 800 and 16) 1000-800=200, quotient += temporary_quotient (16) Repetition of entire procedure once again: temporary_quotient = 1; 200 > 50 (true) 50*2 = 100, temporary_quotient*2=2 200 > 100 (true) 100*2=200, temporary_quotient*2=4 200 == 200 (they are equal, end of the loop) 200-200=0, quotient += temporary_quotient (16+4=20) 50 * 20 = 1000 That reminds me that the single division operation in machine code of Motorola 68000 (Amiga 500, Atari ST) was talking over 150-170 cycles of cpu (running at 7.16 MHz) (unsigned integer div faster, signed integer div slower). So at max it could do just 7,160,000 / 150 = ~47,000 divisions per second. Edited January 8 by Sensei 1 Share this post Link to post Share on other sites

ALine 16 Posted January 8 16 hours ago, uncool said: 1) Wouldn't 1-1 be 1|2? 2) What do you mean by 1-1-1-1? Is the dash meant to be a minus sign? 1 resp) yep, sorry about that 2 resp) yep 10 hours ago, Eise said: First, I would plead to write 1 + 1 + 1 as 3 * 1, not as 1 * 3. In words: add 1 3 times. So where 2 * 3 and 3 * 2 have the same result, the operations are slightly different: 2 * 3 means 3 + 3, and 3 * 2 means 2 + 2 + 2. It is a mathematical proof that these different meanings always lead to the same result. I had no idea the order gave rise to different interpretations. Learn something new every day. 10 hours ago, Eise said: Now the opposite question is: how many 1s do you need if you want to reach 0? So take 3, and count how many 1s you can subtract until you get at 0: 3 -1 -1 -1 = 0. count the 1s: there are 3 of them. This works for all natural numbers. The more I think about it the more feel as though it should be 1|3 = -3 or 3|1 = -1-1-1 instead of 1-1-1 because I do not think that it would make any sense to have a positive 1 in front while the rest are negatives. Apologies for not giving specifications toward my reasoning for this. Not well versed in the field of mathematics and justifications. 10 hours ago, Eise said: As you see yourself, your '|' operator leads to ambiguous results: 1|4 = 1 -1 -1 -1 = -3, or 4. Who would need such an operator? I do not think that it would really have a need. Just an idea so if someone discovers a need for it then far be it from me to stop them.(assuming this is not just some crazy idea) 7 hours ago, studiot said: am suprised no-one has mentioned fractional quantities (since division itself was mentioned). This is the standard bugbear of the view of multiplication as repeated addition and division as repeated subtraction. This issue has at least partly been addressed in mathematics by the 'shift operator' which allows one to move forwards or backwards along a table of values (integer or fractional) one entry at a time. Unfortunately I could quickly find a simple reference, Wikipedia launches straight into higher maths in this instance, but the technique has been used for years in numerical methods, quantum mechanics and many other situations. Had no idea....will need to look into that. @Sensei Nice code man. 0 Share this post Link to post Share on other sites

Sensei 922 Posted January 8 1 hour ago, ALine said: I had no idea the order gave rise to different interpretations. Learn something new every day. In multiplication it does not matter, in division it does matter. a*b=c b*a=c but a/b=c b/a=1/c=c^-1 When you multiply you can have a or b equal 0. No big deal. You will just get 0 result. But with division, if dividend is 0, okay. If divisor equals 0 -> illegal operation.. (during computer programming it can rise exception (which must be captured by try {} catch {}), or even crash code, so any division by variable must be checked against being 0 in divisor!) Notice what would happen with my brute-force algorithm if you would use divisor = 0. You would have infinite never ending loop! Procedure would never exit. 0 Share this post Link to post Share on other sites

ALine 16 Posted January 8 @SenseiOhhhh, so you used it as a method in order to determine if it is a legal operation in terms of mathematical. Through the modeling of it to determine if it breaks this "no divisor equals 0" rule? Apologies, I did not know that is what you were going for with your code. 0 Share this post Link to post Share on other sites

John Cuthber 3667 Posted January 8 6 hours ago, Sensei said: The simplest brute-force dividing algorithm in C/C++ would look like: int quotient = 0; while( dividend >= divisor ) { dividend -= divisor; quotient++; } int reminder = dividend; // subtraction failed "subtract divisor from dividend until dividend is greater than or equal to divisor". The number of repetitions on the loop will be O(quotient) The more sophisticated version could left-shift divisor prior subtraction from dividend. Each binary left-shift operation is multiplication by 2. At the same time value added to quotient should be multiplied by 2. (In binary numeral system left-shift is equivalent of multiplication by 2, move the all bits one position to the left and make room for 0 at the end for the least significant bit) So e.g. division of 1000 by 50 will look like: temporary_quotient = 1; 1000 > 50 (true) 50*2 = 100, temporary_quotient*2 =2 1000 > 100 (true) 100*2=200, temporary_quotient*2=4 1000>200 (true) 200*2=400, temporary_quotient*2 =8 1000>400 (true) 400*2=800, temporary_quotient*2=16 1000>800 (true) 800*2=1600, temporary_quotient*2=32 1000>1600 (false! We are using previous values and subtract it from 1000! i.e. 800 and 16) 1000-800=200, quotient += temporary_quotient (16) Repetition of entire procedure once again: temporary_quotient = 1; 200 > 50 (true) 50*2 = 100, temporary_quotient*2=2 200 > 100 (true) 100*2=200, temporary_quotient*2=4 200 == 200 (they are equal, end of the loop) 200-200=0, quotient += temporary_quotient (16+4=20) 50 * 20 = 1000 That reminds me that the single division operation in machine code of Motorola 68000 (Amiga 500, Atari ST) was talking over 150-170 cycles of cpu (running at 7.16 MHz) (unsigned integer div faster, signed integer div slower). So at max it could do just 7,160,000 / 150 = ~47,000 divisions per second. I know it's just an illustration of the point but, it's worth mentioning that you should check that you are not trying to divide by zero, or you get stuck in an infinite loop. 0 Share this post Link to post Share on other sites

Sensei 922 Posted January 8 4 minutes ago, John Cuthber said: I know it's just an illustration of the point but, it's worth mentioning that you should check that you are not trying to divide by zero, or you get stuck in an infinite loop. Quoting myself: "Notice what would happen with my brute-force algorithm if you would use divisor = 0. You would have infinite never ending loop! Procedure would never exit."... 0 Share this post Link to post Share on other sites

John Cuthber 3667 Posted January 8 1 minute ago, Sensei said: Quoting myself: "Notice what would happen with my brute-force algorithm if you would use divisor = 0. You would have infinite never ending loop! Procedure would never exit."... Doh! 0 Share this post Link to post Share on other sites

ALine 16 Posted January 9 I was thinking about it further, and what if instead of it being 3|1= 1-1-1 it is instead, 3|1= -1-1-1. Like instead of it using positive numbers it just used the negative equivalency, so 3|1=-(3*1). Ex: 3|1 = -1-1-1 = -3 and -(3*1) = -(1+1+1) =-3. So it would maybe act like multiplication but just in the negative axis. 0 Share this post Link to post Share on other sites

Sensei 922 Posted January 9 10 minutes ago, ALine said: I was thinking about it further, I think that your thinking requires more rethinking... 1 Share this post Link to post Share on other sites

ALine 16 Posted January 9 5 minutes ago, Sensei said: think that your thinking requires more rethinking... Yep, I just jumped the shark on that one. 0 Share this post Link to post Share on other sites

Eise 409 Posted January 9 16 hours ago, Sensei said: The simplest brute-force dividing algorithm in C/C++ would look like: int quotient = 0; while( dividend >= divisor ) { dividend -= divisor; quotient++; } int reminder = dividend; // subtraction failed "subtract divisor from dividend until dividend is greater than or equal to divisor". The number of repetitions on the loop will be O(quotient) Remembers me of the mechanical calculator, standing next to the Apple II during my physics study. It was pretty fast with addition, subtraction and multiplication. But division... It subtracted the divisor, again and again, counting how many time it could do. So you can imagine how long it takes to divide a huge number by 1... 13 hours ago, ALine said: I had no idea the order gave rise to different interpretations. Yes, we are so used to the fact that multiplication and addition are commutative, i.e. give the same results, that we do not realize that the meaning of (a + b) and (b + a), resp (a * b ) and (b * a) is not the same. It is a bit like the 'morning star' and the 'evening star'. According to their meaning, they are definitively not the same. You can't see the morning start in the evening, per definition. In this case it was an empirical discovery that they refer to the same object, the planet Venus. With commutativity of multiplication and addition, one can proof they always yield the same result; in case of Venus, it was an empirical discovery. 0 Share this post Link to post Share on other sites

ALine 16 Posted January 9 (edited) 29 minutes ago, Eise said: Yes, we are so used to the fact that multiplication and addition are commutative, i.e. give the same results, that we do not realize that the meaning of (a + b) and (b + a), resp (a * b ) and (b * a) is not the same. It is a bit like the 'morning star' and the 'evening star'. According to their meaning, they are definitively not the same. You can't see the morning start in the evening, per definition. In this case it was an empirical discovery that they refer to the same object, the planet Venus. With commutativity of multiplication and addition, one can proof they always yield the same result; in case of Venus, it was an empirical discovery. I remember learning about vectors where order matters as well. Is it roughly the same concept, but instead of just scalar values it has vector values and those vectors values make it obvious the underlining mathematics involved? Also I keep hearing about the importance of the divisor. Why is that? (model association question) - would the divisor be related to set theory in any way? Like if you divide a number by its divisor would that be the same as taking a section or a sub set from an overall given set. image ref below p.s. apologies for my jump in reasoning. I am a daredevil when it comes to drawing conclusions. Also I feel as though this is getting off topic. Is there any way this can be moved to an area which would satisfy its new topic? Like general discussion? Edited January 9 by ALine 0 Share this post Link to post Share on other sites

Eise 409 Posted January 9 15 minutes ago, ALine said: would the divisor be related to set theory in any way? Like if you divide a number by its divisor would that be the same as taking a section or a sub set from an overall given set. Yes, and no. If you want to formulate it in terms of set theory, I suppose it becomes something like this: a set has 20 elements. How many subsets of 4 elements can you create, where no element appears in 2 subsets? The same question would be: how many times can you take 4 elements away, until the set is empty? 0 Share this post Link to post Share on other sites

studiot 1803 Posted January 9 8 hours ago, ALine said: I was thinking about it further, and what if instead of it being 3|1= 1-1-1 it is instead, 3|1= -1-1-1. Like instead of it using positive numbers it just used the negative equivalency, so 3|1=-(3*1). Ex: 3|1 = -1-1-1 = -3 and -(3*1) = -(1+1+1) =-3. So it would maybe act like multiplication but just in the negative axis. You need to clearly distinguish between the sign of a number and the operations of addition and subtraction. Don't forget that at least one number has no sign, but you can still add or subtract it. Also if you try the set theory approach, what happens if you subtract a (positive) number from a negative number ? The result is 'larger' than the original! 0 Share this post Link to post Share on other sites