Calculation Field: Trigonometric and Math Functions

Tap Forms – Organizer Database App for Mac, iPhone, and iPad Forums Using Tap Forms Calculation Field: Trigonometric and Math Functions

Viewing 3 reply threads
  • Author
    Posts
  • June 11, 2014 at 8:27 PM #10360

    1Levite
    Participant

    I thought I recalled seeing a list of functions that could be used in the calculation field (other than the basic four: +, -, /, x), but I can’t seem to find it now. Here’s a short observation on more interesting calculations.

    I found that the following functions seem to work great:

    SIN(fieldname) where fieldname is a Numeric field.
    COS(fieldname)
    TAN(fieldname)
    LOG(fieldname) [although couldn’t figure out natural log]
    SQRT(fieldname) for square root
    PI may be used in calculations as PI
    If you are using SIN(), COS(), TAN(), be aware that fieldname must be in radians (or be converted from degrees to radians in the calculation by multiplying degrees by PI/180).

    The default for calculation fields seems to be zero decimal places–remember to assign the desired number of decimal values.

    The calculation field offers more than I originally thought. Very nifty–if you need that sort of thing.

    June 13, 2014 at 12:21 AM #10367

    Brendan
    Keymaster

    I didn’t publish these extra math functions because I wanted to have a better math parser than what I have now. Plus you can’t enter that stuff on the iOS version. But they should work fine nonetheless.

    Good sleuthing though!

    Thanks!

    Brendan

    June 14, 2014 at 11:23 AM #10380

    1Levite
    Participant

    One more: Raising to powers in the TF OSX calculation field.(TF 2.2.3)

    [fieldname]^3 in the calculation field will give you the cube of fieldname.

    If you have two separate numeric fields, the following works too:

    [fieldname1]^[fieldname2] returns fieldname1 raised to the power of fieldname2

    June 14, 2014 at 11:32 AM #10382

    Brendan
    Keymaster

    If you want to see the original source of the math library I’m using, you can find it here:

    http://apptree.net/parser.htm

    But I’m hoping to change to this parser at some point:

    Math Parser for Objective C

    It has some interesting features. I’m also hoping to modify the parser to support string concatenation. So you could do “Total: ” + Cost * 1.05 + ” owed”. Or even simply First Name + ” ” + Last Name.

    Thanks!

    Brendan

Viewing 3 reply threads

You must be logged in to reply to this topic.