Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Method default argument whose type is the class not yet defined

Reply
Thread Tools

Method default argument whose type is the class not yet defined

 
 
Mark Lawrence
Guest
Posts: n/a
 
      11-12-2012
On 12/11/2012 01:18, Oscar Benjamin wrote:
> On 12 November 2012 01:10, Mark Lawrence <(E-Mail Removed)> wrote:
>> On 12/11/2012 00:31, Oscar Benjamin wrote:
>>>
>>>
>>> Plain wrong. Vectors are not defined *from any origin*.
>>>

>>
>> So when the Captain says "full speed ahead, steer 245 degrees", you haven't
>> the faintest idea where you're going, because you have no origin?

>
> As Steve has just explained, the origin has nothing to do with the
> orientation of the coordinate system.
>
> But then I'm assuming you meant that 245 degrees was a bearing
> relative to North. Was it supposed to be relative to my current angle?
> Truthfully I wouldn't know what to do without asking the captain a
> couple more questions.
>
>
> Oscar
>


The only good acedemic is a dead acedemic?

--
Cheers.

Mark Lawrence.

 
Reply With Quote
 
 
 
 
Roy Smith
Guest
Posts: n/a
 
      11-12-2012
In article <(E-Mail Removed)>,
Oscar Benjamin <(E-Mail Removed)> wrote:

> But then I'm assuming you meant that 245 degrees was a bearing
> relative to North. Was it supposed to be relative to my current angle?
> Truthfully I wouldn't know what to do without asking the captain a
> couple more questions.


Granted, this requires some domain-specific knowledge, but an order to
"steer 245 degrees" means relative to north (and, technically, it's a
heading, not a bearing, but that's another discussion).

If the captain wanted you to change you heading relative to your current
heading, he would say something like, "turn left 10 degrees" (that may
not be strictly the correct wording).
 
Reply With Quote
 
 
 
 
Mark Lawrence
Guest
Posts: n/a
 
      11-12-2012
On 12/11/2012 01:15, Roy Smith wrote:
> In article <(E-Mail Removed)>,
> Mark Lawrence <(E-Mail Removed)> wrote:
>
>> On 12/11/2012 00:31, Oscar Benjamin wrote:
>>>
>>> Plain wrong. Vectors are not defined *from any origin*.
>>>

>>
>> So when the Captain says "full speed ahead, steer 245 degrees", you
>> haven't the faintest idea where you're going, because you have no origin?

>
> Vectors have a length ("full speed ahead") and a direction ("245
> degrees"). What they don't have is a fixed location in space. The
> captain didn't say, "Full speed ahead, steer 245 degrees, from 45.0N,
> 20.0W".
>
> In other words, you are correct. The order, "full speed ahead, steer
> 245 degrees", doesn't give you the faintest idea of where you're going.
> If you were the helmsman, after you executed that order, without any
> additional information (such as your current location), you would have
> no idea what piece of land you will hit, or when you will hit it, if you
> maintain your current course and speed.
>


Thank you for your explanation.

--
Cheers.

Mark Lawrence.

 
Reply With Quote
 
Oscar Benjamin
Guest
Posts: n/a
 
      11-12-2012
On 12 November 2012 01:29, Mark Lawrence <(E-Mail Removed)> wrote:
> On 12/11/2012 01:18, Oscar Benjamin wrote:
>>
>> On 12 November 2012 01:10, Mark Lawrence <(E-Mail Removed)> wrote:
>>>
>>> On 12/11/2012 00:31, Oscar Benjamin wrote:
>>>>
>>>> Plain wrong. Vectors are not defined *from any origin*.
>>>
>>> So when the Captain says "full speed ahead, steer 245 degrees", you
>>> haven't
>>> the faintest idea where you're going, because you have no origin?

>>
>>
>> As Steve has just explained, the origin has nothing to do with the
>> orientation of the coordinate system.
>>
>> But then I'm assuming you meant that 245 degrees was a bearing
>> relative to North. Was it supposed to be relative to my current angle?
>> Truthfully I wouldn't know what to do without asking the captain a
>> couple more questions.

>
> The only good acedemic is a dead acedemic?


Is that what happens when people ask questions on your ship: "it's the
plank for him with the questions-askin'!"

I'm glad you're not my captain.


Oscar
 
Reply With Quote
 
Steven D'Aprano
Guest
Posts: n/a
 
      11-12-2012
On Mon, 12 Nov 2012 00:31:53 +0000, Oscar Benjamin wrote:

[...]
>>> You were right the first time, Chris. A point that happens to coincide
>>> with the arbitrarily chosen origin is no more truthy or falsey than
>>> any other. A vector of length 0 on the other hand is a very different
>>> beast.

>>
>> Nonsense. The length and direction of a vector is relative to the
>> origin. If the origin is arbitrary, as you claim, then so is the length
>> of the vector.

>
> Wrong on all counts. Neither the length not the direction os a vector
> are relative to any origin. When we choose to express a vector in
> Cartesian components our representation assumes an orientation for the
> axes of the coordinate system. Even in this sense, though, the origin
> itself does not affect the components of the vector.



Draw a set of axes and mark the vector [1, 1]. Here's a crappy ASCII art
diagram, with X marking the head of the vector and a line drawn from the
origin to the head.

|
| X
| /
| /
|/
+------


Now draw a second set of axes with the origin set at the head of that
vector. For reference, I leave the previous axis in place. As before, X
represents the head of the vector.


| |
----X-----
| |
| |
| |
+---|--


Note that the "body" of the vector -- the line from the origin to the
head -- is gone. That's because the vector [1, 1] is transformed to the
vector [0, 0] under a translation of one unit in both the X and Y
directions. The magnitude of the vector under one coordinate system is 1,
under the second it is 0.

In a nutshell, you can't talk about either *distance* (magnitude) or
*direction* without an answer to "distance from where? direction relative
to what?".


> I have spent a fair few hours in the past few weeks persuading teenaged
> Engineering students to maintain a clear distinction between points,
> vectors and lines. One of the ways that I distinguish vectors from
> points is to say that a vector is like an arrow but its base has no
> particular position. A point on the other hand is quite simply a
> position. Given an origin (an arbitrarily chosen point) we can specify
> another point using a "position vector": a vector from the origin to the
> point in question.


Just because you have spent a lot of time and effort giving people advice
doesn't make it *good* advice.



[...]
> Wrong. The point (0,0,0,...) in some ND space is an arbitrarily chosen
> position. By this I don't mean to say that the sequence of coordinates
> consisting of all zeros is arbitrary. The choice of the point *in the
> real/hypothetical space* that is designated by the sequence of zero
> coordinates is arbitrary.


So what? All you are saying is that there is more than one coordinate
system, and we can choose the one we like for any problem. Of course we
can, and that's a good thing.



>>> The significance of zero in real algebra is not that it is the origin
>>> but rather that it is the additive and multiplicative zero:
>>>
>>> a + 0 = a for any real number a
>>> a * 0 = 0 for any real number a

>>
>> I'm not sure what you mean by "additive and multiplicative zero", you
>> appear to be conflating two different properties here. 0 is the
>> additive *identity*, but 1 is the multiplicative identity:

>
> I mean that it has the properties that zero has when used in addition
> and multiplication:
> http://en.wikipedia.org/wiki/0_%28nu...entary_algebra


I see no reference to "additive and multiplicative zero" there. Did you
make up that terminology? The *identity* element is a common mathematical
term, but 1 is the multiplicative identity element.

What you are describing is generally known as the "absorbing element"
over multiplication: if X*a = X for any a, then X is an absorbing element
under multiplication.

http://en.wikipedia.org/wiki/Absorbing_element


And by the way, the vector [0, 0] (generalised to however many dimensions
you need) is not necessarily the only null (zero) vector. Some vector
spaces have many null vectors with non-zero components.

http://en.wikipedia.org/wiki/Zero_vector

but I digress.

The exact terminology doesn't really change anything, since everything
you say about vector [0,0] applies equally to the point (0,0) in the
Cartesian plane.



[...]
>>> There is however no meaningful sense in which points (as opposed to
>>> vectors) can be added to each other or multiplied by anything, so
>>> there is no zero point.

>>
>> I think that the great mathematician Carl Gauss would have something to
>> say about that.

>
> Is the text below a quote?


No.

>> Points in the plane are equivalent to complex numbers, and you can
>> certainly add and multiply complex numbers. Adding two points is
>> equivalent to a translation; multiplication of a scalar with a point is
>> equivalent to a scale transformation. Multiplying two points is
>> equivalent to complex multiplication, which is a scale + a rotation.

>
> The last point is bizarre. Complex multiplication makes no sense when
> you're trying to think about vectors. Draw a 2D plot and convince
> yourself that the square of the point (0, 1) is (-1, 0).


Um, yes? It's a rotation of the point (0, 1) by 90° counter-clockwise,
with a scale factor of 1. Does that confuse you? It's a straight-forward
geometric interpretation of multiplication in the complex plane.

http://www.clarku.edu/~djoyce/complex/mult.html

If you take the vector [0, 1] and rotate it by 90° counter-clockwise, you
get the vector [-1, 0].


>> Oh look, that's exactly the same geometric interpretation as for
>> vectors. Hardly surprising, since vectors are the magnitude and
>> direction of a line from the origin to a point.

>
> Here it becomes clear that you have conflated "position vectors" with
> vectors in general. Let me list some other examples of vectors that are
> clearly not "from the origin to a point":
>
> velocity
> acceleration
> force
> electric field
> angular momentum
> wave vector
>
> (I could go on)


But they are, all of them, without exception. E.g. velocity is relative
to some frame of reference, that is, which sets the "zero velocity"
relative to which all other velocities are measured. Electric fields are
relative to the vacuum far from any electric charges. And so on.

I quote:

"The angular momentum L of a particle about a given origin is defined as:

L = r × p

where r is the position vector of the particle relative to the origin, p
is the linear momentum of the particle, and × denotes the cross product."

http://en.wikipedia.org/wiki/Angular_momentum

Is there some part of "about a given origin" which needs additional
explanation?



--
Steven
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VHDL Type Mismatch error indexed name returns a value whose type does not match programmingzeal VHDL 0 05-06-2012 06:38 AM
declaring a friend template function whose arguments are of type = private member type Hicham Mouline C++ 1 03-27-2009 03:58 PM
object as a argument of the method in which the method is defined ? mike C++ 5 02-22-2006 01:24 PM
#if (defined(__STDC__) && !defined(NO_PROTOTYPE)) || defined(__cplusplus) Oodini C Programming 1 09-27-2005 07:58 PM
Error *cannot return a value from method whose result type is void* Charles Java 6 07-28-2004 12:13 PM



Advertisments