Page 1 of 1
symbols in lisp
Posted: Wed Oct 05, 2011 2:00 pm
by gayelle
Hello,
I was wondering if anyone could let me know how I can have allegro common lisp recognize the mathematical symbol 'e' as the mathematical e and not a letter or something
thank you
Re: symbols in lisp
Posted: Wed Oct 05, 2011 4:37 pm
by edgar-rft
I don't know if there's an Allegro-specific extension that defines e as Euler's number, but e is no predefined constant of the Common Lisp standard.
Here's how you can make your own e constant:
Code: Select all
CL-USER> (defconstant e (exp 1))
E
CL-USER> e
2.7182817
HTH - edgar
Re: symbols in lisp
Posted: Wed Oct 05, 2011 5:07 pm
by gayelle
I have this question to answer for a quiz and im at an impass. At first i couldnt figure out the E but now I cant figure out how to use a condition... This was the question:
4. Use cond and exp to define (activation type sum) which returns the activation value of a connectionist unit given a sum of products of input activations x corresponding connection weights. Include both ‘sigmoid and ‘asigmoid types of activation functions, and return ‘unknown-type if some other type is used as input.
I defined two functions for the asigmoid and sigmoid functions but have no idea how to put them together in an activation sum function
Code: Select all
(defun sigmoid (x)
(- 0.5 (/ 1 (- 1 (exp x)))))
(defun asigmoid (x)
(/ 1 (- 1 (exp x))))