# [Maxima] nouns & verbs

Barton Willis willisb at unk.edu
Tue Apr 20 07:44:47 CDT 2010

```I'm experimenting with converting spherical harmonic to a simplifying function,
but I think the code has a noun/verb problem. Consider

(%i58) integrate(integrate(spherical_harmonic(n1,m1,th,ph) *
conjugate(spherical_harmonic(n2,m2,th,ph)) * sin(th),th,0,%pi),ph,0,2*%pi);

(%o58) (-1)^m2*'integrate('integrate(spherical_harmonic(n1,m1,th,ph)
*spherical_harmonic(n2,-m2,th,ph)
*sin(th),th,0,%pi),ph,0,2*%pi)

(%i59) subst([n1=3,m1=1,n2=5,m2=1],%);

(%o59) sqrt(3)*sqrt(7)
*('integrate(%e^(%i*ph)*'integrate(
''spherical_harmonic(5,1,th,-ph)
*(-5*(1-cos(th))/2+5*(1-cos(th))^2/4+1)
*sin(th)^2,th,0,%pi),ph,0,2*%pi))
/(2*sqrt(%pi))

Now we have a form ((\$spherical_harmonic) ...) that refuses to simplify:

(%i60) ?print(%);

((MTIMES SIMP) ((RAT SIMP) 1 2) ((MEXPT SIMP) 3 ((RAT SIMP) 1 2)) ((MEXPT SIMP) 7 ((RAT SIMP) 1 2)) ((MEXPT SIMP) \$%PI ((RAT SIMP) -1 2)) ((%INTEGRATE SIMP) ((MTIMES SIMP) ((MEXPT SIMP) \$%E ((MTIMES SIMP) \$%I \$PH)) ((%INTEGRATE SIMP) ((MTIMES SIMP) ((\$SPHERICAL_HARMONIC SIMP) 5 1 \$TH ((MTIMES SIMP) -1 \$PH)) ((MPLUS SIMP) 1 ((MTIMES SIMP) ((RAT SIMP) 5 4) ((MEXPT SIMP) ((MPLUS SIMP) 1 ((MTIMES SIMP) -1 ((%COS SIMP) \$TH))) 2)) ((MTIMES SIMP) ((RAT SIMP) -5 2) ((MPLUS SIMP) 1 ((MTIMES SIMP) -1 ((%COS SIMP) \$TH))))) ((MEXPT SIMP) ((%SIN SIMP) \$TH) 2)) \$TH 0 \$%PI)) \$PH 0 ((MTIMES SIMP) 2 \$%PI)))

I don't know what all of the following do, but:

(%i61) :lisp(get '%spherical_harmonic 'operators);
SIMP-SPHERICAL-HARMONIC

(%i61) :lisp(get '%spherical_harmonic 'noun);
\$SPHERICAL_HARMONIC

(%i61) :lisp(get '%spherical_harmonic 'verb);
NIL

(%i61) :lisp(get '\$spherical_harmonic 'noun);
NIL

(%i61) :lisp(get '\$spherical_harmonic 'verb);
%SPHERICAL_HARMONIC

(%i61) :lisp(get '%spherical_harmonic 'alias);
NIL

(%i61) :lisp(get '\$spherical_harmonic 'alias);
%SPHERICAL_HARMONIC

(%i61) :lisp(get '\$spherical_harmonic 'reversealias);
NIL

(%i61) :lisp(get '%spherical_harmonic 'reversealias);
\$SPHERICAL_HARMONIC

--Barton
```