generate points from a WhileLoop
TrajectoryPoints(loop, seedpoints, n, p, trajectorytype)
list of integers, or a list or a set thereof; initial points for the generated trajectories
posint, number of trajectory points to generate per seed point
(optional) posint, compute the trajectories modulo this number
(optional) one of plain (default), inductive, or absolute, the type of trajectory to generate
This command computes loop trajectories for the WhileLoop loop. The trajectories start the point(s) given by seedpoints. These points are formed of loop's parameters and variables, formed as the list loop:−variables,loop:−parameters. The loop is iterated for each of these seed points and new values are computed.
This command operates in three modes depending on the trajectorytype:
trajectorytype = plain (default) : the loop is executed as in the original procedure. loop's guard and branch conditions are evaluated at every iteration, causing a single trajectory to be generate per initial point and terminating as the guard condition evaluates to false or as the requested number of points is reached.
trajectorytype = inductive : the guard condition is ignored while iterating the loop so that the generated trajectories may continue beyond their natural end points.
trajectorytype = absolute : both the guard and branch conditions of the loop are ignored. At each iteration, the trajectory is split so that it follows each branch in the loop's if statement as if the branches were all simultaneously taken.
The loop will be iterated until at least n distinct points are generated, if possible. The number of returned points may be fewer than n if the loop terminates prematurely due to the guard condition or if the trajectories loop back onto themselves and cease to generate new points.
The evaluation of the loop trajectories can optionally be conducted modulo p. By default, the computations are done without modular arithmetic in a characteristic zero field.
Generating a Sufficient Number of Points
The following procedure counts up from 1 to a:
p := proc(a)
n := 1:
while n < a do
n := n + 1:
Create the WhileLoop data structure:
loop ≔ CreateLoop⁡p
loop ≔ Record⁡WhileLoop,variables=n,parameters=a,initialization=1,transitions=,n+1,guard=n<a,precondition=,postcondition=,returnvalue=n
Ask for 20 trajectory points to be generated, starting with n=1 and taking a=10:
trajcetory_points_1 ≔ TrajectoryPoints⁡loop,1,10,20
trajcetory_points_1 ≔ 10,10,5,10,2,10,3,10,1,10,4,10,9,10,6,10,8,10,7,10
Fewer than 20 points were generated in counting from 1 to 10:
Additional seed points can be given to generate more trajectory points:
trajcetory_points_2 ≔ TrajectoryPoints⁡loop,1,10,1,20,20
trajcetory_points_2 ≔ 9,20,10,10,7,20,5,10,8,20,2,10,3,10,6,20,1,10,11,20,1,20,4,10,10,20,9,10,6,10,8,10,3,20,2,20,7,10,5,20,4,20
The CodeTools[ProgramAnalysis][TrajectoryPoints] command was introduced in Maple 2016.
For more information on Maple 2016 changes, see Updates in Maple 2016.
Download Help Document
What kind of issue would you like to report? (Optional)
Thank you for submitting feedback on this help document. Your feedback will be used
to improve Maple's help in the future.