lousy at math

Command: (load "phi") ; error: LOAD failed: "phi"
Command: phi 1.61803
Command: Command: '_.help Command: (* phi 2)
; error: bad argument type: numberp: nil
Command: (* (phi) 2) ; error: no function definition: PHI
Command: phi 1.61803
Command: Command: PHI 1.61803
Command:
my acaddoc.lsp has this in it..... (defun c:phi () (/ (+ 1 (sqrt 5)) 2))
am scratching head as to why i cant times it by two.. or three, or .... which part of code did i write wrong? did it on fly. seems to me, that i should simply be able to :: (* phi 2) (times phi by two)
oh well.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
I think the problem is that you haven't set a variable to hold the real number. The function returns the value, but only when you run it, and I don't think you can run it when it's a term in another function. Try running this:
(defun c:phunction ( / ) (setq phi (/ (+ 1 (sqrt 5)) 2)))
Now you can summon the vaule stored in phi from other functions during the drawing session. I also think it's a problem to have the function and the variable have the same name. If you want to use the value of phi in other functions, name this function something else.
--


MichaelB
www.michaelbulatovich.ca
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
(defun c:phi () (setq phi (/ (+ 1 (sqrt 5)) 2))) The function name won't interfere with the variable name, so if sunnysidedown wants to have a "phi" function and variable, it'll be OK.

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
That's what I thought, but it didn't work until I changed it...That's why I said "I think".
--


MichaelB
www.michaelbulatovich.ca
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Not being critical, just factual. You would be correct in assuming there would be interference IF the function name did not have "c:" in front of it.
Bill DeShawn http://my.sterling.net/~bdeshawn

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Have you tried it named the same?\

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.