1 ;; Author Barton Willis
2 ;; University of Nebraska at Kearney
3 ;; Copyright (C) 2004, Barton Willis
5 ;; Brief Description: Maxima code for linear homogeneous second order
6 ;; differential equations.
8 ;; Maxima odelin is free software; you can redistribute it and/or
9 ;; modify it under the terms of the GNU General Public License,
10 ;; http://www.gnu.org/copyleft/gpl.html.
12 ;; Maxima odelin has NO WARRANTY, not even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 ($put
'$testodelin
1 '$version
)
18 (defun $testodelin
(fn)
19 (let ((acc) (strm) (de) (sol) (t1) (gork) (i 0) (times)
20 (solved-des) (unsolved-des) (total-time 0)
24 (setq fn
(make-pathname :name fn
))
27 (setq strm
(open fn
:direction
:input
))
28 (while (not (eq 'eof
(setq de
(mread strm
'eof
))))
29 (push (nth 2 de
) acc
))
32 (setq acc
(reverse acc
))
35 (meval '(($kill
) $all
)) ;; sigh....
36 (format t
"~%-- ~A ------------------------------------~%" i
)
37 (setq t1
(get-internal-run-time))
38 (displa `((mequal) de
,de
))
39 (setq gork
`(($errcatch
) (($odelin
) ,de |$y| |$x|
)))
40 (setq sol
(meval gork
))
41 (setq t1
(- (get-internal-run-time) t1
))
43 (setq longest-time
(max longest-time t1
))
44 (setq t1
(float (/ t1 internal-time-units-per-second
)))
46 (setq t1
(mul t1
'$sec
))
47 (cond ((and (not (like sol
'((mlist)))) (not (like ($first sol
) nil
)))
49 (setq sol
($first sol
))
50 (displa `((mequal) sol
,sol
))
51 (displa `((mequal) time
,t1
)))
53 (push de unsolved-des
)
54 (displa `((mequal) time
,t1
))
55 (displa `((mequal) notsolved
,de
)))))
57 (setq longest-time
(float (/ longest-time internal-time-units-per-second
)))
58 (setq total-time
(mul total-time
'$sec
))
59 (displa `((mequal) totaltime
,total-time
))
60 (displa `((mequal) longest_time
,longest-time
))
61 (displa `((mequal) number_of_solved_des
,(length solved-des
)))
62 (displa `((mequal) number_of_unsolved_des
,(length unsolved-des
)))
64 (setq times
(sort times
#'<))
66 (displa `((mequal) times
,times
))
68 (dolist (de unsolved-des
)