// > CustomCode.functionSelect:13 algebriteintegral = Algebrite.eval('integral('+fTyp+')').toString(); // > CustomCode.functionSelect:14 algebriteintegralprintfull = Algebrite.run('printfull('+algebriteintegral+')').toString(); // > CustomCode.functionSelect:15 algebriteintegralprintfullshow =true; // > CustomCode.functionSelect:16 } else if (option=="a*sin(nx)") { //2 // > CustomCode.functionSelect:17 fTyp = a+"*sin("+n+"*x)"; // > CustomCode.functionSelect:18 min = 0; // > CustomCode.functionSelect:19 max = 2*Math.PI; // > CustomCode.functionSelect:20 fDisp = "a*sin(nx)"; // > CustomCode.functionSelect:21 fTypS = (-a/n)+"*cos("+n+"*x)"; // > CustomCode.functionSelect:22 // need this to work // > CustomCode.functionSelect:23 // // > CustomCode.functionSelect:24 algebriteintegral = Algebrite.eval('integral('+fTyp+')').toString(); // > CustomCode.functionSelect:25 algebriteintegralprintfull = Algebrite.run('printfull('+algebriteintegral+')').toString(); // > CustomCode.functionSelect:26 algebriteintegralprintfullshow =true; // > CustomCode.functionSelect:27 } else if (option=="a*sin(mx) + b*cos(nx)") { //3 // > CustomCode.functionSelect:28 // > CustomCode.functionSelect:29 fTyp = a+"*sin("+m+"*x) + "+b+"*cos("+n+"*x)"; // > CustomCode.functionSelect:30 min = 0; // > CustomCode.functionSelect:31 max = 2*Math.PI; // > CustomCode.functionSelect:32 fDisp = "a*sin(mx) + b*cos(nx)"; // > CustomCode.functionSelect:33 // fTypS = (b/n)+"*sin("+n+"*x) + "+(-a/n)+"*cos("+n+"*x)"; // > CustomCode.functionSelect:34 fTypS = (-a/m)+"*cos("+m+"*x)+" +(b/n)+"*sin("+n+"*x)"; // > CustomCode.functionSelect:35 // need this to work // > CustomCode.functionSelect:36 // // > CustomCode.functionSelect:37 algebriteintegral = Algebrite.eval('integral('+fTyp+')').toString(); // > CustomCode.functionSelect:38 algebriteintegralprintfull = Algebrite.run('printfull('+algebriteintegral+')').toString(); // > CustomCode.functionSelect:39 algebriteintegralprintfullshow =true; // > CustomCode.functionSelect:40 } else if (option=="b*cos(mx)*sin(nx)") { //4 // > CustomCode.functionSelect:41 b=1; //give it some line to see // > CustomCode.functionSelect:42 fTyp = b+"*cos("+m+"*x)*sin("+n+"*x)"; // > CustomCode.functionSelect:43 min = 0; // > CustomCode.functionSelect:44 max = 2*Math.PI; // > CustomCode.functionSelect:45 fDisp = "b*cos(mx)*sin(nx)"; // > CustomCode.functionSelect:46 fTypS = (b/(m*m-n*n))+"*("+m+"*sin("+m+"*x)*sin("+n+"*x) + "+n+"*cos("+m+"*x)*cos("+n+"*x))"; // > CustomCode.functionSelect:47 // no solutuon algebrite // > CustomCode.functionSelect:48 algebriteintegral = fTypS; // > CustomCode.functionSelect:49 algebriteintegralprintfullshow =false; // > CustomCode.functionSelect:50 // algebriteintegral = Algebrite.eval('integral('+fTyp+')').toString(); // > CustomCode.functionSelect:51 //algebriteintegralprintfull = Algebrite.run('printfull('+algebriteintegral+')').toString(); // > CustomCode.functionSelect:52 //algebriteintegralprintfullshow =true; // > CustomCode.functionSelect:53 } else if (option=="a*cos(mx)*cos(nx)") { //5 // > CustomCode.functionSelect:54 fTyp = a+"*cos("+m+"*x)*cos("+n+"*x)"; // > CustomCode.functionSelect:55 min = 0; // > CustomCode.functionSelect:56 max = 2*Math.PI; // > CustomCode.functionSelect:57 fDisp = "a*cos(mx)*cos(nx)"; // > CustomCode.functionSelect:58 fTypS = (a/(m*m-n*n))+"*("+m+"*sin("+m+"*x)*cos("+n+"*x) + "+(-n)+"*cos("+m+"*x)*sin("+n+"*x))"; // > CustomCode.functionSelect:59 //no solutuon algebrite // > CustomCode.functionSelect:60 algebriteintegral = fTypS; // > CustomCode.functionSelect:61 algebriteintegralprintfullshow =false; // > CustomCode.functionSelect:62 } else if (option=="b*sin(mx)*sin(nx)") { //6 // > CustomCode.functionSelect:63 fTyp = b+"*sin("+m+"*x)*sin("+n+"*x)"; // > CustomCode.functionSelect:64 min = 0; // > CustomCode.functionSelect:65 max = 2*Math.PI; // > CustomCode.functionSelect:66 fDisp = "b*sin(mx)*sin(nx)"; // > CustomCode.functionSelect:67 fTypS = (b/(m*m-n*n))+"*("+n+"*sin("+m+"*x)*cos("+n+"*x) + "+(-m)+"*cos("+m+"*x)*sin("+n+"*x))"; // > CustomCode.functionSelect:68 //no solutuon algebrite // > CustomCode.functionSelect:69 algebriteintegral = fTypS; // > CustomCode.functionSelect:70 algebriteintegralprintfullshow =false; // > CustomCode.functionSelect:71 } else if (option=="cos(mx)*(a*cos(nx) + b*sin(nx))") { //7 // > CustomCode.functionSelect:72 fTyp = "cos("+m+"*x)*("+a+"*cos("+n+"*x) + "+b+"*sin("+n+"*x))"; // > CustomCode.functionSelect:73 min = 0; // > CustomCode.functionSelect:74 max = 2*Math.PI; // > CustomCode.functionSelect:75 fDisp = "cos(mx)*(a*cos(nx) + b*sin(nx))"; // > CustomCode.functionSelect:76 fTypS = (n/(m*m-n*n))+"*cos("+m+"*x)*("+b+"*cos("+n+"*x)-"+a+"*sin("+n+"*x)) + "+(m/(m*m-n*n))+"*sin("+m+"*x)*("+a+"*cos("+n+"*x)+"+b+"*sin("+n+"*x))"; // > CustomCode.functionSelect:77 //no solutuon algebrite // > CustomCode.functionSelect:78 algebriteintegral = fTypS; // > CustomCode.functionSelect:79 algebriteintegralprintfullshow =false; // > CustomCode.functionSelect:80 } else if (option=="Sawtooth Cosine") { //8 // > CustomCode.functionSelect:81 fTyp = a+"*(x-3.14159+"+b+")*cos("+n+"*x)"; // > CustomCode.functionSelect:82 min = 0; // > CustomCode.functionSelect:83 max = 2*Math.PI; // > CustomCode.functionSelect:84 fDisp = "a*(x-π+b)*cos(nx)"; // > CustomCode.functionSelect:85 // fTypS = (a/(n*n))+"*("+n+"*(x-3.14159+"+b+")*sin("+n+"*x)+cos("+n+"*x))-1"; // > CustomCode.functionSelect:86 fTypS = (a/(n*n))+"*("+n+"*(x-3.14159+"+b+")*sin("+n+"*x)+cos("+n+"*x))"; // > CustomCode.functionSelect:87 // need this to work // > CustomCode.functionSelect:88 // // > CustomCode.functionSelect:89 algebriteintegral = Algebrite.eval('integral('+fTyp+')').toString(); // > CustomCode.functionSelect:90 algebriteintegralprintfull = Algebrite.run('printfull('+algebriteintegral+')').toString(); // > CustomCode.functionSelect:91 algebriteintegralprintfullshow =true; // > CustomCode.functionSelect:92 } else if (option=="Sawtooth Sine") { //9 // > CustomCode.functionSelect:93 // fTyp = a+"*(x-3.14159+"+b+")*sin("+n+"*x)"; // > CustomCode.functionSelect:94 fTyp = a+"*(x-pi+"+b+")*sin("+n+"*x)"; // > CustomCode.functionSelect:95 min = 0; // > CustomCode.functionSelect:96 max = 2*Math.PI; // > CustomCode.functionSelect:97 fDisp = "a*(x-π+b)*sin(nx)"; // > CustomCode.functionSelect:98 fTypS = (a/(n*n))+"*("+(-n)+"*(x-3.14159+"+b+")*cos("+n+"*x)+sin("+n+"*x))"; // > CustomCode.functionSelect:99 // need this to work // > CustomCode.functionSelect:100 // // > CustomCode.functionSelect:101 algebriteintegral = Algebrite.eval('integral('+fTyp+')').toString(); // > CustomCode.functionSelect:102 algebriteintegralprintfull = Algebrite.run('printfull('+algebriteintegral+')').toString(); // > CustomCode.functionSelect:103 algebriteintegralprintfullshow =true; // > CustomCode.functionSelect:104 } else if (option=="Rectangular Cosine") { //10 // > CustomCode.functionSelect:105 // fTyp = a+"*step(x-3.14159+"+b+")*cos("+n+"*x)"; // > CustomCode.functionSelect:106 fTyp = a+"*step(x-pi+"+b+")*cos("+n+"*x)"; // > CustomCode.functionSelect:107 min = 0; // > CustomCode.functionSelect:108 max = 2*Math.PI; // > CustomCode.functionSelect:109 fDisp = "a*step(x-π+b)*cos(nx)"; // > CustomCode.functionSelect:110 fTypS = (a/n)+"*step(x-3.14159+"+b+")*sin("+n+"*x)"; // > CustomCode.functionSelect:111 //no solutuon algebrite // > CustomCode.functionSelect:112 algebriteintegral = fTypS; // > CustomCode.functionSelect:113 algebriteintegralprintfullshow =false; // > CustomCode.functionSelect:114 } // > CustomCode.functionSelect:115 else if (option=="Rectangular Sine") { //11 // > CustomCode.functionSelect:116 // fTyp = a+"*step(x-3.14159+"+b+")*sin("+n+"*x)"; // > CustomCode.functionSelect:117 fTyp = a+"*step(x-pi+"+b+")*sin("+n+"*x)"; // > CustomCode.functionSelect:118 min = 0; // > CustomCode.functionSelect:119 max = 2*Math.PI; // > CustomCode.functionSelect:120 fDisp = "a*step(x-π+b)*sin(nx)"; // > CustomCode.functionSelect:121 fTypS = (-a/n)+"*step(x-3.14159+"+b+")*cos("+n+"*x)"; // > CustomCode.functionSelect:122 //no solutuon algebrite // > CustomCode.functionSelect:123 algebriteintegral = fTypS; // > CustomCode.functionSelect:124 algebriteintegralprintfullshow =false; // > CustomCode.functionSelect:125 } else if (option=="Rectangular Pulse Cosine") { // > CustomCode.functionSelect:126 fTyp = a+"*(step(x-3.14159+"+b+")-step(x-3.14159+"+0.25*m+"))*cos("+n+"*x)"; // > CustomCode.functionSelect:127 min = 0; // > CustomCode.functionSelect:128 max = 2*Math.PI; // > CustomCode.functionSelect:129 fDisp = "a*(step(x-π+b)-step(x-π+(m/4)))*cos(nx)"; // > CustomCode.functionSelect:130 fTypS = (a/n)+"*(step(x-3.14159+"+b+")-step(x-3.14159+"+0.25*m+"))*sin("+n+"*x)"; // > CustomCode.functionSelect:131 //no solutuon algebrite // > CustomCode.functionSelect:132 algebriteintegral = fTypS; // > CustomCode.functionSelect:133 algebriteintegralprintfullshow =false; // > CustomCode.functionSelect:134 } else if (option=="Rectangular Pulse Sine") { // > CustomCode.functionSelect:135 //fTyp = a+"*(step(x-3.14159+"+b+")-step(x-3.14159+"+0.25*m+"))*sin("+n+"*x)"; // > CustomCode.functionSelect:136 fTyp = a+"*(step(x-pi+"+b+")-step(x-pi+"+0.25*m+"))*sin("+n+"*x)"; // > CustomCode.functionSelect:137 min = 0; // > CustomCode.functionSelect:138 max = 2*Math.PI; // > CustomCode.functionSelect:139 fDisp = "a*(step(x-π+b)-step(x-π+(m/4)))*sin(nx)"; // > CustomCode.functionSelect:140 fTypS = (-a/n)+"*(step(x-3.14159+"+b+")-step(x-3.14159+"+0.25*m+"))*cos("+n+"*x)"; // > CustomCode.functionSelect:141 //no solutuon algebrite // > CustomCode.functionSelect:142 algebriteintegral = fTypS; // > CustomCode.functionSelect:143 algebriteintegralprintfullshow =false; // > CustomCode.functionSelect:144 } else if (option=="Gaussian Pulse Cosine") { // > CustomCode.functionSelect:145 fTyp = a+"*2.718281828^(-"+m*m+"*(x-3.14159+"+b+")*(x-3.14159+"+b+"))*cos("+n+"*x)"; // > CustomCode.functionSelect:146 min = 0; // > CustomCode.functionSelect:147 max = 2*Math.PI; // > CustomCode.functionSelect:148 fDisp = "a*e^(-(m*(x-π+b))^2)*cos(nx)"; // > CustomCode.functionSelect:149 fTypS = "3.14159^0.5"; // > CustomCode.functionSelect:150 //no solutuon algebrite // > CustomCode.functionSelect:151 algebriteintegral = fTypS; // > CustomCode.functionSelect:152 algebriteintegralprintfullshow =false; // > CustomCode.functionSelect:153 } else if (option=="Gaussian Pulse Sine") { // > CustomCode.functionSelect:154 fTyp = a+"*2.718281828^(-"+m*m+"*(x-3.14159+"+b+")*(x-3.14159+"+b+"))*sin("+n+"*x)"; // > CustomCode.functionSelect:155 min = 0; // > CustomCode.functionSelect:156 max = 2*Math.PI; // > CustomCode.functionSelect:157 fDisp = "a*e^(-(m*(x-π+b))^2)*sin(nx)"; // > CustomCode.functionSelect:158 fTypS = "3.14159^0.5"; // > CustomCode.functionSelect:159 //no solutuon algebrite // > CustomCode.functionSelect:160 algebriteintegral = fTypS; // > CustomCode.functionSelect:161 algebriteintegralprintfullshow =false; // > CustomCode.functionSelect:162 } // > CustomCode.functionSelect:163 // > CustomCode.functionSelect:164 } // > CustomCode.functionSelect:165 _model.addToInitialization(function() { if (!__pagesEnabled["Init Page"]) return; a = 1.0; // > Initialization.Init Page:1 b = 0; // > Initialization.Init Page:2 m = 1.0; // > Initialization.Init Page:3 n = 10.0; // > Initialization.Init Page:4 functionSelect(); // > Initialization.Init Page:5 }); _model.addToFixedRelations(function() { _isPaused = _model.isPaused(); _isPlaying = _model.isPlaying(); }); _model.addToFixedRelations(function() { if (!__pagesEnabled["FixRel Page"]) return; functionSelect(); // > FixedRelations.FixRel Page:1 if (m==n) { // > FixedRelations.FixRel Page:2 m = 1; // > FixedRelations.FixRel Page:3 n = 2; // > FixedRelations.FixRel Page:4 } // > FixedRelations.FixRel Page:5 }); _model.addToFixedRelations(function() { if (!__pagesEnabled["axes"]) return; _view.plottingPanel.getAxisX().setAbsoluteY(_view.plottingPanel.getGrid().getFixedTickY()); // > FixedRelations.axes:1 _view.plottingPanel.getAxisY().setAbsoluteX(_view.plottingPanel.getGrid().getFixedTickX()); // > FixedRelations.axes:2 }); _model.addToFixedRelations(function() { _isPaused = _model.isPaused(); _isPlaying = _model.isPlaying(); }); _model._fontResized = function(iBase,iSize,iDelta) { _view._fontResized(iBase,iSize,iDelta); }; // end of _fontResized function _getViews() { var _viewsInfo = []; var _counter = 0; _viewsInfo[_counter++] = { name : "Simulation View", width : 800, height : 600 }; return _viewsInfo; } // end of _getViews function _selectView(_viewNumber) { _view = null; _view = new e_Fourier_2_View(_topFrame,_viewNumber,_libraryPath,_codebasePath); var _view_super_reset = _view._reset; _view._reset = function() { _view_super_reset(); switch(_viewNumber) { case -10 : break; // make Lint happy default : case 0: _view.label.linkProperty("Font", function() { return font; }, function(_v) { font = _v; } ); // Simulation View linking property 'Font' for element 'label' _view.functionSelect.linkProperty("Options", function() { return ["a*cos(nx)", "a*sin(nx)", "a*sin(mx) + b*cos(nx)", "b*cos(mx)*sin(nx)", "a*cos(mx)*cos(nx)", "b*sin(mx)*sin(nx)", "cos(mx)*(a*cos(nx) + b*sin(nx))", "Sawtooth Cosine", "Sawtooth Sine", "Rectangular Cosine", "Rectangular Sine", "Rectangular Pulse Cosine", "Rectangular Pulse Sine", "Gaussian Pulse Cosine", "Gaussian Pulse Sine"]; } ); // Simulation View linking property 'Options' for element 'functionSelect' _view.functionSelect.setAction("OnChange", function(_data,_info) { functionSelect (); }); // Simulation View setting action 'OnChange' for element 'functionSelect' _view.functionSelect.linkProperty("Font", function() { return font; }, function(_v) { font = _v; } ); // Simulation View linking property 'Font' for element 'functionSelect' _view.functionField.linkProperty("Value", function() { return fDisp; }, function(_v) { fDisp = _v; } ); // Simulation View linking property 'Value' for element 'functionField' _view.functionField.linkProperty("Font", function() { return font; }, function(_v) { font = _v; } ); // Simulation View linking property 'Font' for element 'functionField' _view.showIntegral.setAction("OnCheckOff", function(_data,_info) { showINT = false; algebriteintegralprintfullshow=false; }); // Simulation View setting action 'OnCheckOff' for element 'showIntegral' _view.showIntegral.linkProperty("Font", function() { return font; }, function(_v) { font = _v; } ); // Simulation View linking property 'Font' for element 'showIntegral' _view.showIntegral.setAction("OnCheckOn", function(_data,_info) { showINT = true; algebriteintegralprintfullshow=true; }); // Simulation View setting action 'OnCheckOn' for element 'showIntegral' _view.a.linkProperty("Font", function() { return font; }, function(_v) { font = _v; } ); // Simulation View linking property 'Font' for element 'a' _view.fielda.linkProperty("Value", function() { return a; }, function(_v) { a = _v; } ); // Simulation View linking property 'Value' for element 'fielda' _view.fielda.setAction("OnChange", function(_data,_info) { functionSelect (); // to evaluate algebrite; }); // Simulation View setting action 'OnChange' for element 'fielda' _view.fielda.linkProperty("Font", function() { return font; }, function(_v) { font = _v; } ); // Simulation View linking property 'Font' for element 'fielda' _view.slidera.linkProperty("Value", function() { return a; }, function(_v) { a = _v; } ); // Simulation View linking property 'Value' for element 'slidera' _view.slidera.setAction("OnChange", function(_data,_info) { functionSelect (); // to evaluate algebrite; }); // Simulation View setting action 'OnChange' for element 'slidera' _view.b.linkProperty("Font", function() { return font; }, function(_v) { font = _v; } ); // Simulation View linking property 'Font' for element 'b' _view.fieldb.linkProperty("Value", function() { return b; }, function(_v) { b = _v; } ); // Simulation View linking property 'Value' for element 'fieldb' _view.fieldb.setAction("OnChange", function(_data,_info) { functionSelect (); // to evaluate algebrite; }); // Simulation View setting action 'OnChange' for element 'fieldb' _view.fieldb.linkProperty("Font", function() { return font; }, function(_v) { font = _v; } ); // Simulation View linking property 'Font' for element 'fieldb' _view.sliderb.linkProperty("Value", function() { return b; }, function(_v) { b = _v; } ); // Simulation View linking property 'Value' for element 'sliderb' _view.sliderb.setAction("OnChange", function(_data,_info) { functionSelect (); // to evaluate algebrite; }); // Simulation View setting action 'OnChange' for element 'sliderb' _view.m.linkProperty("Font", function() { return font; }, function(_v) { font = _v; } ); // Simulation View linking property 'Font' for element 'm' _view.fieldm.linkProperty("Value", function() { return m; }, function(_v) { m = _v; } ); // Simulation View linking property 'Value' for element 'fieldm' _view.fieldm.setAction("OnChange", function(_data,_info) { functionSelect (); // to evaluate algebrite; }); // Simulation View setting action 'OnChange' for element 'fieldm' _view.fieldm.linkProperty("Font", function() { return font; }, function(_v) { font = _v; } ); // Simulation View linking property 'Font' for element 'fieldm' _view.sliderm.linkProperty("Value", function() { return m; }, function(_v) { m = _v; } ); // Simulation View linking property 'Value' for element 'sliderm' _view.sliderm.setAction("OnChange", function(_data,_info) { functionSelect (); // to evaluate algebrite; }); // Simulation View setting action 'OnChange' for element 'sliderm' _view.n.linkProperty("Font", function() { return font; }, function(_v) { font = _v; } ); // Simulation View linking property 'Font' for element 'n' _view.fieldn.linkProperty("Value", function() { return n; }, function(_v) { n = _v; } ); // Simulation View linking property 'Value' for element 'fieldn' _view.fieldn.setAction("OnChange", function(_data,_info) { functionSelect (); // to evaluate algebrite; }); // Simulation View setting action 'OnChange' for element 'fieldn' _view.fieldn.linkProperty("Font", function() { return font; }, function(_v) { font = _v; } ); // Simulation View linking property 'Font' for element 'fieldn' _view.slidern.linkProperty("Value", function() { return n; }, function(_v) { n = _v; } ); // Simulation View linking property 'Value' for element 'slidern' _view.slidern.setAction("OnChange", function(_data,_info) { functionSelect (); // to evaluate algebrite; }); // Simulation View setting action 'OnChange' for element 'slidern' _view.plottingPanel.linkProperty("AxisYFont", function() { return font; }, function(_v) { font = _v; } ); // Simulation View linking property 'AxisYFont' for element 'plottingPanel' _view.plottingPanel.linkProperty("MaximumX", function() { return 2*Math.PI; } ); // Simulation View linking property 'MaximumX' for element 'plottingPanel' _view.plottingPanel.linkProperty("TRMessage", function() { return "Fourier Expansion"+" Function="+fTyp; } ); // Simulation View linking property 'TRMessage' for element 'plottingPanel' _view.plottingPanel.linkProperty("XTickStep", function() { return Math.PI; } ); // Simulation View linking property 'XTickStep' for element 'plottingPanel' _view.plottingPanel.linkProperty("AxisXFont", function() { return font; }, function(_v) { font = _v; } ); // Simulation View linking property 'AxisXFont' for element 'plottingPanel' _view.plottingPanel.linkProperty("TLMessage", function() { return showINT?algebriteintegral:""; } ); // Simulation View linking property 'TLMessage' for element 'plottingPanel' _view.analyticCurve.linkProperty("FunctionY", function() { return fTyp; }, function(_v) { fTyp = _v; } ); // Simulation View linking property 'FunctionY' for element 'analyticCurve' _view.analyticCurve.linkProperty("Maximum", function() { return 2*Math.PI; } ); // Simulation View linking property 'Maximum' for element 'analyticCurve' _view.integralAlgebrite.linkProperty("FunctionY", function() { return algebriteintegralprintfull; }, function(_v) { algebriteintegralprintfull = _v; } ); // Simulation View linking property 'FunctionY' for element 'integralAlgebrite' _view.integralAlgebrite.linkProperty("Maximum", function() { return 2*Math.PI; } ); // Simulation View linking property 'Maximum' for element 'integralAlgebrite' _view.integralAlgebrite.linkProperty("Visibility", function() { return algebriteintegralprintfullshow&&showINT; } ); // Simulation View linking property 'Visibility' for element 'integralAlgebrite' _view.integral.linkProperty("FunctionY", function() { return fTypS; }, function(_v) { fTypS = _v; } ); // Simulation View linking property 'FunctionY' for element 'integral' _view.integral.linkProperty("NumPoints", function() { return q; }, function(_v) { q = _v; } ); // Simulation View linking property 'NumPoints' for element 'integral' _view.integral.linkProperty("Maximum", function() { return 2*Math.PI; } ); // Simulation View linking property 'Maximum' for element 'integral' _view.integral.linkProperty("Visibility", function() { return showINT; }, function(_v) { showINT = _v; } ); // Simulation View linking property 'Visibility' for element 'integral' _view.cutoffzero.linkProperty("NumPoints", function() { return q; }, function(_v) { q = _v; } ); // Simulation View linking property 'NumPoints' for element 'cutoffzero' _view.zero.linkProperty("NumPoints", function() { return q; }, function(_v) { q = _v; } ); // Simulation View linking property 'NumPoints' for element 'zero' _view.cutoff2pi.linkProperty("NumPoints", function() { return q; }, function(_v) { q = _v; } ); // Simulation View linking property 'NumPoints' for element 'cutoff2pi' _view.tau.linkProperty("Font", function() { return font; }, function(_v) { font = _v; } ); // Simulation View linking property 'Font' for element 'tau' _view.xaxis.linkProperty("Font", function() { return font; }, function(_v) { font = _v; } ); // Simulation View linking property 'Font' for element 'xaxis' break; } // end of switch }; // end of new reset _model.setView(_view); _model.reset(); _view._enableEPub(); } // end of _selectView _model.setAutoplay(false); _model.setFPS(20); _model.setStepsPerDisplay(1); _selectView(_model._autoSelectView(_getViews())); // this includes _model.reset() return _model; } function e_Fourier_2_View (_topFrame,_viewNumber,_libraryPath,_codebasePath) { var _view; switch(_viewNumber) { case -10 : break; // make Lint happy default : case 0: _view = e_Fourier_2_View_0 (_topFrame); break; } // end of switch if (_codebasePath) _view._setResourcePath(_codebasePath); if (_libraryPath) _view._setLibraryPath(_libraryPath); _view._addDescriptionPage('Fourier Coefficients','./e_Fourier_2_Intro_1.html'); _view._addDescriptionPage('Description','./e_Fourier_2_Intro_2.html'); _view._addDescriptionPage('Experiments','./e_Fourier_2_Intro_3.html'); _view._addDescriptionPage('Authors','./e_Fourier_2_Intro_4.html'); return _view; } // end of main function function e_Fourier_2_View_0 (_topFrame) { var _view = EJSS_CORE.createView(_topFrame); _view._reset = function() { _view._clearAll(); _view._addElement(EJSS_INTERFACE.panel,"panel", _view._topFrame) // EJsS HtmlView.Simulation View: declaration of element 'panel' ; _view._addElement(EJSS_INTERFACE.panel,"functionPanel", _view.panel) // EJsS HtmlView.Simulation View: declaration of element 'functionPanel' ; _view._addElement(EJSS_INTERFACE.imageAndTextButton,"label", _view.functionPanel) // EJsS HtmlView.Simulation View: declaration of element 'label' .setProperty("Text","Function: ") // EJsS HtmlView.Simulation View: setting property 'Text' for element 'label' ; _view._addElement(EJSS_INTERFACE.comboBox,"functionSelect", _view.functionPanel) // EJsS HtmlView.Simulation View: declaration of element 'functionSelect' ; _view._addElement(EJSS_INTERFACE.textField,"functionField", _view.functionPanel) // EJsS HtmlView.Simulation View: declaration of element 'functionField' .setProperty("Width","22vw") // EJsS HtmlView.Simulation View: setting property 'Width' for element 'functionField' .setProperty("Editable",false) // EJsS HtmlView.Simulation View: setting property 'Editable' for element 'functionField' ; _view._addElement(EJSS_INTERFACE.checkBox,"showIntegral", _view.functionPanel) // EJsS HtmlView.Simulation View: declaration of element 'showIntegral' .setProperty("Checked",false) // EJsS HtmlView.Simulation View: setting property 'Checked' for element 'showIntegral' .setProperty("Background","Red") // EJsS HtmlView.Simulation View: setting property 'Background' for element 'showIntegral' .setProperty("Text","Show Integral") // EJsS HtmlView.Simulation View: setting property 'Text' for element 'showIntegral' ; _view._addElement(EJSS_INTERFACE.panel,"controlPanel", _view.panel) // EJsS HtmlView.Simulation View: declaration of element 'controlPanel' ; _view._addElement(EJSS_INTERFACE.imageAndTextButton,"a", _view.controlPanel) // EJsS HtmlView.Simulation View: declaration of element 'a' .setProperty("Background","rgba(0,255,255,1)") // EJsS HtmlView.Simulation View: setting property 'Background' for element 'a' .setProperty("Text","a = ") // EJsS HtmlView.Simulation View: setting property 'Text' for element 'a' ; _view._addElement(EJSS_INTERFACE.numberField,"fielda", _view.controlPanel) // EJsS HtmlView.Simulation View: declaration of element 'fielda' .setProperty("Width","5vw") // EJsS HtmlView.Simulation View: setting property 'Width' for element 'fielda' .setProperty("Format","a = 0.00") // EJsS HtmlView.Simulation View: setting property 'Format' for element 'fielda' .setProperty("Editable",true) // EJsS HtmlView.Simulation View: setting property 'Editable' for element 'fielda' ; _view._addElement(EJSS_INTERFACE.slider,"slidera", _view.controlPanel) // EJsS HtmlView.Simulation View: declaration of element 'slidera' .setProperty("Width","10vw") // EJsS HtmlView.Simulation View: setting property 'Width' for element 'slidera' .setProperty("Minimum",-3.0) // EJsS HtmlView.Simulation View: setting property 'Minimum' for element 'slidera' .setProperty("Maximum",3.0) // EJsS HtmlView.Simulation View: setting property 'Maximum' for element 'slidera' .setProperty("Format","a = 0.00") // EJsS HtmlView.Simulation View: setting property 'Format' for element 'slidera' .setProperty("Background","rgba(0,255,255,1)") // EJsS HtmlView.Simulation View: setting property 'Background' for element 'slidera' .setProperty("Tooltip","Adjust value of a") // EJsS HtmlView.Simulation View: setting property 'Tooltip' for element 'slidera' ; _view._addElement(EJSS_INTERFACE.imageAndTextButton,"b", _view.controlPanel) // EJsS HtmlView.Simulation View: declaration of element 'b' .setProperty("Background","rgba(255,0,128,1)") // EJsS HtmlView.Simulation View: setting property 'Background' for element 'b' .setProperty("Text","b = ") // EJsS HtmlView.Simulation View: setting property 'Text' for element 'b' ; _view._addElement(EJSS_INTERFACE.numberField,"fieldb", _view.controlPanel) // EJsS HtmlView.Simulation View: declaration of element 'fieldb' .setProperty("Width","5vw") // EJsS HtmlView.Simulation View: setting property 'Width' for element 'fieldb' .setProperty("Format","b = 0.00") // EJsS HtmlView.Simulation View: setting property 'Format' for element 'fieldb' .setProperty("Editable",true) // EJsS HtmlView.Simulation View: setting property 'Editable' for element 'fieldb' ; _view._addElement(EJSS_INTERFACE.slider,"sliderb", _view.controlPanel) // EJsS HtmlView.Simulation View: declaration of element 'sliderb' .setProperty("Width","10vw") // EJsS HtmlView.Simulation View: setting property 'Width' for element 'sliderb' .setProperty("Minimum",-6.0) // EJsS HtmlView.Simulation View: setting property 'Minimum' for element 'sliderb' .setProperty("Maximum",6.0) // EJsS HtmlView.Simulation View: setting property 'Maximum' for element 'sliderb' .setProperty("Format","b = 0.00") // EJsS HtmlView.Simulation View: setting property 'Format' for element 'sliderb' .setProperty("Background","rgba(255,0,128,1)") // EJsS HtmlView.Simulation View: setting property 'Background' for element 'sliderb' .setProperty("Font","Adjust value of b") // EJsS HtmlView.Simulation View: setting property 'Font' for element 'sliderb' ; _view._addElement(EJSS_INTERFACE.imageAndTextButton,"m", _view.controlPanel) // EJsS HtmlView.Simulation View: declaration of element 'm' .setProperty("Background","rgba(255,255,64,1)") // EJsS HtmlView.Simulation View: setting property 'Background' for element 'm' .setProperty("Text","m = ") // EJsS HtmlView.Simulation View: setting property 'Text' for element 'm' ; _view._addElement(EJSS_INTERFACE.numberField,"fieldm", _view.controlPanel) // EJsS HtmlView.Simulation View: declaration of element 'fieldm' .setProperty("Width","5vw") // EJsS HtmlView.Simulation View: setting property 'Width' for element 'fieldm' .setProperty("Format","m = 0.0") // EJsS HtmlView.Simulation View: setting property 'Format' for element 'fieldm' .setProperty("Editable",true) // EJsS HtmlView.Simulation View: setting property 'Editable' for element 'fieldm' ; _view._addElement(EJSS_INTERFACE.slider,"sliderm", _view.controlPanel) // EJsS HtmlView.Simulation View: declaration of element 'sliderm' .setProperty("Width","10vw") // EJsS HtmlView.Simulation View: setting property 'Width' for element 'sliderm' .setProperty("Minimum",1) // EJsS HtmlView.Simulation View: setting property 'Minimum' for element 'sliderm' .setProperty("Maximum",10) // EJsS HtmlView.Simulation View: setting property 'Maximum' for element 'sliderm' .setProperty("Format","m = 0") // EJsS HtmlView.Simulation View: setting property 'Format' for element 'sliderm' .setProperty("Background","rgba(255,255,64,1)") // EJsS HtmlView.Simulation View: setting property 'Background' for element 'sliderm' .setProperty("Tooltip","Adjust value of m") // EJsS HtmlView.Simulation View: setting property 'Tooltip' for element 'sliderm' ; _view._addElement(EJSS_INTERFACE.imageAndTextButton,"n", _view.controlPanel) // EJsS HtmlView.Simulation View: declaration of element 'n' .setProperty("Background","rgba(0,192,0,1)") // EJsS HtmlView.Simulation View: setting property 'Background' for element 'n' .setProperty("Text","n = ") // EJsS HtmlView.Simulation View: setting property 'Text' for element 'n' ; _view._addElement(EJSS_INTERFACE.numberField,"fieldn", _view.controlPanel) // EJsS HtmlView.Simulation View: declaration of element 'fieldn' .setProperty("Width","5vw") // EJsS HtmlView.Simulation View: setting property 'Width' for element 'fieldn' .setProperty("Format","n = 0.0") // EJsS HtmlView.Simulation View: setting property 'Format' for element 'fieldn' .setProperty("Editable",true) // EJsS HtmlView.Simulation View: setting property 'Editable' for element 'fieldn' ; _view._addElement(EJSS_INTERFACE.slider,"slidern", _view.controlPanel) // EJsS HtmlView.Simulation View: declaration of element 'slidern' .setProperty("Width","10vw") // EJsS HtmlView.Simulation View: setting property 'Width' for element 'slidern' .setProperty("Minimum",1) // EJsS HtmlView.Simulation View: setting property 'Minimum' for element 'slidern' .setProperty("Maximum",10) // EJsS HtmlView.Simulation View: setting property 'Maximum' for element 'slidern' .setProperty("Format","n = 0") // EJsS HtmlView.Simulation View: setting property 'Format' for element 'slidern' .setProperty("Background","rgba(0,192,0,1)") // EJsS HtmlView.Simulation View: setting property 'Background' for element 'slidern' .setProperty("Tooltip","Adjust value of n") // EJsS HtmlView.Simulation View: setting property 'Tooltip' for element 'slidern' ; _view._addElement(EJSS_DRAWING2D.plottingPanel,"plottingPanel", _view.panel) // EJsS HtmlView.Simulation View: declaration of element 'plottingPanel' .setProperty("Height","83vh") // EJsS HtmlView.Simulation View: setting property 'Height' for element 'plottingPanel' .setProperty("Width","100%") // EJsS HtmlView.Simulation View: setting property 'Width' for element 'plottingPanel' .setProperty("Gutters",[0,0,0,0]) // EJsS HtmlView.Simulation View: setting property 'Gutters' for element 'plottingPanel' .setProperty("YScalePrecision",0) // EJsS HtmlView.Simulation View: setting property 'YScalePrecision' for element 'plottingPanel' .setProperty("XFixedTick",0) // EJsS HtmlView.Simulation View: setting property 'XFixedTick' for element 'plottingPanel' .setProperty("Enabled",true) // EJsS HtmlView.Simulation View: setting property 'Enabled' for element 'plottingPanel' .setProperty("SquareAspect",true) // EJsS HtmlView.Simulation View: setting property 'SquareAspect' for element 'plottingPanel' .setProperty("MaximumY",2) // EJsS HtmlView.Simulation View: setting property 'MaximumY' for element 'plottingPanel' .setProperty("YFixedTick",0) // EJsS HtmlView.Simulation View: setting property 'YFixedTick' for element 'plottingPanel' .setProperty("YAutoTicks",false) // EJsS HtmlView.Simulation View: setting property 'YAutoTicks' for element 'plottingPanel' .setProperty("MinimumX",0) // EJsS HtmlView.Simulation View: setting property 'MinimumX' for element 'plottingPanel' .setProperty("MinimumY",-2) // EJsS HtmlView.Simulation View: setting property 'MinimumY' for element 'plottingPanel' .setProperty("YTickStep",1) // EJsS HtmlView.Simulation View: setting property 'YTickStep' for element 'plottingPanel' .setProperty("AutoScaleY",false) // EJsS HtmlView.Simulation View: setting property 'AutoScaleY' for element 'plottingPanel' .setProperty("AutoScaleX",false) // EJsS HtmlView.Simulation View: setting property 'AutoScaleX' for element 'plottingPanel' .setProperty("XAutoTicks",false) // EJsS HtmlView.Simulation View: setting property 'XAutoTicks' for element 'plottingPanel' .setProperty("XScalePrecision",4) // EJsS HtmlView.Simulation View: setting property 'XScalePrecision' for element 'plottingPanel' ; _view._addElement(EJSS_DRAWING2D.analyticCurve,"analyticCurve", _view.plottingPanel) // EJsS HtmlView.Simulation View: declaration of element 'analyticCurve' .setProperty("FunctionX","x") // EJsS HtmlView.Simulation View: setting property 'FunctionX' for element 'analyticCurve' .setProperty("Minimum",0) // EJsS HtmlView.Simulation View: setting property 'Minimum' for element 'analyticCurve' .setProperty("Variable","x") // EJsS HtmlView.Simulation View: setting property 'Variable' for element 'analyticCurve' .setProperty("LineColor","blue") // EJsS HtmlView.Simulation View: setting property 'LineColor' for element 'analyticCurve' .setProperty("X",0) // EJsS HtmlView.Simulation View: setting property 'X' for element 'analyticCurve' .setProperty("Y",0) // EJsS HtmlView.Simulation View: setting property 'Y' for element 'analyticCurve' .setProperty("LineWidth",2) // EJsS HtmlView.Simulation View: setting property 'LineWidth' for element 'analyticCurve' ; _view._addElement(EJSS_DRAWING2D.analyticCurve,"integralAlgebrite", _view.plottingPanel) // EJsS HtmlView.Simulation View: declaration of element 'integralAlgebrite' .setProperty("FunctionX","x") // EJsS HtmlView.Simulation View: setting property 'FunctionX' for element 'integralAlgebrite' .setProperty("Minimum",0) // EJsS HtmlView.Simulation View: setting property 'Minimum' for element 'integralAlgebrite' .setProperty("Variable","x") // EJsS HtmlView.Simulation View: setting property 'Variable' for element 'integralAlgebrite' .setProperty("LineColor","Magenta") // EJsS HtmlView.Simulation View: setting property 'LineColor' for element 'integralAlgebrite' .setProperty("LineWidth",3) // EJsS HtmlView.Simulation View: setting property 'LineWidth' for element 'integralAlgebrite' ; _view._addElement(EJSS_DRAWING2D.analyticCurve,"integral", _view.plottingPanel) // EJsS HtmlView.Simulation View: declaration of element 'integral' .setProperty("FunctionX","x") // EJsS HtmlView.Simulation View: setting property 'FunctionX' for element 'integral' .setProperty("Minimum",0) // EJsS HtmlView.Simulation View: setting property 'Minimum' for element 'integral' .setProperty("Variable","x") // EJsS HtmlView.Simulation View: setting property 'Variable' for element 'integral' .setProperty("X",0) // EJsS HtmlView.Simulation View: setting property 'X' for element 'integral' .setProperty("LineColor","red") // EJsS HtmlView.Simulation View: setting property 'LineColor' for element 'integral' .setProperty("Y",0) // EJsS HtmlView.Simulation View: setting property 'Y' for element 'integral' .setProperty("LineWidth",2) // EJsS HtmlView.Simulation View: setting property 'LineWidth' for element 'integral' ; _view._addElement(EJSS_DRAWING2D.analyticCurve,"cutoffzero", _view.plottingPanel) // EJsS HtmlView.Simulation View: declaration of element 'cutoffzero' .setProperty("FunctionY","y") // EJsS HtmlView.Simulation View: setting property 'FunctionY' for element 'cutoffzero' .setProperty("FunctionX","0") // EJsS HtmlView.Simulation View: setting property 'FunctionX' for element 'cutoffzero' .setProperty("Minimum",-5) // EJsS HtmlView.Simulation View: setting property 'Minimum' for element 'cutoffzero' .setProperty("Maximum",5) // EJsS HtmlView.Simulation View: setting property 'Maximum' for element 'cutoffzero' .setProperty("Variable","y") // EJsS HtmlView.Simulation View: setting property 'Variable' for element 'cutoffzero' .setProperty("X",0) // EJsS HtmlView.Simulation View: setting property 'X' for element 'cutoffzero' .setProperty("LineColor","Green") // EJsS HtmlView.Simulation View: setting property 'LineColor' for element 'cutoffzero' .setProperty("Attributes",{ "stroke-dasharray":"8 8 8 8" }) // EJsS HtmlView.Simulation View: setting property 'Attributes' for element 'cutoffzero' .setProperty("Y",0) // EJsS HtmlView.Simulation View: setting property 'Y' for element 'cutoffzero' .setProperty("LineWidth",3) // EJsS HtmlView.Simulation View: setting property 'LineWidth' for element 'cutoffzero' ; _view._addElement(EJSS_DRAWING2D.analyticCurve,"zero", _view.plottingPanel) // EJsS HtmlView.Simulation View: declaration of element 'zero' .setProperty("FunctionY","0") // EJsS HtmlView.Simulation View: setting property 'FunctionY' for element 'zero' .setProperty("FunctionX","x") // EJsS HtmlView.Simulation View: setting property 'FunctionX' for element 'zero' .setProperty("Variable","x") // EJsS HtmlView.Simulation View: setting property 'Variable' for element 'zero' .setProperty("X",0) // EJsS HtmlView.Simulation View: setting property 'X' for element 'zero' .setProperty("LineColor","black") // EJsS HtmlView.Simulation View: setting property 'LineColor' for element 'zero' .setProperty("Y",0) // EJsS HtmlView.Simulation View: setting property 'Y' for element 'zero' .setProperty("LineWidth",1) // EJsS HtmlView.Simulation View: setting property 'LineWidth' for element 'zero' ; _view._addElement(EJSS_DRAWING2D.analyticCurve,"cutoff2pi", _view.plottingPanel) // EJsS HtmlView.Simulation View: declaration of element 'cutoff2pi' .setProperty("FunctionY","y") // EJsS HtmlView.Simulation View: setting property 'FunctionY' for element 'cutoff2pi' .setProperty("FunctionX","6.283185") // EJsS HtmlView.Simulation View: setting property 'FunctionX' for element 'cutoff2pi' .setProperty("Minimum",-5) // EJsS HtmlView.Simulation View: setting property 'Minimum' for element 'cutoff2pi' .setProperty("Maximum",5) // EJsS HtmlView.Simulation View: setting property 'Maximum' for element 'cutoff2pi' .setProperty("Variable","y") // EJsS HtmlView.Simulation View: setting property 'Variable' for element 'cutoff2pi' .setProperty("X",0) // EJsS HtmlView.Simulation View: setting property 'X' for element 'cutoff2pi' .setProperty("LineColor","Green") // EJsS HtmlView.Simulation View: setting property 'LineColor' for element 'cutoff2pi' .setProperty("Attributes",{ "stroke-dasharray":"8 8 8 8" }) // EJsS HtmlView.Simulation View: setting property 'Attributes' for element 'cutoff2pi' .setProperty("Y",0) // EJsS HtmlView.Simulation View: setting property 'Y' for element 'cutoff2pi' .setProperty("LineWidth",3) // EJsS HtmlView.Simulation View: setting property 'LineWidth' for element 'cutoff2pi' ; _view._addElement(EJSS_DRAWING2D.text,"tau", _view.plottingPanel) // EJsS HtmlView.Simulation View: declaration of element 'tau' .setProperty("FillColor","black") // EJsS HtmlView.Simulation View: setting property 'FillColor' for element 'tau' .setProperty("X",6.4) // EJsS HtmlView.Simulation View: setting property 'X' for element 'tau' .setProperty("Y",-0.1) // EJsS HtmlView.Simulation View: setting property 'Y' for element 'tau' .setProperty("Text","2π") // EJsS HtmlView.Simulation View: setting property 'Text' for element 'tau' .setProperty("Visibility",false) // EJsS HtmlView.Simulation View: setting property 'Visibility' for element 'tau' ; _view._addElement(EJSS_DRAWING2D.text,"xaxis", _view.plottingPanel) // EJsS HtmlView.Simulation View: declaration of element 'xaxis' .setProperty("FillColor","black") // EJsS HtmlView.Simulation View: setting property 'FillColor' for element 'xaxis' .setProperty("X",0.07) // EJsS HtmlView.Simulation View: setting property 'X' for element 'xaxis' .setProperty("Y",-0.1) // EJsS HtmlView.Simulation View: setting property 'Y' for element 'xaxis' .setProperty("Text","0") // EJsS HtmlView.Simulation View: setting property 'Text' for element 'xaxis' .setProperty("Visibility",false) // EJsS HtmlView.Simulation View: setting property 'Visibility' for element 'xaxis' ; }; return _view; } //-->
This simulation enables learners to calculate and visualize Fourier coefficients for periodic functions. Students can explore how complex periodic waveforms decompose into simple sine and cosine components, discovering the mathematical foundations of harmonic analysis and signal processing through hands-on interaction.
Learning objectives: Understand how Fourier coefficients represent periodic functions as infinite trigonometric series | Calculate coefficients for various periodic waveforms and interpret their mathematical significance | Visualize the relationship between time-domain functions and their frequency-domain representations