Results 1 to 6 of 6
  1. #1
    jlbird is offline Member
    Join Date
    Oct 2010
    Posts
    2
    Rep Power
    0

    Default Output Equations in Java

    Hello,

    I was wondering if anyone knew of a library that could take an equation like

    Java Code:
    x = (-b +- (b^2-4ac)^(1/2))/2


    And turned it into something like:




    Preferably I would not like the output to be an image, but an image output is fine. I just wanted to check if something like this exists before I start coding it myself.

    Thanks

  2. #2
    jlbird is offline Member
    Join Date
    Oct 2010
    Posts
    2
    Rep Power
    0

    Default

    Would this be a better placed question somewhere else?

  3. #3
    argus is offline Member
    Join Date
    Oct 2010
    Posts
    11
    Rep Power
    0

    Default

    hey,
    first.I can't help you.But what do you want to achieve.That the parameters in this new Form will be valuable themselfs? If you know what i mean?

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    There are some packages in Java, that you can draw equations, graphs, shapes, etc.. Search on Google.

    David J. Eck

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,658
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by jlbird View Post
    Hello,

    I was wondering if anyone knew of a library that could take an equation like

    Java Code:
    x = (-b +- (b^2-4ac)^(1/2))/2


    And turned it into something like:
    [ snip picture ]
    I once generated html version 3.2. tags from an infix expression (there's a little thread about it in the AWT/Swing forum). First the infix expression was parsed to its abstract syntax tree; a visitor would visit all the nodes (where the nodes would tell the visitor their type of node) and html code was generated. It turned out a bit of a mess because html 3.2 isn't well suited to mark up mathematical expressions. Here's an example: the expression:

    Java Code:
    ((-b + sqrt(b**2-4*a*c))/2*a)
    is compiled to an AST; the postfix form of the AST is:

    Java Code:
    b +- b 2 ** 4 a * c * - sqrt + 2 / a *
    (note: +- is the token for the unary minus operator) and the html output is:

    Java Code:
    (-<i>b</i>+<font color="#cc"><b>&radic;</b></font>(<i>b</i><sup><font color="#8000">2</font></sup>&minus;<font color="#8000">4</font>&middot;
    <i>a</i>&middot;<i>c</i>))&nbsp;&frasl;&nbsp;<font color="#8000">2</font>&middot;<i>a</i>
    As I wrote: html isn't the best output for mathematical infix expressions. If you can, select another output form. Parsing the infix expression is just standard technology (my version is a recursive descent parser).

    kind regards,

    Jos

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default

    You could try LaTex, if you can find a plugin viewer for Java that is.

    MathML maybe?

Similar Threads

  1. linear systems of equations
    By tyang in forum New To Java
    Replies: 2
    Last Post: 03-24-2010, 03:13 PM
  2. Finding the intercept using two equations.
    By MapleLeafRag in forum New To Java
    Replies: 1
    Last Post: 12-03-2009, 08:32 PM
  3. Java, output string, getting correct output? HELP!
    By computerboyo in forum New To Java
    Replies: 2
    Last Post: 02-25-2009, 11:44 PM
  4. Solving this equations problem in Java
    By matt_well in forum New To Java
    Replies: 17
    Last Post: 08-30-2008, 09:05 PM
  5. equations
    By Peter in forum New To Java
    Replies: 2
    Last Post: 07-04-2007, 06:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •