AOWANG / symja

Automatically exported from code.google.com/p/symja
1 stars 0 forks source link

Problem with JAS library using Integrate[] and Simplify[] #44

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I do this:

Integrate[D[Tan[x],x],x] and I get this throwable:

java.lang.NoClassDefFoundError: edu/jas/poly/TermOrder

adding

import edu.jas.poly.TermOrder in my .java file doesn't solve the problem. The 
source code I use for the operation is:
private EvalUtilities util;
private IExpr result;

MainMethodHere(){
result = util.evaluate("Integrate[D[Tan[x],x],x]");
OutputFormFactory.get().convert(buf, result);
String output = buf.toString();
System.out.println("OUT: "+output);
}

Simplify[] sometimes doesn't work too.

Original issue reported on code.google.com by carlosg...@gmail.com on 13 Aug 2012 at 3:58

GoogleCodeExporter commented 8 years ago
What version do you use?

Did you add 
  F.initSymbols(null);
somewhere in your code as described here:

http://code.google.com/p/symja/wiki/EvalFromJava

Original comment by axelclk@gmail.com on 18 Aug 2012 at 12:13

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Thank you. That was the problem. There's not much documentation and I just 
copied that. Replacing F.initSymbols(null) with F.initSymbols() fixes the 
problem.

One thing I don't like is that I do N[Integrate[Diff[Cos[x],x],x]] and I don't 
get Cos[x], I get something like (1.0-2.44929E-16)*Cos[x]. If I remove the N[] 
part I get the good answer, but still, is there any way to not get this type of 
results when using the numerical solution?

Also, I'd like to know if there's a way to switch from rad to deg and set the 
decimal precision. I have thought that I could create functions like Sind[], 
Cosd[], ... like Matlab does but I'm using .jar files so I can't modify the 
library. Do you know where I could download the library files (not the .jar 
files)?

I'm using this version: MathEclipse symbolic evaluation console 0.0.10  

Original comment by carlosg...@gmail.com on 18 Aug 2012 at 1:31

GoogleCodeExporter commented 8 years ago
You probably mean Integrate[D[Cos[x],x],x] ?
In the latest Symja AJAX version, this seemed to be fixed?
http://symjaweb.appspot.com/?ci=ta:Issue44:t:Integrate[D[Cos[x],x],x]

To switch from rad to deg, you can use the constant Degree.
Example: Sin[90 Degree]

You can get the complete Eclipse project from SVN. See these instructions:
http://code.google.com/p/symja/source/checkout

Original comment by axelclk@gmail.com on 18 Aug 2012 at 3:03

GoogleCodeExporter commented 8 years ago
My bad. It still doesn't work.

I have F.initSymbols(null) in the code.

I have fixed the cos problem by doing Integrate[D[Cos[x],x],x], and then apply 
to the result N[] instead of using it directly like N[Integrate[D[Cos[x],x],x]].

Original comment by carlosg...@gmail.com on 18 Aug 2012 at 5:08