symbols in lisp

Discussion of Common Lisp

symbols in lisp

Postby gayelle » Wed Oct 05, 2011 2:00 pm

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
gayelle
 
Posts: 9
Joined: Mon Oct 03, 2011 8:34 pm

Re: symbols in lisp

Postby edgar-rft » Wed Oct 05, 2011 4:37 pm

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
edgar-rft
 
Posts: 157
Joined: Fri Aug 06, 2010 6:34 am
Location: Germany

Re: symbols in lisp

Postby gayelle » Wed Oct 05, 2011 5:07 pm

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))))
gayelle
 
Posts: 9
Joined: Mon Oct 03, 2011 8:34 pm


Return to Common Lisp

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests