Skip to content

Commit

Permalink
python 3 for os x
Browse files Browse the repository at this point in the history
  • Loading branch information
tcaduser committed Jun 25, 2018
1 parent 305bc85 commit 696d520
Show file tree
Hide file tree
Showing 43 changed files with 515 additions and 60 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -16,6 +16,7 @@ before_install:
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then - if [ "$TRAVIS_OS_NAME" == "osx" ]; then
(curl -O https://repo.continuum.io/miniconda/Miniconda2-latest-MacOSX-x86_64.sh && (curl -O https://repo.continuum.io/miniconda/Miniconda2-latest-MacOSX-x86_64.sh &&
bash Miniconda2-latest-MacOSX-x86_64.sh -b -p $HOME/anaconda bash Miniconda2-latest-MacOSX-x86_64.sh -b -p $HOME/anaconda
${HOME}/anaconda/bin/conda create -y --name python3 python=3
); );
fi fi


Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
@@ -1,6 +1,8 @@
PROJECT (SYMDIFF) PROJECT (SYMDIFF)


OPTION(TCLMAIN "Build with TCL Interpreter" ON) OPTION(TCLMAIN "Build with TCL Interpreter" ON)
#Python 2 version is always build
OPTION(PYTHON3 "Build Python 3 Interpreter" OFF)


set (CMAKE_CXX_STANDARD 11) set (CMAKE_CXX_STANDARD 11)


Expand Down
2 changes: 1 addition & 1 deletion examples/arrhenius.py
Expand Up @@ -20,5 +20,5 @@
mylist = ordered_list('omega_dot_H', 'omega_dot_H__T', 'omega_dot_H__H', 'omega_dot_H__HCN', 'omega_dot_H__AR', 'omega_dot_H__CN') mylist = ordered_list('omega_dot_H', 'omega_dot_H__T', 'omega_dot_H__H', 'omega_dot_H__HCN', 'omega_dot_H__AR', 'omega_dot_H__CN')
for i in mylist: for i in mylist:
mv = symdiff("model_value(%s);" % i) mv = symdiff("model_value(%s);" % i)
print "%s, %s" % (i, mv) print("%s, %s" % (i, mv))


2 changes: 1 addition & 1 deletion examples/deftest.py
Expand Up @@ -45,4 +45,4 @@
] ]


for i in commands: for i in commands:
print symdiff(i) print(symdiff(i))
2 changes: 1 addition & 1 deletion examples/modellist1.py
Expand Up @@ -6,4 +6,4 @@
symdiff('declare_model(y)') symdiff('declare_model(y)')
l = model_list(); l = model_list();
for i in l: for i in l:
print('%s' % i) print(('%s' % i))
42 changes: 21 additions & 21 deletions examples/models1.py
Expand Up @@ -2,40 +2,40 @@
# Any copyright is dedicated to the Public Domain. # Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/ # http://creativecommons.org/publicdomain/zero/1.0/


print symdiff('declare_model(x)') print(symdiff('declare_model(x)'))
print symdiff('define_model(y, a*x)') print(symdiff('define_model(y, a*x)'))
print symdiff('diff(y, x)') print(symdiff('diff(y, x)'))
print symdiff('clear_model(x)') print(symdiff('clear_model(x)'))
print ordered_list('y') print(ordered_list('y'))
print symdiff('declare_model(x)') print(symdiff('declare_model(x)'))
print ordered_list('y') print(ordered_list('y'))
print symdiff('define_model(x,y)') print(symdiff('define_model(x,y)'))
# catch cycles # catch cycles
try: try:
print ordered_list('y') print(ordered_list('y'))
except SymdiffError as x: except SymdiffError as x:
print x print(x)


for i in model_list(): for i in model_list():
print i + ' ' + symdiff('model_value(%s)' % i) print(i + ' ' + symdiff('model_value(%s)' % i))
symdiff('clear_model(%s)' % i) symdiff('clear_model(%s)' % i)


print print("")
print symdiff('declare_model(x)') print(symdiff('declare_model(x)'))
print symdiff('define_model(y,x^2)') print(symdiff('define_model(y,x^2)'))
print symdiff('diff(y,x)') print(symdiff('diff(y,x)'))
print symdiff('clear_model(y)') print(symdiff('clear_model(y)'))
print symdiff('model_value(y__x)') print(symdiff('model_value(y__x)'))
print symdiff('diff(model_value(y__x),z)') print(symdiff('diff(model_value(y__x),z)'))


for i in model_list(): for i in model_list():
print i + ' ' + symdiff('model_value(%s)' % i) print(i + ' ' + symdiff('model_value(%s)' % i))


print print("")
symdiff('clear_model(x)') symdiff('clear_model(x)')
symdiff('clear_model(x__z)') symdiff('clear_model(x__z)')


for i in model_list(): for i in model_list():
print i + ' ' + symdiff('model_value(%s)' % i) print(i + ' ' + symdiff('model_value(%s)' % i))
symdiff('clear_model(%s)' % i) symdiff('clear_model(%s)' % i)


2 changes: 1 addition & 1 deletion examples/ordered.py
Expand Up @@ -6,4 +6,4 @@
symdiff('define_model(d, b * c)') symdiff('define_model(d, b * c)')
mylist = ordered_list('d'); mylist = ordered_list('d');
for i in mylist: for i in mylist:
print('%s' % i) print(('%s' % i))
6 changes: 3 additions & 3 deletions examples/parsetest.py
Expand Up @@ -3,13 +3,13 @@
# http://creativecommons.org/publicdomain/zero/1.0/ # http://creativecommons.org/publicdomain/zero/1.0/


def maptest(arg): def maptest(arg):
print print("")
print arg; print(arg);
try: try:
out = symdiff(arg) out = symdiff(arg)
except SymdiffError as x: except SymdiffError as x:
out = x out = x
print out print(out)


maptest("a*x") maptest("a*x")
maptest("simplify(a*a)") maptest("simplify(a*a)")
Expand Down
2 changes: 1 addition & 1 deletion examples/remove1.py
Expand Up @@ -5,4 +5,4 @@
symdiff('define_model(x, 0)') symdiff('define_model(x, 0)')
symdiff('define_model(y, x + z)') symdiff('define_model(y, x + z)')
remove_zeros() remove_zeros()
print('%s' % symdiff('model_value(y)')) print(('%s' % symdiff('model_value(y)')))
2 changes: 1 addition & 1 deletion examples/subexpression1.py
Expand Up @@ -7,4 +7,4 @@
subexpression() subexpression()
l = model_list() l = model_list()
for i in l: for i in l:
print("%s, %s" % (i, symdiff('model_value(%s)' % i))) print(("%s, %s" % (i, symdiff('model_value(%s)' % i))))
2 changes: 1 addition & 1 deletion examples/table.py
Expand Up @@ -4,4 +4,4 @@


symdiff('declare_model(x)') symdiff('declare_model(x)')
for i, v in enumerate(symdiff_table('a*x + b*c')): for i, v in enumerate(symdiff_table('a*x + b*c')):
print '%s %s' % (i, v) print('%s %s' % (i, v))
6 changes: 3 additions & 3 deletions examples/undefined1.py
Expand Up @@ -5,6 +5,6 @@
symdiff('declare_model(y)') symdiff('declare_model(y)')
symdiff('define_model(x, 3 * y + z)') symdiff('define_model(x, 3 * y + z)')
symdiff('diff(x, z)') symdiff('diff(x, z)')
print('%s' % symdiff('model_value(x)')) print(('%s' % symdiff('model_value(x)')))
print('%s' % symdiff('model_value(x__z)')) print(('%s' % symdiff('model_value(x__z)')))
print('%s' % symdiff('model_value(y__z)')) print(('%s' % symdiff('model_value(y__z)')))
4 changes: 2 additions & 2 deletions examples/utf8.py
Expand Up @@ -4,7 +4,7 @@
# http://creativecommons.org/publicdomain/zero/1.0/ # http://creativecommons.org/publicdomain/zero/1.0/


alpha = 'α' alpha = 'α'
print alpha print(alpha)
x = symdiff('%s' % alpha); x = symdiff('%s' % alpha);
x = symdiff('diff(%s^2, %s)' % (alpha, alpha)); x = symdiff('diff(%s^2, %s)' % (alpha, alpha));
print x print(x)
File renamed without changes.
33 changes: 33 additions & 0 deletions goldenresults/unix/arrhenius_py3.out
@@ -0,0 +1,33 @@
unique3, pow(T,(-1))
unique12, (Ea * unique3)
unique11, exp((-unique12))
arrhenius, (Cf * pow(T,Etar) * unique11)
fprod, UNDEFINED
unique4, pow(A2,(-1))
unique2, (-unique3 + unique4)
unique5, pow(R,(-1))
unique1, (A1 * unique2 * unique5)
unique0, exp(unique1)
KC1, (A3 * R * T * unique0)
unique8, pow(KC1,(-1))
kb_model, (arrhenius * unique8)
rprod, (AR * CN * H)
unique10, (vr_H - vf_H)
omega_dot_H, ((-(kb_model * rprod) + (arrhenius * fprod)) * unique10)
arrhenius__T, ((Cf * Ea * pow(T,(-2 + Etar)) * unique11) + (Cf * Etar * pow(T,(-1 + Etar)) * unique11))
fprod__T, UNDEFINED
KC1__T, ((A1 * A3 * unique0 * unique3) + (A3 * R * unique0))
unique9, pow(KC1,(-2))
kb_model__T, (-(KC1__T * arrhenius * unique9) + (arrhenius__T * unique8))
omega_dot_H__T, ((-(kb_model__T * rprod) + (arrhenius * fprod__T) + (arrhenius__T * fprod)) * unique10)
fprod__H, UNDEFINED
rprod__H, (AR * CN)
omega_dot_H__H, ((-(kb_model * rprod__H) + (arrhenius * fprod__H)) * unique10)
fprod__HCN, UNDEFINED
omega_dot_H__HCN, (arrhenius * fprod__HCN * unique10)
fprod__AR, UNDEFINED
rprod__AR, (CN * H)
omega_dot_H__AR, ((-(kb_model * rprod__AR) + (arrhenius * fprod__AR)) * unique10)
fprod__CN, UNDEFINED
rprod__CN, (AR * H)
omega_dot_H__CN, ((-(kb_model * rprod__CN) + (arrhenius * fprod__CN)) * unique10)
File renamed without changes.
35 changes: 35 additions & 0 deletions goldenresults/unix/deftest_py3.out
@@ -0,0 +1,35 @@
f(x, y)
pow(y,2)
((2 * x * y) + (3 * pow(y,2)))
pow(x,2)
((2 * x * y) + (3 * pow(x,2)))
cos(x)
sin(x)
cos(x)
cos(x)
0
(2 * x * cos(pow(x,2)))
(2 * y * cos(pow(y,2)))
0
f(x, y)
pow(y,2)
((2 * x * y) + (3 * pow(y,2)))
pow(x,2)
((2 * x * y) + (3 * pow(x,2)))
0
g(x, y, z)
f(x, y, z)
(0 + 0 + g(y, z, x))
(0 + 0 + 0)
(0 + 0 + g(b, c, a))
(0 + 0 + 1)
(0 + 0 + 0)
0
(a + b)
((a + b) * (a + b))
((2 * a * b) + pow(a,2) + pow(b,2))
((2 * a * b) + pow(a,2) + pow(b,2))
(1 + (2 * a * b) + pow(a,2) + pow(b,2))
(1 - (1 + (2 * a * b) + pow(a,2) + pow(b,2)) + (2 * a * b) + pow(a,2) + pow(b,2))
(1 - (1 + (2 * a * b) + pow(a,2) + pow(b,2)) + (2 * a * b) + pow(a,2) + pow(b,2))
0
File renamed without changes.
2 changes: 2 additions & 0 deletions goldenresults/unix/modellist1_py3.out
@@ -0,0 +1,2 @@
x
y
File renamed without changes.
26 changes: 26 additions & 0 deletions goldenresults/unix/models1_py3.out
@@ -0,0 +1,26 @@
x
y
y__x
0
('y',)
x
('x', 'y')
x
While calling symdiff interpreter
y is being processed in terms of itself

x y
y (a * x)
y__x a

x
y
y__x
0
(2 * x)
(2 * x__z)
x UNDEFINED
x__z UNDEFINED
y__x (2 * x)

y__x (2 * x)
File renamed without changes.
2 changes: 2 additions & 0 deletions goldenresults/unix/ordered_py3.out
@@ -0,0 +1,2 @@
b
d
File renamed without changes.

0 comments on commit 696d520

Please sign in to comment.