Valerie

132 Reputation

6 Badges

6 years, 46 days
I am a front end developer here at Maplesoft working on Maple Learn and the Maple Calculator.

MaplePrimes Activity


These are Posts that have been published by Valerie

The order in which expressions evaluate in Maple is something that occasionally causes even advanced users to make syntax errors.

I recently saw a single line of Maple code that provided a good example of a command not evaluating in the order the user desired.

The command in question (after calling with(plots):) was

animate(display, [arrow(<cos(t), sin(t)>)], t = 0 .. 2*Pi)

This resulted in the error:

Error, (in plots/arrow) invalid input: plottools:-arrow expects its 3rd argument, pv, to be of type {Vector, list, vector, complexcons, realcons}, but received 0.5000000000e-1*(cos(t)^2+sin(t)^2)^(1/2)
 

This error indicates that the issue in the animation is the arrow command

arrow(<cos(t), sin(t)>)

on its own, the above command would give the same error. However, the animate command takes values of t from 0 to 2*Pi and substitutes them in, so at first glance, you wouldn't expect the same error to occur.

What is happening is that the command 

arrow(<cos(t), sin(t)>)

in the animate expression is evaluating fully, BEFORE the call to animate is happening. This is due to Maple's automatic simplification (since if this expression contained large expressions, or the values were calculated from other function calls, that could be simplified down, you'd want that to happen first to prevent unneeded calculation time at each step).

So the question is how do we stop it evaluating ahead of time since that isn't what we want to happen in this case?

In order to do this we can use uneval quotes (the single quotes on the keyboard - not to be confused with the backticks). 

animate(display, ['arrow'(<cos(t), sin(t)>)], t = 0 .. 2*Pi)

By surrounding the arrow function call in the uneval quotes, the evaluation is delayed by a level, allowing the animate call to happen first so that each value of t is then substituted before the arrow command is called.

Maple_Evaluation_Order_Example.mw

With the new features added to the Student[LinearAlgebra] package I wanted to go over some of the basics on how someone can do Linear Algebra in Maple without require them to do any programming.  I was recently asked about this and thought that the information may be useful to others.
 

This post will be focussed towards new Maple users. I hope that this will be helpful to students using Maple for the first time and professors who want their students to use Maple without needing to spend time learning the language.
 

In addition to the following post you can find a detailed video on using Maple to do Linear Algebra without programming here. You can also find some of the tools that are new to Maple 2020 for Linear Algebra here.

The biggest tools you'll be using are the Matrix palette on the left of Maple, and the Context Panel on the right of Maple.

First you should load the Student[LinearAlgebra] package by entering:

with(Student[LinearAlgebra]);

at the beginning of your document. If you end it with a colon rather than a semi colon it won't display the commands in the package.

Use the Matrix Palette on the left to input Matrices:

 


Once you have a Matrix you can use the context panel on the right to apply a variety of operations to it:

 


The Student Linear Algebra Menu will give you many linear algebra commands.

 


You can also access Maple's Tutors from the Tools Menu

Tools > Tutors > Linear Algebra



If you're interested in using the commands for Student[LinearAlegbra] in Maple you can view the help pages here or by entering:

?Student[LinearAlegbra]

into Maple.

I hope that this helps you get started using Maple for Linear Algebra.

Page 1 of 1