Simplify output
I'm working with Symja on java to simplify an equation. This is the equation:
5.0+4.0(x-0.0)+3.0(x-0.0)(x-1.0)+1.0(x-0.0)(x-1.0)(x-2.0)
I use Simplify(eq) and I got this:
(x)x^2.0+3.0*x+5.0
[Using the online demo](http://symjaweb.appspot.com/?ci=ta:Input:t:Simplify(5.0%2B4.0(x-0.0)%2B3.0(x-0.0)(x-1.0)%2B1.0(x-0.0)(x-1.0)(x-2.0))
3.0*x+x^3.0+5.0
I did some testing and discovered that, using java, the simplify function can't simplify this: x(x^2.00)--------Output--------> x(x^2.0)
but it works with this: x^2.00(x)--------Output-------->x^3.0 x(x^2)--------Output-------->x^3.0
I'm using: Windows 7 x64 Netbeans IDE 7.4 Java 7u60 log4j-1.2.15.jar symja-2014-05-18.jar
Comments (5)
-
-
repo owner x(...) is interpreted as call to function "x" with no argument and not as multiplication.
Please try it with "x*(x^2.00)"
You can download the latest Java version here: https://bitbucket.org/axelclk/symja_android_library/downloads/symja-2014-06-09.jar
-
Sorry for the misleading info. There's a problem with the text here in bitbucket. I used the "()" as a replacement for "*". I don't know why but when I put many asterisks they get deleted. Here's an example:
5.0+4.0(x-0.0)+3.0(x-0.0)(x-1.0)+1.0(x-0.0)(x-1.0)(x-2.0)
I tried to paste this instead
5.0+4.0*(x-0.0)+3.0*(x-0.0)*(x-1.0)+1.0*(x-0.0)*(x-1.0)*(x-2.0)
Same with some new lines, I need to press "Enter" twice or the text will be "pulled" to the last one.
Well, back to the main topic.
Fixed! I replaced the jar in my classpath with the new version and everything works fine. Just to be sure you can test the original equation with the symja-2014-05-18.jar. This are my results:
Using symja-2014-05-18.jar Simplify("5.0+4.0*(x-0.0)+3.0*(x-0.0)*(x-1.0)+1.0*(x-0.0)*(x-1.0)*(x-2.0)") Output x*x^2.0+3.0*x+5.0 Using symja-2014-06-09.jar Simplify("5.0+4.0*(x-0.0)+3.0*(x-0.0)*(x-1.0)+1.0*(x-0.0)*(x-1.0)*(x-2.0)") Output 3.0*x+x^3.0+5.0
So I guess that's all. Ordering the output by degree would be cool! But that's for another time, I could make that instead of bothering you.
Edit: Don't know if this should be in another issue but the output changes with whole numbers. It's just a minimal detail. Example:
Input Simplify("5.0+4.0*(x-0.0)+3.0*(x-0.0)*(x-1.0)+1.0*(x-0.0)*(x-1.0)*(x-2.0)") Output 3.0*x+x^3.0+5.0 Input Simplify("5+4*(x-0)+3*(x-0)*(x-1)+1*(x-0)*(x-1)*(x-2)") Output x^3+3*x+5
-
repo owner I adjusted the sorting of Orderless expressions with this commit: https://bitbucket.org/axelclk/symja_android_library/commits/8b899aa05a52ee1cc7097a75dfdd0bab47feac9f
-
repo owner - changed status to resolved
- Log in to comment
Didn't logged in when I wrote this. Just wanted to post the fixed link. Here's the link to the online demo with the equation