SlideShare a Scribd company logo
1 of 3
Download to read offline
A Case History in Interactive Problem-Solving
Richard J. Fateman
Department of Mathematics
Massachusetts Institute of Technologg
Cambridge. Mass.
ABSTRACT
MACSYMA [1], a computer program for algebraic
manipulation, is used to solve, sgmbolicallg and exactlg, a
problem involving integration and the solution of an
infinite set of linear equations. This is a tutorial in the
use of 11ACSYMA. and illustrates some of the choices
available to the interactive user which aid in solving a
mathematical problem.
I - The problem
In [2]. H. P. Greenspan develops a model of the
generation of large scale magnetic fields from small scale
motions of a conducting flu.d. We take as a starting point.
a met of equations (whose significance will not be discussed
here) to be solved for coefficients B[2N+i]. The equations
are
I NF
 . . . . 2 (K + 1) (2 K + I ) B
 2 K + 1
( > (A B ) ) + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C
I N, K 2 N + i 4 K +3 K
I=.==
N=8
A
N, K
~PI
2
/
[
(I
]
/
TH
and
K = 8 , 1. . . .
~PI
2
I
[ (1) 2 N + 3
- - I ((P ( C O S ( T H ] ]
SIN(TH)
] 2K+l
/
0
(1)
(1) - 2 N - 3
(P (COS(Z)) SIN(Z] ] dZ])/COS[TH)} dTH
2 N + 1 (2)
3
GAMMA(-) GAMMA(2 K + 3]
2
C ............................................ (3)
K 3
2 GAMMA(K + 3) GAMMA(- - K) GAMMA(2 K + 1]
2
where P is an associated Legendre function. The above
displags were generated bg MACSYMA, and includes a summation
sign and two integrals (stand back a bit if gou can't see
them).
II - The Solution
Equation (1) is an infinite set of linear equations.
The technique for solving for the B[i] is to generate and
solve the first equation for B[1], then generate the next
equation, and solve these two equations together to get B[I]
and B[3], etc. One hopes that the sequence of values for
BIll derived in this wag converges, and similarlg for B[3],
etc, It is also expected, in the context of this problem,
that B[i] tends to 0 for large i.
We will assume that the reader has a slight
acquaintance with MACSYMA [1] or a similar agetem for
algebraic manipulation.
Let us do the easg parts first. Equation (3) defines
a set of values for C. We could define a function C(K)
which when given the value for K returns the value for C(K),
but this gould repeatedlg compute C. We might as well save
them in an arrag, especiallg since in MACSYMA it is just as
simple. In this case, when C[1] is requested the first
time, it gets computed using the formula, and is then stored
in memorg so that subsequent references to C[I] are just
read out of storage. The definition (and displag] of C as
given to 11ACSYMA is=
(C1 ] C [KI ; = -GAMMA(3/2) ~'rGAMMA
(2~'~+3) /
(2~'~GAMMA(2~',K+1) ~'A3AMMA
(3/2-K) ~AMMA (3-PK) ) ;
SORT(%PI) GAMMA(2 K + 3]
(D1) C =. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
K 3
4 GAMMA(K + 3) GAMMA(- - K) GAMMA(2 K + i )
2
Note that MACSY11Ahas simplified the GAMMA(3/2).
Let ue compute a list of the first 4 values.
(C2] [C [0] ,C [1] ,C [2] ,C [31 ] ;
1 1 5 7
(D2] [ - - , - - , - - , - - - ]
2 2 32 80
Next, let us compute the associated Legendre functions
bg ang convenient method. Rodrigues' formula is handgz
N+11
N 2 N/2 0 2 M
( - 1) (1 - X ) ( ....... (X - 1) !
N+M
(N) DX
P (X) .......................................
M M
2 M~
But since all we need is the N=I case evaluated at cos(u],
He can replace (1-X'I'2)f(N/2) bg sin(u), and after taking
derivatives with respect to x, substitute cos( U) for x. ge
can set up an arrag of functions, one for each associated
Legendre function at a cosine point bg
(C3) ALF[M](Y):=-SIN(Y)/(2fM~'~!)~SUBST(CDS(Y],X,
DIFF((Xf2-1)fM,X,M+I)):
(D3]
M+I
D 2 M
SIN(Y) SUBST(COS(Y), X, - ...... (X - 1) )
I1+1
DX
ALF (Y) =.............................................
M M
2 M!
(C4) ALF[S](X);
2 2 4 2
(04] - ((;200 (COS (X) - 1) + $7800 COS (X) + 88400 COS (X)
(COS (X] -1)) SIN(X])/3840
This might be sufficient, but it is somewhat neater to
convert these results into a simpler form involving just
sines or just cosines. Since formula (2) alreadg involves
sines, we choose sines. Ue can do this bg defining get
another arrag, which has the same values as ALF, but with
(1-SIN(Y)~2) substituted for COS(Y)~2 evergwhere. Since He
also want to convert COS(Y)t4 (etc) to SIN's, we use
RATSUBST=
(C5) ALF1 [M] (Y] == RATSUBST(l-S( N(Y) t2, COS(Y) f2, ALF [M] (Y)) $
30
it Imeea.prafarabla to divide the denominator through,
Imlam tMpe#
(C8) RATIEXPANOz
T$
(C7) ALF1 [5] (X)
5 3
315 SIN (X) 185 SIN (X)
(O7) ............ + ............ 15 SIN(X)
8 2
The next problem ie to evaluate the integrals of
equation (2). Me Bay have no a priori knoHledgm of Mhathmr
the integral |e singular, or if it can be done exactlw by
conventional methods, or if it involves special functions.
Me can let rlACSYItA take care of these problems if Me just
define:
(C8) A IN,K]:- INTEGRATE(-BIN(TH)~(2.~N+3I/COS(TH)~
ALF1 [2.kK+l] (TH)~
INTEGRATE(ALFi[2~.N+II(Z)/SIN(Z)~(2ctN+3),Z,TH,¢OI/2),
TH,B,Y,PI/2)$
This iea time-consuming calculation since definite
integration in MACSYMA is done Nith great concern for a
function's behavior, and can use contour integration
algorithms, and various heuristic methods. Another fault
with this formulation ie that if Me are going to compute
many of these A[N,K], Me Mill be recomputing the inner
integral, Nhich depends only on N, repeatedly. Although
this formulation can be used, it is helpful to analyze the
problem further.
Some experimentation shows that the inner integral Is
siNeWs 8 at ZPI/2, and that all Me have to do is compute:
(C8) INNER|NT[N]:- -INTEGRATE(ALFi[2~+iI(TH)/SIN(TH)~(2.crN+3),TH)$
An improvement in running time can be made by first
cancelling the SIN's in the denominator and expanding the
integrand. After this expansion, the integration program
produces an integral entirely in terms of I/TAN(TH).
Mlthout this transformation, the integration program returns
a much more unuleldy aneMer. The interactive nature of
I'IACSYrlA aided in this discoverw, because both of the
indicated programs Mare tried out.
(C18) INNER;NT[N]zm -INTEGRATE(RATEXPAND(ALFI[2~,N+I](TH)/
SIN(TH)~(2~AS+3I),THI$
(Cll) INNERINT[2]~
1S iS 3
(011) .......... + ...................
8 TAN(TH) 3 5
2 TAN (TH) TAN (TH)
This ie fairly neat. Mhat Me Mould really prefer, le to
remove the TAN'B and put in SIN's, or at least S|N'e and
COS'e. This can be done quite simply using RATSUBST.
(C12) [1 [N]z-RATSUBST(1-SIN(THIt2,COS(THIt2,
RATSUBST(S|N(TH)/COS(TH),TAN(TH),INNERINT [N]))I
(C13) i1(2]1
99 COS(TH) 27 COS(TH) 3 COS(TH)
(D13) ........... + ....................
8 SIN(TH) 3 S
2 SIN (TH) SIN (TH)
NoM Me are at the point Mhere Me can generate the integrand
for the outer integral, and examine Nhat it is Me really are
after. The integrands have a suprisingl W simple structure.
(C14) R(N,KIz=RATEXPAND(-SIN(THIt(2~N+3)/
COS(THI~ALF~I2c,K+I](THI~II[N])$
(C15) R(8,1Is
(DIS)
(C16) R(1,8)~
(016)
S
15 SIN (TH} 3
............ G SIN (TH)
2
S
7 SIN (TH) 3
........... 2 SIN (TH)
2
(C17)'R(1,1)~
7
185 SIN (TH) 5 3
(017) ............. + 3G SIN (TH) - 12 SIN (TH)
4
]t can be determined that in fact all integrande are auma of
poMere of S]N(TH), and only odd poMere, at that,
Integration could be done by using the INTEGRATE command,
but this computation Mould proceed bW doing the indefinite
integral, and then return the difference of evaluating at
the limits. This ie fine for one or tMo cases, but Me can
save considerable time bg computing definite integrals of
powers of SIN, and storing them in an array. Me can also
illustrate some mope facilitee Of MACSYMAalong the Nay.
There iea little formula available fop computing the
integral from 8 to Y,
PI/2 of an odd pouer of SIN. It is:
(C18) ISIN[N]:-BLOCK([M), Mz(N-1)/2,
RETURN(2t(2~)~(M!It2/N!))$
NoM Me are ready to produce the A[N,K]:
(C1S) A[N,K]:- BLOCK([EXP,ANS,COEF,H],
ANS:8,
EXP:R(N.K),
H:HIPOW(EXP,SIN(TH)),
FOR IzH STEP -2 THRU i DO
[COEF:BOTHCOEF(EXP,SIN(TH)~i),
ANSsANS+ISIN[I]wINPART(COEF,1),
EXPzINPARTICOEF,2)],
RETURN(ANS))$
Let us describe the steps in the program above:
(line 1) the variables EXP, ANS, COEF, and H are declared
local to the BLOCK, That is, values of EXP (etc.) Mithin
this program bear no relation to values previously assigned
to EXP (etc.).
(line 2) Set ANS to B. ANS Mill have the ansMer Mhen Me
conclude execution of this program.
(line 3) Set EXP to the integrand computed by function R.
(line 4) Set H to the highest power of BIN(TH) in EXP.
(line S) Set up a loop on I for all (odd) poMere of SIN(TH)
in EXP.
(line G) Set COEF to a list of (1) the coefficient of
SIN(TH)~I in EXP, and (2), the rest of EXP Mith the
SIN(TH)tl term removed.
(line 7} Add to ANS the integral of SIN(TH)~I times the
appropriate coefficient. ([NPART(COEF,1) picks out the first
part of the answer from BOTHCOEF.)
(line 8) Set EXP to the part Mhich remains after removing
the SIN(TH)~I term from the integrand. (Also, return to line
G for the next value of I unless |=1)
(line 9) Return ANS as the value of the integral, and set
A IN,K] to that value.
Me can no. set up the equations to be solved. Me can
convert equation (2} to the form
INF
=..=

(BET(N, K) B ) = C
/ > 2 N + i K
/==..
N - 8
Mhere BET(N,K) is A[N,K] if N is not equal to K, otherMise
to A[N,K] + an additional term. It looks like this:
(C28) BET(N,K):- IF (N#K) THEN A[N,K) ELSE
A[N,K]+(2~cN+i)~(2~'~+2)/(4~a+3)$
SETUP sets up N equations, EQ[8] ..... EQ[N-1].
(C21} SETUP(N):- FOR L:B THRU N-1 DO
EQ[L]:SUM(BET(I,LI~B[2~I+I],I,1,NI=C[LI$
Finally Me define a program Mhich sets up lists of
equations and variables, and calls the built-in command,
SOLVE. CONS is a program Mhich adds an element to the
beginning of a list, An empty list is [].
31
(C22) ISOLVE(N)s- BLOCK ([EQS,VARS],
EQSI[], VARS:[],
SETUP]N),
FOR L: 1THRU N DO
[EOS:CONSIEO[L-1],EOS),
VARS:CONS(B[2~4.+I],VARS)],
RETURN(SOLVE(EQS,VARS)}}$
Let's try it out.
(C23) ISOLVE(1)#
(023) [E23)
This is a list of the solutions from SOLVE. Evaluate )tz
(C24) EV(%}s
16
(024) [8 . . . . ]
3 16
If we set TIME to TRUE, us can find out how long
computations take.
(C26) TIME:TRUES
TIME- 4 MSEC.
(C2G) 1SOLVE(2)#
TIME- 11863 MSEC.
(D27) [E26, E27]
(C28) EV(~)~
TIME- 11MSEC.
(D28)
35 36
[B .... , B . . . . ]
6 144 3 48
(C29) ISOLVE(3)~
TIME- 61849 MSEC.
(D31) [E2S, E30, E31]
(C32) EV(~)#
TIME- 14 MSEC.
83 77 36
(D32) [B ..... , B .... , B - --]
7 $12 S 576 3 48
In fact, we can run this example out much further, and we
note that we have an exact solution from |SOLVE(N) fop the
terms up to 2N-1. That is, the infinite set of equations
has an exact solution, This surprising situation is a
result of the fact that A[N,K] is 8 for K • N, which is
obvious if we look at the values of the A[N,K]. We can
display them in a matrix.
First we have to offset the values of A bu 1, since
matrices in MACSYMA (as in most other places) begin their
indexing at 1, not 0. We can do it as follous:
(C33) AA[N,K]I-A[N-1,K-1]$
TIME- 20 MSEC.
(C34) GENMATRIX(AA,3,3)=
TIME- 38S5 MSEC.
(D34)
[ 2 I
[ -- 0 0 ]
[ 3 ]
[ ]
[ 8 4 ]
[ . . . . 0 ]
[ 15 6 ]
[ ]
[ 18 24 G ]
[ --]
[ 36 36 7 ]
The surprising pattern in the values of the double
integral of equation (2) led to a recurs(on relation (note
that AA[1,2]-AA[1,1]~AA[2,2], etc.) and a formula to
evaluate it analytically for all values of N and K. Further
examination shone that the matrix "BET" leads to a system
where each roH can be cancelled, except for the diagonal
term, bW a multiple of the next. This diagonal system was
explicitly solved to yield a closed form result for the
B[2N+I]. For some details of this, consult the paper by
Greenepan [2].
If| - Additional Comments
As is fairly typical in mathematics, the problem as
originally stated (and which was, in fact, also solved) Nae
of no interest because the equations were erroneous. In
fact, that use of MACSYMAwas someghat more elegant, because
an approximation to a non-rational portion of the integrals
was computed using power series. However, the values of
B[2N+i] which were produced bg that formulation did not
converge, but oscillated and grew. This unsatisfactory
result suggested that MACSYMAwas being asked the wrong
questions, as indeed was the case. A corrected version of
the equations leads, as Ne have seen, to a decreasing and
convergent series.
IV - Loncluaions
We would like to briefly point out a few of the
facilities in MACSYMAwhich make it useful to a working
applied mathematician.
(i) Incorrect and/or useless formulations can be discarded
more rapidly bu following such formulations through to
symbolic results (or numerical results) in sufficient
quantity to answer basic questions concerning the behavior
of a solution.
(2) Partial results can be examined immediately to
determine procedures to be followed in the next steps.
(3} Large numbers of techniques can be draun upon, without
explicit user definition. For example, the presence of
GAMMA function evaluation and simplification routines, the
iNTEGRATE command, the SOLVE command.
(4) The ability to set up hierarchies of programs which
duplicate the sequence of typed in commands, once a sequence
is, in fact, well-defined, makes it easy to initiate
complicated calculations in a simple fashion. Furthermore,
the extension to more terms or higher accuracy is usually
extremely simple.
Acknowledgments
Work reported herein was supported in part by Project
MAC, an M.I.T. interdepartmental laboratory sponsored by the
Advanced Research Projects Agency, Department of Defense,
under Office of Naval Research Contract NOO14-70-A-O3G2-801,
and in part bu the Department of Mathematics, M.].T. under
National Science Foundation Grant GP 22796,
I would like to thank H. P. Greenspan for introducing
me to this problem, and M. Israeli for his suggestions
concerning various modifications of this problem and its
solution.
References
[1] Began, R., et al, The MACSYMAManual, Project MAC,
M.I.T.
[2] Greenspan, H. P., "On A'pha-dynamos", J. of Applied
Math. (to appear).
32

More Related Content

Similar to Interactive Problem-Solving with MACSYMA Algebra System

Paper computer
Paper computerPaper computer
Paper computerbikram ...
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentationManchireddy Reddy
 
Banco de preguntas para el ap
Banco de preguntas para el apBanco de preguntas para el ap
Banco de preguntas para el apMARCELOCHAVEZ23
 
New data structures and algorithms for \\post-processing large data sets and ...
New data structures and algorithms for \\post-processing large data sets and ...New data structures and algorithms for \\post-processing large data sets and ...
New data structures and algorithms for \\post-processing large data sets and ...Alexander Litvinenko
 
INDUCTIVE LEARNING OF COMPLEX FUZZY RELATION
INDUCTIVE LEARNING OF COMPLEX FUZZY RELATIONINDUCTIVE LEARNING OF COMPLEX FUZZY RELATION
INDUCTIVE LEARNING OF COMPLEX FUZZY RELATIONijcseit
 
INDUCTIVE LEARNING OF COMPLEX FUZZY RELATION
INDUCTIVE LEARNING OF COMPLEX FUZZY RELATIONINDUCTIVE LEARNING OF COMPLEX FUZZY RELATION
INDUCTIVE LEARNING OF COMPLEX FUZZY RELATIONijcseit
 
TM plane wave scattering from finite rectangular grooves in a conducting plan...
TM plane wave scattering from finite rectangular grooves in a conducting plan...TM plane wave scattering from finite rectangular grooves in a conducting plan...
TM plane wave scattering from finite rectangular grooves in a conducting plan...Yong Heui Cho
 
data structure and algorithm Array.pptx btech 2nd year
data structure and algorithm  Array.pptx btech 2nd yeardata structure and algorithm  Array.pptx btech 2nd year
data structure and algorithm Array.pptx btech 2nd yearpalhimanshi999
 
Exhaustive Combinatorial Enumeration
Exhaustive Combinatorial EnumerationExhaustive Combinatorial Enumeration
Exhaustive Combinatorial EnumerationMathieu Dutour Sikiric
 
Iterative procedure for uniform continuous mapping.
Iterative procedure for uniform continuous mapping.Iterative procedure for uniform continuous mapping.
Iterative procedure for uniform continuous mapping.Alexander Decker
 
pradeepbishtLecture13 div conq
pradeepbishtLecture13 div conqpradeepbishtLecture13 div conq
pradeepbishtLecture13 div conqPradeep Bisht
 
Ee693 sept2014midsem
Ee693 sept2014midsemEe693 sept2014midsem
Ee693 sept2014midsemGopi Saiteja
 
Tucker tensor analysis of Matern functions in spatial statistics
Tucker tensor analysis of Matern functions in spatial statistics Tucker tensor analysis of Matern functions in spatial statistics
Tucker tensor analysis of Matern functions in spatial statistics Alexander Litvinenko
 
10.1.1.474.2861
10.1.1.474.286110.1.1.474.2861
10.1.1.474.2861pkavitha
 
Theory of Advanced Relativity
Theory of Advanced RelativityTheory of Advanced Relativity
Theory of Advanced RelativityMihir Jha
 

Similar to Interactive Problem-Solving with MACSYMA Algebra System (20)

Paper computer
Paper computerPaper computer
Paper computer
 
Ijetr011923
Ijetr011923Ijetr011923
Ijetr011923
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentation
 
Banco de preguntas para el ap
Banco de preguntas para el apBanco de preguntas para el ap
Banco de preguntas para el ap
 
New data structures and algorithms for \\post-processing large data sets and ...
New data structures and algorithms for \\post-processing large data sets and ...New data structures and algorithms for \\post-processing large data sets and ...
New data structures and algorithms for \\post-processing large data sets and ...
 
INDUCTIVE LEARNING OF COMPLEX FUZZY RELATION
INDUCTIVE LEARNING OF COMPLEX FUZZY RELATIONINDUCTIVE LEARNING OF COMPLEX FUZZY RELATION
INDUCTIVE LEARNING OF COMPLEX FUZZY RELATION
 
INDUCTIVE LEARNING OF COMPLEX FUZZY RELATION
INDUCTIVE LEARNING OF COMPLEX FUZZY RELATIONINDUCTIVE LEARNING OF COMPLEX FUZZY RELATION
INDUCTIVE LEARNING OF COMPLEX FUZZY RELATION
 
TM plane wave scattering from finite rectangular grooves in a conducting plan...
TM plane wave scattering from finite rectangular grooves in a conducting plan...TM plane wave scattering from finite rectangular grooves in a conducting plan...
TM plane wave scattering from finite rectangular grooves in a conducting plan...
 
data structure and algorithm Array.pptx btech 2nd year
data structure and algorithm  Array.pptx btech 2nd yeardata structure and algorithm  Array.pptx btech 2nd year
data structure and algorithm Array.pptx btech 2nd year
 
Exhaustive Combinatorial Enumeration
Exhaustive Combinatorial EnumerationExhaustive Combinatorial Enumeration
Exhaustive Combinatorial Enumeration
 
Iterative procedure for uniform continuous mapping.
Iterative procedure for uniform continuous mapping.Iterative procedure for uniform continuous mapping.
Iterative procedure for uniform continuous mapping.
 
pradeepbishtLecture13 div conq
pradeepbishtLecture13 div conqpradeepbishtLecture13 div conq
pradeepbishtLecture13 div conq
 
Ee693 sept2014midsem
Ee693 sept2014midsemEe693 sept2014midsem
Ee693 sept2014midsem
 
Tucker tensor analysis of Matern functions in spatial statistics
Tucker tensor analysis of Matern functions in spatial statistics Tucker tensor analysis of Matern functions in spatial statistics
Tucker tensor analysis of Matern functions in spatial statistics
 
Merge sort
Merge sortMerge sort
Merge sort
 
E33018021
E33018021E33018021
E33018021
 
M112rev
M112revM112rev
M112rev
 
10.1.1.474.2861
10.1.1.474.286110.1.1.474.2861
10.1.1.474.2861
 
1 ca nall
1 ca nall1 ca nall
1 ca nall
 
Theory of Advanced Relativity
Theory of Advanced RelativityTheory of Advanced Relativity
Theory of Advanced Relativity
 

More from Lori Moore

How To Research For A Research Paper. Write A Re
How To Research For A Research Paper. Write A ReHow To Research For A Research Paper. Write A Re
How To Research For A Research Paper. Write A ReLori Moore
 
Best Custom Research Writing Service Paper W
Best Custom Research Writing Service Paper WBest Custom Research Writing Service Paper W
Best Custom Research Writing Service Paper WLori Moore
 
Free Printable Number Worksheets - Printable Wo
Free Printable Number Worksheets - Printable WoFree Printable Number Worksheets - Printable Wo
Free Printable Number Worksheets - Printable WoLori Moore
 
Author Research Paper. How To Co. 2019-02-04
Author Research Paper. How To Co. 2019-02-04Author Research Paper. How To Co. 2019-02-04
Author Research Paper. How To Co. 2019-02-04Lori Moore
 
Free Rainbow Stationery And Writing Paper Writing Pap
Free Rainbow Stationery And Writing Paper Writing PapFree Rainbow Stationery And Writing Paper Writing Pap
Free Rainbow Stationery And Writing Paper Writing PapLori Moore
 
Terrorism Threat To World Peace. Online assignment writing service.
Terrorism Threat To World Peace. Online assignment writing service.Terrorism Threat To World Peace. Online assignment writing service.
Terrorism Threat To World Peace. Online assignment writing service.Lori Moore
 
Lined Paper For First Graders. Online assignment writing service.
Lined Paper For First Graders. Online assignment writing service.Lined Paper For First Graders. Online assignment writing service.
Lined Paper For First Graders. Online assignment writing service.Lori Moore
 
FREE Printable Always Do Your Be. Online assignment writing service.
FREE Printable Always Do Your Be. Online assignment writing service.FREE Printable Always Do Your Be. Online assignment writing service.
FREE Printable Always Do Your Be. Online assignment writing service.Lori Moore
 
Scholarship Essay Essay Writers Service. Online assignment writing service.
Scholarship Essay Essay Writers Service. Online assignment writing service.Scholarship Essay Essay Writers Service. Online assignment writing service.
Scholarship Essay Essay Writers Service. Online assignment writing service.Lori Moore
 
Essay Written In Third Person - College Life
Essay Written In Third Person - College LifeEssay Written In Third Person - College Life
Essay Written In Third Person - College LifeLori Moore
 
Professional Essay Writers At Our Service Papers-Land.Com Essay
Professional Essay Writers At Our Service Papers-Land.Com EssayProfessional Essay Writers At Our Service Papers-Land.Com Essay
Professional Essay Writers At Our Service Papers-Land.Com EssayLori Moore
 
Buy College Admission Essay Buy College Admissi
Buy College Admission Essay Buy College AdmissiBuy College Admission Essay Buy College Admissi
Buy College Admission Essay Buy College AdmissiLori Moore
 
PPT - Attitudes Towards Religious Plurality Exclusi
PPT - Attitudes Towards Religious Plurality ExclusiPPT - Attitudes Towards Religious Plurality Exclusi
PPT - Attitudes Towards Religious Plurality ExclusiLori Moore
 
Critique Format Example. How To Write Critique With
Critique Format Example. How To Write Critique WithCritique Format Example. How To Write Critique With
Critique Format Example. How To Write Critique WithLori Moore
 
Printable Alphabet Worksheets For Preschool
Printable Alphabet Worksheets For PreschoolPrintable Alphabet Worksheets For Preschool
Printable Alphabet Worksheets For PreschoolLori Moore
 
Analysis Essay Thesis Example. Analytical Thesis Statement Exam
Analysis Essay Thesis Example. Analytical Thesis Statement ExamAnalysis Essay Thesis Example. Analytical Thesis Statement Exam
Analysis Essay Thesis Example. Analytical Thesis Statement ExamLori Moore
 
How To Write College Admission Essay. How To
How To Write College Admission Essay. How ToHow To Write College Admission Essay. How To
How To Write College Admission Essay. How ToLori Moore
 
Modes Of Writing Worksheet, Are Yo. Online assignment writing service.
Modes Of Writing Worksheet, Are Yo. Online assignment writing service.Modes Of Writing Worksheet, Are Yo. Online assignment writing service.
Modes Of Writing Worksheet, Are Yo. Online assignment writing service.Lori Moore
 
A Critique Of Racial Attitudes And Opposition To Welfare
A Critique Of Racial Attitudes And Opposition To WelfareA Critique Of Racial Attitudes And Opposition To Welfare
A Critique Of Racial Attitudes And Opposition To WelfareLori Moore
 
Elegant Writing Stationery Papers, Printable Letter Wr
Elegant Writing Stationery Papers, Printable Letter WrElegant Writing Stationery Papers, Printable Letter Wr
Elegant Writing Stationery Papers, Printable Letter WrLori Moore
 

More from Lori Moore (20)

How To Research For A Research Paper. Write A Re
How To Research For A Research Paper. Write A ReHow To Research For A Research Paper. Write A Re
How To Research For A Research Paper. Write A Re
 
Best Custom Research Writing Service Paper W
Best Custom Research Writing Service Paper WBest Custom Research Writing Service Paper W
Best Custom Research Writing Service Paper W
 
Free Printable Number Worksheets - Printable Wo
Free Printable Number Worksheets - Printable WoFree Printable Number Worksheets - Printable Wo
Free Printable Number Worksheets - Printable Wo
 
Author Research Paper. How To Co. 2019-02-04
Author Research Paper. How To Co. 2019-02-04Author Research Paper. How To Co. 2019-02-04
Author Research Paper. How To Co. 2019-02-04
 
Free Rainbow Stationery And Writing Paper Writing Pap
Free Rainbow Stationery And Writing Paper Writing PapFree Rainbow Stationery And Writing Paper Writing Pap
Free Rainbow Stationery And Writing Paper Writing Pap
 
Terrorism Threat To World Peace. Online assignment writing service.
Terrorism Threat To World Peace. Online assignment writing service.Terrorism Threat To World Peace. Online assignment writing service.
Terrorism Threat To World Peace. Online assignment writing service.
 
Lined Paper For First Graders. Online assignment writing service.
Lined Paper For First Graders. Online assignment writing service.Lined Paper For First Graders. Online assignment writing service.
Lined Paper For First Graders. Online assignment writing service.
 
FREE Printable Always Do Your Be. Online assignment writing service.
FREE Printable Always Do Your Be. Online assignment writing service.FREE Printable Always Do Your Be. Online assignment writing service.
FREE Printable Always Do Your Be. Online assignment writing service.
 
Scholarship Essay Essay Writers Service. Online assignment writing service.
Scholarship Essay Essay Writers Service. Online assignment writing service.Scholarship Essay Essay Writers Service. Online assignment writing service.
Scholarship Essay Essay Writers Service. Online assignment writing service.
 
Essay Written In Third Person - College Life
Essay Written In Third Person - College LifeEssay Written In Third Person - College Life
Essay Written In Third Person - College Life
 
Professional Essay Writers At Our Service Papers-Land.Com Essay
Professional Essay Writers At Our Service Papers-Land.Com EssayProfessional Essay Writers At Our Service Papers-Land.Com Essay
Professional Essay Writers At Our Service Papers-Land.Com Essay
 
Buy College Admission Essay Buy College Admissi
Buy College Admission Essay Buy College AdmissiBuy College Admission Essay Buy College Admissi
Buy College Admission Essay Buy College Admissi
 
PPT - Attitudes Towards Religious Plurality Exclusi
PPT - Attitudes Towards Religious Plurality ExclusiPPT - Attitudes Towards Religious Plurality Exclusi
PPT - Attitudes Towards Religious Plurality Exclusi
 
Critique Format Example. How To Write Critique With
Critique Format Example. How To Write Critique WithCritique Format Example. How To Write Critique With
Critique Format Example. How To Write Critique With
 
Printable Alphabet Worksheets For Preschool
Printable Alphabet Worksheets For PreschoolPrintable Alphabet Worksheets For Preschool
Printable Alphabet Worksheets For Preschool
 
Analysis Essay Thesis Example. Analytical Thesis Statement Exam
Analysis Essay Thesis Example. Analytical Thesis Statement ExamAnalysis Essay Thesis Example. Analytical Thesis Statement Exam
Analysis Essay Thesis Example. Analytical Thesis Statement Exam
 
How To Write College Admission Essay. How To
How To Write College Admission Essay. How ToHow To Write College Admission Essay. How To
How To Write College Admission Essay. How To
 
Modes Of Writing Worksheet, Are Yo. Online assignment writing service.
Modes Of Writing Worksheet, Are Yo. Online assignment writing service.Modes Of Writing Worksheet, Are Yo. Online assignment writing service.
Modes Of Writing Worksheet, Are Yo. Online assignment writing service.
 
A Critique Of Racial Attitudes And Opposition To Welfare
A Critique Of Racial Attitudes And Opposition To WelfareA Critique Of Racial Attitudes And Opposition To Welfare
A Critique Of Racial Attitudes And Opposition To Welfare
 
Elegant Writing Stationery Papers, Printable Letter Wr
Elegant Writing Stationery Papers, Printable Letter WrElegant Writing Stationery Papers, Printable Letter Wr
Elegant Writing Stationery Papers, Printable Letter Wr
 

Recently uploaded

Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 

Recently uploaded (20)

Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 

Interactive Problem-Solving with MACSYMA Algebra System

  • 1. A Case History in Interactive Problem-Solving Richard J. Fateman Department of Mathematics Massachusetts Institute of Technologg Cambridge. Mass. ABSTRACT MACSYMA [1], a computer program for algebraic manipulation, is used to solve, sgmbolicallg and exactlg, a problem involving integration and the solution of an infinite set of linear equations. This is a tutorial in the use of 11ACSYMA. and illustrates some of the choices available to the interactive user which aid in solving a mathematical problem. I - The problem In [2]. H. P. Greenspan develops a model of the generation of large scale magnetic fields from small scale motions of a conducting flu.d. We take as a starting point. a met of equations (whose significance will not be discussed here) to be solved for coefficients B[2N+i]. The equations are I NF . . . . 2 (K + 1) (2 K + I ) B 2 K + 1 ( > (A B ) ) + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C I N, K 2 N + i 4 K +3 K I=.== N=8 A N, K ~PI 2 / [ (I ] / TH and K = 8 , 1. . . . ~PI 2 I [ (1) 2 N + 3 - - I ((P ( C O S ( T H ] ] SIN(TH) ] 2K+l / 0 (1) (1) - 2 N - 3 (P (COS(Z)) SIN(Z] ] dZ])/COS[TH)} dTH 2 N + 1 (2) 3 GAMMA(-) GAMMA(2 K + 3] 2 C ............................................ (3) K 3 2 GAMMA(K + 3) GAMMA(- - K) GAMMA(2 K + 1] 2 where P is an associated Legendre function. The above displags were generated bg MACSYMA, and includes a summation sign and two integrals (stand back a bit if gou can't see them). II - The Solution Equation (1) is an infinite set of linear equations. The technique for solving for the B[i] is to generate and solve the first equation for B[1], then generate the next equation, and solve these two equations together to get B[I] and B[3], etc. One hopes that the sequence of values for BIll derived in this wag converges, and similarlg for B[3], etc, It is also expected, in the context of this problem, that B[i] tends to 0 for large i. We will assume that the reader has a slight acquaintance with MACSYMA [1] or a similar agetem for algebraic manipulation. Let us do the easg parts first. Equation (3) defines a set of values for C. We could define a function C(K) which when given the value for K returns the value for C(K), but this gould repeatedlg compute C. We might as well save them in an arrag, especiallg since in MACSYMA it is just as simple. In this case, when C[1] is requested the first time, it gets computed using the formula, and is then stored in memorg so that subsequent references to C[I] are just read out of storage. The definition (and displag] of C as given to 11ACSYMA is= (C1 ] C [KI ; = -GAMMA(3/2) ~'rGAMMA (2~'~+3) / (2~'~GAMMA(2~',K+1) ~'A3AMMA (3/2-K) ~AMMA (3-PK) ) ; SORT(%PI) GAMMA(2 K + 3] (D1) C =. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K 3 4 GAMMA(K + 3) GAMMA(- - K) GAMMA(2 K + i ) 2 Note that MACSY11Ahas simplified the GAMMA(3/2). Let ue compute a list of the first 4 values. (C2] [C [0] ,C [1] ,C [2] ,C [31 ] ; 1 1 5 7 (D2] [ - - , - - , - - , - - - ] 2 2 32 80 Next, let us compute the associated Legendre functions bg ang convenient method. Rodrigues' formula is handgz N+11 N 2 N/2 0 2 M ( - 1) (1 - X ) ( ....... (X - 1) ! N+M (N) DX P (X) ....................................... M M 2 M~ But since all we need is the N=I case evaluated at cos(u], He can replace (1-X'I'2)f(N/2) bg sin(u), and after taking derivatives with respect to x, substitute cos( U) for x. ge can set up an arrag of functions, one for each associated Legendre function at a cosine point bg (C3) ALF[M](Y):=-SIN(Y)/(2fM~'~!)~SUBST(CDS(Y],X, DIFF((Xf2-1)fM,X,M+I)): (D3] M+I D 2 M SIN(Y) SUBST(COS(Y), X, - ...... (X - 1) ) I1+1 DX ALF (Y) =............................................. M M 2 M! (C4) ALF[S](X); 2 2 4 2 (04] - ((;200 (COS (X) - 1) + $7800 COS (X) + 88400 COS (X) (COS (X] -1)) SIN(X])/3840 This might be sufficient, but it is somewhat neater to convert these results into a simpler form involving just sines or just cosines. Since formula (2) alreadg involves sines, we choose sines. Ue can do this bg defining get another arrag, which has the same values as ALF, but with (1-SIN(Y)~2) substituted for COS(Y)~2 evergwhere. Since He also want to convert COS(Y)t4 (etc) to SIN's, we use RATSUBST= (C5) ALF1 [M] (Y] == RATSUBST(l-S( N(Y) t2, COS(Y) f2, ALF [M] (Y)) $ 30
  • 2. it Imeea.prafarabla to divide the denominator through, Imlam tMpe# (C8) RATIEXPANOz T$ (C7) ALF1 [5] (X) 5 3 315 SIN (X) 185 SIN (X) (O7) ............ + ............ 15 SIN(X) 8 2 The next problem ie to evaluate the integrals of equation (2). Me Bay have no a priori knoHledgm of Mhathmr the integral |e singular, or if it can be done exactlw by conventional methods, or if it involves special functions. Me can let rlACSYItA take care of these problems if Me just define: (C8) A IN,K]:- INTEGRATE(-BIN(TH)~(2.~N+3I/COS(TH)~ ALF1 [2.kK+l] (TH)~ INTEGRATE(ALFi[2~.N+II(Z)/SIN(Z)~(2ctN+3),Z,TH,¢OI/2), TH,B,Y,PI/2)$ This iea time-consuming calculation since definite integration in MACSYMA is done Nith great concern for a function's behavior, and can use contour integration algorithms, and various heuristic methods. Another fault with this formulation ie that if Me are going to compute many of these A[N,K], Me Mill be recomputing the inner integral, Nhich depends only on N, repeatedly. Although this formulation can be used, it is helpful to analyze the problem further. Some experimentation shows that the inner integral Is siNeWs 8 at ZPI/2, and that all Me have to do is compute: (C8) INNER|NT[N]:- -INTEGRATE(ALFi[2~+iI(TH)/SIN(TH)~(2.crN+3),TH)$ An improvement in running time can be made by first cancelling the SIN's in the denominator and expanding the integrand. After this expansion, the integration program produces an integral entirely in terms of I/TAN(TH). Mlthout this transformation, the integration program returns a much more unuleldy aneMer. The interactive nature of I'IACSYrlA aided in this discoverw, because both of the indicated programs Mare tried out. (C18) INNER;NT[N]zm -INTEGRATE(RATEXPAND(ALFI[2~,N+I](TH)/ SIN(TH)~(2~AS+3I),THI$ (Cll) INNERINT[2]~ 1S iS 3 (011) .......... + ................... 8 TAN(TH) 3 5 2 TAN (TH) TAN (TH) This ie fairly neat. Mhat Me Mould really prefer, le to remove the TAN'B and put in SIN's, or at least S|N'e and COS'e. This can be done quite simply using RATSUBST. (C12) [1 [N]z-RATSUBST(1-SIN(THIt2,COS(THIt2, RATSUBST(S|N(TH)/COS(TH),TAN(TH),INNERINT [N]))I (C13) i1(2]1 99 COS(TH) 27 COS(TH) 3 COS(TH) (D13) ........... + .................... 8 SIN(TH) 3 S 2 SIN (TH) SIN (TH) NoM Me are at the point Mhere Me can generate the integrand for the outer integral, and examine Nhat it is Me really are after. The integrands have a suprisingl W simple structure. (C14) R(N,KIz=RATEXPAND(-SIN(THIt(2~N+3)/ COS(THI~ALF~I2c,K+I](THI~II[N])$ (C15) R(8,1Is (DIS) (C16) R(1,8)~ (016) S 15 SIN (TH} 3 ............ G SIN (TH) 2 S 7 SIN (TH) 3 ........... 2 SIN (TH) 2 (C17)'R(1,1)~ 7 185 SIN (TH) 5 3 (017) ............. + 3G SIN (TH) - 12 SIN (TH) 4 ]t can be determined that in fact all integrande are auma of poMere of S]N(TH), and only odd poMere, at that, Integration could be done by using the INTEGRATE command, but this computation Mould proceed bW doing the indefinite integral, and then return the difference of evaluating at the limits. This ie fine for one or tMo cases, but Me can save considerable time bg computing definite integrals of powers of SIN, and storing them in an array. Me can also illustrate some mope facilitee Of MACSYMAalong the Nay. There iea little formula available fop computing the integral from 8 to Y, PI/2 of an odd pouer of SIN. It is: (C18) ISIN[N]:-BLOCK([M), Mz(N-1)/2, RETURN(2t(2~)~(M!It2/N!))$ NoM Me are ready to produce the A[N,K]: (C1S) A[N,K]:- BLOCK([EXP,ANS,COEF,H], ANS:8, EXP:R(N.K), H:HIPOW(EXP,SIN(TH)), FOR IzH STEP -2 THRU i DO [COEF:BOTHCOEF(EXP,SIN(TH)~i), ANSsANS+ISIN[I]wINPART(COEF,1), EXPzINPARTICOEF,2)], RETURN(ANS))$ Let us describe the steps in the program above: (line 1) the variables EXP, ANS, COEF, and H are declared local to the BLOCK, That is, values of EXP (etc.) Mithin this program bear no relation to values previously assigned to EXP (etc.). (line 2) Set ANS to B. ANS Mill have the ansMer Mhen Me conclude execution of this program. (line 3) Set EXP to the integrand computed by function R. (line 4) Set H to the highest power of BIN(TH) in EXP. (line S) Set up a loop on I for all (odd) poMere of SIN(TH) in EXP. (line G) Set COEF to a list of (1) the coefficient of SIN(TH)~I in EXP, and (2), the rest of EXP Mith the SIN(TH)tl term removed. (line 7} Add to ANS the integral of SIN(TH)~I times the appropriate coefficient. ([NPART(COEF,1) picks out the first part of the answer from BOTHCOEF.) (line 8) Set EXP to the part Mhich remains after removing the SIN(TH)~I term from the integrand. (Also, return to line G for the next value of I unless |=1) (line 9) Return ANS as the value of the integral, and set A IN,K] to that value. Me can no. set up the equations to be solved. Me can convert equation (2} to the form INF =..= (BET(N, K) B ) = C / > 2 N + i K /==.. N - 8 Mhere BET(N,K) is A[N,K] if N is not equal to K, otherMise to A[N,K] + an additional term. It looks like this: (C28) BET(N,K):- IF (N#K) THEN A[N,K) ELSE A[N,K]+(2~cN+i)~(2~'~+2)/(4~a+3)$ SETUP sets up N equations, EQ[8] ..... EQ[N-1]. (C21} SETUP(N):- FOR L:B THRU N-1 DO EQ[L]:SUM(BET(I,LI~B[2~I+I],I,1,NI=C[LI$ Finally Me define a program Mhich sets up lists of equations and variables, and calls the built-in command, SOLVE. CONS is a program Mhich adds an element to the beginning of a list, An empty list is []. 31
  • 3. (C22) ISOLVE(N)s- BLOCK ([EQS,VARS], EQSI[], VARS:[], SETUP]N), FOR L: 1THRU N DO [EOS:CONSIEO[L-1],EOS), VARS:CONS(B[2~4.+I],VARS)], RETURN(SOLVE(EQS,VARS)}}$ Let's try it out. (C23) ISOLVE(1)# (023) [E23) This is a list of the solutions from SOLVE. Evaluate )tz (C24) EV(%}s 16 (024) [8 . . . . ] 3 16 If we set TIME to TRUE, us can find out how long computations take. (C26) TIME:TRUES TIME- 4 MSEC. (C2G) 1SOLVE(2)# TIME- 11863 MSEC. (D27) [E26, E27] (C28) EV(~)~ TIME- 11MSEC. (D28) 35 36 [B .... , B . . . . ] 6 144 3 48 (C29) ISOLVE(3)~ TIME- 61849 MSEC. (D31) [E2S, E30, E31] (C32) EV(~)# TIME- 14 MSEC. 83 77 36 (D32) [B ..... , B .... , B - --] 7 $12 S 576 3 48 In fact, we can run this example out much further, and we note that we have an exact solution from |SOLVE(N) fop the terms up to 2N-1. That is, the infinite set of equations has an exact solution, This surprising situation is a result of the fact that A[N,K] is 8 for K • N, which is obvious if we look at the values of the A[N,K]. We can display them in a matrix. First we have to offset the values of A bu 1, since matrices in MACSYMA (as in most other places) begin their indexing at 1, not 0. We can do it as follous: (C33) AA[N,K]I-A[N-1,K-1]$ TIME- 20 MSEC. (C34) GENMATRIX(AA,3,3)= TIME- 38S5 MSEC. (D34) [ 2 I [ -- 0 0 ] [ 3 ] [ ] [ 8 4 ] [ . . . . 0 ] [ 15 6 ] [ ] [ 18 24 G ] [ --] [ 36 36 7 ] The surprising pattern in the values of the double integral of equation (2) led to a recurs(on relation (note that AA[1,2]-AA[1,1]~AA[2,2], etc.) and a formula to evaluate it analytically for all values of N and K. Further examination shone that the matrix "BET" leads to a system where each roH can be cancelled, except for the diagonal term, bW a multiple of the next. This diagonal system was explicitly solved to yield a closed form result for the B[2N+I]. For some details of this, consult the paper by Greenepan [2]. If| - Additional Comments As is fairly typical in mathematics, the problem as originally stated (and which was, in fact, also solved) Nae of no interest because the equations were erroneous. In fact, that use of MACSYMAwas someghat more elegant, because an approximation to a non-rational portion of the integrals was computed using power series. However, the values of B[2N+i] which were produced bg that formulation did not converge, but oscillated and grew. This unsatisfactory result suggested that MACSYMAwas being asked the wrong questions, as indeed was the case. A corrected version of the equations leads, as Ne have seen, to a decreasing and convergent series. IV - Loncluaions We would like to briefly point out a few of the facilities in MACSYMAwhich make it useful to a working applied mathematician. (i) Incorrect and/or useless formulations can be discarded more rapidly bu following such formulations through to symbolic results (or numerical results) in sufficient quantity to answer basic questions concerning the behavior of a solution. (2) Partial results can be examined immediately to determine procedures to be followed in the next steps. (3} Large numbers of techniques can be draun upon, without explicit user definition. For example, the presence of GAMMA function evaluation and simplification routines, the iNTEGRATE command, the SOLVE command. (4) The ability to set up hierarchies of programs which duplicate the sequence of typed in commands, once a sequence is, in fact, well-defined, makes it easy to initiate complicated calculations in a simple fashion. Furthermore, the extension to more terms or higher accuracy is usually extremely simple. Acknowledgments Work reported herein was supported in part by Project MAC, an M.I.T. interdepartmental laboratory sponsored by the Advanced Research Projects Agency, Department of Defense, under Office of Naval Research Contract NOO14-70-A-O3G2-801, and in part bu the Department of Mathematics, M.].T. under National Science Foundation Grant GP 22796, I would like to thank H. P. Greenspan for introducing me to this problem, and M. Israeli for his suggestions concerning various modifications of this problem and its solution. References [1] Began, R., et al, The MACSYMAManual, Project MAC, M.I.T. [2] Greenspan, H. P., "On A'pha-dynamos", J. of Applied Math. (to appear). 32