References
[1] Eugene McDonnell, “At Play with J: Beware Scholes” Vector 19.3, pp137-142
Appendix 1
A1
load 'statdist'
cnd=: 3 : 'normalprob 0 1 __, y' "0 NB. Hu Zhe
BS=: 3 : 0 NB. Eugene McDonnell
'S X T R V'=.y
d=. ((^.S%X) + T*R(+,−)−:*:V)%V*%:T
│(S,X*^−R*T)−/ .*cnd d*/1 _1
)
A2
erf=:1 H. 1.5@*: * 2p_0.5 &* %^@:*: NB. Ewart Shaw
cnd=: −:@ >:@erf %&(%:2)
BS=: 3 : 0
'S X T R V'=.y
d=. ((^.S%X) + T*R(+,−)−:*:V)%V*%:T
│(S,X*^−R*T)−/ .*cnd d*/1 _1
)
A3 (modified A1)
cnd=: 3 : 0
b=. 0 0.31938153 _0.356563782 1.781477937 _1.821255978 1.330274429
1−│(0.398942* ^_0.5**:y)* b p. %>:y*0.2316419
)
BS=: 3 : 0
'S X T R V'=.y
d=. ((^.S%X) + T*R(+,−)−:*:V)%V*%:T
│(S,X*^−R*T)−/ .*cnd d*/1 _1
)
Appendix 2
CND provides for cumulative normal distributions, but only for use in Black-Scholes. It can be modified for any shape argument by simple changes in line 2 (made, of necessity, for timing comparisons). ERF returns the error function value for its argument, and must also be modified for timing comparisons (again in line 2) or multiple arguments.
∇ Z←CND Y
[1] Z←6 1⍴1.330274 ¯1.821256 1.78148 ¯0.356565 0.31938153 0
[2] Z←1-|(0.398942×*¯0.5×Y*2)×2 2⍴(4 1⍴÷1+Y×0.2316419)⊥Z
∇
∇ Z←BS Y;S;X;T;R;V
[1] (S X T R V)←Y
[2] Z←|(S,X×*-R×T)-.×CND(((⍟S÷X)+T×R+Z,-Z←0.5×V*2)÷V×T*0.5)∘.×1 ¯1
∇
∇ Z←ERF Y
[1] Z←6 1⍴1.330274 ¯1.821256 1.78148 ¯0.356565 0.31938153 0
[2] Z←1-2×|(0.398942×*-Y*2)×(÷1+Y×0.3275911166)⊥Z
∇
(Readers might prefer the following slightly shorter version in Dyalog, using the direct-definition form implemented by John Scholes. Ed. )
CONS←6 1⍴1.330274 ¯1.821256 1.78148 ¯0.356565 0.31938153 0
CND←CONS∘{1-|(0.398942×*¯0.5×⍵*2)×2 2⍴(4 1⍴÷1+⍵×0.2316419)⊥⍺}
ERF←CONS∘{1-2×|(0.398942×*-Y*2)×(÷1+⍵×0.3275911166)⊥⍺}
∇ Z←BS (S X T R V)
[1] Z←|(S,X×*-R×T)-.×CND(((⍟S÷X)+T×R+1 ¯1×0.5×V*2)÷V×T*0.5)∘.×1 ¯1
∇
Digitalising the Vector Archive
by Ian Clark (earthspot2000@hotmail.com)
Two years ago the decision was taken to make all future articles available on the Vector website (www.vector.org.uk). It was a natural decision to convert back-issue articles to the same format. The Vector production team reached the conclusion that HTML was a good definitive format for maintaining documents which needed to be published in a variety of forms (e.g. on the Web and in printed version). This set the pattern for the web-published archive.
It was considered that HTML versions of articles to be published on the Vector website ought to include minimal mark-up, consisting of no more than what is necessary to identify different sections of text, to be handled in different ways (e.g. narrative text, APL code, tables and placement of diagrams). As many options as possible ought to be deferred for controlling the appearance of the article on the screen.
This is a deceptively straightforward requirement. Most of it can be delivered by using a cascaded style sheet (CSS file), but it is also important to avoid browser features which act in such a way as to reduce our options in the future. It takes a lot of experience to know what these features are, plus the need to debate what represents good practice. Personal favourite constructs have to be sacrificed on the altar of compliance to the HTML 4 standard recommendation [1], because at the time of writing this is considered the way to go for future XML migration.
The History of Vector Production
Camera copy for Vector was originally pasted up from panels of printed text and art-work produced in a variety of ways. Gradually page layouts became computer generated in increasingly standardised ways. By volume 4.2 (October 1987), substantially complete camera copy is extant in the form of Microsoft Word files. This is the sort of material to be found in the APL Madrid CD [2], of which more below.
Nowadays camera copy takes the form of one or more PDF files, which are what is delivered to the printer. Assuming we have done our job properly, it would in principle be possible to republish back editions of Vector by regenerating PDF files from the web archive, to the extent of course that all the articles are there. Which they aren’t, and probably never will be, because much of Vector consists of ephemera. However what defines ephemera is a debatable question and nobody has debated it yet.
The author considers that there are many fine editorials going back to Vol 1.1 (1984) which can still be read with pleasure and profit – indeed whose content is extremely provocative in the light of subsequent developments. On the other hand when choosing which articles to varch next, i.e. to process for publication in the archive, some sort of priority asserts itself: articles of timeless application coming before articles focussing on obsolete technology.
The APL Madrid CD
The APL Madrid CD was the first serious attempt to publish the whole Vector Archive for the benefit of members at large. The CD was produced in quantity and given to all delegates at APL Madrid 2002. The material on it however is incomplete, conforms to various different standards and is of variable quality. A variety of different APL fonts are in use (I-APL, APL2, APL*PLUS, Dyalog APL, etc), these all having different ⎕AV layouts. The DOC files which comprise the bulk of the material on the CD require a range of obsolete versions of Microsoft Word in order to display them, and even then this cannot be relied upon to work correctly (see below). It is only when you attempt to do so that you realise how badly Microsoft Word supports upward-compatibility, or historically has done so since 1984. Diagrams and mathematical formulae do not reproduce reliably. If you install a series of obsolete versions of Microsoft Word in order to display these files, you discover that these software antiques no longer perform on modern machines in quite the same way as they did when they were first released, not least because the author of a typical article dealing with APL has until very recently been pushing his word-processor to the limit. The result might be considered (by the vendor) good enough to import an old document for editing and re-issue, but in the author’s opinion it is not dependable enough to view a published document.
It soon becomes clear that to publish even the content of the APL Madrid CD on the Web is a shade more complicated than what the vendor would like you to believe, i.e. that you merely have to feed each DOC file into the latest release of Microsoft Word and select menu: “Save as Web Page…”. Migrating each paper in the archive to the web is an act of creative originality and support for the task cannot be purchased off-the-peg. Indeed the task has to be properly designed if it is to be consistent and economical to perform.
Share with your friends: |