以sinx为例,lisp程序如下: (defun C:Psin() ;其中d是函数的步长 (setq os(getvar "osmode")) (setvar "osmode" 0) (arxload "geomcal.arx") (setq s (getreal "\n输入初值:")) (setq e (getreal "\n输入终值:")) (setq d (getreal "\n输入步长:")) (setq i s) (while (<= i e) (setq x i) (setq y (cal "sin(x*180/pi)")) (if (= i s) (setq p1 (list x y)) (progn (setq p2 (list x y)) (command "_line" p1 p2 "") (setq p1 p2)) ) (setq i (+ i d)) ) (setvar "osmode" os) ) |