Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs1-24fa
minimathematica
Commits
93edccad
Commit
93edccad
authored
10 months ago
by
Adam Blank
Browse files
Options
Download
Email Patches
Plain Diff
fix differentation tests
parent
ac2867e6
master
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/0.D/test_differentiation.py
+10
-8
tests/0.D/test_differentiation.py
with
10 additions
and
8 deletions
+10
-8
tests/0.D/test_differentiation.py
View file @
93edccad
...
...
@@ -23,10 +23,12 @@ def sympy_to_us(expr):
return
expr
.
replace
(
"**"
,
"^"
).
replace
(
"exp("
,
"e("
).
replace
(
"atan("
,
"arctan("
)
def
pprint
(
expr
,
pr
=
True
):
orig
=
expr_to_string
(
expr
)
result
=
expr_to_string
(
oursimplify
(
expr
),
use_parens
=
False
)
result_parens
=
expr_to_string
(
oursimplify
(
expr
),
use_parens
=
True
)
print
(
expr
)
orig
=
expr
result
=
expr_to_string
(
oursimplify
(
parse
(
expr
)),
use_parens
=
False
)
result_parens
=
expr_to_string
(
oursimplify
(
parse
(
expr
)),
use_parens
=
True
)
ref
=
nsimplify
(
expand
(
sympify
(
us_to_sympy
(
orig
))))
print
(
result
,
ref
,
orig
)
if
pr
:
print
(
orig
,
end
=
" "
)
print
(
colored
(
"="
,
'yellow'
),
end
=
" "
)
...
...
@@ -40,21 +42,21 @@ def pprint(expr, pr=True):
"3*diff((4*x)^2 + 1, x)"
,
])
def
test_basic_differentiation
(
expr
):
pprint
(
parse
(
expr
)
,
False
)
pprint
(
expr
,
False
)
@
pytest
.
mark
.
parametrize
(
'expr'
,
cases
+
cases_extend
)
def
test_more_differentiation
(
expr
):
pprint
(
parse
(
(
'diff('
+
expr
+
', x)'
)
)
,
False
)
pprint
((
'diff('
+
expr
+
', x)'
),
False
)
@
pytest
.
mark
.
parametrize
(
'expr'
,
cases2
+
cases2_extend
)
def
test_moremore_differentiation
(
expr
):
pprint
(
parse
(
(
'diff('
+
expr
+
', x)'
)
)
,
False
)
pprint
((
'diff('
+
expr
+
', x)'
),
False
)
@
pytest
.
mark
.
parametrize
(
'expr'
,
cases
+
cases_extend
)
def
test_moremoremore_differentiation
(
expr
):
pprint
(
parse
(
(
'diff(diff('
+
expr
+
', x), x)'
)
)
,
False
)
pprint
((
'diff(diff('
+
expr
+
', x), x)'
),
False
)
@
pytest
.
mark
.
parametrize
(
'expr'
,
cases2
+
cases2_extend
)
def
test_moremoremore_differentiation
(
expr
):
pprint
(
parse
((
'diff(diff('
+
expr
+
', x), x)'
)),
False
)
\ No newline at end of file
pprint
(
'diff(diff('
+
expr
+
', x), x)'
,
False
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help