Runge--Kutta of order 2


This tutorial surves as an introduction to the computer algebra system Maple, created by MapleSoft ©. It is made solely for the purpose of education. This tutorial assumes that you have a working knowledge of basic Maple functionality. This includes knowing how to define variables and carry out algebraic manipulations. If you are completely new to Maple, then please go to the introductory tutorial for APMA0330.

Usually, the same algorithm can be implemented in many different ways to accomplish the same task. As a result, this tutorial may introduce several different commands (or sets of commands) to do the same thing. It is always good to be aware of these alternate pathways; however, you are welcome to pick up any approach whatever you like the best .

Finally, the commands in this tutorial are all written in red text (as Maple input), while Maple output is in blue, which means that the output is in 2D output style. You can copy and paste all commands into Maple, change the parameters and run them. You, as the user, are free to use the mw files and scripts to your needs, and have the rights to distribute this tutorial and refer to this tutorial as long as this tutorial is accredited appropriately. The tutorial accompanies the textbook Applied Differential Equations. The Primary Course by Vladimir Dobrushkin, CRC Press, 2015; http://www.crcpress.com/product/isbn/9781439851043.

Return to computing page for the first course APMA0330
Return to computing page for the second course APMA0340
Return to Maple tutorial for the first course (APMA0330)
Return to Maple tutorial for the second course (APMA0340)
Return to the main page for the course APMA0340
Return to the main page for the course APMA0330

Return to Matrix Algebra with(linalg)


Now we will explore topics from Linear Algebra. To begin, we will need to load the linear algebra package. Actually, Maple has two such packages: linalg and LinearAlgebra. The linalg package is older and considered obsolete; it was replaced by LinearAlgebra in Maple version 6 (in 1999). The LinearAlgebra package is more powerful and it is recommended to use. However, for our needs, linalg package may be sufficient.
The command to invoke a linear algebra package is with(LInearAlgebra): If the package is not loaded, then either a typed command will not be recognized, or a different command with the same name will be used. Note that the LinearAlgebra package uses commands that start with an upper-case initial letters, similar to Mathematica.

2.1.1. How to Define and Operate on Vectors

g:= <1, t^2, 2, t^3>

map(u -> u^2, g)

The map( ) command takes each element u of the vector and applies the function f(u) to it. In this example, each element of the vector g is squared. u is a dummy variable. Any other letter or name could be used in its place. This command is particularly useful for taking derivatives and integrals of vectors and matrices.

Matrix Derivative and Integral Example:
B:= <<t, exp(t)>|<sin(t), t^4>>

map(q -> diff(q, t), B)

map(q -> int(q, t), B)

The integral command does not include constants of integration.

Definite Integral:
map(q -> int(q, t = 0..5), B)