Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
3c8c5a1e
Commit
3c8c5a1e
authored
Jun 02, 2012
by
ichuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(cleanup cruft) renamed sympy_check stuff to become symmath
parent
52e1f178
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
10 deletions
+16
-10
lib/symmath/__init__.py
+1
-1
lib/symmath/formula.py
+1
-1
lib/symmath/symmath_check.py
+14
-8
No files found.
lib/sym
py_check
/__init__.py
→
lib/sym
math
/__init__.py
View file @
3c8c5a1e
from
formula
import
*
from
sym
py_check2
import
*
from
sym
math_check
import
*
lib/sym
py_check
/formula.py
→
lib/sym
math
/formula.py
View file @
3c8c5a1e
...
...
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
#
# File: formula.py
# Date: 04-May-12
# Date: 04-May-12
(creation)
# Author: I. Chuang <ichuang@mit.edu>
#
# flexible python representation of a symbolic mathematical formula.
...
...
lib/sym
py_check/sympy_check2
.py
→
lib/sym
math/symmath_check
.py
View file @
3c8c5a1e
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# File: sympy_check2.py
# Date: 02-May-12
# Author: I. Chuang <ichuang@mit.edu>
# File: symmath_check.py
# Date: 02-May-12 (creation)
#
#
Use sympy to check for expression equality
#
Symbolic mathematical expression checker for edX. Uses sympy to check for expression equality.
#
# Takes in math expressions given as Presentation MathML (from ASCIIMathML), converts to Content MathML using SnuggleTeX
...
...
@@ -15,11 +14,13 @@ from formula import *
#-----------------------------------------------------------------------------
# check function interface
#
# This is one of the main entry points to call.
def
sym
py
_check_simple
(
expect
,
ans
,
adict
=
{},
symtab
=
None
,
extra_options
=
None
):
def
sym
math
_check_simple
(
expect
,
ans
,
adict
=
{},
symtab
=
None
,
extra_options
=
None
):
'''
Check a symbolic mathematical expression using sympy.
The input is an ascii string (not MathML)
The input is an ascii string (not MathML)
converted to math using sympy.sympify.
'''
options
=
{
'__MATRIX__'
:
False
,
'__ABC__'
:
False
,
'__LOWER__'
:
False
}
...
...
@@ -133,11 +134,13 @@ def check(expect,given,numerical=False,matrix=False,normphase=False,abcsym=False
#-----------------------------------------------------------------------------
# Check function interface, which takes pmathml input
#
# This is one of the main entry points to call.
def
sym
py
_check
(
expect
,
ans
,
adict
=
{},
abname
=
''
):
def
sym
math
_check
(
expect
,
ans
,
adict
=
{},
abname
=
''
):
'''
Check a symbolic mathematical expression using sympy.
The input may be presentation MathML
The input may be presentation MathML
. Uses formula.
'''
msg
=
''
...
...
@@ -231,6 +234,9 @@ def sympy_check(expect,ans,adict={},abname=''):
return
{
'ok'
:
False
,
'msg'
:
msg
,
'ex'
:
fexpect
,
'got'
:
fsym
}
#-----------------------------------------------------------------------------
# tests
def
sctest1
():
x
=
"1/2*(1+(k_e* Q* q)/(m *g *h^2))"
y
=
'''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment