
Visual lisp 错误: 没有为参数定义函数
程序如下(defunc:jtyz()(setqR(getreal"\nenterR"))(setqH(getreal"\nenterH"))(setqH1(getreal...
程序如下
(defun c:jtyz()
(setq R (getreal "\nenter R "))
(setq H (getreal "\nenter H "))
(setq H1 (getreal "\nenter H1 "))
(setq a (getreal "\nenter a "))
(setq dh (getreal "\nenter dh "))
(setq tana (/ (sin a) (cos a)))
(setq hmin (+ H1 (/ (* tana (- H H1)) (- tana (/ H R)))))
(setq hmax (+ H1 (/ (* tana (- H H1)) (+ tana (/ H R)))))
(setq h hmin)
(setq x0 0 y0 hmin)
(while (<= h hmax)
(setq h (+ h dh))
(setq r (/ (* R (- H h)) H))
(setq y (/ (- h H1) tana))
(setq x (sqrt (- (* r r) (* y y))))
(setq phi (+ (atan x y) (/ pi 2)))
(setq x1 (* r phi) y1 h)
(command "line" (list x0 y0) (list x1 y1)"")
(setq x0 x1 y0 y1)
)
) 展开
(defun c:jtyz()
(setq R (getreal "\nenter R "))
(setq H (getreal "\nenter H "))
(setq H1 (getreal "\nenter H1 "))
(setq a (getreal "\nenter a "))
(setq dh (getreal "\nenter dh "))
(setq tana (/ (sin a) (cos a)))
(setq hmin (+ H1 (/ (* tana (- H H1)) (- tana (/ H R)))))
(setq hmax (+ H1 (/ (* tana (- H H1)) (+ tana (/ H R)))))
(setq h hmin)
(setq x0 0 y0 hmin)
(while (<= h hmax)
(setq h (+ h dh))
(setq r (/ (* R (- H h)) H))
(setq y (/ (- h H1) tana))
(setq x (sqrt (- (* r r) (* y y))))
(setq phi (+ (atan x y) (/ pi 2)))
(setq x1 (* r phi) y1 h)
(command "line" (list x0 y0) (list x1 y1)"")
(setq x0 x1 y0 y1)
)
) 展开
展开全部
将
(setq x (sqrt (- (* r r) (* y y))))
改为
(setq x (sqrt (abs (- (* r r) (* y y)))))
当(* r r) -(* y y)<0.0时,负数不能开方。
(setq x (sqrt (- (* r r) (* y y))))
改为
(setq x (sqrt (abs (- (* r r) (* y y)))))
当(* r r) -(* y y)<0.0时,负数不能开方。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询