<script>on mouseUpput hcoftpfgestalt("HigherMath","getFunctions") into cd fld oneend mouseUp</script>
</part>
<part>
<id>3</id>
<type>field</type>
<visible> <true /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <false /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <true /> </lockText>
<rect>
<left>0</left>
<top>65</top>
<right>354</right>
<bottom>158</bottom>
</rect>
<style>rectangle</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <true /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Geneva</font>
<textSize>9</textSize>
<textStyle>plain</textStyle>
<textHeight>12</textHeight>
<name></name>
<script></script>
</part>
<part>
<id>4</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>14</left>
<top>15</top>
<right>26</right>
<bottom>27</bottom>
</rect>
<style>transparent</style>
<showName> <false /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <false /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>center</textAlign>
<font>Avant Garde</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name></name>
<script>function baseconvertreal n,s,dput intgr(n) into iput decml(n) into rput baseconvert(i,s,d) into newiput frbaseconvert(r,s,d) into newtdelete first char of newtput newi & newt into newnreturn newnend baseconvertrealfunction frFromDec b,dn,lz,mnglobal x,p,y,r,t,dput empty into xput empty into pput empty into yput empty into rput empty into tput empty into ddelete char 1 of dndelete char 1 of dn-- Start Setupput 1 into xput 1 into pif mn is "true" then monrepeatif mn is "true" then monput b^x into item x+1 of pif (b^x) > dn then exit repeatput x+1 into xend repeat-- Start Divisionput 1 into yrepeat with z=(the number of items in p) down to 1if mn is "true" then monput dn DIV item z of p into item z of rput y+1 into yput dn MOD item z of p into dnend repeat-- Start New Number Systemrepeat with a=1 to the number of items in rif mn is "true" then monif item a of r < 10 then next repeatput numToChar(item a of r+55) into item a of rend repeatput 1 into drepeat with c=the number of items in r down to 1put item c of r into char d of tput d+1 into dend repeatif lz is not "true" thenrepeat with xx=1 to (the number of chars in t - 1)if char 1 of t=0 then delete char 1 of tend repeatend ifreturn tend frFromDecfunction frToDec b,bn,lz,mnglobal x,p,y,r,t,dput empty into xput empty into pput empty into yput empty into rput empty into tput empty into d-- Start Setupput 1 into xput 1 into pif mn is "true" then monrepeat the number of chars in bn-1if mn is "true" then monput b^x into item x+1 of pput x+1 into xend repeat-- Start New Number Systemrepeat with z=1 to the number of chars in bnif mn is "true" then monif char z of bn <10 thenput char z of bn into item z of rnext repeatend ifput charToNum(char z of bn)-55 into item z of rend repeat-- Start Multiplicationput 1 into yput 0 into trepeat with a=the number of items in p down to 1if mn is "true" then monadd (item y of r * item a of p) to tput y+1 into yend repeatif lz is not "true" thenrepeat with xx=1 to (the number of chars in t - 1)if char 1 of t=0 then delete char 1 of tend repeatend ifreturn tend frToDecfunction frBaseConvert n,s,dreturn frfromDec(d,frtoDec(s,n))end frBaseConvert</script>
</part>
<part>
<id>80</id>
<type>field</type>
<visible> <true /> </visible>
<dontWrap> <true /> </dontWrap>
<dontSearch> <false /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <false /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <true /> </lockText>
<rect>
<left>353</left>
<top>91</top>
<right>512</right>
<bottom>163</bottom>
</rect>
<style>scrolling</style>
<autoSelect> <true /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <true /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>Geneva</font>
<textSize>9</textSize>
<textStyle>plain</textStyle>
<textHeight>12</textHeight>
<name>HMExtensions</name>
<script>on mouseUpset the enabled of cd btn "remove" to trueend mouseUp</script>
</part>
<part>
<id>81</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>353</left>
<top>162</top>
<right>433</right>
<bottom>182</bottom>
</rect>
<style>rectangle</style>
<showName> <true /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <true /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>center</textAlign>
<font>Palatino</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name>Add...</name>
<script>on mouseUprepeatanswer file "Select an extension for HyperMath:" of type "STAK"put it into fnif fn is empty or fn is "Cancel" then exit to hypercardput word 2 of the long name of this stack into spdelete first char of spdelete last char of spput the itemDelimiter into iset the itemDelimiter to ":"put the last item of fn into sfndelete last item of spset the itemDelimiter to iif sp is not in fn thenanswer "File must be in modules folder."next repeatend ifif char 1 to 2 of sfn is not "HM" thenanswer "File must be a HyperMath extension."next repeatend ifexit repeatend repeatdelete first char of sfndelete first char of sfnrepeat with x = the number of chars in sfn down to 2if char x of sfn = "&" or (the charToNum of char x of sfn < 91 and the charToNum of char x of sfn > 64) thenput space before char x of sfnend ifend repeatput return & sfn after cd fld "HMExtensions"sort cd fld "HMExtensions" ascendingrepeat until the first line of cd fld "HMExtensions" is not emptydelete line 1 of cd fld "HMExtensions"end repeatput word 2 of the long name of this stack into spdelete first char of spdelete last char of spput the itemDelimiter into iset the itemDelimiter to ":"delete last item of spset the itemDelimiter to iput ":HyperMath Extension Settings" after spopen file spwrite (cd fld "HMExtensions") to file spclose file spend mouseUp</script>
</part>
<part>
<id>95</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <false /> </enabled>
<rect>
<left>432</left>
<top>162</top>
<right>512</right>
<bottom>182</bottom>
</rect>
<style>rectangle</style>
<showName> <true /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <true /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>center</textAlign>
<font>Palatino</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name>Remove</name>
<script>on mouseUpput value(the selectedLine of cd fld "HMExtensions") into trepeat with x = (the number of chars in t) down to 1if char x of t is space then delete char x of tend repeatput "HM" before tif t is in the stacksInUse thenstop using stack tend ifdelete line (word 2 of selectedLine(cd fld "HMExtensions")) of cd fld "HMExtensions"put word 2 of the long name of this stack into spdelete first char of spdelete last char of spput the itemDelimiter into iset the itemDelimiter to ":"delete last item of spset the itemDelimiter to iput ":HyperMath Extension Settings" after spopen file spwrite (cd fld "HMExtensions") to file spclose file spend mouseUp</script>
</part>
<content>
<layer>card</layer>
<id>1</id>
<text><span class="style3">ncluded Functions:</span><span class="style1"></span><span class="style2">Trigonometry (Basic Functions):</span><span class="style1">sec(x) -- secant of xcsc(x) -- cosecant of xcot(x) -- cotangent of xsinh(x) -- hyperbolic sine of xcosh(x) -- hyperbolic cosine of xtanh(x) -- hyperbolic tangent of xcoth(x) -- hyperbolic cotangent of xsech(x) -- hyperbolic secant of xcsch(x) -- hyperbolic cosecant of xasin(x) -- arcsine of xacos(x) -- arcosine of xacot(x) -- arcotangent of xasec(x) -- arcsecant of xacsc(x) -- arcosecant of xasinh(x) -- hyperbolic arcsine of xacosh(x) -- hyperbolic arcosine of xatanh(x) -- hyperbolic arctangent of xacoth(x) -- hyperbolic arcotangent of xasech(x) -- hyperbolic arcsecant of xacsch(x) -- hyperbolic arcosecant of x</span><span class="style2">Essentials (Basic Functions):</span><span class="style1">newsqrt(x) -- square root of x (negative for negative x)root(n,r) -- the r root of nnewroot(n,r) -- the r root of n (negative for negative n)cbrt(x) -- cube root of xnewcbrt(x) -- cube root of x (negative for negative x)recip(x) -- reciprocal of xsquare(x) -- x squaredcube(x) -- x cubedintgr(x) -- integer part of xdecml(x) -- decimal part of xe() -- 2.7182818284...itothei() -- i to the i-th power, or 0.20768...goldenratio() -- the golden ratio, or 1.618034...infinitesimal() -- the closest number to 0 without actually being 0, based on the NumberFormatinfinity() -- HyperCard can return "INF" as a result, but doesn't accept it as input. This will work instead.radius(x,y) -- finds value of polar coordinate r for rectangular coordinates x,y (Note: This also finds the absolute value of complex number x+iy, the hypotenuse of a right triangle with legs x and y, and solutions to many other problems involving the Pythagorean Theorem.)theta(x,y) -- finds value of polar coordinate theta for rectangular coordinates x,y (Note: This is more accurate than atan(y/x).)xcoord(r,theta) -- finds value of rectangular coordinate x for polar coordinates r,thetaycoord(r,theta) -- finds value of rectangular coordinate y for polar coordinates r,theta</span><span class="style2">Logarithms (Basic Functions):</span><span class="style1">log10(x) -- base 10 logarithm of xnaturallogarithm(x) -- base e logarithm of xnaturalexponential(x) -- base e exponential of xnaturalmulog(x,y) -- base e x mulog ynaturaldivlog(x,y) -- base e x divlog ynaturalpowelog(x,y) -- base e x powelog ybinarylogarithm(x) -- base 2 logarithm of xbinaryexponential(x) -- base 2 exponential of xbinarymulog(x,y) -- base 2 x mulog ybinarydivlog(x,y) -- base 2 x divlog ybinarypowelog(x,y) -- base 2 x powelog ycommonlogarithm(x) -- base 10 logarithm of xcommonexponential(x) -- base 10 exponential of xcommonmulog(x,y) -- base 10 x mulog ycommondivlog(x,y) -- base 10 x divlog ycommonpowelog(x,y) -- base 10 x powelog yanylog(x,y) -- base x logarithm of yanyexp(x,y) -- base x exponential of y</span><span class="style2">Factorials (Basic Functions):</span><span class="style1">addendial(x) -- sum of all the numbers from 1 to x-1subtrahendial(x) -- difference of all the numbers from 1 to x-1factorial(x) -- product of all the numbers from 1 to x-1dividendial(x) -- quotient of all the numbers from 1 to x-1factorsum(x) -- sum of all of x's factorsfactorproduct(x) -- product of all of x's factors</span><span class="style2">Miscellaneous (Basic Functions):</span><span class="style1">zeta(x) -- the zeta of xnoise(x) -- returns a random number from x-0.5 to x+0.5bool(x) -- converts x from boolean to decimalsgn(x) -- sign of xsaw(x) -- sawtooth wave at xtri(x) -- triangle wave at xsqu(x) -- square wave at xpolyxcoord(x,n,r) -- x coordinate of vertex x of an n-sided polygon with radius rpolyycoord(x,n,r) -- y coordinate of vertex y of an n-sided polygon with radius rshrinknumber(x) -- shrink x to a value between -1 and 1 (-1 = -竏, -0.75 = -2, -0.5 = -1, 0 = 0, 0.5 = 1, 0.75 = 2, 1 = 竏)randomrange(x,y) -- random number between x and yrandomdecimal() -- random number between 0 and 1nantonum(x) -- not-a-number code to a number (NAN(001) -> "i")nantonumeng(x) -- not-a-number code to a message (NAN(000) -> "indeterminate")superosesin(a,b,ef) -- sine of superose pattern a,b with envelope factor efsuperosecos(a,b,ef) -- cosine of superose pattern a,b with envelope factor efsuperosetan(a,b,ef) -- tangent of superose pattern a,b with envelope factor eflissajoussin(a,b) -- sine of lissajous pattern a,blissajouscos(a,b) -- cosine of lissajous pattern a,blissajoustan(a,b) -- tangent of lissajous pattern a,bconchshellsin(x) -- sine of a conch shell at xconchshellcos(x) -- cosine of a conch shell at x</span><span class="style2">Number Systems (Number Systems):</span><span class="style1">baseconvertreal(n,s,d) -- converts ANY REAL NUMBER n from base s to base drealnumberfromanybasetodecimal(b,n) -- converts ANY REAL NUMBER n from base b to decimalrealnumberfromdecimaltoanybase(b,n) -- converts ANY REAL NUMBER n from decimal to base b</span><span class="style2">Conversions (Conversions):</span><span class="style1">angleconvert(n,s,d) -- convert n from angle measurement s to angle measurement d (s or d can be D, R, G, U, B, A, degrees, radians, gradians, units (1 is 360 degrees), binary (256 is 360 degrees), applesoft, or any number)tempconvert(n,s,d) -- convert n from temperature scale s to temperature scale d (s or d can be Fahrenheit, Celcius, Kelvin, Rankine, Reaumur, F, C, K, Ra, or Re)lengthconvert(n,s,d) -- convert n from linear measurement s to linear measurement d (s or d can be meters, millimeters, centimeters, rods, feet, miles, inches, yards, m, mm, cm, r, ft, mi, in, yd, y, ', '', ")areaconvert(n,s,d) -- convert n from area measurement s to area measurement d (s or d can be feet, square feet, inches, square inches, acres, miles, square miles, yards, square yards, rods, square rods, f, i, a, m, y, r, sq ft, sq in, sq mi, sq yd, sq r)volumeconvert(n,s,d) -- convert n from volume measurement s to volume measurement d (s or d can be feet, cubic feet, inches, cubic inches, yards, cubic yards, cords, cords of wood, f, i, y, c, cu ft, cu in, cu yd, c of w)bytesizeconvert(n,s,d) -- convert n from binary measurement s to binary measurement d (s or d can be bits, nybbles, bytes, words, longs, kilobytes, megabytes, gigabytes, bi, n, by, b, w, l, k, m, g, kb, mb, gb)</span><span class="style2">Volume & Area (Basic Functions):</span><span class="style1">rectangleperimeter(a,b) -- perimeter of rectangle with sides a and brectanglearea(a,b) -- area of reactangle or parallelogram with width a and height bcirclecircumference(r) -- circumference of circle with radius rcirclearea(r) -- area of circle with radius rtrianglearea(b,h) -- area of triangle with base b and height htrapezoidarea(a,b,h) -- area of trapezoid with top a, bottom b, and height hcubesurface(a,b,c) -- surface area of cube with edges a, b, and ccubevolume(a,b,c) -- volume of cube with edges a, b, and cspherevolume(r) -- volume of sphere with radius rprismvolume(b,h,l) -- volume of prism with base b, height h, and length lcylindervolume(r,l) -- volume of cylinder with radius r and length lconevolume(r,h) -- volume of cone with radius r and height h</span><span class="style2">Complex Numbers (Complex Numbers):</span><span class="style1">complexNumbers(a,b,c,d,e) -- does an operation on complex numbers. If c is +, -, *, /, ¥, DIV, MOD, ^, 竏, or ROOT, the appropriate operation is performed on a+ib and d+ie. If a is |, ABS, SIN, COS, TAN, LN, LOG, LOGE, LOG2, LOG10, EXP, 竏, SQR, SQRT, SGN, P>R, R>P, or /, the appropriate operation is performed on b+ic. If a is BC, BASECONV, BASECONVERT, or BASECONVERTREAL, and Number Systems is loaded, b+ic is converted from base d to base e. The older cpx functions are remapped to this new one for compatibility. (Note: Some of the more complicated operations, such as ^, 竏, sin, and cos, require functions in the Basic Functions set.cpxstrtoval(s) -- convert s from string to comma-separated values ("5+3i" -> 5,3)cpxvaltostr(x,y) -- convert x,y from comma-separated values to string (5,3 -> "5+3i")</span><span class="style2">Binary Logic (Number Theory):</span><span class="style1">binaryand(x,y) -- converts x and y to binary and AND's thembinaryor(x,y) -- converts x and y to binary and OR's thembinaryxor(x,y) -- converts x and y to binary and XOR's thembinarynot(x) -- converts x to binary and inverts it</span><span class="style2">Number Theory (Number Theory):</span><span class="style1">isprime(x) -- boolean, is x a prime number?iscomposite(x) -- boolean, is x a composite number?issquare(x) -- boolean, is x a square number?istriangular(x) -- boolean, is x a triangular number?isperfect(x) -- boolean, is x a perfect number?isabundant(x) -- boolean, is x abundant?isdeficient(x) -- boolean, is x deficient?ishappy(x) -- boolean, is x a happy number?ispalindromic(x) -- boolean, does x read the same right-to-left as left-to-right?isodd(x) -- boolean, is x odd?iseven(x) -- boolean, is x even?ispositive(x) -- boolean, is x positive?isnegative(x) -- boolean, is x negative?theperfectness(x) -- 1 if x is abundant, 0 is x is perfect, -1 if x is deficientthepolarity(x) -- 1 if x is positive, 0 is x is 0, -1 if x is negative</span></text>
</content>
<content>
<layer>card</layer>
<id>3</id>
<text>HyperMath is a module for KHyX. It adds numerous (pun not intended) math functions in addition to the built-in ones HyperCard provides. These are provided by extensions to HigherMath itself (although several basic functions are inside HyperMath itself). Included are functions for trigonometry, logarithms, constants, factorials, binary logic, number systems, conversions, geometry, coordinates, complex numbers, and number theory.</text>
<script>-- higher math backup scripts-- in case not all functions transferred to HM files----function csc x-- return 1/sin(x)--end Csc----function sec x-- return 1/cos(x)--end Sec----function cot x-- return 1/tan(x)--end Cot----function sinh x-- return (exp(2*x)-1)/(2*exp(x))--end Sinh----function cosh x-- return (exp(2*x)+1)/(2*exp(x))--end Cosh----function tanh x-- return (exp(2*x)-1)/(exp(2*x)+1)--end Tanh----function asin x-- return atan(x/sqrt(-x*x+1))--end asin----function acos x-- return -atan(x/sqrt(-x*x+1))+pi/2--end acos----function asinh x-- return ln(x+sqrt((x^2)+1))--end Asinh----function acosh x-- return ln(x+sqrt((x^2)-1))--end Acosh----function atanh x-- return .5*(ln((1+x)/(1-x)))--end Atanh----function asec x-- return atan(x/sqrt(x*x-1))--end asec----function acsc x-- return atan(x/sqrt(x*x-1))+(sgn(x)-1*pi/2)--end acsc----function acot x-- return atan(x)+pi/2--end acot----function sech x-- return 2/(exp(x)+exp(-x))--end sech----function csch x-- return 2/(exp(x)-exp(-x))--end csch----function coth x-- return (exp(-x)/exp(x))-(exp(-x))*2+1--end coth----function asech x-- return ln(sqrt(-x*x+1)+1/x)--end asech----function acsch x-- return ln(sgn(x)*sqrt(x*x+1/x))--end acsch----function acoth x-- return ln((x+1)/(x-1))/2--end acoth----function root n,r-- return n^(1/r)--end root----function newSqrt x-- return sqrt(abs(x))*sgn(x)--end newSqrt----function newRoot n,r-- return root(abs(x),r)*sgn(x)--end newroot----function NaturalLogarithm x-- return ln(x)--end NaturalLogarithm----function BinaryLogarithm x-- return log2(x)--end BinaryLogarithm----function CommonLogarithm x-- return (ln(x)/ln(10))--end CommonLogarithm----function NaturalExponential x-- return exp(x)--end NaturalExponential----function BinaryExponential x-- return 2^x--end BinaryExponential----function CommonExponential x-- return 10^x--end CommonExponential----function NaturalMulog n,x-- return (exp(ln(abs(n))*ln(abs(x))))*sgn(n)*sgn(x)--end Naturalmulog----function NaturalDivlog n,x-- return (exp(ln(abs(n))/ln(abs(x))))*sgn(n)*sgn(x)--end NaturalDivlog----function NaturalPowelog n,x-- return (exp(ln(abs(n))^ln(abs(x))))*sgn(n)*sgn(x)--end Naturalpowelog----function BinaryMulog n,x-- return (2^(log2(abs(n))*log2(abs(x))))*sgn(n)*sgn(x)--end BinaryMulog----function BinaryDivlog n,x-- return (2^(log2(abs(n))/log2(abs(x))))*sgn(n)*sgn(x)--end BinaryDivlog----function BinaryPowelog n,x-- return (2^(log2(abs(n))^log2(abs(x))))*sgn(n)*sgn(x)--end BinaryPowelog----function CommonMulog n,x-- return (10^(log10(abs(n))*log10(abs(x))))*sgn(n)*sgn(x)--end CommonMulog----function CommonDivlog n,x-- return (10^(log10(abs(n))/log10(abs(x))))*sgn(n)*sgn(x)--end CommonDivlog----function CommonPowelog n,x-- return (10^(log10(abs(n))^log10(abs(x))))*sgn(n)*sgn(x)--end CommonPowelog----function log10 x-- return commonlogarithm(x)--end log10----function anylog base,n-- return ln(n)/ln(base)--end anylog----function anyexp base,n-- return base^n--end anyexp----function recip x-- return 1/x--end recip----function cbrt x-- return x^(1/3)--end cbrt----function newCbrt x-- return newRoot(x,3)--end newCbrt----function square x-- return x^2--end square----function cube x-- return x^3--end cube----function intgr x-- return x DIV 1--end intgr----function decml x-- return x MOD 1--end decml----function e-- return 2.7182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664274--end e----function goldenratio-- return (1+sqrt(5))/2--end goldenratio----function itothei-- return 0.2078795763507619085469556198349787700338778416317696080751358830554198772854821397886002778654260353--end itothei----function factorSum x-- if x < 1 then return 0-- if intgr(x) <> x then return 0-- put intgr(sqrt(x)) into s-- put 0 into t-- repeat with z = 1 to s-- if (x/z) = (x DIV z) then-- add z to t-- add (x/z) to t-- end if-- end repeat-- return t--end factorSum----function factorProduct x-- if x < 1 then return 0-- if intgr(x) <> x then return 0-- put intgr(sqrt(x)) into s-- put 1 into t-- repeat with z = 1 to s-- if (x/z) = (x DIV z) then-- multiply t by z-- multiply t by (x/z)-- end if-- end repeat-- return t--end factorProduct----function factorial x-- if x = 0 then return 1-- if x < 1 then return "NAN(255)"-- if intgr(x) <> x then return "NAN(255)"-- put 1 into y-- repeat with z = 1 to x-- multiply y by z-- end repeat-- return y--end factorial----function addendial x-- if x = 0 then return 1-- if x < 1 then return "NAN(255)"-- if intgr(x) <> x then return "NAN(255)"-- put 0 into y-- repeat with z = 1 to x-- add z to y-- end repeat-- return y--end addendial----function dividendial x-- if x < 1 then return "NAN(255)"-- if intgr(x) <> x then return "NAN(255)"-- return 1/factorial(x)--end dividendial----function subtrahendial x-- if x < 1 then return "NAN(255)"-- if intgr(x) <> x then return "NAN(255)"-- return 1-addendial(x)--end subtrahendial----function binaryAND x,y-- put baseconvert(x,10,2) into bx-- put baseconvert(y,10,2) into by-- repeat while (the number of chars in bx) < (the number of chars in by)-- put "0" before bx-- end repeat-- repeat while (the number of chars in by) < (the number of chars in bx)-- put "0" before by-- end repeat-- put "" into bz-- repeat with xx = 1 to (the number of chars in by)-- put char xx of bx into c1-- put char xx of by into c2-- put ((c1 = 1) AND (c2 = 1)) into bool-- if bool then put "1" after bz-- if not bool then put "0" after bz-- end repeat-- return baseconvert(bz,2,10)--end binaryAND----function binaryOR x,y-- put baseconvert(x,10,2) into bx-- put baseconvert(y,10,2) into by-- repeat while (the number of chars in bx) < (the number of chars in by)-- put "0" before bx-- end repeat-- repeat while (the number of chars in by) < (the number of chars in bx)-- put "0" before by-- end repeat-- put "" into bz-- repeat with xx = 1 to (the number of chars in by)-- put char xx of bx into c1-- put char xx of by into c2-- put ((c1 = 1) OR (c2 = 1)) into bool-- if bool then put "1" after bz-- if not bool then put "0" after bz-- end repeat-- return baseconvert(bz,2,10)--end binaryOR----function binaryXOR x,y-- put baseconvert(x,10,2) into bx-- put baseconvert(y,10,2) into by-- repeat while (the number of chars in bx) < (the number of chars in by)-- put "0" before bx-- end repeat-- repeat while (the number of chars in by) < (the number of chars in bx)-- put "0" before by-- end repeat-- put "" into bz-- repeat with xx = 1 to (the number of chars in by)-- put char xx of bx into c1-- put char xx of by into c2-- put ((c1 = 1) OR (c2 = 1)) into bool-- if ((c1 = 1) AND (c2 = 1)) then put false into bool-- if bool then put "1" after bz-- if not bool then put "0" after bz-- end repeat-- return baseconvert(bz,2,10)--end binaryXOR----function binaryNOT x-- put baseconvert(x,10,2) into bx-- put "" into bz-- repeat with xx = 1 to (the number of chars in bx)-- put char xx of bx into c1-- if c1 = 0 then put "1" after bz-- if c1 = 1 then put "0" after bz-- end repeat-- return baseconvert(bz,2,10)--end binaryNOT----function SuperoseCOS x,a,ef-- return sin(ef*x)*cos(a*x)--end SuperoseCOS----function SuperoseSIN x,a,ef-- return sin(ef*x)*sin(a*x)--end SuperoseSIN----function SuperoseTAN x,a,ef-- return sin(ef*x)*tan(a*x)--end SuperoseTAN----function LissajousCOS x,a-- return cos(a*x)--end LissajousCOS----function LissajousSIN x,a-- return sin(a*x)--end LissajousSIN----function LissajousTAN x,a-- return tan(a*x)--end LissajousTAN----function ConchShellSIN x-- return sin(x)*x*x--end ConchShellSIN----function ConchShellCOS x-- return cos(x)*x*x--end ConchShellCOS----function noise x-- if x is not empty then-- return (x*((random(1000000)/1000000)+1))/2-- else-- return ((random(1000000)/1000000)+1)/2-- end if--end noise----function bool i-- if not (i is in "true%false%on%off%yes%no%up%down%1%0") then return -1-- if (i is "true" or i is "on" or i is "down" or i is "yes" or i is "1") then return 1-- return 0--end bool----function sgn x-- if x = 0 then return 0-- if x < 0 then return -1-- if x > 0 then return 1--end sgn----function saw n-- return (atan(tan(n*(pi/2))))/(pi/2)--end saw----function tri n-- return (asin(sin(n*(pi/2))))/(pi/2)--end tri----function squ n-- put (sin(n*(pi/2))) into x-- if x > 0 then return 1-- if x < 0 then return -1-- if x = 0 then return 1--end squ----function randomRange x,y-- return random((y-x)+1)+(x-1)--end randomRange----function randomDecimal-- return random(100000000)/100000000--end randomDecimal----function NANtoNUM x-- if x = 1 then return "complex" -- y竏噎 or asin(x)/acos(x) resulting in complex-- if x = 33 then return "undef" -- sin(INF), cos(INF), etc.-- if x = 36 then return "complex" -- log(-x), a***h(-x)-- if x = 37 then return "complex" -- x^y resulting in complex, 1^INF-- if x = 0 then return "undef" -- 0/0, 0*INF, INF/INF, INF-INF-- if x = 255 then return "undef"-- repeat while the number of chars in x <> 3-- put "0" before x-- end repeat-- return "NAN(" & x & ")"--end NANtoNUM----function NANtoNUMeng x-- if x = 1 then return "a complex number"-- if x = 33 then return "an indeterminate"-- if x = 36 then return "a complex number"-- if x = 37 then return "a complex number"-- if x = 0 then return "an indeterminate"-- if x = 255 then return "(the function needed a positive integer)"-- return "an unexpected result"--end NANtoNUMeng----function isPrime x-- if x < 2 then return "neither"-- if intgr(x) <> x then return "neither"-- if (x > 6) and (last char of x is in "024685") then return false -- cheating shortcut-- if (x < 7) then return item x of "neither,true,true,false,true,false,true" -- and another-- put true into bol-- repeat with xx = 2 to intgr(sqrt(x))-- if (x/xx) = intgr(x/xx) then put false into bol-- end repeat-- return bol--end isPrime----function isComposite x-- if x < 2 then return "neither"-- if intgr(x) <> x then return "neither"-- return (not (isprime(x)))--end isComposite----function isPerfect x-- put empty into factorList-- if x < 1 then return "neither"-- if intgr(x) <> x then return "neither"-- if comma & x & comma is in ",6,28,496,8128,33550336,8589869056,137438691328,2305843008139952128," then return true -- cheating shortcut-- if x < 100000000 then return false -- and another-- if (factorSum(x)-x) = x then return true-- return false--end isPerfect----function isAbundant x-- put empty into factorList-- if x < 1 then return "neither"-- if intgr(x) <> x then return "neither"-- if comma & x & comma is in ",6,28,496,8128,33550336,8589869056,137438691328,2305843008139952128," then return false-- return (factorSum(x)-x) > x--end isAbundant----function isDeficient x-- put empty into factorList-- if x < 1 then return "neither"-- if intgr(x) <> x then return "neither"-- if comma & x & comma is in ",6,28,496,8128,33550336,8589869056,137438691328,2305843008139952128," then return false-- return (factorSum(x)-x) < x--end isDeficient----function isHappy x-- if x < 0 then return "neither"-- if intgr(x) <> x then return "neither"-- put 0 into a-- repeat with i = 1 to (the number of chars in x)-- add (char i of x)^3 to a-- end repeat-- return (a = x)--end isHappy----function isPalindromic x-- put x into n1-- put empty into n2-- repeat with x = 1 to (the number of chars in n1)-- put char x of n1 before n2-- end repeat-- return (n1 = n2)--end isPalindromic----function isTriangular x-- return (sqrt((8*x)+1) = intgr(sqrt((8*x)+1)))--end isTriangular----function isSquare x-- return (sqrt(x) = intgr(sqrt(x)))--end isSquare----function baseConvertReal theNumber,sourceBase,destBase-- put realNumberFromAnyBaseToDecimal(sourceBase,theNumber) into t-- put realNumberFromDecimalToAnyBase(destBase,t) into u-- return u--end baseConvertReal----function realNumberFromAnyBaseToDecimal base,aNumber-- if base = "Binary" then put 2 into base-- if base = "Quinary" then put 5 into base-- if base = "Octal" then put 8 into base-- if base = "Decimal" then put 10 into base-- if base = "Duodecimal" then put 12 into base-- if base = "Hexadecimal" then put 16 into base-- if base = "Vigesimal" then put 20 into base-- if base = "Bin" then put 2 into base-- if base = "Oct" then put 8 into base-- if base = "Dec" then put 10 into base-- if base = "Hex" then put 16 into base-- if base = 10 then return aNumber-- if the first char of aNumber = "-" then-- put true into NisNeg-- delete first char of aNumber-- else-- put false into NisNeg-- end if-- put empty into integerPart-- put empty into realPart-- put 0 into integeriteration-- put (the number of chars in aNumber)+1 into realiteration-- repeat-- add 1 to integeriteration-- if char integeriteration of aNumber = "." then exit repeat-- if char integeriteration of aNumber is empty then exit repeat-- put char integeriteration of aNumber into t-- if t is not a number then put ((the chartonum of t)-55) into t-- put "," & t after integerPart-- end repeat-- if aNumber contains "." then-- repeat-- subtract 1 from realiteration-- if char realiteration of aNumber = "." then exit repeat-- if char realiteration of aNumber is empty then exit repeat-- put char realiteration of aNumber into t-- if t is not a number then put ((the chartonum of t)-55) into t-- put "," & t after realPart-- end repeat-- end if-- delete first char of realpart-- delete first char of integerpart-- if integerpart is empty then put "0" into integerPart-- if realpart is empty then put "0" into realPart-- put 0 into intacc-- put 0 into realacc-- repeat with x = 1 to the number of items in integerPart-- multiply intacc by base-- add item x of integerPart to intacc-- end repeat-- repeat with x = 1 to the number of items in realPart-- add item x of realPart to realacc-- divide realacc by base-- end repeat-- delete char 1 of realacc-- put intacc & realacc into newNumber-- repeat until the last char of newNumber <> "0"-- delete last char of newNumber-- end repeat-- repeat until the first char of newNumber <> "0"-- delete first char of newNumber-- end repeat-- if NisNeg then return (newNumber * (-1))-- return newNumber--end realNumberFromAnyBaseToDecimal----function realNumberFromDecimalToAnyBase base,aNumber-- if base = "Binary" then put 2 into base-- if base = "Quinary" then put 5 into base-- if base = "Octal" then put 8 into base-- if base = "Decimal" then put 10 into base-- if base = "Duodecimal" then put 12 into base-- if base = "Hexadecimal" then put 16 into base-- if base = "Vigesimal" then put 20 into base-- if base = "Bin" then put 2 into base-- if base = "Oct" then put 8 into base-- if base = "Dec" then put 10 into base-- if base = "Hex" then put 16 into base-- if base = 10 then return aNumber-- if aNumber < 0 then-- put true into NisNeg-- put abs(aNumber) into aNumber-- else-- put false into NisNeg-- end if-- put aNumber DIV 1 into ipart-- put aNumber MOD 1 into rpart-- put empty into iacc-- put empty into racc-- repeat until ipart = 0-- --put ipart MOD base before iacc-- put ipart MOD base into t-- if t > 9 then put the numtochar of (t+55) into t-- put t before iacc-- put ipart DIV base into ipart-- end repeat-- repeat 15-- --put (rpart * base) DIV 1 after racc-- put (rpart * base) DIV 1 into t-- if t > 9 then put the numtochar of (t+55) into t-- put t after racc-- put (rpart * base) MOD 1 into rpart-- end repeat-- put iacc & "." & racc into newNumber-- repeat until the last char of newNumber <> "0"-- delete last char of newNumber-- end repeat-- repeat until the first char of newNumber <> "0"-- delete first char of newNumber-- end repeat-- if the last char of newNumber = "." then delete last char of newNumber-- if NisNeg then put "-" before newNumber-- return newNumber--end realNumberFromDecimalToAnyBase----function isEven x-- return (x/2 = intgr(x/2))--end isEven----function isOdd x-- return not isEven(x)--end isOdd----function isPositive x-- return (x > 0)--end isPositive----function isNegative x-- return (x < 0)--end isNegative----function thePerfectness x-- if isAbundant(x) then return "1"-- if isDeficient(x) then return "-1"-- if isPerfect(x) then return "0"--end thePerfectness----function thePolarity x-- return sgn(x)--end thePolarity----function zeta x-- -- WARNING!!! For values of x less than 3, calculation may take a LONG time!-- if (x < 0) and (round(x/2) = x/2) then return 0-- put 0 into a-- put 0 into b-- put 0 into i-- repeat-- add 1 to i-- add 1/(i^x) to b-- if a=b then exit repeat-- put b into a-- end repeat-- return b--end zeta----function complexNumbers a,b,o,c,d-- if o = "+" then return (a+c)&(the itemdelimiter)&(b+d)-- if o = "-" then return (a-c)&(the itemdelimiter)&(b-d)-- if o = "*" then return ((a*c)-(b*d))&(the itemdelimiter)&((b*c)+(c*d))-- if o = "/" then return (((a*c)/((c^2)+(d^2)))+((b*d)/((c^2)+(d^2))))&(the itemdelimiter)&(((b*c)/((c^2)+(d^2)))+((c*d)/(((c^2)+(d^2))^2)))-- if o = "¥" or h = "div" then return (((a*c)DIV((c^2)+(d^2)))+((b*d)DIV((c^2)+(d^2))))&(the itemdelimiter)&(((b*c)DIV((c^2)+(d^2)))+((c*d)DIV(((c^2)+(d^2))^2)))-- if o = "mod" then return (((a*c)MOD((c^2)+(d^2)))+((b*d)MOD((c^2)+(d^2))))&(the itemdelimiter)&(((b*c)MOD((c^2)+(d^2)))+((c*d)MOD(((c^2)+(d^2))^2)))-- if o = "^" then return cpxPower(a,b,c,d)-- if o = "竏" or h = "root" then return cpxRoot(a,b,c,d)---- if a = "|" or f = "abs" then return sqrt((b^2)+(o^2))-- if a = "sin" then return sin(b)*cosh(o)&(the itemdelimiter)&cos(b)*sinh(o)-- if a = "cos" then return cos(b)*cosh(o)&(the itemdelimiter)&sin(b)*sinh(o)-- if a = "tan" then return cpxTan(b,o)-- if a = "/" then return (b/((b^2)+(o^2)))&(the itemdelimiter)&(o/((b^2)+(o^2)))-- if a = "log" then return cpxLog(b,o,d)-- if a = "exp" then return (exp(b)*cos(o))&(the itemdelimiter)&(cos(o)*sin(o))-- if a = "竏" or f = "sqrt" or f = "sqr" then return cpxSqrt(b,o)-- if a = "sgn" then return sgn(b)&(the itemdelimiter)&sgn(o)---- return "Error: Unsupported operation."--end complexNumbers----function cn z,y,x,w,v-- return complexNumbers(z,y,x,w,v)--end cn----function cpxAdd a,b,c,d-- return cn(a,b,"+",c,d)--end cpxAdd----function cpxSub a,b,c,d-- return cn(a,b,"-",c,d)--end cpxSub----function cpxMul a,b,c,d-- return cn(a,b,"*",c,d)--end cpxMul----function cpxDiv a,b,c,d-- return cn(a,b,"/",c,d)--end cpxDiv----function cpxPower a,b,c,d-- return exp((c*ln(radius(a,b)))-(d*theta(a,b)))*cos((d*ln(radius(a,b)))+(c*theta(a,b)))&(the itemdelimiter)&exp((c*ln(radius(a,b)))-(d*theta(a,b)))*sin((d*ln(radius(a,b)))+(c*theta(a,b)))--end cpxPower----function cpxExp a,b-- return cn("exp",a,b)--end cpxExp----function cpxLog a,b,k-- if k is a number then return ln(abs(a))&(the itemdelimiter)&(theta(a,b)+(2*pi*k))-- return ln(abs(a))&(the itemdelimiter)&theta(a,b)--end cpxLog----function cpxSin a,b-- return cn("sin",a,b)--end cpxSin----function cpxCos a,b-- return cn("cos",a,b)--end cpxCos----function cpxTan a,b-- return cn(item 1 of cpxsin(a,b),item 2 of cpxsin(a,b),"/",item 1 of cpxcos(a,b),item 2 of cpxcos(a,b))--end cpxTan----function cpxAbs a,b-- return cn("|",a,b)--end cpxAbs----function cpxSqrt a,b-- return cn(a,b,"^",0.5,0)--end cpxSqrt----function cpxRoot a,b,c,d-- return cn(a,b,"^",item 1 of cn("/",c,d),item 2 of cn("/",c,d))--end cpxRoot----function cpxRecip a,b-- return cn("/",a,b)--end cpxRecip----function cpxSgn a,b-- return cn("sgn",a,b)--end cpxSgn----function cpxIntDiv a,b,c,d-- return cn(a,b,"¥",c,d)--end cpxIntDiv----function cpxMod a,b,c,d-- return cn(a,b,"mod",c,d)--end cpxMod----function cpxstrtoval x-- put the itemdelimiter into z-- if x is a number then return (x*1)&z&"0"-- if the last char of x <> "i" then return "ERROR: Expected complex number here."-- if "+" is not in x and "-" is not in x then-- delete last char of x-- return "0"&z&(x*1)-- end if-- if "+" is in x and "-+" is not in x then-- set the itemdelimiter to "+"-- delete last char of x-- put ((item 1 of x)*1)&z&((item 2 of x)*1) into y-- set the itemdelimiter to z-- return y-- end if-- if the first char of x is "-" and "+-" is not in x then-- set the itemdelimiter to "-"-- delete last char of x-- put ((item 2 of x)*-1)&z&-((item 3 of x)*1) into y-- set the itemdelimiter to z-- return y-- end if-- if "-" is in x and "+-" is not in x then-- set the itemdelimiter to "-"-- delete last char of x-- put ((item 1 of x)*1)&z&-((item 2 of x)*1) into y-- set the itemdelimiter to z-- return y-- end if--end cpxstrtoval----function cpxvaltostr a,b-- put a into x-- if b<0 then put b after x-- if b=0 or b>0 then put "+" & b after x-- put "i" after x-- return x--end cpxvaltostr----function radius x,y-- return sqrt((x^2)+(y^2))--end radius----function theta x,y-- if x>0 then return atan(y/x)-- if x<0 then return atan(y/x)-(pi/2)-- if x=0 then-- if y>0 then return (pi/2)-- if y<0 then return (pi/(-2))-- if y=0 then return 0-- end if--end theta----function xcoord r,theta-- return r*cos(theta)--end xcoord----function ycoord r,theta-- return r*sin(theta)--end ycoord----function infinitesimal-- put ((the number of chars in (pi+0))-3) into a-- put "0." into b-- repeat a-- put "0" after b-- end repeat-- put "1" after b-- return b*1--end infinitesimal----function angleconvert n,s,d-- if the first char of s = "d" then put 360 into s -- degrees-- if the first char of s = "r" then put 2*pi into s -- radians-- if the first char of s = "g" then put 400 into s -- gradians-- if the first char of s = "u" then put 1 into s -- units-- if the first char of s = "b" then put 256 into s -- binary-- if the first char of s = "a" then put 64 into s -- applesoft basic-- if the first char of d = "d" then put 360 into d-- if the first char of d = "r" then put 2*pi into d-- if the first char of d = "g" then put 400 into d-- if the first char of d = "u" then put 1 into d-- if the first char of d = "b" then put 256 into d-- if the first char of d = "a" then put 64 into d-- if d is empty then put 2*pi into d-- if s is empty then put 360 into s-- if n is empty then put 0 into n-- return n*(d/s)--end angleconvert----function tempconvert n,s,d-- put the first char of s into e-- if the first char of s = "r" then put the second char of s after e-- put the first char of d after e-- if the first char of d = "r" then put the second char of d after e-- if e = "fc" then return (n-32)/1.8-- if e = "cf" then return (n*1.8)+32-- if e = "fk" then return (n+459.67)/1.8-- if e = "ck" then return n+273.16-- if e = "kf" then return (n*1.8)-459.67-- if e = "kc" then return n-273.16-- if e = "rek" then return (n*1.25)+273.16-- if e = "rak" then return n/1.8-- if e = "kra" then return n*1.8-- if e = "kre" then return (n-273.16)/1.25-- if e = "ref" then return (((n*1.25)+273.16)*1.8)-459.67-- if e = "fre" then return (((n+459.67)/1.8)-273.16)/*1.25-- if e = "rec" then return n*1.25-- if e = "cre" then return n/1.25-- if e = "fra" then return n+459.67-- if e = "cra" then return (n+273.16)*1.8-- if e = "raf" then return n-459.67-- if e = "rac" then return (n/1.8)-273.16-- if e = "rare" then return ((n/1.8)-273.16)/1.25-- if e = "rera" then return ((n*1.25)+273.16)*1.8-- if e is in "/rara/rere/ff/cc/kk/" then return n--end tempconvert----function lengthconvert n,s,d-- if s = "meters" or s = "m" then put 39.13 into s-- if s = "millimeters" or s = "mm" then put 0.3125 into s-- if s = "centimeters" or s = "cm" then put 0.3937008 into s-- if s = "rods" or s = "r" then put 198 into s-- if s = "feet" or s = "ft" or s = "'" then put 12 into s-- if s = "miles" or s = "mi" then put 63360 into s-- if s = "inches" or s = "in" or s = "''" or s = quote then put 1 into s-- if s = "yards" or s = "yd" or s = "y" then put 36 into s-- if d = "meters" or d = "m" then put 39.13 into d-- if d = "millimeters" or d = "mm" then put 0.3125 into d-- if d = "centimeters" or d = "cm" then put 0.3937008 into d-- if d = "rods" or d = "r" then put 198 into d-- if d = "feet" or d = "ft" or d = "'" then put 12 into d-- if d = "miles" or d = "mi" then put 63360 into d-- if d = "inches" or d = "in" or d = "''" or d = quote then put 1 into d-- if d = "yards" or d = "yd" or d = "y" then put 36 into d-- return n*(d/s)--end lengthconvert----function areaconvert n,s,d-- if char 1 of s = "f" or char 1 of word 2 of s = "f" then put 144 into s-- if char 1 of s = "i" or char 1 of word 2 of s = "i" then put 1 into s-- if char 1 of s = "a" or char 1 of word 2 of s = "a" then put 6324480 into s-- if char 1 of s = "m" or char 1 of word 2 of s = "m" then put 4047667200 into s-- if char 1 of s = "y" or char 1 of word 2 of s = "y" then put 1296 into s-- if char 1 of s = "r" or char 1 of word 2 of s = "r" then put 39528 into s-- if char 1 of d = "f" or char 1 of word 2 of d = "f" then put 144 into d-- if char 1 of d = "i" or char 1 of word 2 of d = "i" then put 1 into d-- if char 1 of d = "a" or char 1 of word 2 of d = "a" then put 6324480 into d-- if char 1 of d = "m" or char 1 of word 2 of d = "m" then put 4047667200 into d-- if char 1 of d = "y" or char 1 of word 2 of d = "y" then put 1296 into d-- if char 1 of d = "r" or char 1 of word 2 of d = "r" then put 39528 into d-- return n*(d/s)--end areaconvert----function volumeconvert n,s,d-- if char 1 of s = "f" or char 1 of word 2 of s = "f" then put 1728 into s-- if char 1 of s = "i" or char 1 of word 2 of s = "i" then put 1 into s-- if char 1 of s = "y" or char 1 of word 2 of s = "y" then put 46656 into s-- if char 1 of s = "c" or char 1 of word 2 of s = "c" then put 221184 into s-- if char 1 of d = "f" or char 1 of word 2 of d = "f" then put 1728 into d-- if char 1 of d = "i" or char 1 of word 2 of d = "i" then put 1 into d-- if char 1 of d = "y" or char 1 of word 2 of d = "y" then put 46656 into d-- if char 1 of d = "c" or char 1 of word 2 of d = "c" then put 221184 into d-- return n*(d/s)--end volumeconvert----function bytesizeconvert n,s,d-- if char 1 of s = "b" and char 2 of s = "i" then put 0.125 into s -- bits-- if char 1 of s = "n" then put 0.5 into s -- nybbles-- if char 1 of s = "b" and char 2 of s = "y" then put 1 into s -- bytes-- if char 1 of s = "b" then put 1 into s -- bytes-- if char 1 of s = "w" then put 2 into s -- words-- if char 1 of s = "l" then put 4 into s -- longs-- if char 1 of s = "k" then put 1024 into s -- kilobytes-- if char 1 of s = "m" then put 1048576 into s -- megabytes-- if char 1 of s = "g" then put 1073741824 into s -- gigabytes-- if char 1 of d = "b" and char 2 of d = "i" then put 0.125 into d-- if char 1 of d = "n" then put 0.5 into d-- if char 1 of d = "b" and char 2 of d = "y" then put 1 into d-- if char 1 of d = "b" then put 1 into d-- if char 1 of d = "w" then put 2 into d-- if char 1 of d = "l" then put 4 into d-- if char 1 of d = "k" then put 1024 into d-- if char 1 of d = "m" then put 1048576 into d-- if char 1 of d = "g" then put 1073741824 into d-- return n*(d/s)--end bytesizeconvert----function rectangleperimeter a,b-- return a+a+b+b--end rectangleperimeter----function rectanglearea a,b-- return a*b--end rectanglearea----function cubesurface a,b,c-- return (a*b + a*c + b*c) * 2--end cubesurface----function cubevolume a,b,c-- return a*b*c-- end cubearea----function circlecircumference r-- return pi*r*2--end circlecircumference----function circlearea r-- return pi*(r^2)--end circlearea----function spherevolume r-- return (4/3)*pi*(r^3)--end spherevolume----function trianglearea b,h-- return (b*h)/2--end trianglearea----function trapezoidarea a,b,h-- return ((a+b)*h)/2--end trapezoidarea----function prismvolume b,h,l-- return (b*h*l)/2--end prismvolume----function cylindervolume r,l-- return pi*(r^2)*l--end cylindervolume----function conevolume r,h-- return (pi*(r^2)*h)/3--end conevolume----function shrinknumber x-- if x = "INF" then return 1-- if x = "-INF" then return -1-- if x > 1 then put 2-(1/x) into x-- if x < -1 then put (-2)+((-1)/x) into x-- return x/2--end shrinknumber----function infinity-- return (1/0)--end infinity</script>