Mathematics in Objective-C

Discussion in 'iOS Programming' started by spaz926, May 2, 2010.

  1. spaz926 macrumors newbie

    Joined:
    May 2, 2010
    #1
    Hello, I'm new to Objective-C programming, and I'm looking for a way to code equations, fast and easy. If somebody could explain how to do this, that would be great.
    This is what I need help on:

    User inputs integers, and program takes the integers and does an equation out of it. Formulas, geometric and algebraic.

    Thank you in advance.
     
  2. miles01110 macrumors Core

    miles01110

    Joined:
    Jul 24, 2006
    Location:
    The Ivory Tower (I'm not coming down)
    #2
    If you want a "fast and easy" way to do equations, why even bother with Objective-C? Use a scripting language like TCL/Tk or Python.
     
  3. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #3
    Look up the math.h functions. There are many (hyperbolic cotangent, etc.), all in C. If you want Objective C wrappers for these, you may have to write your own.

    And user input from the UI is usually in the form of NSStrings. You'll have to use one of several methods (string utility, scanner, etc.), depending on your needs (unicode input, error checking, international currency/date formats, etc.), to convert the input into an integers.
     
  4. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #4
    TCL and Python don't seem to be allowed, according to the iPhone developer agreement.

    You can, however, send the entire calculation, in string form, to be computed using Javascript (wrapped in a UIWebView) on an iPhone, legally.
     
  5. miles01110 macrumors Core

    miles01110

    Joined:
    Jul 24, 2006
    Location:
    The Ivory Tower (I'm not coming down)
    #5
    The OP doesn't mention anything about an iP* app. Unless they are planning to make an app, this should be in Mac Programming anyways. If they are planning to make an app, there is no "fast and easy" way to achieve what they want.
     
  6. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #6
    ...except for posting their question in the iPhone/iPad Programming forum.
     
  7. miles01110 macrumors Core

    miles01110

    Joined:
    Jul 24, 2006
    Location:
    The Ivory Tower (I'm not coming down)
    #7
    People post in the wrong forum all the time. In fact, I believe this was originally in the Mac Programming forum to begin with before it got moved.

    Edit: Furthermore, how do you plan on getting this on an iPhone/iPad in a usable format without an interface and everything else you'd need to get it working? If it's just equations they want there are numerous apps that already do this.

    The OP would do well to make some major clarifications on what exactly he/she is envisioning.
     

Share This Page