-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
130 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
In [1]: 12 | ||
Out[1]: 12 0x0c 0000 1100 | ||
In [1]: 30/3deg | ||
Out[1]: | ||
1800 | ||
---- ≈ 572.957795130823 | ||
pi | ||
In [1]: [pi/2, log(x)/sin(y), Sum(1/n**2,(n,1,4))] | ||
Out[1]: | ||
4 | ||
____ | ||
\ ` | ||
\ 1 log(x) | ||
pi log(x) \ -- ≈ [1.57079632679490, ------, 1.42361111111111] | ||
[--, ------, / 2] sin(y) | ||
2 sin(y) / n | ||
/___, | ||
n = 1 | ||
In [1]: SymmetricGroup(3).conjugacy_classes() | ||
Out[1]: [{()}, {(0 1 2), (0 2 1)}, {(0 2), (1 2), (0 1)}] | ||
In [1]: latex(diff($\frac{1}{x}$ * $\sin{x}$)) | ||
Out[1]: \frac{\cos{\left(x \right)}}{x} - \frac{\sin{\left(x \right)}}{x^{2}} | ||
In [1]: 8x**2+2x-10 = 0 | ||
In [1]: ?23232 | ||
Out[1]: 23232 0x5ac0 0101 1010 1100 0000 | ||
|
||
2 6 1 | ||
11 *2 *3 {2: 6, 3: 1, 11: 2} = factorint(_) | ||
In [1]: ?((1,2),(2,3)) | ||
Out[1]: | ||
[1 2] | ||
[ ] | ||
[2 3] | ||
|
||
-1 = det(_) | ||
4 = trace(_) | ||
|
||
[-3 2 ] | ||
[ ] | ||
[2 -1] = _**-1 | ||
|
||
2 | ||
lambda - 4*lambda - 1 = _.charpoly().as_expr() | ||
|
||
[ ___ ] [ ___] | ||
[ \/ 5 1] [ 1 \/ 5 ] | ||
___ [- ----- - -] ___ [- - + -----] | ||
[(2 - \/ 5 , 1, [[ 2 2]]), (2 + \/ 5 , 1, [[ 2 2 ]])] | ||
[ ] [ ] | ||
[ 1 ] [ 1 ] = _.eigenvects() # ((eval, mult, evec),... | ||
|
||
[ ___ ___] | ||
[ \/ 5 1 1 \/ 5 ] [ ___ ] | ||
[- ----- - - - - + -----] [2 - \/ 5 0 ] | ||
([ 2 2 2 2 ], [ ]) | ||
[ ] [ ___] | ||
[ 1 1 ] [ 0 2 + \/ 5 ] = _.diagonalize() # (P,D) so _=PDP^-1 | ||
In [1]: ?e**(-x**2) | ||
Out[1]: | ||
2 | ||
-x | ||
e | ||
|
||
2 | ||
-x | ||
-2*x*e = diff(_) | ||
|
||
____ | ||
\/ pi *erf(x) | ||
------------- | ||
2 = integrate(_) | ||
|
||
4 | ||
2 x / 6\ | ||
1 - x + -- + O\x / | ||
2 = series(_) | ||
|
||
[] = solve(_) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env python3 | ||
import os | ||
from time import sleep | ||
|
||
OUTPUT_FILE_PATH = os.path.join(os.path.dirname(__file__), 'output.txt') | ||
|
||
def run_flow(ip): | ||
def run_cell(raw_cell): | ||
print('In [1]: ' + raw_cell) | ||
ip.run_cell(raw_cell) | ||
|
||
run_cell('12') | ||
run_cell('30/3deg') | ||
run_cell('[pi/2, log(x)/sin(y), Sum(1/n**2,(n,1,4))]') | ||
run_cell('SymmetricGroup(3).conjugacy_classes()') | ||
run_cell(r'latex(diff($\frac{1}{x}$ * $\sin{x}$))') | ||
run_cell('8x**2+2x-10 = 0') | ||
run_cell('?23232') | ||
sleep(1) | ||
run_cell('?((1,2),(2,3))') | ||
sleep(1) | ||
run_cell('?e**(-x**2)') | ||
sleep(2) | ||
|
||
def test_output(ip, capsys): | ||
run_flow(ip) | ||
captured = capsys.readouterr() | ||
with open(OUTPUT_FILE_PATH) as f: | ||
assert f.read() == captured.out, \ | ||
r'output mismatch, regenerate output by `python calcpy\tests\test_output.py`' | ||
assert '' == captured.err | ||
|
||
if __name__ == '__main__': | ||
import os | ||
from contextlib import redirect_stdout | ||
from IPython.testing.globalipapp import start_ipython | ||
|
||
ip = start_ipython() | ||
ip.run_line_magic('load_ext', 'calcpy') | ||
print(f'writing output to {OUTPUT_FILE_PATH}') | ||
with open(OUTPUT_FILE_PATH, 'w') as f: | ||
with redirect_stdout(f): | ||
run_flow(ip) | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters