 |
 |
|
 |
|
 |
|  |
|  |
|
 |
From: Sven Littkowski
Subject: Function: Making negative numbers positive
Date: 24 Nov 2015 20:11:15
Message: <56550ab3@news.povray.org>
|
|
 |
|  |
|  |
|
 |
Hi.
Is there a POV-Ray function that allows to make a negative number to a
positive number? I want to use such a function, to make a coordinate
number to a positive number. Thanks.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 2015-11-24 17:11, Sven Littkowski wrote:
> Hi.
>
> Is there a POV-Ray function that allows to make a negative number to a
> positive number? I want to use such a function, to make a coordinate
> number to a positive number. Thanks.
>
Multiply the number by -1.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Sven Littkowski wrote:
> Hi.
>
> Is there a POV-Ray function that allows to make a negative number to a
> positive number? I want to use such a function, to make a coordinate
> number to a positive number. Thanks.
abs()
--
Ger
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
sqrt(pow(x,2))
;) :D
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Alain
Subject: Re: Function: Making negative numbers positive
Date: 26 Nov 2015 23:11:51
Message: <5657d807@news.povray.org>
|
|
 |
|  |
|  |
|
 |
Le 15-11-24 20:11, Sven Littkowski a écrit :
> Hi.
>
> Is there a POV-Ray function that allows to make a negative number to a
> positive number? I want to use such a function, to make a coordinate
> number to a positive number. Thanks.
>
That's the absolute value. The abs() function does exactly what you want.
From the documentation:
Abs
Absolute value of A. If A is negative, returns -A otherwise returns A.
#declare Abs = abs(A);
A convoluted, and slow, way is to take the square root of the squared value:
#declare Abs = sqrt(pow(x,2));
You can also use the sellect() function:
#declare Abs = sellect(A, -A, A);
Or use an #if...#else...#end test:
#declare Abs = #if(A<0) -A; #lese A; #end
or
#if(A<0) #declare Abs = -A; #elese #declare Abs = A; #end
If you search and experiment, you may find some other ways to do the same.
Alain
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 2015-11-26 20:12, Alain wrote:
> Le 15-11-24 20:11, Sven Littkowski a écrit :
>> Hi.
>>
>> Is there a POV-Ray function that allows to make a negative number to a
>> positive number? I want to use such a function, to make a coordinate
>> number to a positive number. Thanks.
>>
>
> That's the absolute value. The abs() function does exactly what you want.
> From the documentation:
> Abs
> Absolute value of A. If A is negative, returns -A otherwise returns A.
>
> #declare Abs = abs(A);
>
> A convoluted, and slow, way is to take the square root of the squared
> value:
> #declare Abs = sqrt(pow(x,2));
>
> You can also use the sellect() function:
> #declare Abs = sellect(A, -A, A);
>
> Or use an #if...#else...#end test:
> #declare Abs = #if(A<0) -A; #lese A; #end
> or
> #if(A<0) #declare Abs = -A; #elese #declare Abs = A; #end
>
> If you search and experiment, you may find some other ways to do the same.
>
>
>
>
> Alain
Why use a function at all? If you want to change a negative number to a
positive number all you have to do is multiply it by -1.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Am 27.11.2015 um 11:40 schrieb Todd Carnes:
> Why use a function at all? If you want to change a negative number to a
> positive number all you have to do is multiply it by -1.
That's only true if the number in question is known to be negative.
In that case, however, it is easier and more efficient to just use the
unary minus operator:
#declare PositiveNumber = -NegativeNumber;
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Am 27.11.2015 um 05:12 schrieb Alain:
> You can also use the sellect() function:
> #declare Abs = sellect(A, -A, A);
The keyword is actually "select".
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 11/27/2015 10:52 AM, clipka wrote:
> Am 27.11.2015 um 05:12 schrieb Alain:
>
>> You can also use the sellect() function:
>> #declare Abs = sellect(A, -A, A);
>
> The keyword is actually "select".
>
There is an 'L of a difference. ;-)
--
Regards
Stephen
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 2015-11-27 02:45, clipka wrote:
> That's only true if the number in question is known to be negative.
>
I know, but that was what the OP asked for.
> In that case, however, it is easier and more efficient to just use the
> unary minus operator:
>
> #declare PositiveNumber = -NegativeNumber;
That works too, but then it's really just masking the fact that you are
doing what I said... i.e. multiplying by -1.
Todd
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 2015-11-27 03:15, Stephen wrote:
> On 11/27/2015 10:52 AM, clipka wrote:
>> Am 27.11.2015 um 05:12 schrieb Alain:
>>
>>> You can also use the sellect() function:
>>> #declare Abs = sellect(A, -A, A);
>>
>> The keyword is actually "select".
>>
>
> There is an 'L of a difference. ;-)
>
LOL! :)
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Alain
Subject: Re: Function: Making negative numbers positive
Date: 27 Nov 2015 14:23:26
Message: <5658adae@news.povray.org>
|
|
 |
|  |
|  |
|
 |
Le 15-11-27 05:52, clipka a écrit :
> Am 27.11.2015 um 05:12 schrieb Alain:
>
>> You can also use the sellect() function:
>> #declare Abs = sellect(A, -A, A);
>
> The keyword is actually "select".
>
Oups
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Le 15-11-27 11:20, Todd Carnes a écrit :
> On 2015-11-27 02:45, clipka wrote:
>> That's only true if the number in question is known to be negative.
>>
>
> I know, but that was what the OP asked for.
>
>> In that case, however, it is easier and more efficient to just use the
>> unary minus operator:
>>
>> #declare PositiveNumber = -NegativeNumber;
>
> That works too, but then it's really just masking the fact that you are
> doing what I said... i.e. multiplying by -1.
>
> Todd
>
It's always safer to assume that the value in question *may* be negative
as well as positive.
You want the result to be *always* positive indepentently if it's
original sign.
Alain
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Am 27.11.2015 um 17:20 schrieb Todd Carnes:
> On 2015-11-27 02:45, clipka wrote:
>> That's only true if the number in question is known to be negative.
>>
>
> I know, but that was what the OP asked for.
>
>> In that case, however, it is easier and more efficient to just use the
>> unary minus operator:
>>
>> #declare PositiveNumber = -NegativeNumber;
>
> That works too, but then it's really just masking the fact that you are
> doing what I said... i.e. multiplying by -1.
No, actually it's just the other way round: Multiplication by -1 is a
negation in a complicated disguise.
Mathematically, the definition of the negative of a value x has nothing
to do with multiplication whatsoever; instead, it is defined as the
inverse of x regarding the addition, i.e. the value that, when added to
x, will result in the neutral element 0.
In other words, the expression
-x
is defined such that:
x + (-x) = 0
See? No multiplication involved there. As a matter of fact, in its most
basic form the multiplication operation isn't even /defined/ for
negative numbers; defining whether the product of two negative values
should itself be negative or positive is actually a choice -- it doesn't
follow from first principles (although the choice that such a product
should be positive turns out to be helpful).
In computing, too, arithmetic negation is a well-established operation
in and of itself that has nothing to do with multiplication whatsoever.
CPUs had arithmetic negation operations long before multiplications were
implemented as dedicated machine code operations; earlier computers had
to implement multiplications as a series of additions, but could negate
with ease. And as a matter of fact, in the early days multiplication
functions (and later machine code operations) were sometimes unable to
deal with negative numbers entirely, and to compute the product of two
numbers of arbitrary sign it would have been necessary to first
determine the operands' signs and figure out whether the result should
be negative, then negate any negative operands to get their absolute
value, multiply those, and then negate the result again if it was
supposed to be negative.
In floating-point arithmetics as used by POV-Ray, numbers are typically
stored in sign-and-magnitude format, i.e. there is a bit indicating the
sign of the number, while all the other bits combined indicate the
magnitude. Thus, arithmetic negation is as simple as flipping the sign
bit. Multiplying a number by -1, on the other hand, is as complicated as
multiplying the magnitudes of the operands, and setting the result's
sign bit to the XOR of the operands' sign bits. In this context,
multiplying by 1 is as complicated as multiplying by any other value,
unless the compiler knows in advance that the value is 1 and can
therefore optimize the operation.
In POV-Ray, something even more surprising happens; let's look at the
following statement:
#declare PositiveNumber = -1 * NegativeNumber;
This is actually equivalent to:
#declare UNDEFINED_IDENTIFIER = -CONST * FLOAT_IDENTIFIER;
where UNDEFINED_IDENTIFIER happens to be called "PositiveNumber" and is
(presumably) undefined, CONST happens to be 1.0, and FLOAT_IDENTIFIER
happens to be called "NegativeNumber" and (presumably) holds some
negative number.
As you may notice, this statement includes a negation _and_ a
multiplication. The reason is that POV-Ray does not know negative
constants - all it gives you is positive constants and a negation operator.
(The same is also true in the C and C++ programming languages; in their
case, there are even situations where this matters, and can mess up the
code of unsuspecting programmers.)
As POV-Ray is not an optimizing compiler (actually it's no compiler at
all), it resolves the multiplication operation by blindly invoking the
CPU's floating point multiplication machine code operation, even if one
of the operands happens to be 1 in magnitude.
Obviously, multiplying a number with a negated positive constant takes
longer to execute than just negating the number in question -- and it
also takes longer to parse, requiring at least two more tokens (the
numeric literal "1" and the multiplication operator "*").
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Am 27.11.2015 um 20:26 schrieb Alain:
> Le 15-11-27 11:20, Todd Carnes a écrit :
>> On 2015-11-27 02:45, clipka wrote:
>>> That's only true if the number in question is known to be negative.
>>>
>>
>> I know, but that was what the OP asked for.
>>
>>> In that case, however, it is easier and more efficient to just use the
>>> unary minus operator:
>>>
>>> #declare PositiveNumber = -NegativeNumber;
>>
>> That works too, but then it's really just masking the fact that you are
>> doing what I said... i.e. multiplying by -1.
>>
>> Todd
>>
>
> It's always safer to assume that the value in question *may* be negative
> as well as positive.
> You want the result to be *always* positive indepentently if it's
> original sign.
Actually we can't tell whether that's what the OP wants, as he never
told us the intended result for this case. (Though I'd agree it's a good
guess that he would have known about the negation or multiplication by
-1 if that had been the behaviour he was after.)
We can be pretty sure what /Todd/ wants though, and it's certainly /not/
what you claim he wants ;)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 11/27/2015 7:24 PM, Alain wrote:
> Le 15-11-27 05:52, clipka a écrit :
>> Am 27.11.2015 um 05:12 schrieb Alain:
>>
>>> You can also use the sellect() function:
>>> #declare Abs = sellect(A, -A, A);
>>
>> The keyword is actually "select".
>>
> Oups
Or Oops, in English. :-P
PS I know that I have a cheek correcting anyone's spelling but I could
not resist it.
--
Regards
Stephen
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 2015-11-27 11:26, Alain wrote:
>>
>>
>
> It's always safer to assume that the value in question *may* be negative
> as well as positive.
> You want the result to be *always* positive indepentently if it's
> original sign
That's a good point.
Todd
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 2015-11-27 11:37, clipka wrote:
> We can be pretty sure what/Todd/ wants though, and it's certainly/not/
> what you claim he wants;)
Just as I can be "pretty sure" that what you are implying I want is wrong.
Todd
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 2015-11-27 11:28, clipka wrote:
>> That works too, but then it's really just masking the fact that you are
>> >doing what I said... i.e. multiplying by -1.
> No, actually it's just the other way round: Multiplication by -1 is a
> negation in a complicated disguise.
>
>
> Mathematically, the definition of the negative of a value x has nothing
> to do with multiplication whatsoever; instead, it is defined as the
> inverse of x regarding the addition, i.e. the value that, when added to
> x, will result in the neutral element 0.
>
> In other words, the expression
>
> -x
>
> is defined such that:
>
> x + (-x) = 0
>
> See? No multiplication involved there. As a matter of fact, in its most
> basic form the multiplication operation isn't even/defined/ for
> negative numbers; defining whether the product of two negative values
> should itself be negative or positive is actually a choice -- it doesn't
> follow from first principles (although the choice that such a product
> should be positive turns out to be helpful).
>
>
> In computing, too, arithmetic negation is a well-established operation
> in and of itself that has nothing to do with multiplication whatsoever.
> CPUs had arithmetic negation operations long before multiplications were
> implemented as dedicated machine code operations; earlier computers had
> to implement multiplications as a series of additions, but could negate
> with ease. And as a matter of fact, in the early days multiplication
> functions (and later machine code operations) were sometimes unable to
> deal with negative numbers entirely, and to compute the product of two
> numbers of arbitrary sign it would have been necessary to first
> determine the operands' signs and figure out whether the result should
> be negative, then negate any negative operands to get their absolute
> value, multiply those, and then negate the result again if it was
> supposed to be negative.
>
> In floating-point arithmetics as used by POV-Ray, numbers are typically
> stored in sign-and-magnitude format, i.e. there is a bit indicating the
> sign of the number, while all the other bits combined indicate the
> magnitude. Thus, arithmetic negation is as simple as flipping the sign
> bit. Multiplying a number by -1, on the other hand, is as complicated as
> multiplying the magnitudes of the operands, and setting the result's
> sign bit to the XOR of the operands' sign bits. In this context,
> multiplying by 1 is as complicated as multiplying by any other value,
> unless the compiler knows in advance that the value is 1 and can
> therefore optimize the operation.
>
>
> In POV-Ray, something even more surprising happens; let's look at the
> following statement:
>
> #declare PositiveNumber = -1 * NegativeNumber;
>
> This is actually equivalent to:
>
> #declare UNDEFINED_IDENTIFIER = -CONST * FLOAT_IDENTIFIER;
>
> where UNDEFINED_IDENTIFIER happens to be called "PositiveNumber" and is
> (presumably) undefined, CONST happens to be 1.0, and FLOAT_IDENTIFIER
> happens to be called "NegativeNumber" and (presumably) holds some
> negative number.
>
> As you may notice, this statement includes a negation_and_ a
> multiplication. The reason is that POV-Ray does not know negative
> constants - all it gives you is positive constants and a negation operator.
>
> (The same is also true in the C and C++ programming languages; in their
> case, there are even situations where this matters, and can mess up the
> code of unsuspecting programmers.)
>
> As POV-Ray is not an optimizing compiler (actually it's no compiler at
> all), it resolves the multiplication operation by blindly invoking the
> CPU's floating point multiplication machine code operation, even if one
> of the operands happens to be 1 in magnitude.
>
> Obviously, multiplying a number with a negated positive constant takes
> longer to execute than just negating the number in question -- and it
> also takes longer to parse, requiring at least two more tokens (the
> numeric literal "1" and the multiplication operator "*").
>
Thank you for taking the time to explain all this. It was actually much
more complicated than I had first thought.
Todd
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Am 27.11.2015 um 23:44 schrieb Todd Carnes:
> On 2015-11-27 11:37, clipka wrote:
>> We can be pretty sure what/Todd/ wants though, and it's certainly/not/
>> what you claim he wants;)
>
> Just as I can be "pretty sure" that what you are implying I want is wrong.
Gotme ;)
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Thomas de Groot
Subject: Re: Function: Making negative numbers positive
Date: 28 Nov 2015 02:58:00
Message: <56595e88@news.povray.org>
|
|
 |
|  |
|  |
|
 |
On 27-11-2015 22:12, Stephen wrote:
> On 11/27/2015 7:24 PM, Alain wrote:
>> Le 15-11-27 05:52, clipka a écrit :
>>> Am 27.11.2015 um 05:12 schrieb Alain:
>>>
>>>> You can also use the sellect() function:
>>>> #declare Abs = sellect(A, -A, A);
>>>
>>> The keyword is actually "select".
>>>
>> Oups
>
> Or Oops, in English. :-P
>
> PS I know that I have a cheek correcting anyone's spelling but I could
> not resist it.
>
Carry on Stephen, carry on! ;-)
--
Thomas
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 11/28/2015 7:57 AM, Thomas de Groot wrote:
> On 27-11-2015 22:12, Stephen wrote:
>> On 11/27/2015 7:24 PM, Alain wrote:
>>> Le 15-11-27 05:52, clipka a écrit :
>>>> Am 27.11.2015 um 05:12 schrieb Alain:
>>>>
>>>>> You can also use the sellect() function:
>>>>> #declare Abs = sellect(A, -A, A);
>>>>
>>>> The keyword is actually "select".
>>>>
>>> Oups
>>
>> Or Oops, in English. :-P
>>
>> PS I know that I have a cheek correcting anyone's spelling but I could
>> not resist it.
>>
>
> Carry on Stephen, carry on! ;-)
>
They will only stop me when they box me. :-)
--
Regards
Stephen
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Thomas de Groot
Subject: Re: Function: Making negative numbers positive
Date: 28 Nov 2015 03:59:50
Message: <56596d06$1@news.povray.org>
|
|
 |
|  |
|  |
|
 |
On 28-11-2015 9:24, Stephen wrote:
> On 11/28/2015 7:57 AM, Thomas de Groot wrote:
>> On 27-11-2015 22:12, Stephen wrote:
>>> On 11/27/2015 7:24 PM, Alain wrote:
>>>> Le 15-11-27 05:52, clipka a écrit :
>>>>> Am 27.11.2015 um 05:12 schrieb Alain:
>>>>>
>>>>>> You can also use the sellect() function:
>>>>>> #declare Abs = sellect(A, -A, A);
>>>>>
>>>>> The keyword is actually "select".
>>>>>
>>>> Oups
>>>
>>> Or Oops, in English. :-P
>>>
>>> PS I know that I have a cheek correcting anyone's spelling but I could
>>> not resist it.
>>>
>>
>> Carry on Stephen, carry on! ;-)
>>
>
> They will only stop me when they box me. :-)
>
That's the spirit!
--
Thomas
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
clipka <ano### [at] anonymous org> wrote:
>
> ...As a matter of fact, in its most
> basic form the multiplication operation isn't even /defined/ for
> negative numbers; defining whether the product of two negative values
> should itself be negative or positive is actually a choice -- it doesn't
> follow from first principles (although the choice that such a product
> should be positive turns out to be helpful).
>
This particular example-- multiplying two negative numbers and getting a
positive answer-- has always given me pause, philosophically. That might sound
strange, coming from someone who considers himself (reasonably) math-literate;
but I have always had a kind of built-in stumbling-block regarding it's
'philosophical basis', and why or how this 'convention' came about, in the
history of mathematics. ('Convention' may not be the correct way of putting it,
of course; there have no doubt been many great mathematicians who have struggled
with this concept in order to put it on a firm logical foundation. I hope!)
Put more simply: It seems perfectly 'obvious' that +3 X +2 = +6 (as any child
discovers, when making two sets of three toy blocks, for example.) Likewise, -2
X +3 should 'obviously' produce -6 ... although I can't think of a good
'child's' example to illustrate that ;-) But when it comes to -2 X -3, it just
doesn't seem 'intuitive' that it should produce a positive value. (Although,
what *else* it should produce is certainly a mystery!) HOWEVER... I'm not about
to question centuries (millennia??) of mathematical thought-- I'll just accept
it. ;-)
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Jérôme M. Berger
Subject: Re: Function: Making negative numbers positive
Date: 29 Nov 2015 07:13:20
Message: <565aebe0$1@news.povray.org>
|
|
 |
|  |
|  |
|
 |
On 11/29/2015 09:48 AM, Kenneth wrote:
> Put more simply: It seems perfectly 'obvious' that +3 X +2 = +6 (as a
ny child
> discovers, when making two sets of three toy blocks, for example.) Like
wise, -2
> X +3 should 'obviously' produce -6 ... although I can't think of a good
> 'child's' example to illustrate that ;-) But when it comes to -2 X -3,
it just
> doesn't seem 'intuitive' that it should produce a positive value. (Alth
ough,
> what *else* it should produce is certainly a mystery!) HOWEVER... I'm n
ot about
> to question centuries (millennia??) of mathematical thought-- I'll just
accept
> it. ;-)
>
Here's a logical explanation: it also seems 'obvious' that:
(a + b) × c = (a × c) + (b × c) and it is pretty easy to
validate with
numbers: (1 + 2) × 2 = (3) × 2 = 6 = 2 + 4 = (1 ×
2) + (2 × 2). From a
theoretical standpoint, this is actually one of the ground rules that
define the multiplication (called distributivity). Now, apply this rule
with a = -b and c < 0, for example with your numbers: a = +2, b = -
2 and
c = -3. You get:
(+2 + -2) × -3 = (+2 × -3) + (-2 × -3)
which transforms into:
0 × -3 = (+2 × -3) + (-2 × -3) by definition of -
2
0 = -6 + (-2 × -3) you said yourself it was 'ob
vious'
6 = (-2 × -3) by definition of -6
Note: the 'ovbious' second step derives from the same ground rule by
taking c > 0: 0 = (+2 + -2) × +3 = (+2 × +3) + (-2 × +
3).
Jerome
--
mailto:jeb### [at] free fr
http://jeberger.free.fr
Jabber: jeb### [at] jabber fr
Post a reply to this message
Attachments:
Download 'us-ascii' (1 KB)
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 11/29/2015 8:48 AM, Kenneth wrote:
> This particular example-- multiplying two negative numbers and getting a
> positive answer-- has always given me pause, philosophically. That might sound
> strange, coming from someone who considers himself (reasonably) math-literate;
Hmm! I tried to explain it using adding the number of times you want to
multiply it. When I tried to multiply two negative numbers I am out by a
factor of one. Now I am confused. :-(
Curse you Moriarty! ;-)
--
Regards
Stephen
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Am 29.11.2015 um 09:48 schrieb Kenneth:
> Put more simply: It seems perfectly 'obvious' that +3 X +2 = +6 (as any child
> discovers, when making two sets of three toy blocks, for example.) Likewise, -2
> X +3 should 'obviously' produce -6 ... although I can't think of a good
> 'child's' example to illustrate that ;-) But when it comes to -2 X -3, it just
> doesn't seem 'intuitive' that it should produce a positive value. (Although,
> what *else* it should produce is certainly a mystery!)
Here's my attempt:
Suppose you have some salts dissolved in water, i.e. the water contains
ions of arbitrary elements; depending on the type of element, each ion
is either negatively or positively charged, and the magnitude of its
charge may be 1, 2, 3 or maybe even 4. The whole solution is in
electrostatic equilibrium, i.e. its net charge is 0.
Now suppose you do an experiment in which you know that this solution
exchanges ions of a single element type with the outside world, and you
want to figure out the resulting total charge. You don't know the
element type, nor the direction of the exchange; however, you have a
measurement device that will give you the change in the number of ions
in the solution (a positive value indicating a gain, a negative
indicating a loss), and another measurement device that will give you
the charge of the individual ions.
Now you measure that the gain was -100 (i.e. you actually lost ions),
and the individual ions' charge was -2 (i.e. each ion was doubly
negatively charged).
Obviously the solution's charge now has a magnitude of 100*2 = 200. But
how about the sign?
You lost some negatively charged ions, so your positively charged ions
now have the upper hand: The solution is now positively charged.
Thus, it would make sense in this context if the operation of
multiplying two negative numbers would give a positive result.
Note how this example uses a "magnitude-and-direction" style definition
of a signed number. I guess /any/ "natural" example for multiplication
of two negative values needs to be based on this style of definition.
(After all, how would a signed number fit in a magnitude-only numerical
system anyway?)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 2015-11-27 03:37 PM (-4), clipka wrote:
> Am 27.11.2015 um 20:26 schrieb Alain:
>> It's always safer to assume that the value in question *may* be negative
>> as well as positive.
>> You want the result to be *always* positive indepentently if it's
>> original sign.
>
> Actually we can't tell whether that's what the OP wants, as he never
> told us the intended result for this case. (Though I'd agree it's a good
> guess that he would have known about the negation or multiplication by
> -1 if that had been the behaviour he was after.)
It would be helpful if the OP would write back and explain what he
wants. By now, the confusion caused by his ambiguity should be clear to
any reader.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 2015-11-29 04:48 AM (-4), Kenneth wrote:
> This particular example-- multiplying two negative numbers and getting a
> positive answer-- has always given me pause, philosophically. That might sound
> strange, coming from someone who considers himself (reasonably) math-literate;
> but I have always had a kind of built-in stumbling-block regarding it's
> 'philosophical basis', and why or how this 'convention' came about, in the
> history of mathematics. ('Convention' may not be the correct way of putting it,
> of course; there have no doubt been many great mathematicians who have struggled
> with this concept in order to put it on a firm logical foundation. I hope!)
>
> Put more simply: It seems perfectly 'obvious' that +3 X +2 = +6 (as any child
> discovers, when making two sets of three toy blocks, for example.) Likewise, -2
> X +3 should 'obviously' produce -6 ... although I can't think of a good
> 'child's' example to illustrate that ;-) But when it comes to -2 X -3, it just
> doesn't seem 'intuitive' that it should produce a positive value. (Although,
> what *else* it should produce is certainly a mystery!) HOWEVER... I'm not about
> to question centuries (millennia??) of mathematical thought-- I'll just accept
> it. ;-)
-2 x 3 = -6
-2 x 2 = -4
-2 x 1 = -2
-2 x 0 = 0
-2 x -1 = 2
-2 x -2 = 4
-2 x -3 = 6
Seems intuitive enough. I figured this out on my own as a kid, although
I was suspicious of my own reasoning until it was confirmed in math class.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Le 15-11-30 07:55, Cousin Ricky a écrit :
> On 2015-11-29 04:48 AM (-4), Kenneth wrote:
>> This particular example-- multiplying two negative numbers and getting a
>> positive answer-- has always given me pause, philosophically. That
>> might sound
>> strange, coming from someone who considers himself (reasonably)
>> math-literate;
>> but I have always had a kind of built-in stumbling-block regarding it's
>> 'philosophical basis', and why or how this 'convention' came about, in
>> the
>> history of mathematics. ('Convention' may not be the correct way of
>> putting it,
>> of course; there have no doubt been many great mathematicians who have
>> struggled
>> with this concept in order to put it on a firm logical foundation. I
>> hope!)
>>
>> Put more simply: It seems perfectly 'obvious' that +3 X +2 = +6 (as
>> any child
>> discovers, when making two sets of three toy blocks, for example.)
>> Likewise, -2
>> X +3 should 'obviously' produce -6 ... although I can't think of a good
>> 'child's' example to illustrate that ;-) But when it comes to -2 X -3,
>> it just
>> doesn't seem 'intuitive' that it should produce a positive value.
>> (Although,
>> what *else* it should produce is certainly a mystery!) HOWEVER... I'm
>> not about
>> to question centuries (millennia??) of mathematical thought-- I'll
>> just accept
>> it. ;-)
>
> -2 x 3 = -6
> -2 x 2 = -4
> -2 x 1 = -2
> -2 x 0 = 0
> -2 x -1 = 2
> -2 x -2 = 4
> -2 x -3 = 6
>
> Seems intuitive enough. I figured this out on my own as a kid, although
> I was suspicious of my own reasoning until it was confirmed in math class.
>
I had that same reasoning around 3rd or 4th grade. For the additions, it
was in second grade.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Kenneth" <kdw### [at] gmail com> wrote:
>
> This particular example-- multiplying two negative numbers and getting a
> positive answer-- has always given me pause, philosophically....
> ...when it comes to -2 X -3, it just
> doesn't seem 'intuitive' that it should produce a positive value. (Although,
> what *else* it should produce is certainly a mystery!)
Hey, I've come up with my own 'comfortably' intuitive way of understanding this
concept!
Take a negative number, say -2
Now I want to negate that negative number: -(-2)
There are two ways of 'seeing' or understanding -(-2) The first is simple
'cancellation' of the signs (!). Because, since the leading negative sign is
just a symbol with no numerical quantity attached, the RESULT has to be *a*
value of 2, with some kind of unknown-for-now sign. But the result can't be the
original -2... if it was, then the leading minus-sign would have no purpose at
all(!) Not logical! So, therefore, the result needs to be positive... since it
can't be anything else, dammit! (well, it could *possibly* be zero, by a
quasi-physical rule...i.e., 'forcing' the -2 to go back toward zero on a number
line.... but I'll ignore *that* result...)
The other way of looking at it is as simple multiplication: the 'naked' negative
symbol '-' times -2. Even though this operation *in itself* is the
'non-intuitive' crux of the matter, the RESULT needs to be the same as with the
'cancellation' example above... +2 ... with no need to do any further
conceptualizing!
SO... Following from this 'equality of operations', it now seems obvious that
multiplying a negative with a negative equals a positive! Voila!
My little April Fool's joke, in December :-P Who says amateur philosophers
can't be brilliant?!
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Cousin Ricky <ric### [at] yahoo com> wrote:
>
> -2 x 3 = -6
> -2 x 2 = -4
> -2 x 1 = -2
> -2 x 0 = 0
> -2 x -1 = 2
> -2 x -2 = 4
> -2 x -3 = 6
>
> Seems intuitive enough. I figured this out on my own as a kid, although
> I was suspicious of my own reasoning until it was confirmed in math class.
Hmm. But doesn't the intuitive nature of your construction depend on an implicit
*assumption* that the numerical results should simply go from negative to
positive (in the descending order of your example)? In other words: that the
result of -2 X -2 being positive should *be* positive simply because -2 X 2 was
negative? (or, that -2 X -2 should simply be 'different' from -2 X 2?) Or was it
the middle column of positive-to-negative values that gave you the clue?
I think my own (flawed!) intuition when *I* was a kid would have been that -2 X
-2 would have equaled -4 ! :-O Thankfully, my smarter teachers prevailed. ;-)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Worth watching, as this has some relationship to the topic.
.... and it's animated with POV-Ray. :)
https://www.youtube.com/embed/6cpTEPT5i0A?list=PL3C690048E1531DC7
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |