1 ;;; -*- Mode: Lisp; Package: Maxima; Syntax: Common-Lisp; Base: 10 -*- ;;;;
2 ;;;Translated on: 6/08/85 17:56:35;;Maxima System version 16
3 ;;** Variable settings were **
7 ;;TR_SEMICOMPILE:FALSE;
8 ;;TRANSLATE_FAST_ARRAYS:TRUE;
9 ;;TR_WARN_UNDECLARED:COMPILE;
10 ;;TR_WARN_MEVAL:COMPFILE;
11 ;;TR_WARN_FEXPR:COMPFILE;
13 ;;TR_WARN_UNDEFINED_VARIABLE:ALL;
14 ;;TR_FUNCTION_CALL_DEFAULT:GENERAL;
15 ;;TR_ARRAY_AS_REF:TRUE;
17 ;;DEFINE_VARIABLE:FALSE;
19 (eval-when (compile eval load
)
20 (meval* '(($modedeclare
) $bestlength $fixnum
))
21 (meval* '(($declare
) $bestlength $special
))
22 (defprop $bestlength assign-mode-check assign
)
23 (def-mtrvar $bestlength
0))
24 (eval-when (compile eval load
)
25 (meval* '(($modedeclare
) $trylength $fixnum
))
26 (meval* '(($declare
) $trylength $special
))
27 (defprop $trylength assign-mode-check assign
)
28 (def-mtrvar $trylength
0))
29 (eval-when (compile eval load
)
30 (proclaim '(special $ans
))
32 (simplify ($put
'%sin
'%cos
'$complement_function
))
33 (simplify ($put
'%cos
'%sin
'$complement_function
))
34 (simplify ($put
'%sinh
'%cosh
'$complement_function
))
35 (simplify ($put
'%cosh
'%sinh
'$complement_function
))
36 (simplify ($put
'%cos
1 '$unitcof
))
37 (simplify ($put
'%sin
1 '$unitcof
))
38 (simplify ($put
'%cosh
1 '$unitcof
))
39 (simplify ($put
'%sinh -
1 '$unitcof
))
40 (simplify ($put
'%cos -
1 '$complement_cof
))
41 (simplify ($put
'%sin -
1 '$complement_cof
))
42 (simplify ($put
'%cosh
1 '$complement_cof
))
43 (simplify ($put
'%sinh
1 '$complement_cof
))
44 (simplify ($put
'%sin
'$trigonometric
'$type
))
45 (simplify ($put
'%cos
'$trigonometric
'$type
))
46 (simplify ($put
'%sinh
'$hyper_trigonometric
'$type
))
47 (simplify ($put
'%cosh
'$hyper_trigonometric
'$type
))
50 (eval-when (compile load eval
) (meval* '(($declare
) $list2
52 (eval-when (compile eval load
)
53 (defprop $trigonometricp t translated
)
54 (add2lnc '$trigonometricp $props
)
55 (defmtrfun ($trigonometricp $boolean mdefine nil nil
)
58 (or (like (simplify ($get
(simplify ($inpart $exp
0))
61 (like (simplify ($get
(trd-msymeval $piece
'$piece
)
63 '$hyper_trigonometric
))))
64 (eval-when (compile eval load
)
68 (prog ($a |tr-gensym~
1| |tr-gensym~
2|
)
69 (declare (special $a |tr-gensym~
1| |tr-gensym~
2|
))
70 (cond ((not (equal (kar (kar |tr-gensym~
0|
))
73 (setq |tr-gensym~
1|
(kdr |tr-gensym~
0|
))
74 (setq |tr-gensym~
2|
(kar |tr-gensym~
1|
))
75 (setq $a |tr-gensym~
2|
)
76 (cond ((nthkdr |tr-gensym~
1|
1)
78 (return (mul* (power (simplify (list '(%cos
) $a
))
80 (simplify (list '(%sin
) $a
)))))))
82 ((mequal) ((%tan simp
) $a
)
83 ((mtimes simp
) ((mexpt simp
) ((%cos simp
) $a
) -
1)
86 (mdefprop $trigrule0 $defrule $ruletype
))
87 (eval-when (compile eval load
)
91 (prog ($a |tr-gensym~
4| |tr-gensym~
5|
)
92 (declare (special $a |tr-gensym~
4| |tr-gensym~
5|
))
93 (cond ((not (equal (kar (kar |tr-gensym~
3|
))
96 (setq |tr-gensym~
4|
(kdr |tr-gensym~
3|
))
97 (setq |tr-gensym~
5|
(kar |tr-gensym~
4|
))
98 (setq $a |tr-gensym~
5|
)
99 (cond ((nthkdr |tr-gensym~
4|
1)
101 (return (mul* (power (simplify (list '(%cos
) $a
))
103 (simplify (list '(%sin
) $a
)))))))
105 ((mequal) ((%tan simp
) $a
)
106 ((mtimes simp
) ((mexpt simp
) ((%cos simp
) $a
) -
1)
109 (mdefprop $trigrule1 $defrule $ruletype
))
110 (eval-when (compile eval load
)
114 (prog ($a |tr-gensym~
7| |tr-gensym~
8|
)
115 (declare (special $a |tr-gensym~
7| |tr-gensym~
8|
))
116 (cond ((not (equal (kar (kar |tr-gensym~
6|
))
119 (setq |tr-gensym~
7|
(kdr |tr-gensym~
6|
))
120 (setq |tr-gensym~
8|
(kar |tr-gensym~
7|
))
121 (setq $a |tr-gensym~
8|
)
122 (cond ((nthkdr |tr-gensym~
7|
1)
124 (return (power (simplify (list '(%cos
) $a
)) -
1)))))
126 ((mequal) ((%sec simp
) $a
) ((mexpt simp
) ((%cos simp
) $a
) -
1))
128 (mdefprop $trigrule2 $defrule $ruletype
))
129 (eval-when (compile eval load
)
133 (prog ($a |tr-gensym~
10| |tr-gensym~
11|
)
137 (cond ((not (equal (kar (kar |tr-gensym~
9|
))
140 (setq |tr-gensym~
10|
(kdr |tr-gensym~
9|
))
141 (setq |tr-gensym~
11|
(kar |tr-gensym~
10|
))
142 (setq $a |tr-gensym~
11|
)
143 (cond ((nthkdr |tr-gensym~
10|
1)
145 (return (power (simplify (list '(%sin
) $a
)) -
1)))))
147 ((mequal) ((%csc simp
) $a
) ((mexpt simp
) ((%sin simp
) $a
) -
1))
149 (mdefprop $trigrule3 $defrule $ruletype
))
150 (eval-when (compile eval load
)
154 (prog ($a |tr-gensym~
13| |tr-gensym~
14|
)
158 (cond ((not (equal (kar (kar |tr-gensym~
12|
))
161 (setq |tr-gensym~
13|
(kdr |tr-gensym~
12|
))
162 (setq |tr-gensym~
14|
(kar |tr-gensym~
13|
))
163 (setq $a |tr-gensym~
14|
)
164 (cond ((nthkdr |tr-gensym~
13|
1)
166 (return (mul* (simplify (list '(%cos
) $a
))
167 (power (simplify (list '(%sin
)
171 ((mequal) ((%cot simp
) $a
)
172 ((mtimes simp
) ((%cos simp
) $a
)
173 ((mexpt simp
) ((%sin simp
) $a
) -
1)))
175 (mdefprop $trigrule4 $defrule $ruletype
))
176 (eval-when (compile eval load
)
180 (prog ($a |tr-gensym~
16| |tr-gensym~
17|
)
184 (cond ((not (equal (kar (kar |tr-gensym~
15|
))
187 (setq |tr-gensym~
16|
(kdr |tr-gensym~
15|
))
188 (setq |tr-gensym~
17|
(kar |tr-gensym~
16|
))
189 (setq $a |tr-gensym~
17|
)
190 (cond ((nthkdr |tr-gensym~
16|
1)
192 (return (mul* (power (simplify (list '(%cosh
)
195 (simplify (list '(%sinh
) $a
)))))))
196 (mdefprop $htrigrule1
197 ((mequal) ((%tanh simp
) $a
)
198 ((mtimes simp
) ((mexpt simp
) ((%cosh simp
) $a
) -
1)
201 (mdefprop $htrigrule1 $defrule $ruletype
))
202 (eval-when (compile eval load
)
206 (prog ($a |tr-gensym~
19| |tr-gensym~
20|
)
210 (cond ((not (equal (kar (kar |tr-gensym~
18|
))
213 (setq |tr-gensym~
19|
(kdr |tr-gensym~
18|
))
214 (setq |tr-gensym~
20|
(kar |tr-gensym~
19|
))
215 (setq $a |tr-gensym~
20|
)
216 (cond ((nthkdr |tr-gensym~
19|
1)
218 (return (power (simplify (list '(%cosh
) $a
)) -
1)))))
219 (mdefprop $htrigrule2
220 ((mequal) ((%sech simp
) $a
)
221 ((mexpt simp
) ((%cosh simp
) $a
) -
1))
223 (mdefprop $htrigrule2 $defrule $ruletype
))
224 (eval-when (compile eval load
)
228 (prog ($a |tr-gensym~
22| |tr-gensym~
23|
)
232 (cond ((not (equal (kar (kar |tr-gensym~
21|
))
235 (setq |tr-gensym~
22|
(kdr |tr-gensym~
21|
))
236 (setq |tr-gensym~
23|
(kar |tr-gensym~
22|
))
237 (setq $a |tr-gensym~
23|
)
238 (cond ((nthkdr |tr-gensym~
22|
1)
240 (return (power (simplify (list '(%sinh
) $a
)) -
1)))))
241 (mdefprop $htrigrule3
242 ((mequal) ((%csch simp
) $a
)
243 ((mexpt simp
) ((%sinh simp
) $a
) -
1))
245 (mdefprop $htrigrule3 $defrule $ruletype
))
246 (eval-when (compile eval load
)
250 (prog ($a |tr-gensym~
25| |tr-gensym~
26|
)
254 (cond ((not (equal (kar (kar |tr-gensym~
24|
))
257 (setq |tr-gensym~
25|
(kdr |tr-gensym~
24|
))
258 (setq |tr-gensym~
26|
(kar |tr-gensym~
25|
))
259 (setq $a |tr-gensym~
26|
)
260 (cond ((nthkdr |tr-gensym~
25|
1)
262 (return (mul* (simplify (list '(%cosh
) $a
))
263 (power (simplify (list '(%sinh
)
266 (mdefprop $htrigrule4
267 ((mequal) ((%coth simp
) $a
)
268 ((mtimes simp
) ((%cosh simp
) $a
)
269 ((mexpt simp
) ((%sinh simp
) $a
) -
1)))
271 (mdefprop $htrigrule4 $defrule $ruletype
))
272 (eval-when (compile eval load
)
273 (defprop $trigsimp t translated
)
274 (add2lnc '$trigsimp $props
)
276 ($trigsimp $any mdefine nil nil
)
281 (simplify ($radcan
(do ((|tr-gensym~
27| $x
282 (apply1 |tr-gensym~
27|
285 (|tr-gensym~
28|
'($trigrule1 $trigrule2
286 $trigrule3 $trigrule4
287 $htrigrule1 $htrigrule2
288 $htrigrule3 $htrigrule4
)
289 (cdr |tr-gensym~
28|
)))
290 ((null |tr-gensym~
28|
) |tr-gensym~
27|
)
292 (eval-when (compile eval load
)
293 (defprop $trigsimp3 t translated
)
294 (add2lnc '$trigsimp3 $props
)
296 ($trigsimp3 $any mdefine nil nil
)
299 (progn (setq $expn
(simplify ($totaldisrep $expn
)))
300 (simplify ($ratsimp
(div (simplify ($trigsimp1
($num $expn
)))
301 (simplify ($trigsimp1
($denom $expn
)))))))))
302 (eval-when (compile eval load
)
303 (defprop $trigsimp1 t translated
)
304 (add2lnc '$trigsimp1 $props
)
305 (defmtrfun ($trigsimp1 $any mdefine nil nil
)
308 ((lambda ($listoftrigsq $bestlength $trylength
)
310 (assign-mode-check '$trylength $trylength
)
311 (assign-mode-check '$bestlength $bestlength
)
312 (setq $listoftrigsq
(simplify ($listoftrigsq $expn
)))
313 (progn (assign-mode-check '$bestlength
999999)
314 (setq $bestlength
999999))
315 (cond ((not (like $listoftrigsq
'((mlist))))
316 (simplify ($improve $expn
323 (eval-when (compile eval load
)
324 (defprop $improve t translated
)
325 (add2lnc '$improve $props
)
327 ($improve $any mdefine nil nil
)
328 ($expn $subsofar $listoftrigsq
)
331 ((like $listoftrigsq
'((mlist)))
332 (cond ((< ((lambda (|tr-gensym~
31|
)
333 (progn (assign-mode-check '$trylength |tr-gensym~
31|
)
334 (setq $trylength |tr-gensym~
31|
)))
335 ($expnlength $subsofar
))
336 (trd-msymeval $bestlength
0))
337 ((lambda (|tr-gensym~
30|
)
338 (progn (assign-mode-check '$bestlength |tr-gensym~
30|
)
339 (setq $bestlength |tr-gensym~
30|
)))
340 (trd-msymeval $trylength
0))
344 (setq $subsofar
(simplify ($improve $expn
346 (simplify ($rest $listoftrigsq
)))))
348 (($alt
) (mdo (cdr (simplify ($first $listoftrigsq
))) (cdr mdo
)))
350 (setq $alt
(car mdo
))
359 (simplify ($get
(simplify ($inpart $alt
0)) '$unitcof
))
361 (simplify ($get
(trd-msymeval $piece
'$piece
)
364 (simplify (mapply (simplify ($get
(trd-msymeval $piece
366 '$complement_function
))
367 (list (simplify ($first $alt
)))
369 ((mquote) $complement_function
))))
373 (simplify ($rest $listoftrigsq
))))))
375 (eval-when (compile eval load
)
376 (defprop $listoftrigsq t translated
)
377 (add2lnc '$listoftrigsq $props
)
379 ($listoftrigsq $any mdefine nil nil
)
383 (($atom $expn
) '((mlist)))
390 (cond ((and (like (simplify ($inpart $expn
0)) '&^
)
391 ($integerp
(simplify ($inpart $expn
2)))
392 (not (is-boole-check (mlsp (trd-msymeval $piece
395 (cond (($atom
(setq $expn
(simplify ($inpart $expn
1))))
397 (($trigonometricp $expn
)
398 (return (list '(mlist) (list '(mlist) $expn
)))))))
401 (($arg
) (mdo (cdr $expn
) (cdr mdo
)))
403 (setq $arg
(car mdo
))
406 (simplify ($specialunion
(simplify ($listoftrigsq $arg
))
407 (trd-msymeval $ans
'$ans
)))))
408 (return (trd-msymeval $ans
'$ans
))))
411 (eval-when (compile eval load
)
412 (defprop $specialunion t translated
)
413 (add2lnc '$specialunion $props
)
415 ($specialunion $any mdefine nil nil
)
419 ((like $list1
'((mlist))) (trd-msymeval $list2
'$list2
))
420 ((like (trd-msymeval $list2
'$list2
) '((mlist))) $list1
)
426 (($alt
) (mdo (cdr $alternates
) (cdr mdo
)))
428 (setq $alt
(car mdo
))
431 (simplify ($update $alt
432 (simplify ($get
(simplify ($inpart $alt
0))
433 '$complement_function
))))))
434 (simplify ($specialunion
(simplify ($rest $list1
))
435 (trd-msymeval $list2
'$list2
))))
436 (simplify ($first $list1
)))))))
437 (eval-when (compile eval load
)
438 (defprop $update t translated
)
439 (add2lnc '$update $props
)
441 ($update $any mdefine nil nil
)
446 (declare (special $ans
))
449 (setq $complement
(simplify (mfuncall $complement
450 (simplify ($inpart $form
1)))))
454 (mdo (cdr (trd-msymeval $list2
'$list2
)) (cdr mdo
)))
456 (setq $element
(car mdo
))
457 (cond (($member $form $element
)
459 (($member $complement $element
)
460 (return ($cons
(list '(mlist) $form $complement
)
461 (simplify ($delete $element
464 (cond ((like (trd-msymeval $ans
'$ans
) '$found
)
465 (trd-msymeval $list2
'$list2
))
466 ((like (trd-msymeval $ans
'$ans
) '$done
)
467 ($cons
(list '(mlist) $form
) (trd-msymeval $list2
'$list2
)))
468 (t (trd-msymeval $ans
'$ans
))))
470 (eval-when (compile eval load
)
471 (defprop $expnlength t translated
)
472 (add2lnc '$expnlength $props
)
473 (defmtrfun ($expnlength $fixnum mdefine nil nil
)
478 (cond (($atom $expr
) 1)
480 ($argslength
(simplify ($args $expr
)))))))
482 (eval-when (compile eval load
)
483 (defprop $argslength t translated
)
484 (add2lnc '$argslength $props
)
485 (defmtrfun ($argslength $any mdefine nil nil
)
488 (simplify (mapply-tr '&+
489 (simplify (map1 (getopr '$expnlength
)