Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;перевощикова маша
- ;мех-мат, 1 курс, 3 группа, 2000 год
- ;(wrs 'differen.prt)
- ;(setq echo t)
- ;(setq traceflag nil)
- ;(defun aaa (l)
- ; (trace (l))
- ; (cond (traceflag (traceprint l))
- ; (t nil))
- ;) ; trace
- ;(defun traceprint (l)
- ; (terpri)
- ; (princ l)
- ;) ; traceprint
- (defun dif (l x)
- (cond ((atom l) (cond ((eq l x) 1)
- ( t 0)))
- ((eq (car l) '+) (list '+ (dif (second l) x) (dif (third l) x)))
- ((eq (car l) '*) (list '+ (list '* (dif (second l) x) (third l))
- (list '* (dif (third l) x) (second l))))
- ((eq (car l) '/) (list '/ (list '- (list '* (dif (second l) x) (third l))
- (list '* (dif (third l) x) (second l)))
- (list '^ (third l) 2)))
- ((eq (car l) '-) (list '- (dif (second l) x) (dif (third l) x)))
- ((eq (car l) '^) (list '* (third l) (list '^ (second l) (- (third l) 1))))
- ((eq (car l) 'sin) (list '* (dif (second l) x) (list 'cos (second l))))
- ((eq (car l) 'cos) (list '- (list '* (dif (second l) x) (list 'sin (second l)))))
- ((eq (car l) 'tg) (list '/ (dif (second l) x) (list '^ (list 'cos (second l) 2))))
- ((eq (car l) 'ln) (list '/ (dif (second l) x) (second l)))
- (t l)))
- (print (dif '(/ 3 5 6 89 4) 3))
- (print t)
- (print (/ (- (* 1 5) (* 0 3)) (^ 5 2)) )
- ;(rds)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement