Simplify functions using jscl symbolic engine
Source code name: "symbolic2.py"
Programming language: Python
Topic: Symbolic/Symplify
DMelt Version 1. Last modified: 12/10/2015. License: Pro
https://datamelt.org/code/cache/symbolic2_8559.py
To run this script using the DataMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.


# All tests should return true.

from jhplot.math import * 
from jhplot import *
from java.awt import Color

j=Symbolic("jscl") # using jscl engine

print j.simplify("log(6)") == "log(2)+log(3)"
print j.simplify("(x + 1)^(1/x)") == "(1+x)^(1/x)"
print j.simplify("(x^2-1)/(x-1)") == "1+x"
print j.simplify(j.elementary("atan(tan(x))")) == "(sqrt(-1)*log(1/exp(sqrt(-1)*x)^2))/2"
print j.simplify(j.elementary("cos(x)")) == "(1+exp(sqrt(-1)*x)^2)/(2*exp(sqrt(-1)*x))"
print j.simplify(j.elementary("tanh(x)")) == "-(1-exp(x)^2)/(1+exp(x)^2)"

Ads help maintain this website.