Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String recognition questions...

 
johny doe
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
--------------------------------------------------------------------------------

i want to build a function that inputs

a string
and i want to recognize a complex polynomial
in that string and if
for example if the user inputs the folloing string

(1+i)x^3 +(5i)x^2 +(3+5i)x +5

(each cell in the complex number array consists of
a real number and emaginary)
the function will put in cell 3 the value 1 in the real part
of cell 3 and 1 in the imaginary part of cell 3.

in cell 2
it will put 0 in the real part of cell 2
and 5 in the complex part of cell 2

etc...

is there a way for me to make this function??

another questiob
if i got
a string
=================
a=\b
===============
for wich the user puts values for a and b
i want to make the following operation on the

t=a.divide(b)

how do i build a mechanism that recognises
this pattern??
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a number of 3rd party libraries for parsing maths expressions. I've never used any, so can't recommend anything, but if you Google 'java math parser' you can take a look at a few and see if any meet your needs.
 
johny doe
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i coundnt find the thing iwas looking for
can you be more specific
please
 
Henry Wong
author
Marshal
Pie
Posts: 21123
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by johny doe:
i coundnt find the thing iwas looking for
can you be more specific
please


I followed Joanne's instructions, and typed "java math parser" into google. But let me check.... Yup, the first hit claims that it supports complex numbers too.

Henry
 
Nicholas Jordan
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
  • Developer Forums java string parsing
  • Parser (Java 2 Platform SE v1.4.2)
  • Lexical analysis and Java: Part 1 - Java World
  • A Simple Recursive Descent Parser
  •  
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic