to ljcgq:这有个CAD题,http://www.mouldbbs.com/dispbbs.asp?BoardID=55&replyid=&id=69315&star=1&skin=0 我写了个LISP,是解四次方程序的。代码:
(defun c:wh(/ x xx y flx d1 d2 d3 d4 d5) (setq x 19.0) (setq FX (- (+ (* x x x x) 1225)(+ (* 14 x x x )(* 70 x x)(* 350 x)))) (SETQ FLX (- (* 4 x x x)(+ (* 42 x x)(* 140 x) 350))) (setq xx (- x (/ fx flx))) (while (> (abs (- x xx)) 0.0000000000000000000000000000000000000000000000000000001) (setq x xx) (setq FX (- (+ (* x x x x) 1225)(+ (* 14 x x x )(* 70 x x)(* 350 x)))) (SETQ FLX (- (* 4 x x x)(+ (* 42 x x)(* 140 x) 350))) (setq xx (- x (/ fx flx))) ) (setq y (/ (- 35 (* 5 x)) x)) (setq oldos (getvar "osmode")) (setvar "osmode" 0) (setq d1 (list 0 0 0)) (setq d2 (list 0 x 0)) (setq d3 (list -5 0 0)) (setq d4 (list 0 7 0)) (setq d5 (list y 7 0)) (command "line" d1 d2 d3 "c") (command "line" d4 d5 "") (setvar "osmode" oldos) (princ) )
我VBA稍好一点,LISP水平很菜,向你学习!