12.07.2015 Views

Learning Guide Learning Guide

Learning Guide Learning Guide

Learning Guide Learning Guide

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

7.2 Writing Data to a File • 275Saving Expressions in Maple’s Internal FormatIf you construct a complicated expression or procedure, you may want tosave it for future use in Maple. If you save the expression or procedurein Maple’s internal format, then Maple can retrieve it efficiently. You canaccomplish this by using the save command to write the expression to afile whose name ends with the characters “.m”. Use the save commandwith the following syntax.save nameseq, "filename.m";Here nameseq is a sequence of names; you can save only named objects.The save command saves the objects in filename.m. The .m indicatesthat save will write the file using Maple’s internal format.Consider the following.> qbinomial := (n,k) -> product(1-q^i, i=n-k+1..n) /> product(1-q^i, i=1..k );qbinomial := (n, k) →n∏(1 − q i )i=n−k+1k∏(1 − q i )i=1> expr := qbinomial(10, 4);expr := (1 − q7 ) (1 − q 8 ) (1 − q 9 ) (1 − q 10 )(1 − q) (1 − q 2 ) (1 − q 3 ) (1 − q 4 )> nexpr := normal( expr );nexpr := (q 6 + q 5 + q 4 + q 3 + q 2 + q + 1) (q 4 + 1) (q 6 + q 3 + 1)(q 8 + q 6 + q 4 + q 2 + 1)You can now save these expressions to the file qbinom.m.> save qbinomial, expr, nexpr, "qbinom.m";The restart command clears the three expressions from memory.Thus expr evaluates to its own name below.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!