zeabrah’s lair

14 June, 2008

leakage in R-chain

Filed under: dev — Tags: , — alexeybrazhe @ 11:01 pm

From time to time I will post here some little code snippets from what I write.
All code is under GPL ;)

This time it is a leakage resitance calculator:


(defun make-R-elem (R1 R2)
  (list R1 R2))

(defun axial-R (elem)
  (car elem))

(defun leak-R (elem)
  (cadr elem))

(defun make-R-chain (axial leak &key (number 10))
  (do ((chain nil)
       (n 0  (1+ n)))
      ((> n number) (nreverse chain))
    (push (make-R-elem axial leak) chain)))

(defun leak-resistance (chain)
 "Leakage resistanse of the repeated  circut:
       o---/\/\/\---+------o
         R1 (axial) |
                    /
                    \
                    / R2 (leakage)
                    \
                    /
                    |
                   --- Gnd
   elements are in a list: ((R1 R2) (R1 R2))
  "
  (let ((elem (car chain)))
   (if (null (cdr chain))
    (+ (axial-R elem) (leak-R elem))
    (+ (axial-R elem)
       (/ 1.0 (+ (/ 1.0 (leak-R elem))
                 (/ 1.0 (leak-resistance (cdr chain)))))))))

5 June, 2008

New test

Filed under: Uncategorized — Tags: , , — alexeybrazhe @ 6:51 pm

Let’s try it once again.

At least, tags work now. That’s something.

Blogging from emacs

Filed under: emacs — Tags: , — alexeybrazhe @ 11:48 am

Let’s see if it works.

Update: It does. However, the tags/categories do not work and I don’t know how to fix it.

I added tags and categories from the browser now. Pity

Blog at WordPress.com.