Questions tagged [ddmathparser]

An Objective-C framework for parsing mathematical expressions.

DDMathParser is an Objective-C framework by Dave DeLong for parsing mathematical expressions input by the user. This supports various mathematical expressions. The code is available on GitHub.

Source: DDMathParser Wiki

37 questions
3
votes
1 answer

DDMathParser in .mm file

In my Xcode project I need to rename my ViewController.m in ViewController.mm , but I also need the DDMathParser. I compile the parser in the .m file without any errors. But when I compile it in the .mm file I get following errors: Parse issue at…
1
vote
3 answers

How to import a third-party framework into my Swift project?

I am trying to import the DDMathParser framework into my Swift app. I tried following the installation instructions from the DDMathParser wiki, though it did not work: DDMathParser is packaged as a Swift framework. Add DDMathParser.xcodeproj to…
autobahn
  • 115
  • 1
  • 10
1
vote
1 answer

iOS DDMathParser get solving steps of math expression

I am building a some kind of calculator for iOS using DDMathParser. I would like to know how to separate an expression (NSString) like 3+3*4 (After parsing add(3,multiply(3,4))) into its individual steps:multiply(3,4) add(3,12). I would prefer that…
Fidel
  • 13
  • 2
1
vote
1 answer

How do I use DDMathParser with Objective-C?

I'd like to use the DDMathParser library with Objective-C, but it was written in Swift. Here's what I've tried so far: #import // ... // This throws error: Expression *e; This doesn't build because the compiler can't…
Alex Miller
  • 1,566
  • 1
  • 13
  • 16
1
vote
1 answer

Using Error Handling in DDMathParser

I am using DDMathParser library in my project and I want to use error handling. I want the error to be displayed to user if he inputs wrong expression. What would be my catch block to detect and display related error and its position. Following is…
Bilal
  • 558
  • 8
  • 18
1
vote
1 answer

DDMathParser in Objective-C++ produces error

everybody, I am new to Stack Overflow (and DDMathParser), but came here because of a weird problem that occurred when I was trying to use DDMathParser in an objective-c++ file (main.mm). No matter how simple the code was, it would give a thread…
1
vote
1 answer

Mathematical Parser in Swift

I am wondering if there are any nice Mathematical Parsers in Swift. That is, it can take a string and solve it. I need it to have factorials, exponents, square roots, and all the basic arithmetic operators. I want it to be built into Swift, not 3rd…
Epic Defeater
  • 2,107
  • 17
  • 20
1
vote
1 answer

DDMathParser failing to tokenize solitary plus character

Using DDMathStringTokenizer, while something like 2 + 4 tokenizes fine into 3 tokens (with the second being the + operator and the first and third being numbers), if I pass over a + alone, it fails to return it as a token. This does not hold true…
joshd
  • 1,626
  • 14
  • 17
1
vote
1 answer

Can anyone help fix this DDMathParser new function?

I'm registering a summation function that is sum(expression,initial,final). The expression contains the independent variable x and the initial and final are integers. For example, sum(2x,2,4) should return 2*2+3*2+4*2=18. However, I have trouble…
zyl1024
  • 690
  • 1
  • 9
  • 23
1
vote
1 answer

Can anyone point to a tutorial of adding new functions in ddmathparser?

I am new to programming. I want to add some new functions such as derivatives and integrations to ddmathparser. The only one I can find is the short tutorial on ddmathparser's wiki page…
zyl1024
  • 690
  • 1
  • 9
  • 23
1
vote
1 answer

iOS DDMathParser Get Any Occurrences of (...) In String

I am using DDMathParser in my app, and have recently come across the need to get occurrences of any group of numbers within a () parentheses bracket thingy (very highly technical!). For example, I would need to get (6+5) out of 6+7/8(6+5).…
Undo
  • 25,519
  • 37
  • 106
  • 129
0
votes
1 answer

Expression(string: ) not parsing correct result in DDMathParser

expressions[2] = "$x**3/3+$x*$z**2+2*($x**2-$z**2)" let mathParserExpression2 = try Expression(string: expressions[2]) results in $x ** 3.0 ÷ 3.0 + $x * $z ** 2.0 + 2.0 * $x ** 2.0 − $z ** 2.0 What to do? Even expressions[2] =…
swainwri
  • 66
  • 7
0
votes
1 answer

osx DDMathParser - Find Function Token in String

I try to build an expression string evaluated with DDMathParser from user input (string) for example: 3 + ln(2) + var I try to use the built-in Tokenizer function from DDMathParser in order to find all kind of tokens. But using the following code…
JFS
  • 2,992
  • 3
  • 37
  • 48
0
votes
2 answers

DDMathParser implicit multiplication not working

I use DDMathParser to solver formula expressions using Swift. The following code works fine, however, implicit multiplication doesn't. Reading the docs it should work... So, what do I miss here? my code: ... substitutions.updateValue(3, forKey:…
JFS
  • 2,992
  • 3
  • 37
  • 48
0
votes
1 answer

Getting DDMathParser tokens and group tokens

I already found a solution to my problem on stackoverflow but it is in Objective-C. See this link DDMathParser - Getting tokens I translated this into Swift as shown below. So what is the latest way to get tokens from a string and to get grouped…
TBH
  • 145
  • 1
  • 11
1
2 3