axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-developer] "Sage-type" notebook in a web browser


From: Tim Daly
Subject: Re: [Axiom-developer] "Sage-type" notebook in a web browser
Date: Thu, 23 Jan 2014 10:30:38 -0500

> I'll write the answer you deserve soon, but just one point: according to
> the inverse symbolic calculator at http://isc.carma.newcastle.edu.au/index,
> 3.17313 is the value (among other things) of (23+11*sqrt(5))/15.  I grew up
> thinking that phi was the "golden ratio" of (1+sqrt(5))/2 - but I don't see
> the immediate connection.

The fact that you can't reverse-engineer a constant without knowing the
author's intention IS the immediate connection. 

There is a great book which is written in a literate programming style
called "Implementing Elliptic Curve Cryptography" by Michael Rosing.
(I highly recommend this book as an example of literate style)

In it Rosing has a C constant DEFINED (I don't have my copy handy so
this isn't exact but...)

   #DEFINE numbits 193

He comments that numbits is arbitrary and can be changed at will.

Now suppose you had a copy of the program without the literate text.
And suppose you needed a subroutine where "numbits" was locally 
required to be 255 for some small part of the calculation. It is
very likely that you'd either make a new variable "myNumBits" or
shadow the global value or hard-code your 255. 

You'd be forced into this compromise because it might be too time
consuming or too difficult to ensure that the code is insenstive to
the value of numbits and could be changed globally. Now multiply
this change by 30 other people making local "myNumBitsAlso" and
you can see the intellectual tangle arise in the code base.

In the literate version you know the "author's mind" and can make
the global change with confidence and little thought. And as the
program is literate you ought to modify the global constant to say

   #DEFINE numbits 255

   This constant is globally free to be changed but the foobar
   subroutine depends on the value being a minimum of 255. The
   subroutine uses this as a bitmask to ....



Now consider the same situation where you read:

   PHI = 3.17313

without comment or explanation or any other connection to the 
theory or the implementation. You get to guess. In a really
complex algorithm in an area where you are not the author or
not a PhD in that subject it is unlikely that you have the
background to guess correctly. Or there may be no background
at all since the value might just be a fudge factor that "works".
Who knows?

The author has failed to communicate. 

Tim



   



reply via email to

[Prev in Thread] Current Thread [Next in Thread]