To whom it may concern, I have recently downloaded Ifeffit for Mac OS X from your website. I am hoping to be able to use it with EXAFS data as the FEFF6 website led me to your application. I am currently working through the tutorial. However, every time I try to use the print command to make a literal string statement, all I get is 0.0000 back. Example: print " the square root of ", number, " is ", sqrt(number) 0.0 99.0000000 0.0000000 9.94987437 print "Hi mom" 0.000000000 Any thoughts? Thanks, Tony Tony Kelly, M.S. DTRA PhD Student Department of Engineering Physics Air Force Institute of Technology Office: (937)255-3636 ext 7300
I have recently downloaded Ifeffit for Mac OS X from your website. I am hoping to be able to use it with EXAFS data as the FEFF6 website led me to your application. I am currently working through the tutorial. However, every time I try to use the print command to make a literal string statement, all I get is 0.0000 back. Example:
print " the square root of ", number, " is ", sqrt(number)
0.0 99.0000000 0.0000000 9.94987437
print "Hi mom"
0.000000000
Any thoughts?
My thought is RTM. http://cars9.uchicago.edu/~ifeffit/refman/node96.html Ifeffit isn't really a proper language with a REPL in the sense that, say, bash or python or powershell is. Ifeffit is a pretty singular of purpose object -- it is a tool for processing and analyzing certain kinds of data. It just does that. As the page from the manual explains, "print" is a way of evaluating expression. "Hi mom" evaluates to 0. So does " is ". So does " the square root of ". In the problem area of Ifeffit, "print" is an expression evaluator, not the parser/evaluator of a REPL. Ifeffit> set a=2 Ifeffit> print a 2.00000000 Ifeffit> print sqrt(a)+atan(a**2) 2.74003123 Ifeffit> print "sqrt(a) + atan(a**2)" 2.74003123 HTH, B -- Bruce Ravel ------------------------------------ bravel@bnl.gov National Institute of Standards and Technology Synchrotron Methods Group at NSLS --- Beamlines U7A, X24A, X23A2 Building 535A Upton NY, 11973 My homepage: http://xafs.org/BruceRavel EXAFS software: http://cars9.uchicago.edu/~ravel/software/exafs/
Hi Tony, Bruce, Like Bruce said, Ifeffit is a pretty poor excuse for a general purpose calculator shell program. Sadly, the documentation Bruce pointed turns out to be wrong.... The print function is pretty awful to use. It was inspired by bash & perl, but is much worse.The actual behavior is / appears to be: - strings inside single quotes are not evaluated - strings inside double quotes are evaluated. - spaces in an unquoted string confuse "print", appearing to mean separate items to be evaluated. The general Ifeffit behavior is to "keep going in spite of errors" and so it will spit out piles of zeros rather than tell you what the problem is. Again, it's a poor excuse of a shell program. Whereas the documentation says print "7 * sqrt(99.11) = ", (7 * sqrt(99.11)) What you really want is one of these print '7 * sqrt(99.11) = ', (7*sqrt(99.11)) print '7 * sqrt(99.11) = ', "(7 * sqrt(99.11))" For your question, print " the square root of ", number, " is ", sqrt(number) should be print ' the square root of ', number, ' is ', sqrt(number) although, just for safety, I would recommend print ' the square root of ', "number", ' is ', "sqrt(number)" as it allows an expression with spaces: Ifeffit> number = 19 Ifeffit> print 'the square root of ', number, ' is ', "sqrt(number)" the square root of 19.0000000 is 4.35889894 Ifeffit> print 'the square root of ', "number + 1", ' is ', "sqrt(number + 1)" the square root of 20.0000000 is 4.47213595 Sorry for the confusion, the lame shell, and the poor documentation. OK, I have a New Year's Resolution: make larch/ifeffit2 usable! --Matt
participants (3)
-
Bruce Ravel
-
Kelly, Tony D Ctr USAF AETC AFIT/ENP
-
Matt Newville