/* * ------------------------------------------------------ * Class: ComplexNumberClass.as * ------------------------------------------------------ * Version: 1.0 * ------------------------------------------------------ * Latest update: August 1, 2003 * ------------------------------------------------------ * Description: Reverse polish notation complex number calculator * ------------------------------------------------------ * Developer: Richard Wright * [wisolutions2002@shaw.ca] * ------------------------------------------------------ * Copyright: (c) 2003, Dario Alpern * http://www.alpertron.com.ar/ENGLISH.HTM * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * - Neither the name of this software nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ------------------------------------------------------ * Functions: * * Code requires [inputRe_txt, inputIm_txt, outputReal_txt, outputImg_txt, output_txt] in UI. * 1. Complex(r,i) * 2. compMakeArray(n) * 3 compInput(re,im) * 4. compShow(val) * 5. compW(texto) * 6. compArg(x,y) * 7. compChSign(c) * 8. compNor(c) * 9. compRAbs(c) * 10. compAbs(c) * 11. compTimesi(c) * 12. compTimesi3(c) * 13. compAdd(c1,c2) * 14. compSubt(c1,c2) * 15. compMult(c1,c2) * 16. compDiv(c1,c2) * 17. compLog(c) * 18. compExp(c) * 19. compSqrt(c) * 20. compPower(c1,c2) * 21. compRoot(c1,c2) * 22. compRSinh(r) * 23. compRCosh(r) * 24. compSin(c) * 25. compCos(c) * 26. compTan(c) * 27. compCot(c) * 28. compSec(c) * 29. compCosec(c) * 30. compAsin(c) * 31. compAcos(c) * 32. compAtan(c) * 33. compAcot(c) * 34. compAsec(c) * 35. compAcosec(c) * 36. compSinh(c) * 37. compCosh(c) * 38. compTanh(c) * 39. compCotanh(c) * 40. compSech(c) * 41. compCosech(c) * 42. compAsinh(c) * 43. compAcosh(c) * 44. compAtanh(c) * 45. compAcotanh(c) * 46. compAsech(c) * 47. compAcosech(c) * 48. compContFrac(c1) * 49. compFactorial(c) * 50. compLogGamma(c) * 51. compDiGamma(c) * 52. compTriGamma(c) * 53. compTetraGamma(c) * 54. compPentaGamma(c) * 55. compHexaGamma(c) * 56. compTable(max,buttext) // not used in FMX environment (yet) * * Additional functions from Edwin Heijmen's ComplexNumberClass: * * 57. compEquals() * 58. compConjugate() * 59. compModulo() * ------------------------------------------------------ * Disclaimer: This is an incomplete port of this JS class to FMX. The basic * functions are all successfully ported, but the transition from * html forms functionality to FMX AS is incomplete. * ------------------------------------------------------ * Updates may be available at: * http://members.shaw.ca/flashmath101/as/ * ------------------------------------------------------ */ ////////////////////////////////////////// // Class ////////////////////////////////////////// // check if this file has already been included if (!_global._COMPLEXNUMBERCLASS_AS) { // create the variable that keeps track of whether or not this file has been included _global._COMPLEXNUMBERCLASS_AS = true; // 1. Complex = new object Complex = function(r,i) { this.r = r; this.i = i; }; _global.Mem = new Complex(0,0); _global.One = new Complex(1,0); _global.Pi = new Complex(Math.PI,0); _global.sp = 0; _global.st = new compMakeArray(20); _global.re = inputRe_txt.text; // UI input _global.im = inputIm_txt.text; // UI input _global.real = outputReal_txt.text; // UI output _global.img = outputImg_txt.text; // UI output _global.butindex = 1; _global.ToRad = new Complex(180/Math.PI,0); ////////////////////////////////////////// // Functions ////////////////////////////////////////// // 2. compMakeArray compMakeArray = function(n) { this.length = n; }; // 3. compInput compInput = function(re,im) { var oldRe = re; var oldIm = im; var newRe,newIm; for (var i=0;i0) return Math.atan(y/x); if (x<0 && y>=0) return Math.PI+Math.atan(y/x); if (x<0 && y<0) return -Math.PI+Math.atan(y/x); if (y>0) return Math.PI/2; if (y<0) return -Math.PI/2; return 0; }; // 7. compChSign compChSign = function(c) { c.r = -c.r; c.i = -c.i; return c; }; // 8. compNor compNor = function(c) { return(c.r*c.r+c.i*c.i); }; // 9. compRAbs compRAbs = function(c) { if (Math.abs(c.r)>Math.abs(c.i)) { return Math.abs(c.r)*Math.sqrt(1+(c.i/c.r)*(c.i/c.r)); } return Math.abs(c.i)*Math.sqrt(1+(c.r/c.i)*(c.r/c.i)); }; // 10. compAbs compAbs = function(c) { return new Complex(compRAbs(c),0); }; // 11. compTimesi compTimesi = function(c) { return new Complex(-c.i,c.r); }; // 12. compTimesi3 compTimesi3 = function(c) { return new Complex(c.i,-c.r); }; // 13. compAdd compAdd = function(c1,c2) { return new Complex(c1.r+c2.r,c1.i+c2.i); }; // 14. compSubt compSubt = function(c1,c2) { return new Complex(c1.r-c2.r,c1.i-c2.i); }; // 15. compMult compMult = function(c1,c2) { return new Complex(c1.r*c2.r-c1.i*c2.i,c1.i*c2.r+c1.r*c2.i); }; // 16. compDiv compDiv = function(c1,c2) { if (Math.abs(c2.r)>=Math.abs(c2.i)) { var r = c2.i/c2.r; var s = c2.r+r*c2.i; return new Complex((c1.r+c1.i*r)/s,(c1.i-c1.r*r)/s); } var r = c2.r/c2.i; var s = c2.i+r*c2.r; return new Complex((c1.r*r+c1.i)/s,(c1.i*r-c1.r)/s); }; // 17. compLog compLog = function(c) { return new Complex(Math.log(compRAbs(c)),compArg(c.r,c.i)); }; // 18. compExp compExp = function(c) { return new Complex(Math.exp(c.r)*Math.cos(c.i),Math.exp(c.r)*Math.sin(c.i)); }; // 19. compSqrt compSqrt = function(c) { if (c.r>0) { var aux = compRAbs(c)+c.r; return new Complex(Math.sqrt(aux/2),c.i/Math.sqrt(2*aux)); } else { var aux = compRAbs(c)-c.r; if (c.i<0) { return new Complex(Math.abs(c.i)/Math.sqrt(2*aux),-Math.sqrt(aux/2)); } else { return new Complex(Math.abs(c.i)/Math.sqrt(2*aux),Math.sqrt(aux/2)); } } }; // 20. compPower compPower = function(c1,c2) { return compExp(compMult(compLog(c1),c2)); }; // 21. compRoot compRoot = function(c1,c2) { return compExp(compDiv(compLog(c1),c2)); }; // 22. compRSinh compRSinh = function(r) { if (Math.abs(r)>.1) { return (Math.exp(r)-Math.exp(-r))/2; } else { var s = 1; for (var j=19;j>2;j-=2) { s = s*r*r/j/(j-1)+1; } return s*r; } }; // 23. compRCosh compRCosh = function(r) { return (Math.exp(r)+Math.exp(-r))/2; }; // 24. compSin compSin = function(c) { return new Complex(Math.sin(c.r)*compRCosh(c.i),Math.cos(c.r)*compRSinh(c.i)); }; // 25. compCos compCos = function(c) { return new Complex(Math.cos(c.r)*compRCosh(c.i),-Math.sin(c.r)*compRSinh(c.i)); }; // 26. compTan compTan = function(c) { return compDiv(compSin(c),compCos(c)); }; // 27. compCot compCot = function(c) { return compDiv(compCos(c),compSin(c)); }; // 28. compSec compSec = function(c) { return compDiv(One,compCos(c)); }; // 29. compCosec compCosec = function(c) { return compDiv(One,compSin(c)); }; // 30. compAsin compAsin = function(c) { return compTimesi(compAsinh(compTimesi3(c))); }; // 31. compAcos compAcos = function(c) { return compTimesi(compAcosh(c)); }; // 32. compAtan compAtan = function(c) { var re = compArg(1-compNor(c),2*c.r)/2; var s = 4*c.i/(c.r*c.r+(c.i-1)*(c.i-1)); if (Math.abs(s)>.1) { return new Complex(re,Math.log(1+s)/4); } else { s = -s; var i2 = -1/20; for (var j=19;j>0;j--) i2 = i2*s-1/j; return new Complex(re,s*i2/4) } }; // 33. compAcot compAcot = function(c) { return compAtan(compDiv(One,c)); }; // 34. compAsec compAsec = function(c) { return compTimesi(compAsech(c)); }; // 35. compAcosec compAcosec = function(c) { return compAsin(compDiv(One,c)); }; // 36. compSinh compSinh = function(c) { return new Complex(compRSinh(c.r)*Math.cos(c.i),compRCosh(c.r)*Math.sin(c.i)); }; // 37. compCosh compCosh = function(c) { return new Complex(compRCosh(c.r)*Math.cos(c.i),compRSinh(c.r)*Math.sin(c.i)); }; // 38. compTanh compTanh = function(c) { return compDiv(compSinh(c),compCosh(c)); }; // 39. compCoth compCoth = function(c) { return compDiv(compCosh(c),compSinh(c)); }; // 40. compSech compSech = function(c) { return compDiv(One,compCosh(c)); }; // 41. compCosech compCosech = function(c) { return compDiv(One,compSinh(c)); }; // 42. compAsinh compAsinh = function(c) { if (compNor(c)>.1) { var c1 = compAdd(compSqrt(compAdd(compMult(c,c),One)),c); var c2 = compSubt(compSqrt(compAdd(compMult(c,c),One)),c); if (compNor(c1)>compNor(c2)) return compLog(c1); return compChSign(compLog(c2)); } var c2 = new Complex(-1/19,0); var c3 = compMult(c,c); var sgn = 1; for (var j=17;j>0;j-=2) { c2 = compMult(c3,c2); c2.r = c2.r*j/(j+1)+sgn/j; c2.i = c2.i*j/(j+1); sgn = -sgn; } return compMult(c,c2); }; // 43. compAcosh compAcosh = function(c) { var c1 = compAdd(compSqrt(compSubt(compMult(c,c),One)),c); var c2 = compSubt(compSqrt(compSubt(compMult(c,c),One)),c); if (compNor(c1)>compNor(c2)) return compLog(c1); return compLog(compMult(new Complex(-1,0),c2)); }; // 44. compAtanh compAtanh = function(c) { return compTimesi(compAtan(compTimesi3(c))); }; // 45. compAcoth compAcoth = function(c) { return compAtanh(compDiv(One,c)); }; // 46. compAsech compAsech = function(c) { return compAcosh(compDiv(One,c)); }; // 47. compAcosech compAcosech = function(c) { return compAsinh(compDiv(One,c)); }; // 48. compContFrac compContFrac = function(c1) { var s = compDiv(new Complex(3,0),c1); for (var j=7;j>0;j--) s = compDiv(new Complex(compContFrac.arguments[j],0),compAdd(c1,s)); return s; }; // 49. compFactorial compFactorial = function(c) { if (c.r<-1) { var c2 = compDiv(compPi,compSin(compMult(Pi,c))); c2.r = -c2.r; c2.i = -c2.i; var c1 = compSubt(new Complex(5,0),c); } else { var c1 = compAdd(c,new Complex(6,0)); } var s = compContFrac(c1,1/12,1/30,53/210,195/371,22999/22737,29944523/19733142,109535241009/48264275462); s = compAdd(s,new Complex(.5*Math.log(2*Math.PI),0)); s = compAdd(s,compMult(compAdd(c1,new Complex(.5,0)),compLog(c1))); s = compExp(compSubt(s,c1)); for (j=0;j<6;j++) { s = compDiv(s,c1); c1.r--; } if (c.r>=-1) return s; return compDiv(c2,s); }; // 50. compLogGamma compLogGamma = function(c) { if (c.r<0) { var c2 = compLog(compSin(compMult(Pi,c))); var c1 = compSubt(new Complex(6,0),c); } else { var c1 = compAdd(c,new Complex(7,0)); } var s = compContFrac(c1,1/12,1/30,53/210,195/371,22999/22737,29944523/19733142, 109535241009/48264275462); s = compAdd(s,new Complex(.5*Math.log(2*Math.PI),0)); s = compSubt(compAdd(s,compMult(compSubt(c1,new Complex(.5,0)),compLog(c1))),c1); for (var j=0;j<7;j++) { c1.r--; s = compSubt(s,compLog(c1)); } if (c.r>=0) return s; return compSubt(s,c2); }; // 51. compDiGamma compDiGamma = function(c) { if (c.r<0) { var c2 = compDiv(Pi,compTan(compMult(Pi,c))); var c1 = compSubt(new Complex(6,0),c); } else { var c1 = compAdd(c,new Complex(7,0)); } var s = compContFrac(c1,1/12,1/10,79/210,1205/1659,262445/209429,33461119209/18089284070,361969913862291/137627660760070); s = compDiv(s,c1); s = compAdd(s,compDiv(new Complex(.5,0),c1)); s = compSubt(compLog(c1),s); for (var j=0;j<7;j++) { c1.r--; s = compSubt(s,compDiv(One,c1)); } if (c.r>=0) return s; return compSubt(s,c2); }; // 52. compTriGamma compTriGamma = function(c) { if (c.r<0) { var u = compCot(compMult(Pi,c)); var c2 = compMult(compMult(Pi,Pi),compAdd(compMult(u,u),One)); var c1 = compSubt(new Complex(6,0),c); } else { var c1 = compAdd(c,new Complex(7,0)); } var s = compContFrac(c1,1/6,1/5,18/35,20/21,50/33,315/143,196/65); s = compAdd(s,new Complex(.5,0)); s = compDiv(s,c1); s = compAdd(s,One); s = compDiv(s,c1); for (var j=0;j<7;j++) { c1.r--; var c3 = compMult(c1,c1); s = compAdd(s,compDiv(One,c3)); } if (c.r>=0) return s; return compSubt(c2,s); }; // 53. compTetraGamma compTetraGamma = function(c) { if (c.r<0) { var u = compCot(compMult(Pi,c)); var c2 = compMult(new Complex(2*Math.PI*Math.PI*Math.PI,0),compMult(u,compAdd(compMult(u,u),One))); var c1 = compSubt(new Complex(6,0),c); } else { var c1 = compAdd(c,new Complex(7,0)); } var s = compContFrac(c1,1/2,1/3,2/3,6/5,9/5,18/7,24/7); s = compDiv(compDiv(compAdd(compDiv(compAdd(s,One),c1),One),c1),c1); s.r = -s.r; s.i = -s.i; for (var j=0;j<7;j++) { c1.r--; var c3 = compMult(compMult(c1,c1),c1); c3.r /= 2; c3.i /= 2; s = compSubt(s,compDiv(One,c3)); } if (c.r>=0) return s; return compSubt(s,c2); }; // 54. compPentaGamma compPentaGamma = function(c) { if (c.r<0) { var u = compCot(compMult(Pi,c)); var c2 = compAdd(compMult(compAdd(compMult(compMult(u,u),compMult(new Complex(6,0)),new Complex(8,0)),compMult(u,u)),new Complex(2,0))); c2.r *= -Math.PI*Math.PI*Math.PI*Math.PI; c2.i *= -Math.PI*Math.PI*Math.PI*Math.PI; var c1 = compSubt(new Complex(6,0),c); } else { var c1 = compAdd(c,new Complex(7,0)); } var s = compContFrac(c1,2,1/2,5/6,22/15,116/55,942/319,17622/4553); s = compDiv(compDiv(compDiv(compAdd(compDiv(compAdd(s,new Complex(3,0)),c1),new Complex(2,0)),c1),c1),c1); for (var j=0;j<7;j++) { c1.r--; var c3 = compMult(compMult(c1,c1),compMult(c1,c1)); c3.r /= 6; c3.i /= 6; s = compAdd(s,compDiv(One,c3)); } if (c.r>=0) return s; return compSubt(c2,s); }; // 55. compHexaGamma compHexaGamma = function(c) { if (c.r<0) { var u = compCot(Mult(Pi,c)); var c2 = compMult(compAdd(compMult(compAdd(compMult(compMult(u,u),compMult(new Complex(24,0)),new Complex(40,0)),compMult(u,u)),new Complex(16,0)),u)); c2.r *= -Math.PI*Math.PI*Math.PI*Math.PI*Math.PI; c2.i *= -Math.PI*Math.PI*Math.PI*Math.PI*Math.PI; var c1 = compSubt(new Complex(6,0),c); } else { var c1 = compAdd(c,new Complex(7,0)); } var s = compContFrac(c1,10,7/10,71/70,870/497,15092/6177,156910/46893,2585118/595595); s = compDiv(compDiv(compDiv(compDiv(compAdd(compDiv(compAdd(s,new Complex(12,0)),c1),new Complex(6,0)),c1),c1),c1),c1); s.r = -s.r; s.i = -s.i; for (j=0;j<7;j++) { c1.r--; var c3 = compMult(compMult(compMult(c1,c1),compMult(c1,c1)),c1); c3.r /= 24; c3.i /= 24; s = compSubt(s,compDiv(One,c3)); } if (c.r>=0) return s; return compSubt(s,c2); }; // 56. compTable // Not utilized in FMX environment, but included to preserve original JS integrity compTable = function(max,buttext) { compW('
'); for (var j=0;j'); for (var k=0;k<6;k++) { compW(''); } compW(''); } compW('
'); }; ///////////////////////////////////////// // Additional functions from Edwin Heijmen's ComplexNumberClass ///////////////////////////////////////// // 57. compEquals compEquals = function(c) { // this function tells whether complex number c and this complex number are equal or not return this.re==c.re&&this.im==c.im; }; // 58. compConjugate compConjugate = function() { // this function returns the complex conjugate of this complex number return new ComplexNumber(this.re,-this.im); }; // 59. compModulo compModulo = function() { // this function returns the modulo of this complex number (length of vector) return Math.sqrt(this.re*this.re+this.im*this.im); } ////////////////////////////////////////// // UI Functionality ////////////////////////////////////////// a = new compMakeArray(48); a[1] = 'compShow(compChSign(compInput(re,im)))'; // +/- a[2] = 'compShow(compDiv(One,compInput(re,im)))'; // 1/z a[3] = 'compShow(new Complex(0,0))'; // C a[4] = 'compShow(Pi)'; // Pi a[5] = 'compShow(compAbs(compInp()))'; // Abs a[6] = 'sp = ((sp+1)%20);st[sp]=compInp()'; // Enter a[7] = 'Mem = compAdd(Mem,compInput(re,im))'; // M+ a[8] = 'Mem = compSubt(Mem,compInput(re,im))'; // M- a[9] = 'Mem = compMult(Mem,compInput(re,im))'; // M* a[10] = 'Mem = compDiv(Mem,compInput(re,im))'; // M/ a[11] = 'Mem = compInp()'; // Min a[12] = 'compShow(Mem)'; // MR a[13] = 'compShow(compAdd(st[sp],compInput(re,im)));sp = ((sp+19)%20)'; // + a[14] = 'compShow(compSubt(st[sp],compInput(re,im)));sp = ((sp+19)%20)'; // - a[15] = 'compShow(compMult(st[sp],compInput(re,im)));sp = ((sp+19)%20)'; // * a[16] = 'compShow(compDiv(st[sp],compInput(re,im)));sp = ((sp+19)%20)'; // / a[17] = 'compShow(compPower(st[sp],compInput(re,im)));sp = ((sp+19)%20)'; // Power a[18] = 'compShow(compRoot(st[sp],compInput(re,im)));sp = ((sp+19)%20)'; // Root a[19] = 'compShow(compLog(compInput(re,im)))'; // log a[20] = 'compShow(compExp(compInput(re,im)))'; // exp a[21] = 'compShow(compMult(compInput(re,im),compInput(re,im)))'; // x^2 a[22] = 'compShow(compMult(compInput(re,im),compMult(compInput(re,im),compInput(re,im))))'; // x^3 a[23] = 'compShow(compSqrt(compInput(re,im)))'; // sqrt a[24] = 'compShow(compFactorial(compInput(re,im)))'; // ! a[25] = 'compShow(ToRad.r?compSin(compDiv(compInput(re,im),ToRad)):compSinh(compInput(re,im)))'; // sin a[26] = 'compShow(ToRad.r?compCos(compDiv(compInput(re,im),ToRad)):compCosh(compInput(re,im)))'; // cos a[27] = 'compShow(ToRad.r?compTan(compDiv(compInput(re,im),ToRad)):compTanh(compInput(re,im)))'; // tan a[28] = 'compShow(ToRad.r?compCot(compDiv(compInput(re,im),ToRad)):compCoth(compInput(re,im)))'; // cot a[29] = 'compShow(ToRad.r?compSec(compDiv(compInput(re,im),ToRad)):compSech(compInput(re,im)))'; // sec a[30] = 'compShow(ToRad.r?compCosec(compDiv(compInput(re,im),ToRad)):compCosech(compInput(re,im)))'; // cosec a[31] = 'compShow(ToRad.r?compMult(compAsin(compInput(re,im)),ToRad):compAsinh(compInput(re,im)))'; // asin a[32] = 'compShow(ToRad.r?compMult(compAcos(compInput(re,im)),ToRad):compAcosh(compInput(re,im)))'; // acos a[33] = 'compShow(ToRad.r?compMult(compAtan(compInput(re,im)),ToRad):compAtanh(compInput(re,im)))'; // atan a[34] = 'compShow(ToRad.r?compMult(compAcot(compInput(re,im)),ToRad):compAcoth(compInput(re,im)))'; // acot a[35] = 'compShow(ToRad.r?compMult(compAsec(compInput(re,im)),ToRad):compAsech(compInput(re,im)))'; // asec a[36] = 'compShow(ToRad.r?compMult(compAcosec(compInput(re,im)),ToRad):compAcosech(compInput(re,im)))'; // acosec a[37] = 'compShow(compLogGamma(compInput(re,im)))'; //log gamma a[38] = 'compShow(compDiGamma(compInput(re,im)))'; //digamma a[39] = 'compShow(compTriGamma(compInput(re,im)))'; //trigamma a[40] = 'compShow(compTetraGamma(compInput(re,im)))'; //tetragamma a[41] = 'compShow(compPentaGamma(compInput(re,im)))'; //pentagamma a[42] = 'compShow(compHexaGamma(compInput(re,im)))'; //hexagamma for (var j=0;j<=20;j++) st[j] = new Complex(0,0); /* original JS preserved document.open() compW('
'); compW(' + i'); compW('

'); compTable(4," +/- 1/z C Pi Abs Enter M+ M- M* M/ Min MR + - * / PowerRoot log exp z^2 z^3 sqrt ! "); compW('

Hyperbolic'); compW('Radians'); compW('Degrees'); compW('Gradians
'); compTable(2," sin cos tan cot sec cosecasin acos atan acot asec acsc "); compW('
Polygamma functions
'); compTable(1,"log G Di Tri TetraPentaHexa"); compW('
'); //document.close() */ compShow(new Complex(0,0)); /* original JS preserved document.forms[0].HRDG[2].checked="1" */ } // closes the 'if' statement that checked if this file had already been included