4 * Work out side f square wire to get rectangular wire
7 /* --- Crank up the maths package --- */
9 Do until Abbrev( 'NO', reply, 1) = 1
10 /* --- Get some input --- */
12 say 'Type width , thickness [, length]'
14 If w || t = '' then LEAVE
15 If Datatype( w, 'M') then LEAVE
17 If w < t then Do /* swap t and w if w less than t */
23 /* --- Produce some output --- *
25 * We calculate the side as being $\sqrt[3]{tw^2}$. This is easy.
27 side = topower(t * w**2, 1/3)
28 diam = format(side * 1.128379167,,2) /* 2*sqrt(side**2/pi) -- 2/sqrt(pi) = 1.128379167 */
29 sqside = format( side,,2)
30 say 'You want square wire with side' sqside', or' diam 'diam round'
32 /* --- Maybe print out the original length needed --- *
34 * Original length is $twl \over x^2$.
39 say 'Of length' format(vol/(sqside**2),,2)', or' format(vol/(3.14159*(diam/2)**2),,2) 'respectively'
40 Say 'Volume' vol/1000 || ', weight' vol * 11.2/1000'gm in 9ctY'
44 Parse UPPER PULL reply
47 /* --- Tidy up after us --- */
53 Say 'Specify diam of round stock as "d", or thickness of square as ",t"'
54 Parse UPPER PULL diam ',' thik
56 If Datatype( diam, 'N') then
57 Say 'Length of' diam 'round wire =' format(vol/(3.14159*(diam/2)**2),,2)
60 If Datatype( thik, 'N') then
61 Say 'Length of' thik 'square wire =' format(vol/(thik**2),,2)