LargeExpressions
Veil
hide a complicated expression
Unveil
show a hidden complicated expression
Calling Sequence
Parameters
Description
Examples
References
Veil[K]( complicated_expression )
Unveil[K]( expressions_with_Ks, n )
LastUsed
K
-
unassigned name to use as a label
complicated_expression
expression
expressions_with_Ks
expression that has been veiled
n
positive integer representing the level of unveiling, or infinity, meaning all levels
During a long calculation, it is sometimes useful to explicitly control Maple evaluation of expressions by hiding their values under user-defined labels. This allows compact representation of the results as a computation sequence, generated from the natural hierarchy of the problem.
The Veil command is used to hide information, Unveil to reveal the hidden information. Both commands take an index that specifies the label to use; multiple labels can be present in an expression and manipulated independently. If no label is specified, _V is used.
You can use these commands as a functional argument to collect, replacing complicated coefficients in a sum of terms by simple labels.
The protected variable LastUsed contains a table of indices pointing to the last used label index in each variable.
Treat a polynomial in x,y,z as a polynomial in z with hidden coefficients depending on x,y.
with⁡LargeExpressions:
p≔randpoly⁡x,y,z,degree=5,dense
p≔−7⁢x5+22⁢x4⁢y−55⁢x4⁢z+87⁢x3⁢y2−56⁢x3⁢y⁢z−62⁢x3⁢z2−4⁢x2⁢y3−83⁢x2⁢y2⁢z+62⁢x2⁢y⁢z2−44⁢x2⁢z3−10⁢x⁢y4−7⁢x⁢y3⁢z+42⁢x⁢y2⁢z2+75⁢x⁢y⁢z3+72⁢x⁢z4+29⁢y5+98⁢y4⁢z+10⁢y3⁢z2−29⁢y2⁢z3−47⁢y⁢z4−10⁢z5−94⁢x4+97⁢x3⁢z−10⁢x2⁢y2−82⁢x2⁢y⁢z+71⁢x2⁢z2−40⁢x⁢y3−50⁢x⁢y2⁢z−92⁢x⁢y⁢z2+37⁢x⁢z3−23⁢y4−61⁢y3⁢z+95⁢y2⁢z2+40⁢y⁢z3+31⁢z4−73⁢x3+80⁢x2⁢y−17⁢x2⁢z+23⁢x⁢y2+6⁢x⁢y⁢z−23⁢x⁢z2−8⁢y3+11⁢y2⁢z−81⁢y⁢z2−51⁢z3−75⁢x2+74⁢x⁢y+87⁢x⁢z−49⁢y2+91⁢y⁢z+77⁢z2+44⁢x+68⁢y+95⁢z+1
compact≔collect⁡p,z,VeilK
compact≔−10⁢z5+K1⁢z4−K2⁢z3−K3⁢z2−K4⁢z−K5
zero≔normal⁡UnveilK⁡compact,∞−p
zero≔0
Create another sequence using different labels. Note that the table of last used indices is keyed by the label name (in this case C).
compact2≔collect⁡p,y,VeilC
compact2≔29⁢y5−C1⁢y4−C2⁢y3+C3⁢y2+C4⁢y−C5
CS≔seq⁡Ci=UnveilC⁡Ci,i=1..LastUsedC
CS≔C1=10⁢x−98⁢z+23,C2=4⁢x2+7⁢x⁢z−10⁢z2+40⁢x+61⁢z+8,C3=87⁢x3−83⁢x2⁢z+42⁢x⁢z2−29⁢z3−10⁢x2−50⁢x⁢z+95⁢z2+23⁢x+11⁢z−49,C4=22⁢x4−56⁢x3⁢z+62⁢x2⁢z2+75⁢x⁢z3−47⁢z4−82⁢x2⁢z−92⁢x⁢z2+40⁢z3+80⁢x2+6⁢x⁢z−81⁢z2+74⁢x+91⁢z+68,C5=7⁢x5+55⁢x4⁢z+62⁢x3⁢z2+44⁢x2⁢z3−72⁢x⁢z4+10⁢z5+94⁢x4−97⁢x3⁢z−71⁢x2⁢z2−37⁢x⁢z3−31⁢z4+73⁢x3+17⁢x2⁢z+23⁢x⁢z2+51⁢z3+75⁢x2−87⁢x⁢z−77⁢z2−44⁢x−95⁢z−1
CodeGenerationFortran⁡CS
C(1) = 10 * x - 98 * z + 23 C(2) = 4 * x ** 2 + 7 * x * z - 10 * z ** 2 + 40 * x + 61 * z + 8 C(3) = 87 * x ** 3 - 83 * x ** 2 * z + 42 * x * z ** 2 - 29 * z ** # 3 - 10 * x ** 2 - 50 * x * z + 95 * z ** 2 + 23 * x + 11 * z - 49 C(4) = 22 * x ** 4 - 56 * x ** 3 * z + 62 * x ** 2 * z ** 2 + 75 * # x * z ** 3 - 47 * z ** 4 - 82 * x ** 2 * z - 92 * x * z ** 2 + 40 # * z ** 3 + 80 * x ** 2 + 6 * x * z - 81 * z ** 2 + 74 * x + 91 * #z + 68 C(5) = 7 * x ** 5 + 55 * x ** 4 * z + 62 * x ** 3 * z ** 2 + 44 * #x ** 2 * z ** 3 - 72 * x * z ** 4 + 10 * z ** 5 + 94 * x ** 4 - 97 # * x ** 3 * z - 71 * x ** 2 * z ** 2 - 37 * x * z ** 3 - 31 * z ** # 4 + 73 * x ** 3 + 17 * x ** 2 * z + 23 * x * z ** 2 + 51 * z ** 3 # + 75 * x ** 2 - 87 * x * z - 77 * z ** 2 - 44 * x - 95 * z - 1
The following Frobenius series solution to a differential equation has complicated coefficients, which obscure the structure of the solution.
de≔sin⁡x⁢diff⁡y⁡x,x,x−2⁢cos⁡x⁢diff⁡y⁡x,x−a⁢sin⁡x⁢y⁡x
de≔sin⁡x⁢ⅆ2ⅆx2y⁡x−2⁢cos⁡x⁢ⅆⅆxy⁡x−a⁢sin⁡x⁢y⁡x
Order≔14
soln≔dsolve⁡de,y⁡x,series:
algsol≔convert⁡eval⁡y⁡x,soln,polynom:
collect⁡algsol,x,VeilL
1217945728000⁢L1⁢x15+1518918400⁢L2⁢x13−139916800⁢L3⁢x12+16652800⁢L4⁢x11−1302400⁢L5⁢x10+115120⁢L6⁢x9−13360⁢L7⁢x8+1840⁢L8⁢x7−160⁢L9⁢x6+110⁢L10⁢x5−12⁢L11⁢x4+c__1⁢x3−6⁢L12⁢x2+12⁢c__2
seq⁡Lk=UnveilL⁡Lk,k=1..LastUsedL
L1=c__1⁢7⁢a6−224⁢a5+2016⁢a4−7680⁢a3+14080⁢a2−12288⁢a+4096,L2=c__1⁢3⁢a5−70⁢a4+448⁢a3−1152⁢a2+1280⁢a−512,L3=c__2⁢a⁢11⁢a5−220⁢a4+1232⁢a3−2816⁢a2+2816⁢a−1024,L4=c__1⁢5⁢a4−80⁢a3+336⁢a2−512⁢a+256,L5=c__2⁢a⁢9⁢a4−120⁢a3+432⁢a2−576⁢a+256,L6=c__1⁢a3−10⁢a2+24⁢a−16,L7=c__2⁢a⁢7⁢a3−56⁢a2+112⁢a−64,L8=c__1⁢3⁢a2−16⁢a+16,L9=c__2⁢a⁢5⁢a2−20⁢a+16,L10=c__1⁢a−2,L11=c__2⁢a⁢3⁢a−4,L12=c__2⁢a
Example based on content provided in Chapter 2 of Essential Maple 7.
Corless, Robert M. Essential Maple 7. Springer-Verlag.
See Also
CodeGeneration
collect
CompSeq
freeze
thaw
Download Help Document