MaplePrimes - Maplesoft Blog
http://www.mapleprimes.com/maplesoftblog
en-us2016 Maplesoft, A Division of Waterloo Maple Inc.Maplesoft Document SystemWed, 28 Sep 2016 20:29:02 GMTWed, 28 Sep 2016 20:29:02 GMTThe latest posts on the Maplesoft Bloghttp://www.mapleprimes.com/images/mapleprimeswhite.jpgMaplePrimes - Maplesoft Blog
http://www.mapleprimes.com/maplesoftblog
Showing steps of a solution
http://www.mapleprimes.com/maplesoftblog/206346-Showing-Steps-Of-A-Solution?ref=Feed:MaplePrimes:Maplesoft Blog
<p>Students using Maple often have different needs than non-students. Students need more than just a final answer; they are looking to gain an understanding of the mathematical concepts behind the problems they are asked to solve and to learn how to solve problems. They need an environment that allows them to explore the concepts and break problems down into smaller steps.</p>
<p>The <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student">Student</a> packages in Maple offer focused learning environments in which students can explore and reinforce fundamental concepts for courses in <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Precalculus">Precalculus</a>, <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Calculus1/Hint">Calculus</a>, <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/LinearAlgebra">Linear Algebra</a>, <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Statistics">Statistics</a>, and more. For example, Maple includes step-by-step tutors that allow students to practice <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Calculus1/IntTutor">integration</a>, <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Calculus1/DiffTutor">differentiation</a>, <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Calculus1/LimitTutor">the finding of limits</a>, and more. The Integration Tutor, shown below, lets a student evaluate an integral by selecting an applicable rule at each step. Maple will also offer hints or show the next step, if asked. The tutor doesn't only demonstrate how to obtain the result, but is designed for practicing and learning.</p>
<p style="text-align: center;"><img src="/view.aspx?sf=206346_post/IntMethods.PNG" alt="" width="480" height="436"></p>
<p>For this blog post, I’d like to focus in on an area of great interest to students: showing step-by-step solutions for a variety of problems in Maple.</p>
<p>Several commands in the Student packages can show solution steps as either output or inline in an interactive pop-up window. The first few examples return the solution steps as output.</p>
<p><strong>Precalculus problems:</strong></p>
<p>The <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Basics/ExpandSteps">Student:-Basics</a> sub-package provides a collection of commands to help students and teachers explore fundamental mathematical concepts that are core to many disciplines. It features two commands, both of which return step-by-step solutions as output.</p>
<p>The <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Basics/ExpandSteps">ExpandSteps</a> command accepts a product of polynomials and displays the steps required to expand the expression:</p>
<pre><strong>with(Student:-Basics):</strong></pre>
<pre><strong>ExpandSteps( (a^2-1)/(a/3+1/3) );</strong></pre>
<p style="text-align: center;"><img src="/view.aspx?sf=206346_post/ExpandSteps.PNG" alt="" width="479" height="291"></p>
<p>The <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Basics/LinearSolveSteps">LinearSolveSteps</a> command accepts an equation in one variable and displays the steps required to solve for that variable.</p>
<pre><strong>with(Student:-Basics):</strong></pre>
<pre><strong>LinearSolveSteps( (x+1)/y = 4*y^2 + 3*x, x );</strong></pre>
<p style="text-align: center;"><img src="/view.aspx?sf=206346_post/LinearSolveSteps.PNG" alt="" width="480" height="455"></p>
<p>This command also accepts some nonlinear equations that can be reduced down to linear equations.</p>
<p><strong>Calculus problems:</strong></p>
<p>The <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Calculus1">Student:-Calculus1</a> sub-package is designed to cover the basic material of a standard first course in single-variable calculus. Several commands in this package provide interactive tutors where you can step through computations and step-by-step solutions can be returned as standard worksheet output.</p>
<p>Tools like the <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Calculus1/IntTutor">integration</a>, <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Calculus1/DiffTutor">differentiation</a>, and <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Calculus1/LimitTutor">limit</a> method tutors are interactive interfaces that allow for exploration. For example, similar to the integration-methods tutor above, the differentiation-methods tutor lets a student obtain a derivative by selecting the appropriate rule that applies at each step or by requesting a complete solution all at once. When done, pressing “Close” prints out to the Maple worksheet an annotated solution containing all of the steps.</p>
<p>For example, try entering the following into Maple:</p>
<pre><strong>with(Student:-Calculus1):</strong></pre>
<pre><strong>x*sin(x);</strong></pre>
<p>Next, right click on the Matrix and choose “<strong>Student Calculus1 -> Tutors -> Differentiation Methods…</strong>”</p>
<p style="text-align: center;"><img src="/view.aspx?sf=206346_post/DiffMethods.PNG" alt="" width="480" height="440"></p>
<p>The Student:-Calculus1 sub-package is not alone in offering this kind of step-by-step solution finding. Other commands in other Student packages are also capable of returning solutions.</p>
<p><strong>Linear Algebra Problems:</strong></p>
<p>The <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/LinearAlgebra">Student:-LinearAlgebra</a> sub-package is designed to cover the basic material of a standard first course in linear algebra. This sub-package features similar tutors to those found in the Calculus1 sub-package. Commands such as the <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/LinearAlgebra/GaussianEliminationTutor">Gaussian Elimination</a>, <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/LinearAlgebra/GaussJordanEliminationTutor">Gauss-Jordan Elimination</a>, <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/LinearAlgebra/InverseTutor">Matrix Inverse</a>, <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/LinearAlgebra/EigenvaluesTutor">Eigenvalues</a> or <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/LinearAlgebra/EigenvectorsTutor">Eigenvectors</a> tutors show step-by-step solutions for linear algebra problems in interactive pop-up tutor windows. Of these tutors, a personal favourite has to be the Gauss-Jordan Elimination tutor, which were I still a student, would have saved me a lot of time and effort searching for simple arithmetic errors while row-reducing matrices.</p>
<p>For example, try entering the following into Maple:</p>
<pre><strong>with(Student:-LinearAlgebra):</strong></pre>
<pre><strong>M:=<<77,9,31>|<-50,-80,43>|<25,94,12>|<20,-61,-48>>;</strong></pre>
<p>Next, right click on the Matrix and choose “<strong>Student Linear Algebra -> Tutors -> Gauss-Jordan Elimination Tutor</strong>”</p>
<p style="text-align: center;"><img src="/view.aspx?sf=206346_post/GJElimTutor.PNG" alt="" width="480" height="452"></p>
<p>This tutor makes it possible to step through row-reducing a matrix by using the controls on the right side of the pop-up window. If you are unsure where to go next, the “Next Step” button can be used to move forward one-step. Pressing “All Steps” returns all of the steps required to row reduce this matrix.</p>
<p>When this tutor is closed, it does not return results to the Maple worksheet, however it is still possible to use the Maple interface to step through performing elementary row operations and to capture the output in the Maple worksheet. By loading the Student:-LinearAlgebra package, you can simply use the right-click context menu to apply elementary row operations to a Matrix in order to step through the operations, capturing all of your steps along the way!</p>
<p><strong>An interactive application for showing steps for some problems:</strong></p>
<p>While working on this blog post, it struck me that we did not have any online interactive applications that could show solution steps, so using the commands that I’ve discussed above, I authored an application that can expand, solve linear problems, integrate, differentiate, or find limits. You can interact with this application <a href="http://maplecloud.maplesoft.com/application.jsp?appId=5651983367143424">here</a>, but note that this application is a work in progress, so feel free to email me (maplepm (at) Maplesoft.com) any strange bugs that you may encounter with it.</p>
<p>More detail on each of these commands can be found in Maple’s help pages.</p>
<p> </p><p>Students using Maple often have different needs than non-students. Students need more than just a final answer; they are looking to gain an understanding of the mathematical concepts behind the problems they are asked to solve and to learn how to solve problems. They need an environment that allows them to explore the concepts and break problems down into smaller steps.</p>
<p>The <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student">Student</a> packages in Maple offer focused learning environments in which students can explore and reinforce fundamental concepts for courses in <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Precalculus">Precalculus</a>, <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Calculus1/Hint">Calculus</a>, <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/LinearAlgebra">Linear Algebra</a>, <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Statistics">Statistics</a>, and more. For example, Maple includes step-by-step tutors that allow students to practice <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Calculus1/IntTutor">integration</a>, <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Calculus1/DiffTutor">differentiation</a>, <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Calculus1/LimitTutor">the finding of limits</a>, and more. The Integration Tutor, shown below, lets a student evaluate an integral by selecting an applicable rule at each step. Maple will also offer hints or show the next step, if asked. The tutor doesn't only demonstrate how to obtain the result, but is designed for practicing and learning.</p>
<p style="text-align: center;"><img src="/view.aspx?sf=206346_post/IntMethods.PNG" alt="" width="480" height="436"></p>
<p>For this blog post, I’d like to focus in on an area of great interest to students: showing step-by-step solutions for a variety of problems in Maple.</p>
<p>Several commands in the Student packages can show solution steps as either output or inline in an interactive pop-up window. The first few examples return the solution steps as output.</p>
<p><strong>Precalculus problems:</strong></p>
<p>The <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Basics/ExpandSteps">Student:-Basics</a> sub-package provides a collection of commands to help students and teachers explore fundamental mathematical concepts that are core to many disciplines. It features two commands, both of which return step-by-step solutions as output.</p>
<p>The <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Basics/ExpandSteps">ExpandSteps</a> command accepts a product of polynomials and displays the steps required to expand the expression:</p>
<pre><strong>with(Student:-Basics):</strong></pre>
<pre><strong>ExpandSteps( (a^2-1)/(a/3+1/3) );</strong></pre>
<p style="text-align: center;"><img src="/view.aspx?sf=206346_post/ExpandSteps.PNG" alt="" width="479" height="291"></p>
<p>The <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Basics/LinearSolveSteps">LinearSolveSteps</a> command accepts an equation in one variable and displays the steps required to solve for that variable.</p>
<pre><strong>with(Student:-Basics):</strong></pre>
<pre><strong>LinearSolveSteps( (x+1)/y = 4*y^2 + 3*x, x );</strong></pre>
<p style="text-align: center;"><img src="/view.aspx?sf=206346_post/LinearSolveSteps.PNG" alt="" width="480" height="455"></p>
<p>This command also accepts some nonlinear equations that can be reduced down to linear equations.</p>
<p><strong>Calculus problems:</strong></p>
<p>The <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Calculus1">Student:-Calculus1</a> sub-package is designed to cover the basic material of a standard first course in single-variable calculus. Several commands in this package provide interactive tutors where you can step through computations and step-by-step solutions can be returned as standard worksheet output.</p>
<p>Tools like the <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Calculus1/IntTutor">integration</a>, <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Calculus1/DiffTutor">differentiation</a>, and <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/Calculus1/LimitTutor">limit</a> method tutors are interactive interfaces that allow for exploration. For example, similar to the integration-methods tutor above, the differentiation-methods tutor lets a student obtain a derivative by selecting the appropriate rule that applies at each step or by requesting a complete solution all at once. When done, pressing “Close” prints out to the Maple worksheet an annotated solution containing all of the steps.</p>
<p>For example, try entering the following into Maple:</p>
<pre><strong>with(Student:-Calculus1):</strong></pre>
<pre><strong>x*sin(x);</strong></pre>
<p>Next, right click on the Matrix and choose “<strong>Student Calculus1 -> Tutors -> Differentiation Methods…</strong>”</p>
<p style="text-align: center;"><img src="/view.aspx?sf=206346_post/DiffMethods.PNG" alt="" width="480" height="440"></p>
<p>The Student:-Calculus1 sub-package is not alone in offering this kind of step-by-step solution finding. Other commands in other Student packages are also capable of returning solutions.</p>
<p><strong>Linear Algebra Problems:</strong></p>
<p>The <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/LinearAlgebra">Student:-LinearAlgebra</a> sub-package is designed to cover the basic material of a standard first course in linear algebra. This sub-package features similar tutors to those found in the Calculus1 sub-package. Commands such as the <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/LinearAlgebra/GaussianEliminationTutor">Gaussian Elimination</a>, <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/LinearAlgebra/GaussJordanEliminationTutor">Gauss-Jordan Elimination</a>, <a href="https://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/LinearAlgebra/InverseTutor">Matrix Inverse</a>, <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/LinearAlgebra/EigenvaluesTutor">Eigenvalues</a> or <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/LinearAlgebra/EigenvectorsTutor">Eigenvectors</a> tutors show step-by-step solutions for linear algebra problems in interactive pop-up tutor windows. Of these tutors, a personal favourite has to be the Gauss-Jordan Elimination tutor, which were I still a student, would have saved me a lot of time and effort searching for simple arithmetic errors while row-reducing matrices.</p>
<p>For example, try entering the following into Maple:</p>
<pre><strong>with(Student:-LinearAlgebra):</strong></pre>
<pre><strong>M:=<<77,9,31>|<-50,-80,43>|<25,94,12>|<20,-61,-48>>;</strong></pre>
<p>Next, right click on the Matrix and choose “<strong>Student Linear Algebra -> Tutors -> Gauss-Jordan Elimination Tutor</strong>”</p>
<p style="text-align: center;"><img src="/view.aspx?sf=206346_post/GJElimTutor.PNG" alt="" width="480" height="452"></p>
<p>This tutor makes it possible to step through row-reducing a matrix by using the controls on the right side of the pop-up window. If you are unsure where to go next, the “Next Step” button can be used to move forward one-step. Pressing “All Steps” returns all of the steps required to row reduce this matrix.</p>
<p>When this tutor is closed, it does not return results to the Maple worksheet, however it is still possible to use the Maple interface to step through performing elementary row operations and to capture the output in the Maple worksheet. By loading the Student:-LinearAlgebra package, you can simply use the right-click context menu to apply elementary row operations to a Matrix in order to step through the operations, capturing all of your steps along the way!</p>
<p><strong>An interactive application for showing steps for some problems:</strong></p>
<p>While working on this blog post, it struck me that we did not have any online interactive applications that could show solution steps, so using the commands that I’ve discussed above, I authored an application that can expand, solve linear problems, integrate, differentiate, or find limits. You can interact with this application <a href="http://maplecloud.maplesoft.com/application.jsp?appId=5651983367143424">here</a>, but note that this application is a work in progress, so feel free to email me (maplepm (at) Maplesoft.com) any strange bugs that you may encounter with it.</p>
<p>More detail on each of these commands can be found in Maple’s help pages.</p>
<p> </p>206346Tue, 20 Sep 2016 18:42:06 ZDSkoogDSkoog"Next Number" Puzzles
http://www.mapleprimes.com/maplesoftblog/206105-Next-Number-Puzzles?ref=Feed:MaplePrimes:Maplesoft Blog
<p>The Saturday edition of our local newspaper (Waterloo Region Record) carries, as part of The PUZZLE Corner column, a weekly puzzle "STICKELERS" by Terry Stickels. Back on December 13, 2014, the puzzle was:</p>
<p style="text-align: center;">What number comes next?</p>
<p style="text-align: center;">1 4 18 96 600 4320 ?</p>
<p>The solution given was the number 35280, obtained by setting <em>k</em> = 1 in the general term <em>k⋅k!</em>.</p>
<p>On September 5, 2015, the column contained the puzzle:</p>
<p style="text-align: center;">What number comes next?</p>
<p style="text-align: center;">2 3 3 5 10 13 39 43 172 177 ?</p>
<p>The proposed solution was the number 885, obtained as a<sub>10 </sub>from the recursion</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="/view.aspx?sf=206105_post/recursion.png" alt=""></p>
<p>where a<sub>0</sub> =2.</p>
<p>As a youngster, one of my uncles delighted in teasing me with a similar question for the sequence 36, 9, 50, 55, 62, 71, 79, 18, 20. Ignoring the fact that there is a missing entry between 9 and 50, the next member of the sequence is "Bay Parkway," which is what 22<sup>nd </sup>Avenue is actually called in the Brooklyn neighborhood of my youth. These are subway stops on what was then called the West End line of the subway that went out to Stillwell Avenue in Coney Island.</p>
<p>Armed with the skepticism inspired by this provincial chestnut, I looked at both of these puzzles with the attitude that the "next number" could be anything I chose it to be. After all, a sequence is a mapping from the (nonnegative) integers to the reals, and unless the mapping is completely specified, the function values are not well defined.</p>
<p>Indeed, for the first puzzle, the polynomial <em>f(x) </em>interpolating the points</p>
<p style="text-align: center;"><br>(0, 1), (1, 4), (2, 18), (3, 93), (4, 600), (5, 4320)</p>
<p>reproduces the first six members of the given sequence, and gives 18593 (not 35280) for f(7). In other words, the pattern <em>k⋅k! </em>is not a unique representation of the sequence, given just the first six members. The worksheet <a href="/view.aspx?sf=206105_post/NextNumber.mw">NextNumber</a> derives the interpolating polynomial <em>f</em> and establishes that <em>f(n)</em> is an integer for every nonzero integer <em>n</em>.</p>
<p>Likewise, for the second puzzle, the polynomial <em>g(x) </em>interpolating the points</p>
<p style="text-align: center;">(1, 2) ,(2, 3) ,(3, 3) ,(4, 5) ,(5, 10) ,(6, 13) ,(7, 39) ,(8, 43), (9, 172) ,(10, 177)</p>
<p>reproduces the first ten members of the given sequence, and gives -7331(not 885) for g(11). Once again, the pattern proposed as the "solution" is not unique, given that the worksheet <a href="/view.aspx?sf=206105_post/NextNumber.mw">NextNumber</a> contains both g(x) and a proof that for integer <em>n</em>, all values of <em>g(n)</em> are integers.</p>
<p>The upshot of these observations is that without some guarantee of uniqueness, questions like "what is the next number" are meaningless. It would be far better to pose such challenges with the words "Find a pattern for the given members of the following sequence" and warn that the function capturing that pattern might not be unique.</p>
<p>I leave it to the interested reader to prove or disprove the following conjecture: Interpolate the first n terms of either sequence. The interpolating polynomial <em>p</em> will reproduce these n terms, but for <em>k>n, p(k)</em> will differ from the corresponding member of the sequence determined by the stated patterns. (Results of limited numerical experiments are consistent with the truth of this conjecture.)</p>
<p>Attached: <a href="/view.aspx?sf=206105_post/NextNumber.mw">NextNumber.mw</a></p><p>The Saturday edition of our local newspaper (Waterloo Region Record) carries, as part of The PUZZLE Corner column, a weekly puzzle "STICKELERS" by Terry Stickels. Back on December 13, 2014, the puzzle was:</p>
<p style="text-align: center;">What number comes next?</p>
<p style="text-align: center;">1 4 18 96 600 4320 ?</p>
<p>The solution given was the number 35280, obtained by setting <em>k</em> = 1 in the general term <em>k⋅k!</em>.</p>
<p>On September 5, 2015, the column contained the puzzle:</p>
<p style="text-align: center;">What number comes next?</p>
<p style="text-align: center;">2 3 3 5 10 13 39 43 172 177 ?</p>
<p>The proposed solution was the number 885, obtained as a<sub>10 </sub>from the recursion</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="/view.aspx?sf=206105_post/recursion.png" alt=""></p>
<p>where a<sub>0</sub> =2.</p>
<p>As a youngster, one of my uncles delighted in teasing me with a similar question for the sequence 36, 9, 50, 55, 62, 71, 79, 18, 20. Ignoring the fact that there is a missing entry between 9 and 50, the next member of the sequence is "Bay Parkway," which is what 22<sup>nd </sup>Avenue is actually called in the Brooklyn neighborhood of my youth. These are subway stops on what was then called the West End line of the subway that went out to Stillwell Avenue in Coney Island.</p>
<p>Armed with the skepticism inspired by this provincial chestnut, I looked at both of these puzzles with the attitude that the "next number" could be anything I chose it to be. After all, a sequence is a mapping from the (nonnegative) integers to the reals, and unless the mapping is completely specified, the function values are not well defined.</p>
<p>Indeed, for the first puzzle, the polynomial <em>f(x) </em>interpolating the points</p>
<p style="text-align: center;"><br>(0, 1), (1, 4), (2, 18), (3, 93), (4, 600), (5, 4320)</p>
<p>reproduces the first six members of the given sequence, and gives 18593 (not 35280) for f(7). In other words, the pattern <em>k⋅k! </em>is not a unique representation of the sequence, given just the first six members. The worksheet <a href="/view.aspx?sf=206105_post/NextNumber.mw">NextNumber</a> derives the interpolating polynomial <em>f</em> and establishes that <em>f(n)</em> is an integer for every nonzero integer <em>n</em>.</p>
<p>Likewise, for the second puzzle, the polynomial <em>g(x) </em>interpolating the points</p>
<p style="text-align: center;">(1, 2) ,(2, 3) ,(3, 3) ,(4, 5) ,(5, 10) ,(6, 13) ,(7, 39) ,(8, 43), (9, 172) ,(10, 177)</p>
<p>reproduces the first ten members of the given sequence, and gives -7331(not 885) for g(11). Once again, the pattern proposed as the "solution" is not unique, given that the worksheet <a href="/view.aspx?sf=206105_post/NextNumber.mw">NextNumber</a> contains both g(x) and a proof that for integer <em>n</em>, all values of <em>g(n)</em> are integers.</p>
<p>The upshot of these observations is that without some guarantee of uniqueness, questions like "what is the next number" are meaningless. It would be far better to pose such challenges with the words "Find a pattern for the given members of the following sequence" and warn that the function capturing that pattern might not be unique.</p>
<p>I leave it to the interested reader to prove or disprove the following conjecture: Interpolate the first n terms of either sequence. The interpolating polynomial <em>p</em> will reproduce these n terms, but for <em>k>n, p(k)</em> will differ from the corresponding member of the sequence determined by the stated patterns. (Results of limited numerical experiments are consistent with the truth of this conjecture.)</p>
<p>Attached: <a href="/view.aspx?sf=206105_post/NextNumber.mw">NextNumber.mw</a></p>206105Fri, 09 Sep 2016 20:31:04 ZrlopezrlopezStrategies for accelerating the move to simulation-led, systems-driven engineering
http://www.mapleprimes.com/maplesoftblog/205618-Strategies-For-Accelerating-The-Move?ref=Feed:MaplePrimes:Maplesoft Blog
<p style="padding-left: 30px;"><em>Bruce Jenkins is President of Ora Research, an engineering research and advisory service. Maplesoft commissioned him to examine how systems-driven engineering practices are being integrated into the early stages of product development, the results of which are available in a free whitepaper entitled <a href="http://www.maplesoft.com/contact/webforms/Whitepapers/OraResearch_System-Level_Physical_Modeling_and_Simulation.aspx">System-Level Physical Modeling and Simulation</a>. In the coming weeks, Mr. Jenkins will discuss the results of his research in a series of blog posts.<br> <br> This is the first entry in the series.</em></p>
<p>Discussions of how to bring simulation to bear starting in the early stages of product development have become commonplace today. Driving these discussions, I believe, is growing recognition that engineering design in general, and conceptual and preliminary engineering in particular, face unprecedented pressures to move beyond the intuition-based, guess-and-correct methods that have long dominated product development practices in discrete manufacturing. To continue meeting their enterprises’ strategic business imperatives, engineering organizations must move more deeply into applying all the capabilities for systematic, rational, rapid design development, exploration and optimization available from today’s simulation software technologies.</p>
<p>Unfortunately, discussions of how to simulate early still fixate all too often on 3D CAE methods such as finite element analysis and computational fluid dynamics. This reveals a widespread dearth of awareness and understanding—compounded by some fear, intimidation and avoidance—of system-level physical modeling and simulation software. This technology empowers engineers and engineering teams to begin studying, exploring and optimizing designs in the beginning stages of projects—when product geometry is seldom available for 3D CAE, but when informed engineering decision-making can have its strongest impact and leverage on product development outcomes. Then, properly applied, systems modeling tools can help engineering teams maintain visibility and control at the subsystems, systems and whole-product levels as the design evolves through development, integration, optimization and validation.</p>
<p>As part of my ongoing research and reporting intended to help remedy the low awareness and substantial under-utilization of system-level physical modeling software in too many manufacturing industries today, earlier this year I produced a white paper, “System-Level Physical Modeling and Simulation: Strategies for Accelerating the Move to Simulation-Led, Systems-Driven Engineering in Off-Highway Equipment and Mining Machinery.” The project that resulted in this white paper originated during a technology briefing I received in late 2015 from Maplesoft. The company had noticed my commentary in industry and trade publications expressing the views set out above, and approached me to explore what they saw as shared perspectives.</p>
<p>From these discussions, I proposed that Maplesoft commission me to further investigate these issues through primary research among expert practitioners and engineering management, with emphasis on the off-highway equipment and mining machinery industries. In this research, focused not on software-brand-specific factors but instead on industry-wide issues, I interviewed users of a broad range of systems modeling software products including Dassault Systèmes’ Dymola, Maplesoft’s MapleSim, The MathWorks’ Simulink, Siemens PLM’s LMS Imagine.Lab Amesim, and the Modelica tools and libraries from various providers. Interviewees were drawn from manufacturers of off-highway equipment and mining machinery as well as some makers of materials handling machinery.</p>
<p>At the outset, I worked with Maplesoft to define the project methodology. My firm, Ora Research, then executed the interviews, analyzed the findings and developed the white paper independently of input from Maplesoft. That said, I believe the findings of this project strongly support and validate Maplesoft’s vision and strategy for what it calls model-driven innovation. <a href="http://www.maplesoft.com/contact/webforms/Whitepapers/OraResearch_System-Level_Physical_Modeling_and_Simulation.aspx">You can download the white paper here.</a></p>
<!--break-->
<p>Bruce Jenkins, Ora Research<br><a href="http://oraresearch.com/">oraresearch.com</a></p><p style="padding-left: 30px;"><em>Bruce Jenkins is President of Ora Research, an engineering research and advisory service. Maplesoft commissioned him to examine how systems-driven engineering practices are being integrated into the early stages of product development, the results of which are available in a free whitepaper entitled <a href="http://www.maplesoft.com/contact/webforms/Whitepapers/OraResearch_System-Level_Physical_Modeling_and_Simulation.aspx">System-Level Physical Modeling and Simulation</a>. In the coming weeks, Mr. Jenkins will discuss the results of his research in a series of blog posts.<br> <br> This is the first entry in the series.</em></p>
<p>Discussions of how to bring simulation to bear starting in the early stages of product development have become commonplace today. Driving these discussions, I believe, is growing recognition that engineering design in general, and conceptual and preliminary engineering in particular, face unprecedented pressures to move beyond the intuition-based, guess-and-correct methods that have long dominated product development practices in discrete manufacturing. To continue meeting their enterprises’ strategic business imperatives, engineering organizations must move more deeply into applying all the capabilities for systematic, rational, rapid design development, exploration and optimization available from today’s simulation software technologies.</p>
<p>Unfortunately, discussions of how to simulate early still fixate all too often on 3D CAE methods such as finite element analysis and computational fluid dynamics. This reveals a widespread dearth of awareness and understanding—compounded by some fear, intimidation and avoidance—of system-level physical modeling and simulation software. This technology empowers engineers and engineering teams to begin studying, exploring and optimizing designs in the beginning stages of projects—when product geometry is seldom available for 3D CAE, but when informed engineering decision-making can have its strongest impact and leverage on product development outcomes. Then, properly applied, systems modeling tools can help engineering teams maintain visibility and control at the subsystems, systems and whole-product levels as the design evolves through development, integration, optimization and validation.</p>
<p>As part of my ongoing research and reporting intended to help remedy the low awareness and substantial under-utilization of system-level physical modeling software in too many manufacturing industries today, earlier this year I produced a white paper, “System-Level Physical Modeling and Simulation: Strategies for Accelerating the Move to Simulation-Led, Systems-Driven Engineering in Off-Highway Equipment and Mining Machinery.” The project that resulted in this white paper originated during a technology briefing I received in late 2015 from Maplesoft. The company had noticed my commentary in industry and trade publications expressing the views set out above, and approached me to explore what they saw as shared perspectives.</p>
<p>From these discussions, I proposed that Maplesoft commission me to further investigate these issues through primary research among expert practitioners and engineering management, with emphasis on the off-highway equipment and mining machinery industries. In this research, focused not on software-brand-specific factors but instead on industry-wide issues, I interviewed users of a broad range of systems modeling software products including Dassault Systèmes’ Dymola, Maplesoft’s MapleSim, The MathWorks’ Simulink, Siemens PLM’s LMS Imagine.Lab Amesim, and the Modelica tools and libraries from various providers. Interviewees were drawn from manufacturers of off-highway equipment and mining machinery as well as some makers of materials handling machinery.</p>
<p>At the outset, I worked with Maplesoft to define the project methodology. My firm, Ora Research, then executed the interviews, analyzed the findings and developed the white paper independently of input from Maplesoft. That said, I believe the findings of this project strongly support and validate Maplesoft’s vision and strategy for what it calls model-driven innovation. <a href="http://www.maplesoft.com/contact/webforms/Whitepapers/OraResearch_System-Level_Physical_Modeling_and_Simulation.aspx">You can download the white paper here.</a></p>
<!--break-->
<p>Bruce Jenkins, Ora Research<br><a href="http://oraresearch.com/">oraresearch.com</a></p>205618Tue, 23 Aug 2016 12:33:45 ZBryon ThurBryon ThurHouseholder Reflections
http://www.mapleprimes.com/maplesoftblog/205330-Householder-Reflections?ref=Feed:MaplePrimes:Maplesoft Blog
<p>In a recent blog post, I found <a href="http://www.mapleprimes.com/maplesoftblog/204893-Givens-Rotations">a single rotation that was equivalent to a sequence of Givens rotations</a>, the underlying message being that teaching, learning, and doing mathematics is more effective and efficient when implemented with a tool like Maple. This post has the same message, but the medium is now the Householder reflection.</p>
<p>Given the vector <strong>x</strong> = <img src="/view.aspx?sf=205329_post/1.png" alt="" width="54" height="21">, the Householder matrix <em>H = I - 2 <strong>uu</strong><sup>T</sup> </em>reflects <strong>x</strong> to <strong>y</strong> = <em>Hx</em>, where <em>I</em> is the appropriate identity matrix, <strong>u</strong> = (<strong>x</strong> - <strong>y</strong>) / ||<strong>x</strong> - <strong>y</strong>|| is a unit normal for the plane (or hyperplane) across which <strong>x</strong> is reflected, and <strong>y</strong> necessarily has the same norm as <strong>x</strong>. The matrix H is orthogonal but its determinant is -1, making it a reflection instead of a rotation.</p>
<p>Starting with <strong>x</strong> and <strong>u</strong>, <em>H</em> can be constructed and the reflection y calculated. Starting with <strong>x</strong> and <strong>y</strong>, <strong>u</strong> and <em>H</em> can be determined. But what does any of this look like? Besides, when the Householder matrix is introduced as a tool for upper triangularizing a matrix, or for putting it into upper Hessenberg form, a recipe such as the one stated in Table 1 is the starting point.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="/view.aspx?sf=205329_post/table.png" alt="" width="651" height="153"></p>
<p>In other words, the recipe in Table 1 reflects <strong>x</strong> to a vector y in which all entries below the kth are zero. Again, can any of this be visualized and rendered more concrete? (The chair who hired me into my first job averred that there are students who can learn from the general to the particular. Maybe some of my classmates in graduate school could, but in 40 years of teaching, I've never met one such student. Could that be because all things are known through the eyes of the beholder?)</p>
<p>In the <a href="/view.aspx?sf=205329_post/RHR.mw">attached worksheet</a>, Householder matrices that reflect <strong>x</strong> = <5, -2, 1> to vectors <strong>y</strong> along the coordinate axes are constructed. These vectors and the reflecting planes are drawn, along with the appropriate normals <strong>u</strong>. In addition, the recipe in Table 1 is implemented, and the recipe itself examined. If you look at the worksheet, I believe you will agree that without Maple, the explorations shown would have been exceedingly difficult to carry out by hand.</p>
<p>Attached: <a href="/view.aspx?sf=205329_post/RHR.mw">RHR.mw</a></p><p>In a recent blog post, I found <a href="http://www.mapleprimes.com/maplesoftblog/204893-Givens-Rotations">a single rotation that was equivalent to a sequence of Givens rotations</a>, the underlying message being that teaching, learning, and doing mathematics is more effective and efficient when implemented with a tool like Maple. This post has the same message, but the medium is now the Householder reflection.</p>
<p>Given the vector <strong>x</strong> = <img src="/view.aspx?sf=205329_post/1.png" alt="" width="54" height="21">, the Householder matrix <em>H = I - 2 <strong>uu</strong><sup>T</sup> </em>reflects <strong>x</strong> to <strong>y</strong> = <em>Hx</em>, where <em>I</em> is the appropriate identity matrix, <strong>u</strong> = (<strong>x</strong> - <strong>y</strong>) / ||<strong>x</strong> - <strong>y</strong>|| is a unit normal for the plane (or hyperplane) across which <strong>x</strong> is reflected, and <strong>y</strong> necessarily has the same norm as <strong>x</strong>. The matrix H is orthogonal but its determinant is -1, making it a reflection instead of a rotation.</p>
<p>Starting with <strong>x</strong> and <strong>u</strong>, <em>H</em> can be constructed and the reflection y calculated. Starting with <strong>x</strong> and <strong>y</strong>, <strong>u</strong> and <em>H</em> can be determined. But what does any of this look like? Besides, when the Householder matrix is introduced as a tool for upper triangularizing a matrix, or for putting it into upper Hessenberg form, a recipe such as the one stated in Table 1 is the starting point.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="/view.aspx?sf=205329_post/table.png" alt="" width="651" height="153"></p>
<p>In other words, the recipe in Table 1 reflects <strong>x</strong> to a vector y in which all entries below the kth are zero. Again, can any of this be visualized and rendered more concrete? (The chair who hired me into my first job averred that there are students who can learn from the general to the particular. Maybe some of my classmates in graduate school could, but in 40 years of teaching, I've never met one such student. Could that be because all things are known through the eyes of the beholder?)</p>
<p>In the <a href="/view.aspx?sf=205329_post/RHR.mw">attached worksheet</a>, Householder matrices that reflect <strong>x</strong> = <5, -2, 1> to vectors <strong>y</strong> along the coordinate axes are constructed. These vectors and the reflecting planes are drawn, along with the appropriate normals <strong>u</strong>. In addition, the recipe in Table 1 is implemented, and the recipe itself examined. If you look at the worksheet, I believe you will agree that without Maple, the explorations shown would have been exceedingly difficult to carry out by hand.</p>
<p>Attached: <a href="/view.aspx?sf=205329_post/RHR.mw">RHR.mw</a></p>205330Mon, 08 Aug 2016 20:45:19 ZrlopezrlopezGivens Rotations
http://www.mapleprimes.com/maplesoftblog/204893-Givens-Rotations?ref=Feed:MaplePrimes:Maplesoft Blog
<p>This post describes how Maple was used to investigate the Givens rotation matrix, and to answer a simple question about its behavior. The "Givens" part is the medium, but the message is that it really is better to teach, learn, and do mathematics with a tool like Maple.</p>
<p><strong>The question:</strong> If Givens rotations are used to take the vector <strong>Y</strong> = <5, -2, 1> to <strong>Y<sub>2</sub> </strong>= <img style="vertical-align: bottom;" src="/view.aspx?sf=204893_post/2.PNG" alt="" width="61" height="20">, about what axis and through what angle will a single rotation accomplish the same thing?</p>
<p>The Givens matrix <em>G</em><sub><em>21</em> </sub>takes <strong>Y</strong> to the vector <strong>Y</strong><sub>1</sub> =<img style="vertical-align: bottom;" src="/view.aspx?sf=204893_post/3.png" alt="" width="62" height="19">, and the Givens matrix <em>G</em><sub><em>31</em> </sub>takes <strong>Y</strong><sub><strong>1</strong> </sub>to <strong>Y<sub>2</sub></strong>. Graphing the vectors <strong>Y</strong>, <strong>Y<sub>1</sub></strong>, and <strong>Y<sub>2</sub></strong> reveals that <strong>Y</strong><sub><strong>1</strong> </sub>lies in the xz-plane and that <strong>Y<sub>2</sub></strong> is parallel to the x-axis. (These geometrical observations should have been obvious, but the typical usage of the Givens technique to "zero-out" elements in a vector or matrix obscured this, at least for me.)</p>
<p>The matrix <em>G = G<sub>31</sub> G</em><sub><em>21</em> </sub>rotates <strong>Y</strong> directly to <strong>Y<sub>2</sub></strong>; is the axis of rotation the vector <strong>W = Y x Y</strong><sub><strong>2</strong></sub>, and is the angle of rotation the angle <img style="vertical-align: bottom;" src="/view.aspx?sf=204893_post/4.png" alt="" width="111" height="19"> between <strong>Y</strong> and <strong>Y<sub>2</sub></strong>? To test these hypotheses, I used the <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/LinearAlgebra/RotationMatrix">RotationMatrix</a> command in the Student LinearAlgebra package to build the corresponding rotation matrix <em>R</em>. But <em>R</em> did not agree with <em>G</em>. I had either the axis or the angle (actually both) incorrect.</p>
<p>The individual Givens rotation matrices are orthogonal, so <em>G</em>, their product is also orthogonal. It will have 1 as its single real eigenvalue, and the corresponding eigenvector <strong>V</strong> is actually the direction of the axis of the rotation. The vector <strong>W</strong> is a multiple of <0, 1, 2> but <strong>V</strong> = <a, b, 1>, where <img style="vertical-align: bottom;" src="/view.aspx?sf=204893_post/5.png" alt="" width="268" height="17">. Clearly, <strong>W</strong> <img style="vertical-align: bottom;" src="/view.aspx?sf=204893_post/8.PNG" alt="" width="21" height="18"> <strong>V</strong>.</p>
<p>The rotation matrix that rotates about the axis <strong>V</strong> through the angle <img style="vertical-align: bottom;" src="/view.aspx?sf=204893_post/phi.png" alt="" width="12" height="17"> isn't the matrix <em>G</em> either. The correct angle of rotation about <strong>V</strong> turns out to be</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="/view.aspx?sf=204893_post/6.png" alt="" width="365" height="51"></p>
<p>the angle between the projections of <strong>Y</strong> and <strong>Y<sub>2</sub></strong> onto the plane orthogonal to <strong>V</strong>. That <img style="vertical-align: bottom;" src="/view.aspx?sf=204893_post/7.png" alt="" width="38" height="16">came as a great surprise, one that required a significant adjustment of my intuition about spatial rotations. So again, the message is that teaching, learning, and doing mathematics is so much more effective and efficient when done with a tool like Maple.</p>
<p>A discussion of the Givens rotation, and a summary of the actual computations described above are available in the attached worksheet, <a href="/view.aspx?sf=204893_post/WGWG.mw">What Gives with Givens.mw</a>.</p><p>This post describes how Maple was used to investigate the Givens rotation matrix, and to answer a simple question about its behavior. The "Givens" part is the medium, but the message is that it really is better to teach, learn, and do mathematics with a tool like Maple.</p>
<p><strong>The question:</strong> If Givens rotations are used to take the vector <strong>Y</strong> = <5, -2, 1> to <strong>Y<sub>2</sub> </strong>= <img style="vertical-align: bottom;" src="/view.aspx?sf=204893_post/2.PNG" alt="" width="61" height="20">, about what axis and through what angle will a single rotation accomplish the same thing?</p>
<p>The Givens matrix <em>G</em><sub><em>21</em> </sub>takes <strong>Y</strong> to the vector <strong>Y</strong><sub>1</sub> =<img style="vertical-align: bottom;" src="/view.aspx?sf=204893_post/3.png" alt="" width="62" height="19">, and the Givens matrix <em>G</em><sub><em>31</em> </sub>takes <strong>Y</strong><sub><strong>1</strong> </sub>to <strong>Y<sub>2</sub></strong>. Graphing the vectors <strong>Y</strong>, <strong>Y<sub>1</sub></strong>, and <strong>Y<sub>2</sub></strong> reveals that <strong>Y</strong><sub><strong>1</strong> </sub>lies in the xz-plane and that <strong>Y<sub>2</sub></strong> is parallel to the x-axis. (These geometrical observations should have been obvious, but the typical usage of the Givens technique to "zero-out" elements in a vector or matrix obscured this, at least for me.)</p>
<p>The matrix <em>G = G<sub>31</sub> G</em><sub><em>21</em> </sub>rotates <strong>Y</strong> directly to <strong>Y<sub>2</sub></strong>; is the axis of rotation the vector <strong>W = Y x Y</strong><sub><strong>2</strong></sub>, and is the angle of rotation the angle <img style="vertical-align: bottom;" src="/view.aspx?sf=204893_post/4.png" alt="" width="111" height="19"> between <strong>Y</strong> and <strong>Y<sub>2</sub></strong>? To test these hypotheses, I used the <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Student/LinearAlgebra/RotationMatrix">RotationMatrix</a> command in the Student LinearAlgebra package to build the corresponding rotation matrix <em>R</em>. But <em>R</em> did not agree with <em>G</em>. I had either the axis or the angle (actually both) incorrect.</p>
<p>The individual Givens rotation matrices are orthogonal, so <em>G</em>, their product is also orthogonal. It will have 1 as its single real eigenvalue, and the corresponding eigenvector <strong>V</strong> is actually the direction of the axis of the rotation. The vector <strong>W</strong> is a multiple of <0, 1, 2> but <strong>V</strong> = <a, b, 1>, where <img style="vertical-align: bottom;" src="/view.aspx?sf=204893_post/5.png" alt="" width="268" height="17">. Clearly, <strong>W</strong> <img style="vertical-align: bottom;" src="/view.aspx?sf=204893_post/8.PNG" alt="" width="21" height="18"> <strong>V</strong>.</p>
<p>The rotation matrix that rotates about the axis <strong>V</strong> through the angle <img style="vertical-align: bottom;" src="/view.aspx?sf=204893_post/phi.png" alt="" width="12" height="17"> isn't the matrix <em>G</em> either. The correct angle of rotation about <strong>V</strong> turns out to be</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="/view.aspx?sf=204893_post/6.png" alt="" width="365" height="51"></p>
<p>the angle between the projections of <strong>Y</strong> and <strong>Y<sub>2</sub></strong> onto the plane orthogonal to <strong>V</strong>. That <img style="vertical-align: bottom;" src="/view.aspx?sf=204893_post/7.png" alt="" width="38" height="16">came as a great surprise, one that required a significant adjustment of my intuition about spatial rotations. So again, the message is that teaching, learning, and doing mathematics is so much more effective and efficient when done with a tool like Maple.</p>
<p>A discussion of the Givens rotation, and a summary of the actual computations described above are available in the attached worksheet, <a href="/view.aspx?sf=204893_post/WGWG.mw">What Gives with Givens.mw</a>.</p>204893Wed, 20 Jul 2016 18:31:07 ZrlopezrlopezCustom Application Development
http://www.mapleprimes.com/maplesoftblog/204725-Custom-Application-Development?ref=Feed:MaplePrimes:Maplesoft Blog
<p>Run the following command in Maple:</p>
<pre><strong>Explore(plot(x^k), k = 1 .. 3);</strong></pre>
<p style="text-align: center;"> <img src="/view.aspx?sf=204725_post/Explore.png" alt="" width="258" height="287"></p>
<p>Once you’ve run the command, move the slider from side to side. Neat, isn’t it?</p>
<p>With this single line of code, you have built an interactive application that shows the graph of x to the power of various exponent powers.</p>
<p> </p>
<p>The <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=examples/Explore">Explore</a> command is an application builder. More specifically, the Explore command can programmatically generate interactive content in Maple worksheets.</p>
<p>Programmatically generated content is inserted into a Maple worksheet by executing Maple commands. For example, when you run the Explore command on an expression, it inserts a collection of input and output controllers, called <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=EmbeddedComponents">Embedded Components</a>, into your Maple worksheet. In the preceding example, the Explore command inserts a table containing:</p>
<ul>
<li>a Slider component, which corresponds to the value for the exponent k</li>
<li>a Plot component, which shows the graph of x raised to the power for k</li>
</ul>
<p>Together these components form an interactive application that can be used to visualize the effect of changing parameter values.</p>
<p>Explore can be viewed as an easy application creator that generates simple applications with input and output components. Recently added packages for programmatic content generation broaden Maple’s application authoring abilities to form a full development framework for creating customized interactive content in a Maple worksheet. The <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=DocumentTools">DocumentTools</a> package contains many of these new tools. <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=DocumentTools/Components">Components</a> and <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=DocumentTools/Layout">Layout</a> are two sub-packages that generate XML using function calls that represents GUI elements, such as embedded components, tables, input, or output. For example, the DocumentTools:-Components:-<a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=DocumentTools/Components/Plot">Plot</a> command creates a new Plot component. These key pieces of functionality provide all of the building blocks needed to create customizable interfaces inside of the Maple worksheet. For me, this new functionality has completely altered my approach to building Maple worksheets and made it much easier to create new applications that can explore hundreds of data sets, visualize mathematical functions, and more.</p>
<p>I would go so far as to say that the ability to programmatically generate content is one of the most important new sources of functionality over the past few years, and is something that has the potential to significantly alter the way in which we all use Maple. Programmatic content generation allows you to create applications with hundreds of interactive components in a very short period of time when compared to building them manually using embedded components. As an illustration of this, I will show you how I easily created a table with over 180 embedded components—and the logic to control them.</p>
<p> </p>
<p><strong>Building an interface for exploring data sets:</strong></p>
<p>In my <a href="http://www.mapleprimes.com/maplesoftblog/203857-An-Interactive-Application-For-Exploring">previous</a> blog post on working with data sets in Maple, I demonstrated a simple customized interface for exploring country data sets. That post only hinted at the much bigger story of how the Maple programming language was used to author the application. What follows is the method that I used, and a couple of lessons that I learned along the way.</p>
<p>When I started building an application to explore the country data sets, I began with an approach that I had used to build several MathApps in the past. I started with a blank Maple worksheet and manually added embedded components for controlling input and output. This included checkbox components for each of the world’s countries, drop down boxes for available data sets, and a couple of control buttons for retrieving data to complete my application.</p>
<p>This manual, piece-by-piece method seemed like the most direct approach, but building my application by hand proved time-consuming, given that I needed to create 180 checkboxes to house all available countries with data. What I really needed was a quicker, more scriptable way to build my interface.</p>
<p> </p>
<p>So jumping right into it, you can view the code that I wrote to create the country data application here:<a href="/view.aspx?sf=204725_post/PECCode.txt">PECCode.txt</a></p>
<p>Note that you can download a copy of the associated Maple worksheet at the bottom of this page.</p>
<p> </p>
<p>I won’t go into too much detail on how to write this code, but the first thing to note is the length of the code; in fewer than 70 lines, this code generates an interface with all of the required underlying code to drive interaction for 180+ checkboxes, 2 buttons and a plot. In fact, if you open up the application, you’ll see that every check box has several lines of code behind it. If you tried to do this by hand, the amount of effort would be multiplied several times over.</p>
<p>This is really the key benefit to the world of programmatic content generation. You can easily build and rebuild any kind of interactive application that you need using the Maple programming language. The possibilities are endless.</p>
<p> </p>
<p><strong>Some tips and tricks:</strong></p>
<p>There are a few pitfalls to be aware of when you learn to create content with Maple code. One of the first lessons I learned was that it is always important to consider embedded component name collision and name resolution.</p>
<p>For those that have experimented with embedded components, you may have noticed that Maple’s GUI gives unique names to components that are copied (or added) in a Maple worksheet. For example, the first <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=TextAreaComponent">TextArea</a> component that you add to a worksheet usually has the default name TextArea0. If you next add another TextArea, this new TextArea gets the name TextArea1, so as to not collide with the first component. Similar behaviour can be observed with any other component and even within some component properties such as ‘group’ name.</p>
<p>Many of the options for commands in the DocumentTools sub-packages can have “action code”, or code that is run when the component is interacted with. When building action code for a generated component, the action code is specified using a long string that encapsulates all of the code. Due to this code being provided as a long string, one trick that I quickly picked up is that it is important to separate out the names for any components into sub-strings inside of a longer <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=cat">cat</a> statement.</p>
<p>For example, here is a line that is contained within a longer cat statement in the preceding code:</p>
<pre><strong>cat( "DocumentTools:-SetProperty( \"", "ComboBox_0", </strong><strong>"\", <br> 'value', \"Internet Users\" );\n" )</strong></pre>
<p>It is necessary to enclose “ComboBox_0” in quotes, as well as to add in escaped quotes in order to have the resulting action code look like (also note the added new line at the end):</p>
<pre><strong>“DocumentTools:-SetProperty( “ComboBox_0”, ‘value’, “Internet Users” );”</strong></pre>
<p>Doing so ensures that when the components are created, the names are not hard-coded to always just look for a given name. This means that the GUI can scrape through the code and update any newly generated components with a new name when needed. This is important if “ComboBox_0” already exists so that the GUI can instead create “ComboBox_1”.</p>
<p> </p>
<p>Another challenge for coding applications is adding a component state. One of the most common problems encountered with running any interactive content in Maple is that if state is not persistent, errors can occur when, for example, a play button is clicked but the required procedures have not been run. This is a very challenging problem, which often require solutions like the use of auto-executing start-up code or more involved component programming. Some features in <a href="http://www.maplesoft.com/products/maple/new_features/maple2016/StateComponent.pdf">Maple 2016</a> have started working to address this, but state is still something that usually needs to be considered on an application by application basis.</p>
<p>In my example, I needed to save the state of a table containing country names so that the interface retains the information for check box state (checked or unchecked) after restart. That is, if I saved the application with two countries selected, I wanted to ensure that when I opened the file again those same two countries would still be selected, both in the interface as well as in the table that is used to generate the plot. Now accomplishing this was a more interesting task: my hack was to insert a <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=DocumentTools/Components/DataTable">DataTable</a> component, which stored my table as an entry of a 1x1 Matrix rtable. Since the rtable that underlies a DataTable is loaded into memory on Maple load, this gave me a way to ensure that the checked country table was loaded on open.</p>
<p>Here, for example, is the initial creation of this table:</p>
<pre><strong>"if not eval( :-_SelectedCountries )::Matrix then\n",</strong></pre>
<pre><strong>" :-_SelectedCountries := Matrix(1,1,[table([])]):\n",</strong></pre>
<pre><strong>"end if;\n",</strong></pre>
<p>For more details, just look for the term: “:-_SelectedCountries” in the preceding code.</p>
<p>I could easily devote separate posts to discussing in detail each of these two quick tips. Similarly, there’s much more that can be discussed with respect to authoring an interface using programmatic tools from the DocumentTools packages, but I found the best way to learn more about a command is to try it out yourself. Once you do, you’ll find that there are an endless number of combinations for the kinds of interfaces that can be quickly built using programmatic content generation. Several commands in Maple have already started down the path of inserting customized content for their output (see DataSets:-<a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=DataSets/InsertSearchBox">InsertSearchBox</a> and AudioTools:-<a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=AudioTools/Preview">Preview</a> as a couple of examples) and I can only see this trend growing.</p>
<p>Finally, I would like to say that getting started with programmatic content generation was intimidating at first, but with a little bit of experimentation, it was a rewarding experience that has changed the way in which I work in Maple. In many cases, I now view output as something that can be customized for any command. More often than not, I turn to commands like ‘Explore’ to create an interface to see how sweeping through parameters effects my results, and any time I want to perform a more complex analysis or visualization for my data, I write code to create interfaces that can more easily be customized and re-used for other applications.</p>
<p>If you are interested in learning more about this topic, some good examples to get started with are the examples page for <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=examples/ProgrammaticContentGeneration">programmatic content generation</a> as well as the help pages for the DocumentTools:-<a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=DocumentTools/Components">Components</a> and DocumentTools:-<a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=DocumentTools/Layout">Layout</a> sub-packages.</p>
<p>To download a copy of the worksheet used in this post, click here (note that the code can be found in the start-up code of this worksheet): <a href="/view.aspx?sf=204725_post/CountryDataPEC.mw">CountryDataPEC.mw</a> To create the datasets interface, simply run the CountrySelection(); command.</p><p>Run the following command in Maple:</p>
<pre><strong>Explore(plot(x^k), k = 1 .. 3);</strong></pre>
<p style="text-align: center;"> <img src="/view.aspx?sf=204725_post/Explore.png" alt="" width="258" height="287"></p>
<p>Once you’ve run the command, move the slider from side to side. Neat, isn’t it?</p>
<p>With this single line of code, you have built an interactive application that shows the graph of x to the power of various exponent powers.</p>
<p> </p>
<p>The <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=examples/Explore">Explore</a> command is an application builder. More specifically, the Explore command can programmatically generate interactive content in Maple worksheets.</p>
<p>Programmatically generated content is inserted into a Maple worksheet by executing Maple commands. For example, when you run the Explore command on an expression, it inserts a collection of input and output controllers, called <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=EmbeddedComponents">Embedded Components</a>, into your Maple worksheet. In the preceding example, the Explore command inserts a table containing:</p>
<ul>
<li>a Slider component, which corresponds to the value for the exponent k</li>
<li>a Plot component, which shows the graph of x raised to the power for k</li>
</ul>
<p>Together these components form an interactive application that can be used to visualize the effect of changing parameter values.</p>
<p>Explore can be viewed as an easy application creator that generates simple applications with input and output components. Recently added packages for programmatic content generation broaden Maple’s application authoring abilities to form a full development framework for creating customized interactive content in a Maple worksheet. The <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=DocumentTools">DocumentTools</a> package contains many of these new tools. <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=DocumentTools/Components">Components</a> and <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=DocumentTools/Layout">Layout</a> are two sub-packages that generate XML using function calls that represents GUI elements, such as embedded components, tables, input, or output. For example, the DocumentTools:-Components:-<a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=DocumentTools/Components/Plot">Plot</a> command creates a new Plot component. These key pieces of functionality provide all of the building blocks needed to create customizable interfaces inside of the Maple worksheet. For me, this new functionality has completely altered my approach to building Maple worksheets and made it much easier to create new applications that can explore hundreds of data sets, visualize mathematical functions, and more.</p>
<p>I would go so far as to say that the ability to programmatically generate content is one of the most important new sources of functionality over the past few years, and is something that has the potential to significantly alter the way in which we all use Maple. Programmatic content generation allows you to create applications with hundreds of interactive components in a very short period of time when compared to building them manually using embedded components. As an illustration of this, I will show you how I easily created a table with over 180 embedded components—and the logic to control them.</p>
<p> </p>
<p><strong>Building an interface for exploring data sets:</strong></p>
<p>In my <a href="http://www.mapleprimes.com/maplesoftblog/203857-An-Interactive-Application-For-Exploring">previous</a> blog post on working with data sets in Maple, I demonstrated a simple customized interface for exploring country data sets. That post only hinted at the much bigger story of how the Maple programming language was used to author the application. What follows is the method that I used, and a couple of lessons that I learned along the way.</p>
<p>When I started building an application to explore the country data sets, I began with an approach that I had used to build several MathApps in the past. I started with a blank Maple worksheet and manually added embedded components for controlling input and output. This included checkbox components for each of the world’s countries, drop down boxes for available data sets, and a couple of control buttons for retrieving data to complete my application.</p>
<p>This manual, piece-by-piece method seemed like the most direct approach, but building my application by hand proved time-consuming, given that I needed to create 180 checkboxes to house all available countries with data. What I really needed was a quicker, more scriptable way to build my interface.</p>
<p> </p>
<p>So jumping right into it, you can view the code that I wrote to create the country data application here:<a href="/view.aspx?sf=204725_post/PECCode.txt">PECCode.txt</a></p>
<p>Note that you can download a copy of the associated Maple worksheet at the bottom of this page.</p>
<p> </p>
<p>I won’t go into too much detail on how to write this code, but the first thing to note is the length of the code; in fewer than 70 lines, this code generates an interface with all of the required underlying code to drive interaction for 180+ checkboxes, 2 buttons and a plot. In fact, if you open up the application, you’ll see that every check box has several lines of code behind it. If you tried to do this by hand, the amount of effort would be multiplied several times over.</p>
<p>This is really the key benefit to the world of programmatic content generation. You can easily build and rebuild any kind of interactive application that you need using the Maple programming language. The possibilities are endless.</p>
<p> </p>
<p><strong>Some tips and tricks:</strong></p>
<p>There are a few pitfalls to be aware of when you learn to create content with Maple code. One of the first lessons I learned was that it is always important to consider embedded component name collision and name resolution.</p>
<p>For those that have experimented with embedded components, you may have noticed that Maple’s GUI gives unique names to components that are copied (or added) in a Maple worksheet. For example, the first <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=TextAreaComponent">TextArea</a> component that you add to a worksheet usually has the default name TextArea0. If you next add another TextArea, this new TextArea gets the name TextArea1, so as to not collide with the first component. Similar behaviour can be observed with any other component and even within some component properties such as ‘group’ name.</p>
<p>Many of the options for commands in the DocumentTools sub-packages can have “action code”, or code that is run when the component is interacted with. When building action code for a generated component, the action code is specified using a long string that encapsulates all of the code. Due to this code being provided as a long string, one trick that I quickly picked up is that it is important to separate out the names for any components into sub-strings inside of a longer <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=cat">cat</a> statement.</p>
<p>For example, here is a line that is contained within a longer cat statement in the preceding code:</p>
<pre><strong>cat( "DocumentTools:-SetProperty( \"", "ComboBox_0", </strong><strong>"\", <br> 'value', \"Internet Users\" );\n" )</strong></pre>
<p>It is necessary to enclose “ComboBox_0” in quotes, as well as to add in escaped quotes in order to have the resulting action code look like (also note the added new line at the end):</p>
<pre><strong>“DocumentTools:-SetProperty( “ComboBox_0”, ‘value’, “Internet Users” );”</strong></pre>
<p>Doing so ensures that when the components are created, the names are not hard-coded to always just look for a given name. This means that the GUI can scrape through the code and update any newly generated components with a new name when needed. This is important if “ComboBox_0” already exists so that the GUI can instead create “ComboBox_1”.</p>
<p> </p>
<p>Another challenge for coding applications is adding a component state. One of the most common problems encountered with running any interactive content in Maple is that if state is not persistent, errors can occur when, for example, a play button is clicked but the required procedures have not been run. This is a very challenging problem, which often require solutions like the use of auto-executing start-up code or more involved component programming. Some features in <a href="http://www.maplesoft.com/products/maple/new_features/maple2016/StateComponent.pdf">Maple 2016</a> have started working to address this, but state is still something that usually needs to be considered on an application by application basis.</p>
<p>In my example, I needed to save the state of a table containing country names so that the interface retains the information for check box state (checked or unchecked) after restart. That is, if I saved the application with two countries selected, I wanted to ensure that when I opened the file again those same two countries would still be selected, both in the interface as well as in the table that is used to generate the plot. Now accomplishing this was a more interesting task: my hack was to insert a <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=DocumentTools/Components/DataTable">DataTable</a> component, which stored my table as an entry of a 1x1 Matrix rtable. Since the rtable that underlies a DataTable is loaded into memory on Maple load, this gave me a way to ensure that the checked country table was loaded on open.</p>
<p>Here, for example, is the initial creation of this table:</p>
<pre><strong>"if not eval( :-_SelectedCountries )::Matrix then\n",</strong></pre>
<pre><strong>" :-_SelectedCountries := Matrix(1,1,[table([])]):\n",</strong></pre>
<pre><strong>"end if;\n",</strong></pre>
<p>For more details, just look for the term: “:-_SelectedCountries” in the preceding code.</p>
<p>I could easily devote separate posts to discussing in detail each of these two quick tips. Similarly, there’s much more that can be discussed with respect to authoring an interface using programmatic tools from the DocumentTools packages, but I found the best way to learn more about a command is to try it out yourself. Once you do, you’ll find that there are an endless number of combinations for the kinds of interfaces that can be quickly built using programmatic content generation. Several commands in Maple have already started down the path of inserting customized content for their output (see DataSets:-<a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=DataSets/InsertSearchBox">InsertSearchBox</a> and AudioTools:-<a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=AudioTools/Preview">Preview</a> as a couple of examples) and I can only see this trend growing.</p>
<p>Finally, I would like to say that getting started with programmatic content generation was intimidating at first, but with a little bit of experimentation, it was a rewarding experience that has changed the way in which I work in Maple. In many cases, I now view output as something that can be customized for any command. More often than not, I turn to commands like ‘Explore’ to create an interface to see how sweeping through parameters effects my results, and any time I want to perform a more complex analysis or visualization for my data, I write code to create interfaces that can more easily be customized and re-used for other applications.</p>
<p>If you are interested in learning more about this topic, some good examples to get started with are the examples page for <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=examples/ProgrammaticContentGeneration">programmatic content generation</a> as well as the help pages for the DocumentTools:-<a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=DocumentTools/Components">Components</a> and DocumentTools:-<a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=DocumentTools/Layout">Layout</a> sub-packages.</p>
<p>To download a copy of the worksheet used in this post, click here (note that the code can be found in the start-up code of this worksheet): <a href="/view.aspx?sf=204725_post/CountryDataPEC.mw">CountryDataPEC.mw</a> To create the datasets interface, simply run the CountrySelection(); command.</p>204725Tue, 12 Jul 2016 14:05:53 ZDaniel SkoogDaniel Skoog