<!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
<stack>
<name>in</name>
<id>-1</id>
<cardCount>1</cardCount>
<cardID>3602</cardID>
<listID>2156</listID>
<cantModify><false /></cantModify>
<cantDelete><false /></cantDelete>
<cantAbort><false /></cantAbort>
<cardSize>
<width>416</width>
<height>240</height>
</cardSize>
<script>function complexNumbers a,b,o,c,dif 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 exp((c*ln(sqrt((a^2)+(b^2))))-(d*theta(a,b)))*cos((d*ln(sqrt((a^2)+(b^2))))+(c*theta(a,b)))&(the itemdelimiter)&exp((c*ln(sqrt((a^2)+(b^2))))-(d*theta(a,b)))*sin((d*ln(sqrt((a^2)+(b^2))))+(c*theta(a,b)))if o = "竏" or h = "root" then return complexNumbers(a,b,"^",c/((c^2)+(d^2)),d/((c^2)+(d^2)))if a = "|" or a = "abs" then return sqrt((b^2)+(o^2))&(the itemdelimiter)&"0"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 complexnumbers(sin(b)*cosh(o),cos(b)*sinh(o),"/",cos(b)*cosh(o),sin(b)*sinh(o))if a = "atan" then return ((theta(1-o,b)/2)-(theta(1+o,-b)/2))&(the itemdelimiter)&(ln(((b^2)+((o+1)^2))/((b^2)+((o-1)^2)))/4)if a = "/" then return (b/((b^2)+(o^2)))&(the itemdelimiter)&(o/((b^2)+(o^2)))if a = "ln" or a = "log" or a = "loge" thenif c is a number then return ln(abs(b))&(the itemdelimiter)&(theta(b,o)+(2*pi*c))return ln(abs(b))&(the itemdelimiter)&theta(b,o)end ifif a = "log2" then return complexNumbers(item 1 of complexNumbers("ln",b,o,c),item 2 of complexNumbers("ln",b,o,c),"/",ln(2),0)if a = "log10" then return complexNumbers(item 1 of complexNumbers("ln",b,o,c),item 2 of complexNumbers("ln",b,o,c),"/",ln(10),0)if a = "exp" then return (exp(b)*cos(o))&(the itemdelimiter)&(cos(o)*sin(o))if a = "竏" or a = "sqrt" or a = "sqr" then return complexnumbers(b,o,"^",0.5,0)if a = "sgn" thenif b < 0 then put "-1" into taif b > 0 then put "1" into taif b = 0 then put "0" into taput (the itemdelimiter) after taif o > 0 then put "1" after taif o < 0 then put "-1" after taif o = 0 then put "0" after tareturn taend ifif a = "P>R" then return (b*cos(o))&(the itemdelimiter)&(b*sin(o))if a = "R>P" then return sqrt((b^2)+(o^2))&(the itemdelimiter)&theta(b,o)if a = "BC" or a = "BaseConv" or a = "BaseConvert" or a = "BaseConvertReal" thenput baseconvertreal(b,c,d) into taput (the itemdelimiter) after taput baseconvertreal(o,c,d) after tareturn taend ifreturn "Error: Unsupported operation."end complexNumbersfunction cn l,m,n,o,preturn complexNumbers(l,m,n,o,p)end cnfunction cpxAdd a,b,c,dreturn cn(a,b,"+",c,d)end cpxAddfunction cpxSub a,b,c,dreturn cn(a,b,"-",c,d)end cpxSubfunction cpxMul a,b,c,dreturn cn(a,b,"*",c,d)end cpxMulfunction cpxDiv a,b,c,dreturn cn(a,b,"/",c,d)end cpxDivfunction cpxPower a,b,c,dreturn cn(a,b,"^",c,d)end cpxPowerfunction cpxLog a,b,vreturn cn("ln",a,b,v)end cpxlogfunction cpxExp a,breturn cn("exp",a,b)end cpxExpfunction cpxSin a,breturn cn("sin",a,b)end cpxSinfunction cpxCos a,breturn cn("cos",a,b)end cpxCosfunction cpxAbs a,breturn cn("|",a,b)end cpxAbsfunction cpxRecip a,breturn cn("/",a,b)end cpxRecipfunction cpxSgn a,breturn cn("sgn",a,b)end cpxSgnfunction cpxIntDiv a,b,c,dreturn cn(a,b,"¥",c,d)end cpxIntDivfunction cpxMod a,b,c,dreturn cn(a,b,"mod",c,d)end cpxModfunction cpxSqrt a,breturn cn("sqrt",a,b)end cpxSqrtfunction cpxRoot a,b,c,dreturn cn(a,b,"竏",c,d)end cpxRootfunction cpxTan a,breturn cn("tan",a,b)end cpxTanfunction cpxstrtoval xput the itemdelimiter into zif 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 thendelete last char of xreturn "0"&z&(x*1)end ifif "+" is in x and "-+" is not in x thenset the itemdelimiter to "+"delete last char of xput ((item 1 of x)*1)&z&((item 2 of x)*1) into yset the itemdelimiter to zreturn yend ifif the first char of x is "-" and "+-" is not in x thenset the itemdelimiter to "-"delete last char of xput ((item 2 of x)*-1)&z&-((item 3 of x)*1) into yset the itemdelimiter to zreturn yend ifif "-" is in x and "+-" is not in x thenset the itemdelimiter to "-"delete last char of xput ((item 1 of x)*1)&z&-((item 2 of x)*1) into yset the itemdelimiter to zreturn yend ifend cpxstrtovalfunction cpxvaltostr a,bput a into xif b<0 then put b after xif b=0 or b>0 then put "+" & b after xput "i" after xreturn xend cpxvaltostr</script>