chiark / gitweb /
symbolic.py: before giving up on unicode stuff
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 13 Nov 2017 22:07:35 +0000 (22:07 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 13 Nov 2017 22:08:37 +0000 (22:08 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
symbolic.py [new file with mode: 0755]

diff --git a/symbolic.py b/symbolic.py
new file mode 100755 (executable)
index 0000000..57c11ae
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/python
+
+from sympy import *
+
+import sys
+
+import sys, codecs
+if sys.stdout.encoding is None:
+  sys.stdout = codecs.open("/dev/stdout", "w", 'utf-8')
+
+init_printing(use_unicode=True)
+
+r, theta, s, la, mu = symbols('r theta s la mu')
+
+pprint(theta)
+
+# start      original formulation
+# rightvars  replaces 
+
+p_start = Matrix([
+  r * (1 - cos(theta)),
+  r * sin(theta),
+  mu * s,
+])
+
+p_rightvars = p_start.subs(theta, s/r).subs(r, 1/la)
+
+pprint(p_rightvars)