Loading ...
Sorry, an error occurred while loading the content.
 

Re: [Clip] Re: how to use scientific notation in a clip?

Expand Messages
  • Axel Berger
    ... That depends. you could just go and divide regardless and let it give you the result as E9 and E12 and whatever and visually choose the one that looks
    Message 1 of 4 , Dec 5, 2006
      mfrascinella@... wrote:
      > I imagine it would be tricky to convert the result
      > to scientific notation.

      That depends. you could just go and divide regardless and let it give
      you the result as E9 and E12 and whatever and visually choose the one
      that looks nicest. I wouldn't really want to do a thing like that in
      clip language, but the canonic way, if clips can hack it, is
      3*INT(LOG(x)/3) for the exponent.

      Axel

      N.B: full quotes are evil
    • Axel Berger
      This was first sent last evening, but never appeared: ... That depends. you could just go and divide regardless and let it give you the result as E9 and E12
      Message 2 of 4 , Dec 6, 2006
        This was first sent last evening, but never appeared:

        mfrascinella@... wrote:
        > I imagine it would be tricky to convert the result
        > to scientific notation.

        That depends. you could just go and divide regardless and let it give
        you the result as E9 and E12 and whatever and visually choose the one
        that looks nicest. I wouldn't really want to do a thing like that in
        clip language, but the canonic way, if clips can hack it, is
        3*INT(LOG(x)/3) for the exponent.

        Axel

        N.B: full quotes are evil
      • frascinella
        Hi, I did some further study, especially of the note about math functions that Sheri referred to (from 2003) and finally got the clip to calculate the
        Message 3 of 4 , Dec 12, 2006
          Hi,

          I did some further study, especially of the note about math functions
          that Sheri referred to (from 2003) and finally got the clip to
          calculate the frequency in scientific notation. I took the logarithm
          of the calculated frequency, used the FLOOR function to round the log
          down to an integer, and divided the result by that power of 10 to get
          scientific notation.

          The prompts (now commented out) helped me verify each step of the
          calculation.

          Yours,

          Michael F.
          ==========

          H="Wavelength -> Frequency"

          ^!Set %wavelength%=^?[Enter the wavelength (cm)]
          ;^!Prompt ^%wavelength% cm
          ^!Set %frequency%=^$Calc(2.9979245800e10/^%wavelength%)$
          ;^!Prompt ^%wavelength% cm = ^%frequency% cycles/sec.
          ^!Set %log_frequency%=^$Calc(FLOOR(LOG10(^%frequency%)))$
          ;^!Prompt ^%log_frequency%
          ^!Prompt ^%wavelength% cm = ^$Calc(^%frequency%/1e^%log_frequency%;3)
          $ x 10^^%log_frequency% cycles/sec (scientific notation)
        Your message has been successfully submitted and would be delivered to recipients shortly.