LargeExpressions - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Input and Output : Output : LargeExpressions : LargeExpressions/Veil

LargeExpressions

  

Veil

  

hide a complicated expression

  

Unveil

  

show a hidden complicated expression

 

Calling Sequence

Parameters

Description

Examples

References

Calling Sequence

Veil[K]( complicated_expression )

Unveil[K]( expressions_with_Ks, n )

LastUsed

Parameters

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

Description

• 

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.

Examples

Treat a polynomial in x,y,z as a polynomial in z with hidden coefficients depending on x,y.

withLargeExpressions:

prandpolyx,y,z,degree=5,dense

p7x5+22x4y55x4z+87x3y256x3yz62x3z24x2y383x2y2z+62x2yz244x2z310xy47xy3z+42xy2z2+75xyz3+72xz4+29y5+98y4z+10y3z229y2z347yz410z594x4+97x3z10x2y282x2yz+71x2z240xy350xy2z92xyz2+37xz323y461y3z+95y2z2+40yz3+31z473x3+80x2y17x2z+23xy2+6xyz23xz28y3+11y2z81yz251z375x2+74xy+87xz49y2+91yz+77z2+44x+68y+95z+1

(1)

compactcollectp,z,VeilK

compact10z5+K1z4K2z3K3z2K4zK5

(2)

zeronormalUnveilKcompact,p

zero0

(3)

Create another sequence using different labels. Note that the table of last used indices is keyed by the label name (in this case C).

compact2collectp,y,VeilC

compact229y5C1y4C2y3+C3y2+C4yC5

(4)

CSseqCi=UnveilCCi,i=1..LastUsedC

CSC1=10x98z+23,C2=4x2+7xz10z2+40x+61z+8,C3=87x383x2z+42xz229z310x250xz+95z2+23x+11z49,C4=22x456x3z+62x2z2+75xz347z482x2z92xz2+40z3+80x2+6xz81z2+74x+91z+68,C5=7x5+55x4z+62x3z2+44x2z372xz4+10z5+94x497x3z71x2z237xz331z4+73x3+17x2z+23xz2+51z3+75x287xz77z244x95z1

(5)

CodeGenerationFortranCS

      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.

desinxdiffyx,x,x2cosxdiffyx,xasinxyx

desinxⅆ2ⅆx2yx2cosxⅆⅆxyxasinxyx

(6)

Order14

Order14

(7)

solndsolvede,yx,series:

algsolconvertevalyx,soln,polynom:

collectalgsol,x,VeilL

1217945728000L1x15+1518918400L2x13139916800L3x12+16652800L4x111302400L5x10+115120L6x913360L7x8+1840L8x7160L9x6+110L10x512L11x4+_C1x36L12x2+12_C2

(8)

seqLk=UnveilLLk,k=1..LastUsedL

L1=_C17a6224a5+2016a47680a3+14080a212288a+4096,L2=_C13a570a4+448a31152a2+1280a512,L3=_C2a11a5220a4+1232a32816a2+2816a1024,L4=_C15a480a3+336a2512a+256,L5=_C2a9a4120a3+432a2576a+256,L6=_C1a310a2+24a16,L7=_C2a7a356a2+112a64,L8=_C13a216a+16,L9=_C2a5a220a+16,L10=_C1a2,L11=_C2a3a4,L12=_C2a

(9)

Example based on content provided in Chapter 2 of Essential Maple 7.

References

  

Corless, Robert M. Essential Maple 7. Springer-Verlag.

See Also

CodeGeneration

collect

CompSeq

freeze

thaw