📄 simply.lsp
字号:
; For poly of (ax+b)
(defun normal (exp x)
(cond ((numberp exp) `(EX ,exp 0))
((eq exp x) '(EX 0 1))
((eq exp '+) 'poly-add)
((eq exp '-) 'poly-sub)
((eq exp '*) 'poly-time)
((symbolp exp) `(EX ,exp 0))
(t
`(,(normal (car exp) x) ,(normal (second exp) x) ,(normal (third exp) x))
) ) )
(defun pre-normal (exp x)
(let ((a (car exp))
(b (second exp)) )
(if (< a 0)
`(- ,(eval (* a -1)) (* ,b ,x))
`(+ ,a (* ,b ,x))
) ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun simp (exp x)
(pre-normal (eval (normal exp x)) x)
)
(defun simp-equation (ee x)
(let* ((exp `(- ,(second ee) ,(third ee)) )
(exp2 (pre-normal (eval (normal exp x)) x)) )
`(= ,exp2 0)
) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun EX (x y) (list x y))
(defun poly-add (e1 e2)
`(,(+ (first e1)(first e2))
,(+ (second e1)(second e2)) )
)
(defun poly-sub (e1 e2)
`(,(- (first e1)(first e2))
,(- (second e1)(second e2)) )
)
(defun poly-time(e1 e2)
`(,(* (first e1)(first e2))
,(+ (* (first e1)(second e2))
(* (second e1)(first e2))
) ) )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -