Re: "Strong typing vs. strong testing"

P

Pascal J. Bourguignon

Steven D'Aprano said:
Which is why I said it was LIKE asking the second.



It's quite standard to discuss (say) sin(theta) where theta is an element
of â„. The fact that angles can extent to infinity in both directions is
kind of fundamental to the idea of saying that the trig functions are
periodic.

You're falling in a trap. It's costumary in mathematics to ellide the
trivial isomorphims. But they're still there.

When you're writing: 2+3.4 you have to use the trivial isomorphims
between â„• and the subset of â„ called 1.0â„•, let's call it t, so that when
you write: 2+3.4
you actually mean t(2)+3.4
with t(2) ∈ 1.0â„• ⊂ â„
3.4 ∈ â„
and + being the additive operator on â„ with 0.0 as neutral element.


Similarly, when you write sin(θ) with θ ∈ â„
what you actually mean is sin( angle-equivalence-class-of(θ) )
with angle-equivalence-class-of(θ) ∈ â„/2Ï€.


As a programmer, it should be obvious to you.

(defstruct angle
(representant 0.0 :type real))

(defun sinus (angle)
...)


(sinus 0.2) --> error

(sinus (make-angle :representant 0.2)) --> 0.19866933079506122


It just happen that

(defun cl:sin (representant)
(sinus (make-angle :representant representant)))


But this should not confuse you, nor the type checking.


Would it have been easier to understand if I had made the analogy between
angles and (say) time? A time of 1 minute and a time of 60 seconds are
the same time, regardless of what representation you use for it.

Yes, but time has a dimension (time), so you don't confuse it with
random numbers.
 
S

Steven D'Aprano

But in another section of your previous post you argued that it cannot
be proven as it doesn't hold in projective or hyperbolic geometry.

But in Euclidean geometry it *can* be proven. What I was pointing out
that it can't be taken for granted. Under non-Euclidean geometries, it
can't be proven because it isn't necessarily true; under Euclidean
geometry, there was a time when people didn't know whether or not the
ratio of circumference to radius was or wasn't a constant, and proving
that it is a constant is non-trivial.

But you were claiming that the proposition "C = 2Ï€r is the definition of
Ï€" was false.

Well, what is the definition of pi? Is it:

the ratio of the circumference of a circle to twice its radius;
the ratio of the area of a circle to the square of its radius;
4*arctan(1);
the complex logarithm of -1 divided by the negative of the complex square
root of -1;
any one of many, many other formulae.


None of these formulae are intuitively correct; the formula C = 2Ï€r isn't
a definition in the same sense that 1+1=2 defines 2. The point that I was
trying to get across is that, until somebody proved the formula, it
wasn't clear that the ratio was constant.

Also, it is very intuitive to think that the ratio of the circumference
of a circle to it radius is constant:

Given two circles with radii r1 and r2, circumferences C1 and C2, one is
obviously the scaled-up version of the other, therefore the ratio of
their circumferences is equal to the ratio of their radii:

That's exactly the sort of thing Peter Nilsson was talking about when he
said "Most attempts by students collapse because they assume the formula
in advance". It might be "obvious" to you that the two circles are merely
scaled up versions of each other, but that is equivalent to assuming that
the ratio of the circumference to radius is a constant. Well, yes, it is
(at least under Euclidean geometry), but assuming it is a constant
doesn't allow you to prove it is a constant -- that's circular reasoning,
if you excuse the pun.
 
S

Steve Howell

On Oct 13, 12:31 pm, Steven D'Aprano <st...@REMOVE-THIS-
cybersource.com.au> wrote:
0.2141693770623265
Perhaps this will help illustrate what I'm talking about... the
mathematician Mitchell Feigenbaum discovered in 1975 that, for a large
class of chaotic systems, the ratio of each bifurcation interval to the
next approached a constant:

δ = 4.66920160910299067185320382...

And yet nobody can recite this equally interesting ratio to thousands
of digits:

0.2141693770623265...
 
P

Paul Rubin

Steve Howell said:
And yet nobody can recite this equally interesting ratio to thousands
of digits:

0.2141693770623265...

That is 1/F1 where F1 is the first Feigenbaum constant a/k/a delta.
The mathworld article is pretty good:

http://mathworld.wolfram.com/FeigenbaumConstant.html

It mentions that both constants were calculated to about 1000 digits in
1999. I don't know how that was done, but presumably they could be
calculated to more digits these days if someone felt like it.
 
A

Antoon Pardon

"Very difficult to prove" != "cannot be proven".

Your missing the point. You started talking about non-euclidean geometries
as an argument against the notion that pi was defined as the ratio of
the circumference and the diameter. But in non-euclidean geometries
the equation doesn't hold. So either you think non-euclidian geometries
matter and in that case you should have questioned the equation or
you accept that the context was euclidian geometries and in that case
non euclidian considerations don't matter.
You've missed the point that, 4000 years later it is easy to take pi for
granted, but how did anyone know that it was special? After all, there is
a very similar number 3.1516... but we haven't got a name for it and
there's no formulae using it. Nor do we have a name for the ratio of the
radius of a circle to the proportion of the plane that is uncovered when
you tile it with circles of that radius, because that ratio isn't (as far
as I know) constant.

Your confusing the concept with its specific numerical value. It's not
uncommon in mathematics to give a name to a number that is defined in
a specific way, without knowing its numerical value.
Perhaps this will help illustrate what I'm talking about... the
mathematician Mitchell Feigenbaum discovered in 1975 that, for a large
class of chaotic systems, the ratio of each bifurcation interval to the
next approached a constant:

?? = 4.66920160910299067185320382...

Every chaotic system (of a certain kind) will bifurcate at the same rate.
This constant has been described as being as fundamental to mathematics
as pi or e. Feigenbaum didn't just *define* this constant, he discovered
it by *proving* that the ratio of bifurcation intervals was constant.
Nobody had any idea that this was the case until he did so.

So? That the ratio of the circumference and the diameter of a circel was
constant was proven a long way before people had the tools to calculate
that ratio to very high precision. They did that by noting that the
ratios of the circumference of a regular polygon to the diameter of the
inscribed and outscribed circle were constants and converged to each
other as the number of sides increased.

So there is no problem defining pi as the ratio between the circumference
and the diameter of a circle even if one has only very crude approximations
to the numerical value of that ratio.
 
G

Gregory Ewing

Steven said:
under Euclidean
geometry, there was a time when people didn't know whether or not the
ratio of circumference to radius was or wasn't a constant, and proving
that it is a constant is non-trivial.

I'm not sure that the construction you mentioned proves that
either, because it relies on the same assumptions about scaling
of polygons that one makes about circles in Euclidean geometry.

Seems to me the significance of it is not that it proves
anything about the constness of pi, but that it provides a way
of *calculating* pi to any desired accuracy. Before that,
people had to rely on measurements of physical circles to
come up with estimates for the value of pi.
 
A

Arnaud Delobelle

Steven D'Aprano said:
That's exactly the sort of thing Peter Nilsson was talking about when he
said "Most attempts by students collapse because they assume the formula
in advance". It might be "obvious" to you that the two circles are merely
scaled up versions of each other, but that is equivalent to assuming that
the ratio of the circumference to radius is a constant. Well, yes, it is
(at least under Euclidean geometry), but assuming it is a constant
doesn't allow you to prove it is a constant -- that's circular reasoning,
if you excuse the pun.

There is no circular reasoning. Read on to find out why.

A circle is, by definition, the locus of points equidistant from a given
point (called its centre), and this constant distance is what we call
its radius.

Let's have two circles with the same centre and radii r1 and r2. Let's
scale up (from the centre) the first one by a factor r2/r1. Because all
the points the first circle are r1 units of length away from the centre,
all the points on the scaled up version are r1*r2/r1 = r2 units of
length from the centre. So the scaled up version of the first circle
*is* the second circle.

I'll let you solve the case when the centres are distinct.
 
N

Nick Keighley

On 10/02/10 20:04, NickKeighleywrote:



Something that is true by definition is just as useful as saying: "my
program is correct, by definition, because my requirement is what my
code is doing".

well no it isn't. By definition a compiler catches (or is capable of
catching) type mismatches. And some (all?) type mismatches are a
useful diagnostic. You can dance around all you like but its true.

I've worked in a test department and I really have received "but
that's what the code says!" as an explanation for an observed
misbehaviour.

It's a circular argument, your program requirement, for
which the program is supposed to be tested against, is the code itself;
so whatever undesirable behavior the program might have is parts of the
requirement, so the program is, by definition, bug free and it's user
expectation that's wrong.

yes I know. It's a strawman because I never said that or anything
resembling it.
 
M

Mark Wooding

Steven D'Aprano said:
Well, what is the definition of pi? Is it:

the ratio of the circumference of a circle to twice its radius;
the ratio of the area of a circle to the square of its radius;
4*arctan(1);
the complex logarithm of -1 divided by the negative of the complex square
root of -1;
any one of many, many other formulae.

None of these formulae are intuitively correct; the formula C = 2Ï€r isn't
a definition in the same sense that 1+1=2 defines 2. The point that I was
trying to get across is that, until somebody proved the formula, it
wasn't clear that the ratio was constant.

There are several possible definitions of `2'. You've given a common
one (presumably in terms of a purely algebraic definition of the
integers as being the smallest nontrivial ring with characteristic 0).
Another can be given in terms of Peano arithmetic, possibly using an
encoding of Peano arithmetic using only the Zermelo-- Fraenkel axioms of
set theory: at this point one has only a `successor' operation and must
define addition; the obvious definition of 1 and 2 are s(0) and s(s(0))
respectively, and one then has an obligation to prove that s(0) + s(0) =
s(s(0)), though this isn't very hard.

I think my preferred definition of `pi' goes like this (following Lang's
/Analysis I/). Suppose that there exist real functions s and c, such
that s' = c and c' = -s, with s(0) = 0 and c(0) = 1. One can prove that
a pair of such functions is unique, and periodic. Define pi to be half
the (common) period of these functions. (Now we notice that they factor
through the quotient ring R/(2 pi) and define `sin' and `cos' to be the
induced functions on the quotient ring.)

Would the world be a better place if we had a name for 2 pi rather than
pi itself?

-- [mdw]
 
G

Gregory Ewing

Mark said:
Would the world be a better place if we had a name for 2 pi rather than
pi itself?

I don't think so. The women working in the factory in India
that makes most of the worlds 2s would be out of a job.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top