jasonfan commited on
Commit
556ca7c
·
verified ·
1 Parent(s): 8f51860

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy-1.14.0.dist-info/INSTALLER +1 -0
  2. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy-1.14.0.dist-info/METADATA +319 -0
  3. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy-1.14.0.dist-info/RECORD +0 -0
  4. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy-1.14.0.dist-info/WHEEL +5 -0
  5. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy-1.14.0.dist-info/entry_points.txt +2 -0
  6. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy-1.14.0.dist-info/licenses/AUTHORS +1379 -0
  7. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy-1.14.0.dist-info/licenses/LICENSE +153 -0
  8. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy-1.14.0.dist-info/top_level.txt +2 -0
  9. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_piab.py +29 -0
  10. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_printing.py +900 -0
  11. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_qapply.py +152 -0
  12. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_qasm.py +89 -0
  13. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_qexpr.py +64 -0
  14. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_qft.py +52 -0
  15. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_qubit.py +264 -0
  16. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_represent.py +186 -0
  17. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_sho1d.py +176 -0
  18. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_shor.py +21 -0
  19. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_spin.py +0 -0
  20. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_state.py +248 -0
  21. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_tensorproduct.py +142 -0
  22. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_trace.py +109 -0
  23. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_transforms.py +75 -0
  24. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/tests/__init__.py +0 -0
  25. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/tests/test_clebsch_gordan.py +223 -0
  26. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/tests/test_hydrogen.py +126 -0
  27. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/tests/test_paulialgebra.py +57 -0
  28. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/tests/test_physics_matrices.py +84 -0
  29. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/tests/test_pring.py +41 -0
  30. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/tests/test_qho_1d.py +50 -0
  31. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/tests/test_secondquant.py +1301 -0
  32. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/tests/test_sho.py +21 -0
  33. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/__init__.py +453 -0
  34. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/definitions/__init__.py +265 -0
  35. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/definitions/dimension_definitions.py +43 -0
  36. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/definitions/unit_definitions.py +407 -0
  37. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/dimensions.py +590 -0
  38. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/prefixes.py +219 -0
  39. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/quantities.py +152 -0
  40. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/systems/__init__.py +6 -0
  41. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/systems/cgs.py +82 -0
  42. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/systems/length_weight_time.py +156 -0
  43. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/systems/mks.py +46 -0
  44. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/systems/mksa.py +54 -0
  45. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/systems/natural.py +27 -0
  46. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/systems/si.py +377 -0
  47. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/tests/__init__.py +0 -0
  48. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/tests/test_dimensions.py +150 -0
  49. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/tests/test_dimensionsystem.py +95 -0
  50. code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/tests/test_prefixes.py +86 -0
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy-1.14.0.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy-1.14.0.dist-info/METADATA ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.4
2
+ Name: sympy
3
+ Version: 1.14.0
4
+ Summary: Computer algebra system (CAS) in Python
5
+ Home-page: https://sympy.org
6
+ Author: SymPy development team
7
+ Author-email: sympy@googlegroups.com
8
+ License: BSD
9
+ Project-URL: Source, https://github.com/sympy/sympy
10
+ Keywords: Math CAS
11
+ Classifier: License :: OSI Approved :: BSD License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Topic :: Scientific/Engineering
15
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
16
+ Classifier: Topic :: Scientific/Engineering :: Physics
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3 :: Only
24
+ Classifier: Programming Language :: Python :: Implementation :: CPython
25
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
26
+ Requires-Python: >=3.9
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ License-File: AUTHORS
30
+ Requires-Dist: mpmath<1.4,>=1.1.0
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest>=7.1.0; extra == "dev"
33
+ Requires-Dist: hypothesis>=6.70.0; extra == "dev"
34
+ Dynamic: author
35
+ Dynamic: author-email
36
+ Dynamic: classifier
37
+ Dynamic: description
38
+ Dynamic: description-content-type
39
+ Dynamic: home-page
40
+ Dynamic: keywords
41
+ Dynamic: license
42
+ Dynamic: license-file
43
+ Dynamic: project-url
44
+ Dynamic: provides-extra
45
+ Dynamic: requires-dist
46
+ Dynamic: requires-python
47
+ Dynamic: summary
48
+
49
+ # SymPy
50
+
51
+ [![pypi version](https://img.shields.io/pypi/v/sympy.svg)](https://pypi.python.org/pypi/sympy)
52
+ [![Join the chat at https://gitter.im/sympy/sympy](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sympy/sympy?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
53
+ [![Zenodo Badge](https://zenodo.org/badge/18918/sympy/sympy.svg)](https://zenodo.org/badge/latestdoi/18918/sympy/sympy)
54
+ [![Downloads](https://pepy.tech/badge/sympy/month)](https://pepy.tech/project/sympy)
55
+ [![GitHub Issues](https://img.shields.io/badge/issue_tracking-github-blue.svg)](https://github.com/sympy/sympy/issues)
56
+ [![Git Tutorial](https://img.shields.io/badge/PR-Welcome-%23FF8300.svg?)](https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project)
57
+ [![Powered by NumFocus](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org)
58
+ [![Commits since last release](https://img.shields.io/github/commits-since/sympy/sympy/latest.svg?longCache=true&style=flat-square&logo=git&logoColor=fff)](https://github.com/sympy/sympy/releases)
59
+
60
+ [![SymPy Banner](https://github.com/sympy/sympy/raw/master/banner.svg)](https://sympy.org/)
61
+
62
+
63
+ See the [AUTHORS](AUTHORS) file for the list of authors.
64
+
65
+ And many more people helped on the SymPy mailing list, reported bugs,
66
+ helped organize SymPy's participation in the Google Summer of Code, the
67
+ Google Highly Open Participation Contest, Google Code-In, wrote and
68
+ blogged about SymPy...
69
+
70
+ License: New BSD License (see the [LICENSE](LICENSE) file for details) covers all
71
+ files in the sympy repository unless stated otherwise.
72
+
73
+ Our mailing list is at
74
+ <https://groups.google.com/forum/?fromgroups#!forum/sympy>.
75
+
76
+ We have a community chat at [Gitter](https://gitter.im/sympy/sympy). Feel
77
+ free to ask us anything there. We have a very welcoming and helpful
78
+ community.
79
+
80
+ ## Download
81
+
82
+ The recommended installation method is through Anaconda,
83
+ <https://www.anaconda.com/products/distribution>
84
+
85
+ You can also get the latest version of SymPy from
86
+ <https://pypi.python.org/pypi/sympy/>
87
+
88
+ To get the git version do
89
+
90
+ $ git clone https://github.com/sympy/sympy.git
91
+
92
+ For other options (tarballs, debs, etc.), see
93
+ <https://docs.sympy.org/dev/install.html>.
94
+
95
+ ## Documentation and Usage
96
+
97
+ For in-depth instructions on installation and building the
98
+ documentation, see the [SymPy Documentation Style Guide](https://docs.sympy.org/dev/documentation-style-guide.html).
99
+
100
+ Everything is at:
101
+
102
+ <https://docs.sympy.org/>
103
+
104
+ You can generate everything at the above site in your local copy of
105
+ SymPy by:
106
+
107
+ $ cd doc
108
+ $ make html
109
+
110
+ Then the docs will be in <span class="title-ref">\_build/html</span>. If
111
+ you don't want to read that, here is a short usage:
112
+
113
+ From this directory, start Python and:
114
+
115
+ ``` python
116
+ >>> from sympy import Symbol, cos
117
+ >>> x = Symbol('x')
118
+ >>> e = 1/cos(x)
119
+ >>> print(e.series(x, 0, 10))
120
+ 1 + x**2/2 + 5*x**4/24 + 61*x**6/720 + 277*x**8/8064 + O(x**10)
121
+ ```
122
+
123
+ SymPy also comes with a console that is a simple wrapper around the
124
+ classic python console (or IPython when available) that loads the SymPy
125
+ namespace and executes some common commands for you.
126
+
127
+ To start it, issue:
128
+
129
+ $ bin/isympy
130
+
131
+ from this directory, if SymPy is not installed or simply:
132
+
133
+ $ isympy
134
+
135
+ if SymPy is installed.
136
+
137
+ ## Installation
138
+
139
+ To install SymPy using PyPI, run the following command:
140
+
141
+ $ pip install sympy
142
+
143
+ To install SymPy using Anaconda, run the following command:
144
+
145
+ $ conda install -c anaconda sympy
146
+
147
+ To install SymPy from GitHub source, first clone SymPy using `git`:
148
+
149
+ $ git clone https://github.com/sympy/sympy.git
150
+
151
+ Then, in the `sympy` repository that you cloned, simply run:
152
+
153
+ $ pip install .
154
+
155
+ See <https://docs.sympy.org/dev/install.html> for more information.
156
+
157
+ ## Contributing
158
+
159
+ We welcome contributions from anyone, even if you are new to open
160
+ source. Please read our [Introduction to Contributing](https://docs.sympy.org/dev/contributing/introduction-to-contributing.html)
161
+ page and the [SymPy Documentation Style Guide](https://docs.sympy.org/dev/documentation-style-guide.html). If you
162
+ are new and looking for some way to contribute, a good place to start is
163
+ to look at the issues tagged [Easy to Fix](https://github.com/sympy/sympy/issues?q=is%3Aopen+is%3Aissue+label%3A%22Easy+to+Fix%22).
164
+
165
+ Please note that all participants in this project are expected to follow
166
+ our Code of Conduct. By participating in this project you agree to abide
167
+ by its terms. See [CODE\_OF\_CONDUCT.md](CODE_OF_CONDUCT.md).
168
+
169
+ ## Tests
170
+
171
+ To execute all tests, run:
172
+
173
+ $./setup.py test
174
+
175
+ in the current directory.
176
+
177
+ For the more fine-grained running of tests or doctests, use `bin/test`
178
+ or respectively `bin/doctest`. The master branch is automatically tested
179
+ by GitHub Actions.
180
+
181
+ To test pull requests, use
182
+ [sympy-bot](https://github.com/sympy/sympy-bot).
183
+
184
+ ## Regenerate Experimental <span class="title-ref">LaTeX</span> Parser/Lexer
185
+
186
+ The parser and lexer were generated with the [ANTLR4](http://antlr4.org)
187
+ toolchain in `sympy/parsing/latex/_antlr` and checked into the repo.
188
+ Presently, most users should not need to regenerate these files, but
189
+ if you plan to work on this feature, you will need the `antlr4`
190
+ command-line tool (and you must ensure that it is in your `PATH`).
191
+ One way to get it is:
192
+
193
+ $ conda install -c conda-forge antlr=4.11.1
194
+
195
+ Alternatively, follow the instructions on the ANTLR website and download
196
+ the `antlr-4.11.1-complete.jar`. Then export the `CLASSPATH` as instructed
197
+ and instead of creating `antlr4` as an alias, make it an executable file
198
+ with the following contents:
199
+ ``` bash
200
+ #!/bin/bash
201
+ java -jar /usr/local/lib/antlr-4.11.1-complete.jar "$@"
202
+ ```
203
+
204
+ After making changes to `sympy/parsing/latex/LaTeX.g4`, run:
205
+
206
+ $ ./setup.py antlr
207
+
208
+ ## Clean
209
+
210
+ To clean everything (thus getting the same tree as in the repository):
211
+
212
+ $ git clean -Xdf
213
+
214
+ which will clear everything ignored by `.gitignore`, and:
215
+
216
+ $ git clean -df
217
+
218
+ to clear all untracked files. You can revert the most recent changes in
219
+ git with:
220
+
221
+ $ git reset --hard
222
+
223
+ WARNING: The above commands will all clear changes you may have made,
224
+ and you will lose them forever. Be sure to check things with `git
225
+ status`, `git diff`, `git clean -Xn`, and `git clean -n` before doing any
226
+ of those.
227
+
228
+ ## Bugs
229
+
230
+ Our issue tracker is at <https://github.com/sympy/sympy/issues>. Please
231
+ report any bugs that you find. Or, even better, fork the repository on
232
+ GitHub and create a pull request. We welcome all changes, big or small,
233
+ and we will help you make the pull request if you are new to git (just
234
+ ask on our mailing list or Gitter Channel). If you further have any queries, you can find answers
235
+ on Stack Overflow using the [sympy](https://stackoverflow.com/questions/tagged/sympy) tag.
236
+
237
+ ## Brief History
238
+
239
+ SymPy was started by Ondřej Čertík in 2005, he wrote some code during
240
+ the summer, then he wrote some more code during summer 2006. In February
241
+ 2007, Fabian Pedregosa joined the project and helped fix many things,
242
+ contributed documentation, and made it alive again. 5 students (Mateusz
243
+ Paprocki, Brian Jorgensen, Jason Gedge, Robert Schwarz, and Chris Wu)
244
+ improved SymPy incredibly during summer 2007 as part of the Google
245
+ Summer of Code. Pearu Peterson joined the development during the summer
246
+ 2007 and he has made SymPy much more competitive by rewriting the core
247
+ from scratch, which has made it from 10x to 100x faster. Jurjen N.E. Bos
248
+ has contributed pretty-printing and other patches. Fredrik Johansson has
249
+ written mpmath and contributed a lot of patches.
250
+
251
+ SymPy has participated in every Google Summer of Code since 2007. You
252
+ can see <https://github.com/sympy/sympy/wiki#google-summer-of-code> for
253
+ full details. Each year has improved SymPy by bounds. Most of SymPy's
254
+ development has come from Google Summer of Code students.
255
+
256
+ In 2011, Ondřej Čertík stepped down as lead developer, with Aaron
257
+ Meurer, who also started as a Google Summer of Code student, taking his
258
+ place. Ondřej Čertík is still active in the community but is too busy
259
+ with work and family to play a lead development role.
260
+
261
+ Since then, a lot more people have joined the development and some
262
+ people have also left. You can see the full list in doc/src/aboutus.rst,
263
+ or online at:
264
+
265
+ <https://docs.sympy.org/dev/aboutus.html#sympy-development-team>
266
+
267
+ The git history goes back to 2007 when development moved from svn to hg.
268
+ To see the history before that point, look at
269
+ <https://github.com/sympy/sympy-old>.
270
+
271
+ You can use git to see the biggest developers. The command:
272
+
273
+ $ git shortlog -ns
274
+
275
+ will show each developer, sorted by commits to the project. The command:
276
+
277
+ $ git shortlog -ns --since="1 year"
278
+
279
+ will show the top developers from the last year.
280
+
281
+ ## Citation
282
+
283
+ To cite SymPy in publications use
284
+
285
+ > Meurer A, Smith CP, Paprocki M, Čertík O, Kirpichev SB, Rocklin M,
286
+ > Kumar A, Ivanov S, Moore JK, Singh S, Rathnayake T, Vig S, Granger BE,
287
+ > Muller RP, Bonazzi F, Gupta H, Vats S, Johansson F, Pedregosa F, Curry
288
+ > MJ, Terrel AR, Roučka Š, Saboo A, Fernando I, Kulal S, Cimrman R,
289
+ > Scopatz A. (2017) SymPy: symbolic computing in Python. *PeerJ Computer
290
+ > Science* 3:e103 <https://doi.org/10.7717/peerj-cs.103>
291
+
292
+ A BibTeX entry for LaTeX users is
293
+
294
+ ``` bibtex
295
+ @article{10.7717/peerj-cs.103,
296
+ title = {SymPy: symbolic computing in Python},
297
+ author = {Meurer, Aaron and Smith, Christopher P. and Paprocki, Mateusz and \v{C}ert\'{i}k, Ond\v{r}ej and Kirpichev, Sergey B. and Rocklin, Matthew and Kumar, Amit and Ivanov, Sergiu and Moore, Jason K. and Singh, Sartaj and Rathnayake, Thilina and Vig, Sean and Granger, Brian E. and Muller, Richard P. and Bonazzi, Francesco and Gupta, Harsh and Vats, Shivam and Johansson, Fredrik and Pedregosa, Fabian and Curry, Matthew J. and Terrel, Andy R. and Rou\v{c}ka, \v{S}t\v{e}p\'{a}n and Saboo, Ashutosh and Fernando, Isuru and Kulal, Sumith and Cimrman, Robert and Scopatz, Anthony},
298
+ year = 2017,
299
+ month = Jan,
300
+ keywords = {Python, Computer algebra system, Symbolics},
301
+ abstract = {
302
+ SymPy is an open-source computer algebra system written in pure Python. It is built with a focus on extensibility and ease of use, through both interactive and programmatic applications. These characteristics have led SymPy to become a popular symbolic library for the scientific Python ecosystem. This paper presents the architecture of SymPy, a description of its features, and a discussion of select submodules. The supplementary material provides additional examples and further outlines details of the architecture and features of SymPy.
303
+ },
304
+ volume = 3,
305
+ pages = {e103},
306
+ journal = {PeerJ Computer Science},
307
+ issn = {2376-5992},
308
+ url = {https://doi.org/10.7717/peerj-cs.103},
309
+ doi = {10.7717/peerj-cs.103}
310
+ }
311
+ ```
312
+
313
+ SymPy is BSD licensed, so you are free to use it whatever you like, be
314
+ it academic, commercial, creating forks or derivatives, as long as you
315
+ copy the BSD statement if you redistribute it (see the LICENSE file for
316
+ details). That said, although not required by the SymPy license, if it
317
+ is convenient for you, please cite SymPy when using it in your work and
318
+ also consider contributing all your changes back, so that we can
319
+ incorporate it and all of us will benefit in the end.
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy-1.14.0.dist-info/RECORD ADDED
The diff for this file is too large to render. See raw diff
 
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy-1.14.0.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (79.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy-1.14.0.dist-info/entry_points.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [console_scripts]
2
+ isympy = isympy:main
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy-1.14.0.dist-info/licenses/AUTHORS ADDED
@@ -0,0 +1,1379 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ All people who contributed to SymPy by sending at least a patch or
2
+ more (in the order of the date of their first contribution), except
3
+ those who explicitly didn't want to be mentioned. People with a * next
4
+ to their names are not found in the metadata of the git history. This
5
+ file is generated automatically by running `./bin/authors_update.py`.
6
+
7
+ There are a total of 1371 authors.
8
+
9
+ Ondřej Čertík <ondrej@certik.cz>
10
+ Fabian Pedregosa <fabian@fseoane.net>
11
+ Jurjen N.E. Bos <jnebos@gmail.com>
12
+ Mateusz Paprocki <mattpap@gmail.com>
13
+ *Marc-Etienne M.Leveille <protonyc@gmail.com>
14
+ Brian Jorgensen <brian.jorgensen@gmail.com>
15
+ Jason Gedge <inferno1386@gmail.com>
16
+ Robert Schwarz <lethargo@googlemail.com>
17
+ Pearu Peterson <pearu.peterson@gmail.com>
18
+ Fredrik Johansson <fredrik.johansson@gmail.com>
19
+ Chris Wu <chris.wu@gmail.com>
20
+ *Ulrich Hecht <ulrich.hecht@gmail.com>
21
+ Goutham Lakshminarayan <dl.goutham@gmail.com>
22
+ David Lawrence <dmlawrence@gmail.com>
23
+ Jaroslaw Tworek <dev.jrx@gmail.com>
24
+ David Marek <h4wk.cz@gmail.com>
25
+ Bernhard R. Link <brlink@debian.org>
26
+ Andrej Tokarčík <androsis@gmail.com>
27
+ Or Dvory <gidesa@gmail.com>
28
+ Saroj Adhikari <adh.saroj@gmail.com>
29
+ Pauli Virtanen <pav@iki.fi>
30
+ Robert Kern <robert.kern@gmail.com>
31
+ James Aspnes <aspnes@cs.yale.edu>
32
+ Nimish Telang <ntelang@gmail.com>
33
+ Abderrahim Kitouni <a.kitouni@gmail.com>
34
+ Pan Peng <pengpanster@gmail.com>
35
+ Friedrich Hagedorn <friedrich_h@gmx.de>
36
+ Elrond der Elbenfuerst <elrond+sympy.org@samba-tng.org>
37
+ Rizgar Mella <rizgar.mella@gmail.com>
38
+ Felix Kaiser <felix.kaiser@fxkr.net>
39
+ Roberto Nobrega <rwnobrega@gmail.com>
40
+ David Roberts <dvdr18@gmail.com>
41
+ Sebastian Krämer <basti.kr@gmail.com>
42
+ Vinzent Steinberg <vinzent.steinberg@gmail.com>
43
+ Riccardo Gori <goriccardo@gmail.com>
44
+ Case Van Horsen <casevh@gmail.com>
45
+ Stepan Roucka <stepan@roucka.eu>
46
+ Ali Raza Syed <arsyed@gmail.com>
47
+ Stefano Maggiolo <s.maggiolo@gmail.com>
48
+ Robert Cimrman <cimrman3@ntc.zcu.cz>
49
+ Bastian Weber <bastian.weber@gmx-topmail.de>
50
+ Sebastian Krause <sebastian.krause@gmx.de>
51
+ Sebastian Kreft <skreft@gmail.com>
52
+ *Dan <coolg49964@gmail.com>
53
+ Alan Bromborsky <abrombo@verizon.net>
54
+ Boris Timokhin <qoqenator@gmail.com>
55
+ Robert <average.programmer@gmail.com>
56
+ Andy R. Terrel <aterrel@uchicago.edu>
57
+ Hubert Tsang <intsangity@gmail.com>
58
+ Konrad Meyer <konrad.meyer@gmail.com>
59
+ Henrik Johansson <henjo2006@gmail.com>
60
+ Priit Laes <plaes@plaes.org>
61
+ Freddie Witherden <freddie@witherden.org>
62
+ Brian E. Granger <ellisonbg@gmail.com>
63
+ Andrew Straw <strawman@astraw.com>
64
+ Kaifeng Zhu <cafeeee@gmail.com>
65
+ Ted Horst <ted.horst@earthlink.net>
66
+ Andrew Docherty <andrewd@maths.usyd.edu.au>
67
+ Akshay Srinivasan <akshaysrinivasan@gmail.com>
68
+ Aaron Meurer <asmeurer@gmail.com>
69
+ Barry Wardell <barry.wardell@gmail.com>
70
+ Tomasz Buchert <thinred@gmail.com>
71
+ Vinay Kumar <gnulinooks@gmail.com>
72
+ Johann Cohen-Tanugi <johann.cohentanugi@gmail.com>
73
+ Jochen Voss <voss@seehuhn.de>
74
+ Luke Peterson <hazelnusse@gmail.com>
75
+ Chris Smith <smichr@gmail.com>
76
+ Thomas Sidoti <TSidoti@gmail.com>
77
+ Florian Mickler <florian@mickler.org>
78
+ Nicolas Pourcelot <nicolas.pourcelot@gmail.com>
79
+ Ben Goodrich <goodrich.ben@gmail.com>
80
+ Toon Verstraelen <Toon.Verstraelen@UGent.be>
81
+ Ronan Lamy <ronan.lamy@gmail.com>
82
+ James Abbatiello <abbeyj@gmail.com>
83
+ Ryan Krauss <ryanlists@gmail.com>
84
+ Bill Flynn <wflynny@gmail.com>
85
+ Kevin Goodsell <kevin-opensource@omegacrash.net>
86
+ Jorn Baayen <jorn.baayen@gmail.com>
87
+ Eh Tan <tan2tan2@gmail.com>
88
+ Renato Coutinho <renato.coutinho@gmail.com>
89
+ Oscar Benjamin <oscar.j.benjamin@gmail.com>
90
+ Øyvind Jensen <jensen.oyvind@gmail.com>
91
+ Julio Idichekop Filho <idichekop@yahoo.com.br>
92
+ Łukasz Pankowski <lukpank@o2.pl>
93
+ *Chu-Ching Huang <cchuang@mail.cgu.edu.tw>
94
+ Fernando Perez <Fernando.Perez@berkeley.edu>
95
+ Raffaele De Feo <alberthilbert@gmail.com>
96
+ Christian Muise <christian.muise@gmail.com>
97
+ Matt Curry <mattjcurry@gmail.com>
98
+ Kazuo Thow <kazuo.thow@gmail.com>
99
+ Christian Schubert <chr.schubert@gmx.de>
100
+ Jezreel Ng <jezreel@gmail.com>
101
+ James Pearson <xiong.chiamiov@gmail.com>
102
+ Matthew Brett <matthew.brett@gmail.com>
103
+ Addison Cugini <ajcugini@gmail.com>
104
+ Nicholas J.S. Kinar <n.kinar@usask.ca>
105
+ Harold Erbin <harold.erbin@gmail.com>
106
+ Thomas Dixon <thom@thomdixon.org>
107
+ Cristóvão Sousa <crisjss@gmail.com>
108
+ Andre de Fortier Smit <freevryheid@gmail.com>
109
+ Mark Dewing <markdewing@gmail.com>
110
+ Alexey U. Gudchenko <proga@goodok.ru>
111
+ Gary Kerr <gary.kerr@blueyonder.co.uk>
112
+ Sherjil Ozair <sherjilozair@gmail.com>
113
+ Oleksandr Gituliar <gituliar@gmail.com>
114
+ Sean Vig <sean.v.775@gmail.com>
115
+ Prafullkumar P. Tale <hector1618@gmail.com>
116
+ Vladimir Perić <vlada.peric@gmail.com>
117
+ Tom Bachmann <e_mc_h2@web.de>
118
+ Yuri Karadzhov <yuri.karadzhov@gmail.com>
119
+ Vladimir Lagunov <werehuman@gmail.com>
120
+ Matthew Rocklin <mrocklin@cs.uchicago.edu>
121
+ Saptarshi Mandal <sapta.iitkgp@gmail.com>
122
+ Gilbert Gede <gilbertgede@gmail.com>
123
+ Anatolii Koval <weralwolf@gmail.com>
124
+ Tomo Lazovich <lazovich@gmail.com>
125
+ Pavel Fedotov <fedotovp@gmail.com>
126
+ Jack McCaffery <jpmccaffery@gmail.com>
127
+ Jeremias Yehdegho <j.yehdegho@gmail.com>
128
+ Kibeom Kim <kk1674@nyu.edu>
129
+ Gregory Ksionda <ksiondag846@gmail.com>
130
+ Tomáš Bambas <tomas.bambas@gmail.com>
131
+ Raymond Wong <rayman_407@yahoo.com>
132
+ Luca Weihs <astronomicalcuriosity@gmail.com>
133
+ Shai 'Deshe' Wyborski <shaide@cs.huji.ac.il>
134
+ Thomas Wiecki <thomas.wiecki@gmail.com>
135
+ Óscar Nájera <najera.oscar@gmail.com>
136
+ Mario Pernici <mario.pernici@gmail.com>
137
+ Benjamin McDonald <mcdonald.ben@gmail.com>
138
+ Sam Magura <samtheman132@gmail.com>
139
+ Stefan Krastanov <krastanov.stefan@gmail.com>
140
+ Bradley Froehle <brad.froehle@gmail.com>
141
+ Min Ragan-Kelley <benjaminrk@gmail.com>
142
+ Emma Hogan <ehogan@gemini.edu>
143
+ Nikhil Sarda <diff.operator@gmail.com>
144
+ Julien Rioux <julien.rioux@gmail.com>
145
+ Roberto Colistete, Jr. <roberto.colistete@gmail.com>
146
+ Raoul Bourquin <raoulb@bluewin.ch>
147
+ Gert-Ludwig Ingold <gert.ingold@physik.uni-augsburg.de>
148
+ Srinivas Vasudevan <srvasude@gmail.com>
149
+ Jason Moore <moorepants@gmail.com>
150
+ Miha Marolt <tloramus@gmail.com>
151
+ Tim Lahey <tim.lahey@gmail.com>
152
+ Luis Garcia <ppn.online@me.com>
153
+ Matt Rajca <matt.rajca@me.com>
154
+ David Li <l33tnerd.li@gmail.com>
155
+ Alexandr Gudulin <alexandr.gudulin@gmail.com>
156
+ Bilal Akhtar <bilalakhtar@ubuntu.com>
157
+ Grzegorz Świrski <sognat@gmail.com>
158
+ Matt Habel <habelinc@gmail.com>
159
+ David Ju <Sgtmook314@gmail.com>
160
+ Nichita Utiu <nikita.utiu+github@gmail.com>
161
+ Nikolay Lazarov <qwerqwerqwer@abv.bg>
162
+ Steve Anton <anxuiz.nx@gmail.com>
163
+ Imran Ahmed Manzoor <imran.manzoor31@gmail.com>
164
+ Ljubiša Moćić <3rdslasher@gmail.com>
165
+ Piotr Korgul <p.korgul@gmail.com>
166
+ Jim Zhang <Hyriodula@gmail.com>
167
+ Sam Sleight <samuel.sleight@gmail.com>
168
+ tborisova <ts.borisova3@gmail.com>
169
+ Chancellor Arkantos <Chancellor_Arkantos@hotmail.co.uk>
170
+ Stepan Simsa <simsa.st@gmail.com>
171
+ Tobias Lenz <t_lenz94@web.de>
172
+ Siddhanathan Shanmugam <siddhanathan@gmail.com>
173
+ Tiffany Zhu <bubble.wubble.303@gmail.com>
174
+ Tristan Hume <tris.hume@gmail.com>
175
+ Alexey Subach <alexey.subach@gmail.com>
176
+ Joan Creus <joan.creus.c@gmail.com>
177
+ Geoffry Song <goffrie@gmail.com>
178
+ Puneeth Chaganti <punchagan@gmail.com>
179
+ Marcin Kostrzewa <>
180
+ Natalia Nawara <fankalemura@gmail.com>
181
+ vishal <vishal.panjwani15@gmail.com>
182
+ Shruti Mangipudi <shruti2395@gmail.com>
183
+ Davy Mao <e_equals_mass_speed_light_squared@hotmail.com>
184
+ Swapnil Agarwal <swapnilag29@gmail.com>
185
+ Dhia Kennouche <kendhia@gmail.com>
186
+ jerryma1121 <jerryma1121@gmail.com>
187
+ Joachim Durchholz <jo@durchholz.org>
188
+ Martin Povišer <martin.povik@gmail.com>
189
+ Siddhant Jain <getsiddhant@gmail.com>
190
+ Kevin Hunter <hunteke@earlham.edu>
191
+ Michael Mayorov <marchael@kb.csu.ru>
192
+ Nathan Alison <nathan.f.alison@gmail.com>
193
+ Christian Bühler <christian@cbuehler.de>
194
+ Carsten Knoll <CarstenKnoll@gmx.de>
195
+ Bharath M R <catchmrbharath@gmail.com>
196
+ Matthias Toews <mat.toews@googlemail.com>
197
+ Sergiu Ivanov <unlimitedscolobb@gmail.com>
198
+ Jorge E. Cardona <jorgeecardona@gmail.com>
199
+ Sanket Agarwal <sanket@sanketagarwal.com>
200
+ Manoj Babu K. <manoj.babu2378@gmail.com>
201
+ Sai Nikhil <tsnlegend@gmail.com>
202
+ Aleksandar Makelov <amakelov@college.harvard.edu>
203
+ Sachin Irukula <sachin.irukula@gmail.com>
204
+ Raphael Michel <webmaster@raphaelmichel.de>
205
+ Ashwini Oruganti <ashwini.oruganti@gmail.com>
206
+ Andreas Klöckner <inform@tiker.net>
207
+ Prateek Papriwal <papriwalprateek@gmail.com>
208
+ Arpit Goyal <agmps18@gmail.com>
209
+ Angadh Nanjangud <angadh.n@gmail.com>
210
+ Comer Duncan <comer.duncan@gmail.com>
211
+ Jens H. Nielsen <jenshnielsen@gmail.com>
212
+ Joseph Dougherty <Github@JWDougherty.com>
213
+ Elliot Marshall <Marshall2389@gmail.com>
214
+ Guru Devanla <grdvnl@gmail.com>
215
+ George Waksman <waksman@gwax.com>
216
+ Alexandr Popov <alexandr.s.popov@gmail.com>
217
+ Tarun Gaba <tarun.gaba7@gmail.com>
218
+ Takafumi Arakaki <aka.tkf@gmail.com>
219
+ Saurabh Jha <saurabh.jhaa@gmail.com>
220
+ Rom le Clair <jacen.guardian@gmail.com>
221
+ Angus Griffith <16sn6uv@gmail.com>
222
+ Timothy Reluga <treluga@math.psu.edu>
223
+ Brian Stephanik <xoedusk@gmail.com>
224
+ Alexander Eberspächer <alex.eberspaecher@gmail.com>
225
+ Sachin Joglekar <srjoglekar246@gmail.com>
226
+ Tyler Pirtle <teeler@gmail.com>
227
+ Vasily Povalyaev <vapovalyaev@gmail.com>
228
+ Colleen Lee <colleenclee@gmail.com>
229
+ Matthew Hoff <mhoff14@gmail.com>
230
+ Niklas Thörne <notrupertthorne@gmail.com>
231
+ Huijun Mai <m.maihuijun@gmail.com>
232
+ Marek Šuppa <mr@shu.io>
233
+ Ramana Venkata <idlike2dream@gmail.com>
234
+ Prasoon Shukla <prasoon92.iitr@gmail.com>
235
+ Stefen Yin <zqyin@ucdavis.edu>
236
+ Thomas Hisch <t.hisch@gmail.com>
237
+ Madeleine Ball <mpball@gmail.com>
238
+ Mary Clark <mary.spriteling@gmail.com>
239
+ Rishabh Dixit <rishabhdixit11@gmail.com>
240
+ Manoj Kumar <manojkumarsivaraj334@gmail.com>
241
+ Akshit Agarwal <akshit.jiit@gmail.com>
242
+ CJ Carey <perimosocordiae@gmail.com>
243
+ Patrick Lacasse <patrick.m.lacasse@gmail.com>
244
+ Ananya H <ananyaha93@gmail.com>
245
+ Tarang Patel <tarangrockr@gmail.com>
246
+ Christopher Dembia <cld72@cornell.edu>
247
+ Benjamin Fishbein <fishbeinb@gmail.com>
248
+ Sean Ge <seange727@gmail.com>
249
+ Amit Jamadagni <bitsjamadagni@gmail.com>
250
+ Ankit Agrawal <aaaagrawal@iitb.ac.in>
251
+ Björn Dahlgren <bjodah@gmail.com>
252
+ Christophe Saint-Jean <christophe.saint-jean@univ-lr.fr>
253
+ Demian Wassermann <demian@bwh.harvard.edu>
254
+ Khagesh Patel <khageshpatel93@gmail.com>
255
+ Stephen Loo <shikil@yahoo.com>
256
+ hm <hacman0@gmail.com>
257
+ Patrick Poitras <acebulf@gmail.com>
258
+ Katja Sophie Hotz <katja.sophie.hotz@student.tuwien.ac.at>
259
+ Varun Joshi <joshi.142@osu.edu>
260
+ Chetna Gupta <cheta.gup@gmail.com>
261
+ Thilina Rathnayake <thilinarmtb@gmail.com>
262
+ Max Hutchinson <maxhutch@gmail.com>
263
+ Shravas K Rao <shravas@gmail.com>
264
+ Matthew Tadd <matt.tadd@gmail.com>
265
+ Alexander Hirzel <alex@hirzel.us>
266
+ Randy Heydon <randy.heydon@clockworklab.net>
267
+ Oliver Lee <oliverzlee@gmail.com>
268
+ Seshagiri Prabhu <seshagiriprabhu@gmail.com>
269
+ Pradyumna <pradyu1993@gmail.com>
270
+ Erik Welch <erik.n.welch@gmail.com>
271
+ Eric Nelson <eric.the.red.XLII@gmail.com>
272
+ Roland Puntaier <roland.puntaier@chello.at>
273
+ Chris Conley <chrisconley15@gmail.com>
274
+ Tim Swast <tswast@gmail.com>
275
+ Dmitry Batkovich <batya239@gmail.com>
276
+ Francesco Bonazzi <franz.bonazzi@gmail.com>
277
+ Yuriy Demidov <iurii.demidov@gmail.com>
278
+ Rick Muller <rpmuller@gmail.com>
279
+ Manish Gill <gill.manish90@gmail.com>
280
+ Markus Müller <markus.mueller.1.g@googlemail.com>
281
+ Amit Saha <amitsaha.in@gmail.com>
282
+ Jeremy <twobitlogic@gmail.com>
283
+ QuaBoo <kisonchristian@gmail.com>
284
+ Stefan van der Walt <stefan@sun.ac.za>
285
+ David Joyner <wdjoyner@gmail.com>
286
+ Lars Buitinck <larsmans@gmail.com>
287
+ Alkiviadis G. Akritas <akritas@uth.gr>
288
+ Vinit Ravishankar <vinit.ravishankar@gmail.com>
289
+ Michael Boyle <michael.oliver.boyle@gmail.com>
290
+ Heiner Kirchhoffer <Heiner.Kirchhoffer@gmail.com>
291
+ Pablo Puente <ppuedom@gmail.com>
292
+ James Fiedler <jrfiedler@gmail.com>
293
+ Harsh Gupta <mail@hargup.in>
294
+ Tuomas Airaksinen <tuomas.airaksinen@gmail.com>
295
+ Paul Strickland <p.e.strickland@gmail.com>
296
+ James Goppert <james.goppert@gmail.com>
297
+ rathmann <rathmann.os@gmail.com>
298
+ Avichal Dayal <avichal.dayal@gmail.com>
299
+ Paul Scott <paul.scott@nicta.com.au>
300
+ Shipra Banga <bangashipra@gmail.com>
301
+ Pramod Ch <pramodch14@gmail.com>
302
+ Akshay <akshaynukala95@gmail.com>
303
+ Buck Shlegeris <buck2@bruceh15.anu.edu.au>
304
+ Jonathan Miller <jdmiller93@gmail.com>
305
+ Edward Schembor <eschemb1@jhu.edu>
306
+ Rajath Shashidhara <rajaths.rajaths@gmail.com>
307
+ Zamrath Nizam <zamiguy_ni@yahoo.com>
308
+ Aditya Shah <adityashah30@gmail.com>
309
+ Rajat Aggarwal <rajataggarwal1975@gmail.com>
310
+ Sambuddha Basu <sammygamer@live.com>
311
+ Zeel Shah <kshah215@gmail.com>
312
+ Abhinav Chanda <abhinavchanda01@gmail.com>
313
+ Jim Crist <crist042@umn.edu>
314
+ Sudhanshu Mishra <mrsud94@gmail.com>
315
+ Anurag Sharma <anurags92@gmail.com>
316
+ Soumya Dipta Biswas <sdb1323@gmail.com>
317
+ Sushant Hiray <hiraysushant@gmail.com>
318
+ Ben Lucato <ben.lucato@gmail.com>
319
+ Kunal Arora <kunalarora.135@gmail.com>
320
+ Henry Gebhardt <hsggebhardt@gmail.com>
321
+ Dammina Sahabandu <dmsahabandu@gmail.com>
322
+ Manish Shukla <manish.shukla393@gmail>
323
+ Ralph Bean <rbean@redhat.com>
324
+ richierichrawr <richierichrawr@users.noreply.github.com>
325
+ John Connor <john.theman.connor@gmail.com>
326
+ Juan Luis Cano Rodríguez <juanlu001@gmail.com>
327
+ Sahil Shekhawat <sahilshekhawat01@gmail.com>
328
+ Kundan Kumar <kundankumar18581@gmail.com>
329
+ Stas Kelvich <stanconn@gmail.com>
330
+ sevaader <sevaader@gmail.com>
331
+ Dhruvesh Vijay Parikh <parikhdhruvesh1@gmail.com>
332
+ Venkatesh Halli <venkatesh.fatality@gmail.com>
333
+ Lennart Fricke <lennart@die-frickes.eu>
334
+ Vlad Seghete <vlad.seghete@gmail.com>
335
+ Shashank Agarwal <shashank.agarwal94@gmail.com>
336
+ carstimon <carstimon@gmail.com>
337
+ Pierre Haessig <pierre.haessig@crans.org>
338
+ Maciej Baranski <getrox.sc@gmail.com>
339
+ Benjamin Gudehus <hastebrot@gmail.com>
340
+ Faisal Anees <faisal.iiit@gmail.com>
341
+ Mark Shoulson <mark@kli.org>
342
+ Robert Johansson <jrjohansson@gmail.com>
343
+ Kalevi Suominen <jksuom@gmail.com>
344
+ Kaushik Varanasi <kaushik.varanasi1@gmail.com>
345
+ Fawaz Alazemi <Mba7eth@gmail.com>
346
+ Ambar Mehrotra <mehrotraambar@gmail.com>
347
+ David P. Sanders <dpsanders@gmail.com>
348
+ Peter Brady <petertbrady@gmail.com>
349
+ John V. Siratt <jvsiratt@gmail.com>
350
+ Sarwar Chahal <chahal.sarwar98@gmail.com>
351
+ Nathan Woods <charlesnwoods@gmail.com>
352
+ Colin B. Macdonald <cbm@m.fsf.org>
353
+ Marcus Näslund <naslundx@gmail.com>
354
+ Clemens Novak <clemens@familie-novak.net>
355
+ Mridul Seth <seth.mridul@gmail.com>
356
+ Craig A. Stoudt <craig.stoudt@gmail.com>
357
+ Raj <raj454raj@gmail.com>
358
+ Mihai A. Ionescu <ionescu.a.mihai@gmail.com>
359
+ immerrr <immerrr@gmail.com>
360
+ Chai Wah Wu <cwwuieee@gmail.com>
361
+ Leonid Blouvshtein <leonidbl91@gmail.com>
362
+ Peleg Michaeli <freepeleg@gmail.com>
363
+ ck Lux <lux.r.ck@gmail.com>
364
+ zsc347 <zsc347@gmail.com>
365
+ Hamish Dickson <hamish.dickson@gmail.com>
366
+ Michael Gallaspy <gallaspy.michael@gmail.com>
367
+ Roman Inflianskas <infroma@gmail.com>
368
+ Duane Nykamp <nykamp@umn.edu>
369
+ Ted Dokos <tdokos@gmail.com>
370
+ Sunny Aggarwal <sunnyaggarwal1994@gmail.com>
371
+ Victor Brebenar <v.brebenar@gmail.com>
372
+ Akshat Jain <akshat.jain@students.iiit.ac.in>
373
+ Shivam Vats <shivamvats.iitkgp@gmail.com>
374
+ Longqi Wang <iqgnol@gmail.com>
375
+ Juan Felipe Osorio <jfosorio@gmail.com>
376
+ Ray Cathcart <github@cathcart.us>
377
+ Lukas Zorich <lukas.zorich@gmail.com>
378
+ Eric Miller <emiller42@gmail.com>
379
+ Cody Herbst <cyherbst@gmail.com>
380
+ Nishith Shah <nishithshah.2211@gmail.com>
381
+ Amit Kumar <dtu.amit@gmail.com>
382
+ Yury G. Kudryashov <urkud.urkud@gmail.com>
383
+ Guillaume Gay <contact@damcb.com>
384
+ Mihir Wadwekar <m.mihirw@gmail.com>
385
+ Tuan Manh Lai <laituan245@gmail.com>
386
+ Asish Panda <asishrocks95@gmail.com>
387
+ Darshan Chaudhary <deathbullet@gmail.com>
388
+ Alec Kalinin <alec.kalinin@gmail.com>
389
+ Ralf Stephan <ralf@ark.in-berlin.de>
390
+ Aaditya Nair <aadityanair6494@gmail.com>
391
+ Jayesh Lahori <jlahori92@gmail.com>
392
+ Harshil Goel <harshil158@gmail.com>
393
+ Luv Agarwal <agarwal.iiit@gmail.com>
394
+ Jason Ly <jason.ly@gmail.com>
395
+ Lokesh Sharma <lokeshhsharma@gmail.com>
396
+ Sartaj Singh <singhsartaj94@gmail.com>
397
+ Chris Swierczewski <cswiercz@gmail.com>
398
+ Konstantin Togoi <konstantin.togoi@gmail.com>
399
+ Param Singh <paramsingh258@gmail.com>
400
+ Sumith Kulal <sumith1896@gmail.com>
401
+ Juha Remes <jremes@outlook.com>
402
+ Philippe Bouafia <philippe.bouafia@ensea.fr>
403
+ Peter Schmidt <peter@peterjs.com>
404
+ Jiaxing Liang <liangjiaxing57@gmail.com>
405
+ Lucas Jones <lucas@lucasjones.co.uk>
406
+ Gregory Ashton <gash789@gmail.com>
407
+ Jennifer White <jcrw122@googlemail.com>
408
+ Renato Orsino <renato.orsino@gmail.com>
409
+ Alistair Lynn <arplynn@gmail.com>
410
+ Govind Sahai <gsiitbhu@gmail.com>
411
+ Adam Bloomston <adam@glitterfram.es>
412
+ Kyle McDaniel <mcdanie5@illinois.edu>
413
+ Nguyen Truong Duy <truongduy134@yahoo.com>
414
+ Alex Lindsay <adlinds3@ncsu.edu>
415
+ Mathew Chong <mathewchong.dev@gmail.com>
416
+ Jason Siefken <siefkenj@gmail.com>
417
+ Gaurav Dhingra <gauravdhingra.gxyd@gmail.com>
418
+ Gao, Xiang <qasdfgtyuiop@gmail.com>
419
+ Kevin Ventullo <kevin.ventullo@gmail.com>
420
+ mao8 <thisisma08@gmail.com>
421
+ Isuru Fernando <isuruf@gmail.com>
422
+ Shivam Tyagi <shivam.tyagi.apm13@itbhu.ac.in>
423
+ Richard Otis <richard.otis@outlook.com>
424
+ Rich LaSota <rjlasota@gmail.com>
425
+ dustyrockpyle <dustyrockpyle@gmail.com>
426
+ Anton Akhmerov <anton.akhmerov@gmail.com>
427
+ Michael Zingale <michael.zingale@stonybrook.edu>
428
+ Chak-Pong Chung <chakpongchung@gmail.com>
429
+ David T <derDavidT@users.noreply.github.com>
430
+ Phil Ruffwind <rf@rufflewind.com>
431
+ Sebastian Koslowski <koslowski@kit.edu>
432
+ Kumar Krishna Agrawal <kumar.1994.14@gmail.com>
433
+ Dustin Gadal <Dustin.Gadal@gmail.com>
434
+ João Moura <operte@gmail.com>
435
+ Yu Kobayashi <yukoba@accelart.jp>
436
+ Shashank Kumar <shashank.kumar.apc13@iitbhu.ac.in>
437
+ Timothy Cyrus <tcyrus@users.noreply.github.com>
438
+ Devyani Kota <devyanikota@gmail.com>
439
+ Keval Shah <kevalshah_96@yahoo.co.in>
440
+ Dzhelil Rufat <drufat@caltech.edu>
441
+ Pastafarianist <mr.pastafarianist@gmail.com>
442
+ Sourav Singh <souravsingh@users.noreply.github.com>
443
+ Jacob Garber <jgarber1@ualberta.ca>
444
+ Vinay Singh <csvinay.d@gmail.com>
445
+ GolimarOurHero <metalera94@hotmail.com>
446
+ Prashant Tyagi <prashanttyagi221295@gmail.com>
447
+ Matthew Davis <davisml.md@gmail.com>
448
+ Tschijnmo TSCHAU <tschijnmotschau@gmail.com>
449
+ Alexander Bentkamp <bentkamp@gmail.com>
450
+ Jack Kemp <metaknightdrake-git@yahoo.co.uk>
451
+ Kshitij Saraogi <KshitijSaraogi@gmail.com>
452
+ Thomas Baruchel <baruchel@gmx.com>
453
+ Nicolás Guarín-Zapata <nicoguarin@gmail.com>
454
+ Jens Jørgen Mortensen <jj@smoerhul.dk>
455
+ Sampad Kumar Saha <sampadsaha5@gmail.com>
456
+ Eva Charlotte Mayer <eva-charlotte.mayer@posteo.de>
457
+ Laura Domine <temigo@gmx.com>
458
+ Justin Blythe <jblythe29@gmail.com>
459
+ Meghana Madhyastha <meghana.madhyastha@gmail.com>
460
+ Tanu Hari Dixit <tokencolour@gmail.com>
461
+ Shekhar Prasad Rajak <shekharrajak@live.com>
462
+ Aqnouch Mohammed <aqnouch.mohammed@gmail.com>
463
+ Arafat Dad Khan <arafat.da.khan@gmail.com>
464
+ Boris Atamanovskiy <shaomoron@gmail.com>
465
+ Sam Tygier <sam.tygier@hep.manchester.ac.uk>
466
+ Jai Luthra <me@jailuthra.in>
467
+ Guo Xingjian <Seeker1995@gmail.com>
468
+ Sandeep Veethu <sandeep.veethu@gmail.com>
469
+ Archit Verma <architv07@gmail.com>
470
+ Shubham Tibra <shubh.tibra@gmail.com>
471
+ Ashutosh Saboo <ashutosh.saboo96@gmail.com>
472
+ Michael S. Hansen <michael.hansen@nih.gov>
473
+ Anish Shah <shah.anish07@gmail.com>
474
+ Guillaume Jacquenot <guillaume.jacquenot@gmail.com>
475
+ Bhautik Mavani <mavanibhautik@gmail.com>
476
+ Michał Radwański <enedil.isildur@gmail.com>
477
+ Jerry Li <jerry@jerryli.ca>
478
+ Pablo Zubieta <pabloferz@yahoo.com.mx>
479
+ Shivam Agarwal <knowthyself2503@gmail.com>
480
+ Chaitanya Sai Alaparthi <achaitanyasai@gmail.com>
481
+ Arihant Parsoya <parsoyaarihant@gmail.com>
482
+ Ruslan Pisarev <rpisarev@cloudlinux.com>
483
+ Akash Trehan <akash.trehan123@gmail.com>
484
+ Nishant Nikhil <nishantiam@gmail.com>
485
+ Vladimir Poluhsin <vovapolu@gmail.com>
486
+ Akshay Nagar <awesomeay13@yahoo.com>
487
+ James Brandon Milam <jmilam343@gmail.com>
488
+ Abhinav Agarwal <abhinavagarwal1996@gmail.com>
489
+ Rishabh Daal <rishabhdaal@gmail.com>
490
+ Sanya Khurana <sanya@monica.in>
491
+ Aman Deep <amandeep1024@gmail.com>
492
+ Aravind Reddy <aravindreddy255@gmail.com>
493
+ Abhishek Verma <iamvermaabhishek@gmail.com>
494
+ Matthew Parnell <matt@parnmatt.co.uk>
495
+ Thomas Hickman <Thomas.Hickman42@gmail.com>
496
+ Akshay Siramdas <akshaysiramdas@gmail.com>
497
+ YiDing Jiang <yidinggjiangg@gmail.com>
498
+ Jatin Yadav <jatinyadav25@gmail.com>
499
+ Matthew Thomas <mnmt@users.noreply.github.com>
500
+ Rehas Sachdeva <aquannie@gmail.com>
501
+ Michael Mueller <michaeldmueller7@gmail.com>
502
+ Srajan Garg <srajan.garg@gmail.com>
503
+ Prabhjot Singh <prabhjot.nith@gmail.com>
504
+ Haruki Moriguchi <harukimoriguchi@gmail.com>
505
+ Tom Gijselinck <tomgijselinck@gmail.com>
506
+ Nitin Chaudhary <nitinmax1000@gmail.com>
507
+ Alex Argunov <sajkoooo@gmail.com>
508
+ Nathan Musoke <nathan.musoke@gmail.com>
509
+ Abhishek Garg <abhishekgarg119@gmail.com>
510
+ Dana Jacobsen <dana@acm.org>
511
+ Vasiliy Dommes <vasdommes@gmail.com>
512
+ Phillip Berndt <phillip.berndt@googlemail.com>
513
+ Haimo Zhang <zh.hammer.dev@gmail.com>
514
+ Anthony Scopatz <scopatz@gmail.com>
515
+ bluebrook <perl4logic@gmail.com>
516
+ Leonid Kovalev <leonidvkovalev@gmail.com>
517
+ Josh Burkart <jburkart@gmail.com>
518
+ Dimitra Konomi <t8130064@dias.aueb.gr>
519
+ Christina Zografou <t8130048@dias.aueb.gr>
520
+ Fiach Antaw <fiach.antaw+github@gmail.com>
521
+ Langston Barrett <langston.barrett@gmail.com>
522
+ Krit Karan <kritkaran.b13@iiits.in>
523
+ G. D. McBain <gdmcbain@protonmail.com>
524
+ Prempal Singh <prempal.42@gmail.com>
525
+ Gabriel Orisaka <orisaka@gmail.com>
526
+ Matthias Bussonnier <bussonniermatthias@gmail.com>
527
+ rahuldan <rahul02013@gmail.com>
528
+ Colin Marquardt <github@marquardt-home.de>
529
+ Andrew Taber <andrew.e.taber@gmail.com>
530
+ Yash Reddy <write2yashreddy@gmail.com>
531
+ Peter Stangl <peter.stangl@ph.tum.de>
532
+ elvis-sik <e.sikora@grad.ufsc.br>
533
+ Nikos Karagiannakis <nikoskaragiannakis@gmail.com>
534
+ Jainul Vaghasia <jainulvaghasia@gmail.com>
535
+ Dennis Meckel <meckel@datenschuppen.de>
536
+ Harshil Meena <harshil.7535@gmail.com>
537
+ Micky <mickydroch@gmail.com>
538
+ Nick Curtis <nicholas.curtis@uconn.edu>
539
+ Michele Zaffalon <michele.zaffalon@gmail.com>
540
+ Martha Giannoudovardi <maapxa@gmail.com>
541
+ Devang Kulshreshtha <devang.kulshreshtha.cse14@itbhu.ac.in>
542
+ Steph Papanik <spapanik21@gmail.com>
543
+ Mohammad Sadeq Dousti <msdousti@gmail.com>
544
+ Arif Ahmed <arif.ahmed.5.10.1995@gmail.com>
545
+ Abdullah Javed Nesar <abduljaved1994@gmail.com>
546
+ Lakshya Agrawal <zeeshan.lakshya@gmail.com>
547
+ shruti <shrutishrm512@gmail.com>
548
+ Rohit Rango <rohit.rango@gmail.com>
549
+ Hong Xu <hong@topbug.net>
550
+ Ivan Petuhov <ivan@ostrovok.ru>
551
+ Alsheh <alsheh@rpi.edu>
552
+ Marcel Stimberg <marcel.stimberg@ens.fr>
553
+ Alexey Pakhocmhik <cool.Bakov@yandex.ru>
554
+ Tommy Olofsson <tommy.olofsson.90@gmail.com>
555
+ Zulfikar <zulfikar97@gmail.com>
556
+ Blair Azzopardi <blairuk@gmail.com>
557
+ Danny Hermes <daniel.j.hermes@gmail.com>
558
+ Sergey Pestov <pestov-sa@yandex.ru>
559
+ Mohit Chandra <mohit.chandra@research.iiit.ac.in>
560
+ Karthik Chintapalli <karthik.chintapalli@students.iiit.ac.in>
561
+ Marcin Briański <marcin.brianski@student.uj.edu.pl>
562
+ andreo <andrey.torba@gmail.com>
563
+ Flamy Owl <flamyowl@protonmail.ch>
564
+ Yicong Guo <guoyicong100@gmail.com>
565
+ Varun Garg <varun.garg03@gmail.com>
566
+ Rishabh Madan <rishabhmadan96@gmail.com>
567
+ Aditya Kapoor <aditya.kapoor.apm12@itbhu.ac.in>
568
+ Karan Sharma <karan1276@gmail.com>
569
+ Vedant Rathore <vedantr1998@gmail.com>
570
+ Johan Blåbäck <johan_bluecreek@riseup.net>
571
+ Pranjal Tale <pranjaltale16@gmail.com>
572
+ Jason Tokayer <jason.tokayer@gmail.com>
573
+ Raghav Jajodia <jajodia.raghav@gmail.com>
574
+ Rajat Thakur <rajatthakur1997@gmail.com>
575
+ Dhruv Bhanushali <dhruv_b@live.com>
576
+ Anjul Kumar Tyagi <anjul.ten@gmail.com>
577
+ Barun Parruck <barun.parruck@gmail.com>
578
+ Bao Chau <chauquocbao0907@gmail.com>
579
+ Tanay Agrawal <tanay_agrawal@hotmail.com>
580
+ Ranjith Kumar <ranjith.dakshana2015@gmail.com>
581
+ Shikhar Makhija <shikharmakhija2@gmail.com>
582
+ Yathartha Joshi <yathartha32@gmail.com>
583
+ Valeriia Gladkova <valeriia.gladkova@gmail.com>
584
+ Sagar Bharadwaj <sagarbharadwaj50@gmail.com>
585
+ Daniel Mahler <dmahler@gmail.com>
586
+ Ka Yi <chua.kayi@yahoo.com.sg>
587
+ Rishat Iskhakov <iskhakov@frtk.ru>
588
+ Szymon Mieszczak <szymon.mieszczak@gmail.com>
589
+ Sachin Agarwal <sachinagarwal0499@gmail.com>
590
+ Priyank Patel <pspbot7@gmail.com>
591
+ Satya Prakash Dwibedi <akash581050@gmail.com>
592
+ tools4origins <tools4origins@gmail.com>
593
+ Nico Schlömer <nico.schloemer@gmail.com>
594
+ Fermi Paradox <FermiParadox@users.noreply.github.com>
595
+ Ekansh Purohit <purohit.e15@gmail.com>
596
+ Vedarth Sharma <vedarth.sharma@gmail.com>
597
+ Peeyush Kushwaha <peeyush.p97@gmail.com>
598
+ Jayjayyy <vfhsln8s3l4b87t4c3@byom.de>
599
+ Christopher J. Wright <cjwright4242gh@gmail.com>
600
+ Jakub Wilk <jwilk@jwilk.net>
601
+ Mauro Garavello <mauro.garavello@unimib.it>
602
+ Chris Tefer <ctefer@gmail.com>
603
+ Shikhar Jaiswal <jaiswalshikhar87@gmail.com>
604
+ Chiu-Hsiang Hsu <wdv4758h@gmail.com>
605
+ Carlos Cordoba <ccordoba12@gmail.com>
606
+ Fabian Ball <fabian.ball@kit.edu>
607
+ Yerniyaz <yerniyaz.nurgabylov@nu.edu.kz>
608
+ Christiano Anderson <canderson@riseup.net>
609
+ Robin Neatherway <robin.neatherway@gmail.com>
610
+ Thomas Hunt <thomashunt13@gmail.com>
611
+ Theodore Han <theodorehan@hotmail.com>
612
+ Duc-Minh Phan <alephvn@gmail.com>
613
+ Lejla Metohajrova <l.metohajrova@gmail.com>
614
+ Samyak Jain <samyak.jain2016a@vitstudent.ac.in>
615
+ Aditya Rohan <riyuzakiiitk@gmail.com>
616
+ Vincent Delecroix <vincent.delecroix@labri.fr>
617
+ Michael Sparapany <msparapa@purdue.edu>
618
+ Harsh Jain <harshjniitr@gmail.com>
619
+ Nathan Goldbaum <ngoldbau@illinois.edu>
620
+ latot <felipematas@yahoo.com>
621
+ Kenneth Lyons <ixjlyons@gmail.com>
622
+ Stan Schymanski <stan.schymanski@env.ethz.ch>
623
+ David Daly <david.daly12@kzoo.edu>
624
+ Ayush Shridhar <ayush.shridhar1999@gmail.com>
625
+ Javed Nissar <javednissar@gmail.com>
626
+ Jiri Kuncar <jiri.kuncar@gmail.com>
627
+ vedantc98 <vedantc98@gmail.com>
628
+ Rupesh Harode <rupeshharode@gmail.com>
629
+ Rob Zinkov <rob@zinkov.com>
630
+ James Harrop <ebc121@gmail.com>
631
+ James Taylor <user234683@tutanota.com>
632
+ Ishan Joshi <ishanaj98@gmail.com>
633
+ Marco Mancini <marco.mancini@obspm.fr>
634
+ Boris Ettinger <ettinger.boris@gmail.com>
635
+ Micah Fitch <micahscopes@gmail.com>
636
+ Daniel Wennberg <daniel.wennberg@gmail.com>
637
+ ylemkimon <ylemkimon@naver.com>
638
+ Akash Vaish <akash.9712@gmail.com>
639
+ Peter Enenkel <peter.enenkel+git@gmail.com>
640
+ Waldir Pimenta <waldyrious@gmail.com>
641
+ Jithin D. George <jithindgeorge93@gmail.com>
642
+ Lev Chelyadinov <leva181777@gmail.com>
643
+ Lucas Wiman <lucas.wiman@gmail.com>
644
+ Rhea Parekh <rheaparekh12@gmail.com>
645
+ James Cotton <peabody124@gmail.com>
646
+ Robert Pollak <robert.pollak@posteo.net>
647
+ anca-mc <anca-mc@users.noreply.github.com>
648
+ Sourav Ghosh <souravghosh2197@gmail.com>
649
+ Jonathan Allan <jjallan@users.noreply.github.com>
650
+ Nikhil Pappu <nkhlpappu@gmail.com>
651
+ Ethan Ward <etkewa@gmail.com>
652
+ Cezary Marczak <zeddq1@gmail.com>
653
+ dps7ud <dps7ud@virginia.edu>
654
+ Nilabja Bhattacharya <nilabja10201992@gmail.com>
655
+ Itay4 <31018228+Itay4@users.noreply.github.com>
656
+ Poom Chiarawongse <eight1911@gmail.com>
657
+ Yang Yang <wdscxsj@gmail.com>
658
+ Cavendish McKay <cmckay@tachycline.com>
659
+ Bradley Gannon <bradley.m.gannon@gmail.com>
660
+ B McG <bmcg0890@gmail.com>
661
+ Rob Drynkin <rob.drynkin@gmail.com>
662
+ Seth Ebner <murgrehk@gmail.com>
663
+ Akash Kundu <sk.sayakkundu1997@gmail.com>
664
+ Mark Jeromin <mark.jeromin@sysfrog.net>
665
+ Roberto Díaz Pérez <r.r.1994a@gmail.com>
666
+ Gleb Siroki <g.shiroki@gmail.com>
667
+ Segev Finer <segev208@gmail.com>
668
+ Alex Lubbock <code@alexlubbock.com>
669
+ Ayodeji Ige <ayodeji18@outlook.com>
670
+ Matthew Wardrop <matthew.wardrop@airbnb.com>
671
+ Hugo van Kemenade <hugovk@users.noreply.github.com>
672
+ Austin Palmer <ap4000@nyu.edu>
673
+ der-blaue-elefant <github@kklein.de>
674
+ Filip Gokstorp <filip@gokstorp.se>
675
+ Yuki Matsuda <yuki.matsuda.w@gmail.com>
676
+ Aaron Miller <acmiller273@gmail.com>
677
+ Salil Vishnu Kapur <salilvishnukapur@gmail.com>
678
+ Atharva Khare <khareatharva@gmail.com>
679
+ Shubham Maheshwari <rmaheshwari05@gmail.com>
680
+ Pavel Tkachenko <paveltkachenko@email.com>
681
+ Ashish Kumar Gaurav <ashishkg0022@gmail.com>
682
+ Rajeev Singh <rajs2010@gmail.com>
683
+ Keno Goertz <keno@goertz-berlin.com>
684
+ Lucas Gallindo <lgallindo@gmail.com>
685
+ Himanshu <hs80941@gmail.com>
686
+ David Menéndez Hurtado <david.menendez.hurtado@scilifelab.se>
687
+ Amit Manchanda <amitdelhi1995@gmail.com>
688
+ Rohit Jain <rohitjain3241@gmail.com>
689
+ Jonathan A. Gross <jarthurgross@gmail.com>
690
+ Unknown <kunda@scribus.net>
691
+ Sayan Goswami <Sayan98@users.noreply.github.com>
692
+ Subhash Saurabh <subhashsaurabh419@gmail.com>
693
+ Rastislav Rabatin <rastislav.rabatin@gmail.com>
694
+ Vishal <vishalg2235@gmail.com>
695
+ Jeremey Gluck <jeremygluck@yahoo.com>
696
+ Akshat Maheshwari <akshat14714@gmail.com>
697
+ symbolique <symbolique@users.noreply.github.com>
698
+ Saloni Jain <tosalonijain@gmail.com>
699
+ Arighna Chakrabarty <arighna.chakrabarty100@gmail.com>
700
+ Abhigyan Khaund <mail@abhigyan.xyz>
701
+ Jashanpreet Singh <jashansingh.4398@gmail.com>
702
+ Saurabh Agarwal <shourabh.agarwal@gmail.com>
703
+ luzpaz <luzpaz@users.noreply.github.com>
704
+ P. Sai Prasanth <psai.prasanth.min16@itbhu.ac.in>
705
+ Nirmal Sarswat <nirmalsarswat400@gmail.com>
706
+ Cristian Di Pietrantonio <cristiandipietrantonio@gmail.com>
707
+ Ravi charan <ravicharan.vsp@gmail.com>
708
+ Nityananda Gohain <nityanandagohain@gmail.com>
709
+ Cédric Travelletti <cedrictravelletti@gmail.com>
710
+ Nicholas Bollweg <nick.bollweg@gmail.com>
711
+ Himanshu Ladia <hladia199811@gmail.com>
712
+ Adwait Baokar <adwaitbaokar18@gmail.com>
713
+ Mihail Tarigradschi <m.tarigradschi@gmail.com>
714
+ Saketh <alurusaisaketh@gmail.com>
715
+ rushyam <rushyamsonu@gmail.com>
716
+ sfoo <sfoohei@gmail.com>
717
+ Rahil Hastu <rahilhastu@gmail.com>
718
+ Zach Raines <raineszm@gmail.com>
719
+ Sidhant Nagpal <sidhantnagpal97@gmail.com>
720
+ Gagandeep Singh <singh.23@iitj.ac.in>
721
+ Rishav Chakraborty <annonymousxyz@outlook.com>
722
+ Malkhan Singh <malkhansinghrathaur@gmail.com>
723
+ Joaquim Monserrat <qmonserrat@mailoo.org>
724
+ Mayank Singh <mayank.singh081997@gmail.com>
725
+ Rémy Léone <rleone@online.net>
726
+ Maxence Mayrand <35958639+maxencemayrand@users.noreply.github.com>
727
+ Nikoleta Glynatsi <GlynatsiNE@cardiff.ac.uk>
728
+ helo9 <helo9@users.noreply.github.com>
729
+ Ken Wakita <wakita@is.titech.ac.jp>
730
+ Carl Sandrock <carl.sandrock@up.ac.za>
731
+ Fredrik Eriksson <freeriks@student.chalmers.se>
732
+ Ian Swire <oversizedpenguin@gmail.com>
733
+ Bulat <daianovich@mail.ru>
734
+ Ehren Metcalfe <ehren.m@gmail.com>
735
+ Dmitry Savransky <dsavransky@gmail.com>
736
+ Kiyohito Yamazaki <kyamaz@openql.org>
737
+ Caley Finn <caleyreuben@gmail.com>
738
+ Zhi-Qiang Zhou <zzq_890709@hotmail.com>
739
+ Alexander Pozdneev <pozdneev@users.noreply.github.com>
740
+ Wes Turner <50891+westurner@users.noreply.github.com>
741
+ JMSS-Unknown <31131631+JMSS-Unknown@users.noreply.github.com>
742
+ Arshdeep Singh <singh.arshdeep1999@gmail.com>
743
+ cym1 <16437732+cym1@users.noreply.github.com>
744
+ Stewart Wadsworth <stewart.wadsworth@gmail.com>
745
+ Jared Lumpe <mjlumpe@gmail.com>
746
+ Avi Shrivastava <shrivastavaavi123@gmail.com>
747
+ ramvenkat98 <ramvenkat98@gmail.com>
748
+ Bilal Ahmed <b.ahmed0918@gmail.com>
749
+ Dimas Abreu Archanjo Dutra <dimasad@ufmg.br>
750
+ Yatna Verma <yatnavermaa@gmail.com>
751
+ S.Y. Lee <sylee957@gmail.com>
752
+ Miro Hrončok <miro@hroncok.cz>
753
+ Sudarshan Kamath <sudarshan.kamath97@gmail.com>
754
+ Ayushman Koul <ayushmankoul4570@gmail.com>
755
+ Robert Dougherty-Bliss <robert.w.bliss@gmail.com>
756
+ Andrey Grozin <A.G.Grozin@inp.nsk.su>
757
+ Bavish Kulur <bavishkulur@gmail.com>
758
+ Arun Singh <arunsin997@gmail.com>
759
+ sirnicolaf <43586954+sirnicolaf@users.noreply.github.com>
760
+ Zachariah Etienne <zachetie@gmail.com>
761
+ Prayush Dawda <35144226+iamprayush@users.noreply.github.com>
762
+ 2torus <boris.ettinger@gmail.com>
763
+ Faisal Riyaz <faisalriyaz011@gmail.com>
764
+ Martin Roelfs <u0114255@kuleuven.be>
765
+ SirJohnFranklin <sirjfu@googlemail.com>
766
+ Anthony Sottile <asottile@umich.edu>
767
+ ViacheslavP <public.viacheslav@gmail.com>
768
+ Safiya03 <safiyanesar@gmail.com>
769
+ Alexander Dunlap <alexander.dunlap@gmail.com>
770
+ Rohit Sharma <31184621+rohitx007@users.noreply.github.com>
771
+ Jonathan Warner <warnerjon12@gmail.com>
772
+ Mohit Balwani <mohitbalwani.ict17@gmail.com>
773
+ Marduk Bolaños <mardukbp@mac.com>
774
+ amsuhane <ayushsuhane99@iitkgp.ac.in>
775
+ Matthias Geier <Matthias.Geier@gmail.com>
776
+ klaasvanaarsen <44929042+klaasvanaarsen@users.noreply.github.com>
777
+ Shubham Kumar Jha <skjha832@gmail.com>
778
+ rationa-kunal <kunalgk1999@gmail.com>
779
+ Animesh Sinha <animeshsinha1309@gmail.com>
780
+ Gaurang Tandon <1gaurangtandon@gmail.com>
781
+ Matthew Craven <clyring@users.noreply.github.com>
782
+ Daniel Ingram <ingramds@appstate.edu>
783
+ Jogi Miglani <jmig5776@gmail.com>
784
+ Takumasa Nakamura <n.takumasa@gmail.com>
785
+ Ritu Raj Singh <RituRajSingh878@gmail.com>
786
+ Rajiv Ranjan Singh <rajivperfect007@gmail.com>
787
+ Vera Lozhkina <veralozhkina@gmail.com>
788
+ adhoc-king <46354827+adhoc-king@users.noreply.github.com>
789
+ Mikel Rouco <mikel.mrm@gmail.com>
790
+ Oscar Gustafsson <oscar.gustafsson@gmail.com>
791
+ damianos <damianos@semmle.com>
792
+ Supreet Agrawal <supreet11agrawal@gmail.com>
793
+ shiksha11 <shiksharawat01@gmail.com>
794
+ Martin Ueding <dev@martin-ueding.de>
795
+ sharma-kunal <kunalsharma6914@gmail.com>
796
+ Divyanshu Thakur <divyanshu@iiitmanipur.ac.in>
797
+ Susumu Ishizuka <susumu.ishizuka@kii.com>
798
+ Samnan Rahee <namanush.rsr.16@gmail.com>
799
+ Fredrik Andersson <fredrik.andersson@fcc.chalmers.se>
800
+ Bhavya Srivastava <bhavya17037@iiitd.ac.in>
801
+ Alpesh Jamgade <alpeshjamgade21@gmail.com>
802
+ Shubham Abhang <shubhamabhang77@gmail.com>
803
+ Vishesh Mangla <manglavishesh64@gmail.com>
804
+ Nicko van Someren <nicko@nicko.org>
805
+ dandiez <47832466+dandiez@users.noreply.github.com>
806
+ Frédéric Chapoton <fchapoton2@gmail.com>
807
+ jhanwar <f2015463@pilani.bits-pilani.ac.in>
808
+ Noumbissi valere Gille Geovan <noumbissivalere@gmail.com>
809
+ Salmista-94 <alejandrogroso@hotmail.com>
810
+ Shivani Kohli <shivanikohli.09@gmail.com>
811
+ Parker Berry <parkereberry@gmail.com>
812
+ Pragyan Mehrotra <pragyan18168@iiitd.ac.in>
813
+ Nabanita Dash <dashnabanita@gmail.com>
814
+ Gaetano Guerriero <x.guerriero@tin.it>
815
+ Ankit Raj Pandey <pandeyan@grinnell.edu>
816
+ Ritesh Kumar <ritesh99rakesh@gmail.com>
817
+ kangzhiq <709563092@qq.com>
818
+ Jun Lin <junlin0604@gmail.com>
819
+ Petr Kungurtsev <corwinat@gmail.com>
820
+ Anway De <anway1756@gmail.com>
821
+ znxftw <vishnu2101@gmail.com>
822
+ Denis Ivanenko <ivanenko@ucu.edu.ua>
823
+ Orestis Vaggelis <orestisvaggelis@mail.com>
824
+ Nikhil Maan <nikhilmaan22@gmail.com>
825
+ Abhinav Anand <abhinav.anand2807@gmail.com>
826
+ Qingsha Shi <googol.sqs@gmail.com>
827
+ Juan Barbosa <js.barbosa10@uniandes.edu.co>
828
+ Prionti Nasir <pdn3628@rit.edu>
829
+ Bharat Raghunathan <bharatraghunthan9767@gmail.com>
830
+ arooshiverma <av22@iitbbs.ac.in>
831
+ Christoph Gohle <ctg@mpq.mpg.de>
832
+ Charalampos Tsiagkalis <ctsiagkalis@uth.gr>
833
+ Daniel Sears <highpost@users.noreply.github.com>
834
+ Megan Ly <megan.ly@learnosity.com>
835
+ Sean P. Cornelius <spcornelius@gmail.com>
836
+ Erik R. Gomez <gomez@kth.se>
837
+ Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
838
+ Henry Metlov <genrih.metlov@gmail.com>
839
+ pekochun <hamburg_hamburger2000@yahoo.co.jp>
840
+ Bendik Samseth <b.samseth@gmail.com>
841
+ Vighnesh Shenoy <vighneshq@gmail.com>
842
+ Versus Void <versusvoid@gmail.com>
843
+ Denys Rybalka <rybalka.denis@gmail.com>
844
+ Mark Dickinson <dickinsm@gmail.com>
845
+ Rimi <rimibis@umich.edu>
846
+ rimibis <33387803+rimibis@users.noreply.github.com>
847
+ Steven Lee <stevenlee123@protonmail.com>
848
+ Gilles Schintgen <gschintgen@hambier.lu>
849
+ Abhi58 <abhijithbharadwaj58@gmail.com>
850
+ Tomasz Pytel <tompytel@gmail.com>
851
+ Aadit Kamat <aadit.k12@gmail.com>
852
+ Samesh <samesh.lakhotia@gmail.com>
853
+ Velibor Zeli <velibor@mech.kth.se>
854
+ Gabriel Bernardino <gabriel.bernardino@upf.edu>
855
+ Joseph Redfern <joseph@redfern.me>
856
+ Evelyn King <evelyn.cameron.king@gmail.com>
857
+ Miguel Marco <mmarco@unizar.es>
858
+ David Hagen <david@drhagen.com>
859
+ Hannah Kari <hannah.kari@marquette.edu>
860
+ Soniya Nayak <soniyanayak51@gmail.com>
861
+ Harsh Agarwal <hagarwal9200@gmail.com>
862
+ Enric Florit <efz1005@gmail.com>
863
+ Yogesh Mishra <ymishra013@gmail.com>
864
+ Denis Rykov <rykovd@gmail.com>
865
+ Ivan Tkachenko <me@ratijas.tk>
866
+ Kenneth Emeka Odoh <kenneth.odoh@gmail.com>
867
+ Stephan Seitz <stephan.seitz@fau.de>
868
+ Yeshwanth N <yeshsurya@gmail.com>
869
+ Oscar Gerardo Lazo Arjona <oscar.lazoarjona@physics.ox.ac.uk>
870
+ Srinivasa Arun Yeragudipati <ysarun1999@gmail.com>
871
+ Kirtan Mali <kirtanmali555@gmail.com>
872
+ TitanSnow <sweeto@live.cn>
873
+ Pengning Chao <8857165+PengningChao@users.noreply.github.com>
874
+ Louis Abraham <louis.abraham@yahoo.fr>
875
+ Morten Olsen Lysgaard <morten@lysgaard.no>
876
+ Akash Nagaraj (akasnaga) <akasnaga@cisco.com>
877
+ Akash Nagaraj <grassknoted@gmail.com>
878
+ Lauren Glattly <laurenglattly@gmail.com>
879
+ Hou-Rui <houruinus@gmail.com>
880
+ George Korepanov <gkorepanov.gk@gmail.com>
881
+ dranknight09 <cbhaavan@gmail.com>
882
+ aditisingh2362 <aditisingh2362@gmail.com>
883
+ Gina <Dr-G@users.noreply.github.com>
884
+ gregmedlock <gmedlo@gmail.com>
885
+ Georgios Giapitzakis Tzintanos <giorgosgiapis@mail.com>
886
+ Eric Wieser <wieser.eric@gmail.com>
887
+ Bradley Dowling <34559056+btdow@users.noreply.github.com>
888
+ Maria Marginean <33810762+mmargin@users.noreply.github.com>
889
+ Akash Agrawall <akash.wanted@gmail.com>
890
+ jgulian <josephdgulian@gmail.com>
891
+ Sourav Goyal <souravgl0@gmail.com>
892
+ Zlatan Vasović <zlatanvasovic@gmail.com>
893
+ Alex Meiburg <timeroot.alex@gmail.com>
894
+ Smit Lunagariya <smitlunagariya.mat18@itbhu.ac.in>
895
+ Naman Gera <namangera15@gmail.com>
896
+ Julien Palard <julien@palard.fr>
897
+ Dhruv Mendiratta <dhruvmendiratta6@gmail.com>
898
+ erdOne <36414270+erdOne@users.noreply.github.com>
899
+ risubaba <risubhjain1010@gmail.com>
900
+ abhinav28071999 <41710346+abhinav28071999@users.noreply.github.com>
901
+ Jisoo Song <jeesoo9595@snu.ac.kr>
902
+ Jaime R <38530589+Jaime02@users.noreply.github.com>
903
+ Vikrant Malik <vikrantmalik051@gmail.com>
904
+ Hardik Saini <43683678+Guardianofgotham@users.noreply.github.com>
905
+ Abhishek <uchiha@pop-os.localdomain>
906
+ Johannes Hartung <joha2@gmx.net>
907
+ Milan Jolly <milan.cs16@iitp.ac.in>
908
+ faizan2700 <syedfaizan824@gmail.com>
909
+ mohit <39158356+mohitacecode@users.noreply.github.com>
910
+ Mohit Gupta <mohitgupta@gmail.com>
911
+ Psycho-Pirate <prakharsaxena.civ18@iitbhu.ac.in>
912
+ Chanakya-Ekbote <ca10@iitbbs.ac.in>
913
+ Rashmi Shehana <rashmi.watagedara@syscolabs.com>
914
+ Jonty16117 <jonty@DESKTOP-J1O6ANP.localdomain>
915
+ Anubhav Gupta <anubhav.gupta.cse19@itbhu.ac.in>
916
+ Michal Grňo <m93a.cz@gmail.com>
917
+ vezeli <37907135+vezeli@users.noreply.github.com>
918
+ Tim Gates <tim.gates@iress.com>
919
+ Sandeep Murthy <smurthy@protonmail.ch>
920
+ Neil <mistersheik@gmail.com>
921
+ V1krant <46847915+V1krant@users.noreply.github.com>
922
+ alejandro <amartinhernan@gmail.com>
923
+ Riyan Dhiman <Riyandhiman14@gmail.com>
924
+ sbt4104 <sthorat661@gmail.com>
925
+ Seth Troisi <sethtroisi@google.com>
926
+ Bhaskar Gupta <guptabhanu1999@gmail.com>
927
+ Smit Gajjar <smitgajjar.gs@gmail.com>
928
+ rbl <rlee@grove.co>
929
+ Ilya Pchelintsev <ilya.pchelintsev@outlook.com>
930
+ Omar Wagih <o.wagih.ow@gmail.com>
931
+ prshnt19 <prashant.rawat216@gmail.com>
932
+ Johan Guzman <jguzm022@ucr.edu>
933
+ Vasileios Kalos <kalosbasileios@gmail.com>
934
+ BasileiosKal <61801875+BasileiosKal@users.noreply.github.com>
935
+ Shubham Thorat <37049710+sbt4104@users.noreply.github.com>
936
+ Arpan Chattopadhyay <f20180319@pilani.bits-pilani.ac.in>
937
+ Ashutosh Hathidara <ashutoshhathidara98@gmail.com>
938
+ Moses Paul R <iammosespaulr@gmail.com>
939
+ Saanidhya vats <saanidhyavats@gmail.com>
940
+ tnzl <you@example.com>
941
+ Vatsal Srivastava <alstav.trivas.sava@gmail.com>
942
+ Jean-Luc Herren <jlh@gmx.ch>
943
+ Dhruv Kothari <dhruvkothari22@gmail.com>
944
+ seadavis <45022599+seadavis@users.noreply.github.com>
945
+ kamimura <kamimura@live.jp>
946
+ slacker404 <pchantza@gmail.com>
947
+ Jaime Resano <gemailpersonal02@gmail.com>
948
+ Ebrahim Byagowi <ebrahim@gnu.org>
949
+ wuyudi <wuyudi119@163.com>
950
+ Akira Kyle <ak@akirakyle.com>
951
+ Calvin Jay Ross <calvinjayross@gmail.com>
952
+ Martin Thoma <info@martin-thoma.de>
953
+ Thomas A Caswell <tcaswell@gmail.com>
954
+ Lagaras Stelios <stel.lag@hotmail.com>
955
+ Jerry James <loganjerry@gmail.com>
956
+ Jan Kruse <janckruse@t-online.de>
957
+ Nathan Taylor <pecan.pine@gmail.com>
958
+ Vaishnav Damani <vaishnavdamani3496@gmail.com>
959
+ Mohit Shah <mohitshah3111999@gmail.com>
960
+ Mathias Louboutin <mathias.louboutin@gmail.com>
961
+ Marijan Smetko <marijansmetko123@gmail.com>
962
+ Dave Witte Morris <Dave.Morris@uleth.ca>
963
+ soumi7 <soumibardhan10@gmail.com>
964
+ Zhongshi <zj495@nyu.edu>
965
+ Wes Galbraith <galbwe92@gmail.com>
966
+ KaustubhDamania <kaustubh.damania@gmail.com>
967
+ w495 <w495@yandex-team.ru>
968
+ Akhil Rajput <akh1lrjput@gmail.com>
969
+ Markus Mohrhard <markus.mohrhard@googlemail.com>
970
+ Benjamin Wolba <mail@benjaminwolba.com>
971
+ 彭于斌 <1931127624@qq.com>
972
+ Rudr Tiwari <rudrtiwari@gmail.com>
973
+ Aaryan Dewan <aaryandewan@yahoo.com>
974
+ Benedikt Placke <benedikt.placke@outlook.com>
975
+ Sneha Goddu <s.goddu@wustl.edu>
976
+ goddus <39923708+goddus@users.noreply.github.com>
977
+ Shivang Dubey <shivangdubey8@gmail.com>
978
+ Michael Greminger <michael.greminger@gmail.com>
979
+ Peter Cock <p.j.a.cock@googlemail.com>
980
+ Willem Melching <willem.melching@gmail.com>
981
+ Elias Basler <e.e.basler@protonmail.com>
982
+ Brandon David <brandon.david@zoho.com>
983
+ Abhay_Dhiman <abhaysdhimans@gmail.com>
984
+ Tasha Kim <jae_young_kim@brown.edu>
985
+ Ayush Malik <ayushmalik779@gmail.com>
986
+ Devesh Sawant <devesh47cool@gmail.com>
987
+ Wolfgang Stöcher <wolfgang@stoecher.com>
988
+ Sudeep Sidhu <sudeepmanilsidhu@gmail.com>
989
+ foice <foice.news@gmail.com>
990
+ Ben Payne <ben.is.located@gmail.com>
991
+ Muskan Kumar <31043527+muskanvk@users.noreply.github.com>
992
+ noam simcha finkelstein <noam.finkelstein@protonmail.com>
993
+ Garrett Folbe <gmfolbe@yahoo.com>
994
+ Islam Mansour <is3mansour@gmail.com>
995
+ Sayandip Halder <sayandiph4@gmail.com>
996
+ Shubham Agrawal <shubham.ag6845@gmail.com>
997
+ numbermaniac <5206120+numbermaniac@users.noreply.github.com>
998
+ Sakirul Alam <binarysakir@gmail.com>
999
+ Mohammed Bilal <r.mohammedbilal@gmail.com>
1000
+ Chris du Plessis <christopherjonduplessis@gmail.com>
1001
+ Coder-RG <rgoel1999@gmail.com>
1002
+ Ansh Mishra <anshmishra471@gmail.com>
1003
+ Alex Malins <github@alexmalins.com>
1004
+ Lorenzo Contento <lorenzo.contento@gmail.com>
1005
+ Naveen Sai <naveensaisreenivas@gmail.com>
1006
+ Shital Mule <shitalmule04@gmail.com>
1007
+ Amanda Dsouza <meezamanda@yahoo.com>
1008
+ Nijso Beishuizen <nijso@koolmees.numerically-related.com>
1009
+ Harry Zheng <harry@harryzheng.com>
1010
+ Felix Yan <felixonmars@archlinux.org>
1011
+ Constantin Mateescu <costica1234@me.com>
1012
+ Eva Tiwari <eva.tiwari@gmail.com>
1013
+ Aditya Kumar Sinha <adityakumar113141@gmail.com>
1014
+ Soumi Bardhan <51290447+Soumi7@users.noreply.github.com>
1015
+ Kaustubh Chaudhari <ckaustubhm06@gmail.com>
1016
+ Kristian Brünn <hello@kristianbrunn.com>
1017
+ Neel Gorasiya <mgorasiya1974@gmail.com>
1018
+ Akshat Sood <68052998+akshatsood2249@users.noreply.github.com>
1019
+ Jose M. Gomez <chemoki@gmail.com>
1020
+ Stefan Petrea <stefan@garage-coding.com>
1021
+ Praveen Sahu <povinsahu@gmail.com>
1022
+ Mark Bell <mark00bell@googlemail.com>
1023
+ AlexCQY <alex_chua@u.nus.edu>
1024
+ Fabian Froehlich <fabian@schaluck.com>
1025
+ Nikhil Gopalam <gopalamn@umich.edu>
1026
+ Kartik Sethi <kartiks31416@gmail.com>
1027
+ Muhammed Abdul Quadir Owais <quadirowais200@gmail.com>
1028
+ Harshit Yadav <harshityadav2k@gmail.com>
1029
+ Sidharth Mundhra <sidharthmundhra16@gmail.com>
1030
+ Suryam Arnav Kalra <suryamkalra35@gmail.com>
1031
+ Prince Gupta <codemastercpp@gmail.com>
1032
+ Kunal Singh <ksingh19136@gmail.com>
1033
+ Mayank Raj <mayank_1901cs35@iitp.ac.in>
1034
+ Achal Jain <2achaljain@gmail.com>
1035
+ Mario Maio <mario.maio@aruba.it>
1036
+ Aaron Stiff <69512633+AaronStiff@users.noreply.github.com>
1037
+ Wyatt Peak <wyattpeak@gmail.com>
1038
+ Bhaskar Joshi <bhaskar.joshi@research.iiit.ac.in>
1039
+ Aditya Jindal <jaditya8889@gmail.com>
1040
+ Vaibhav Bhat <vaibhav.bhat2097@gmail.com>
1041
+ Priyansh Rathi <techiepriyansh@gmail.com>
1042
+ Saket Kumar Singh <saketkumar1202@gmail.com>
1043
+ Yukai Chou <muzimuzhi@gmail.com>
1044
+ Qijia Liu <liumeo@pku.edu.cn>
1045
+ Paul Mandel <paulmandel@google.com>
1046
+ Nisarg Chaudhari <54911392+Nisarg-Chaudhari@users.noreply.github.com>
1047
+ Dominik Stańczak <stanczakdominik@gmail.com>
1048
+ Rodrigo Luger <rodluger@gmail.com>
1049
+ Marco Antônio Habitzreuter <mahabitzreuter@gmail.com>
1050
+ Ayush Bisht <bisht.ayush2001@gmail.com>
1051
+ Akshansh Bhatt <akshansh@tuta.io>
1052
+ Brandon T. Willard <brandonwillard@users.noreply.github.com>
1053
+ Thomas Aarholt <thomasaarholt@gmail.com>
1054
+ Hiren Chalodiya <hirenchalodiya99@gmail.com>
1055
+ Roland Dixon <rols121@gmail.com>
1056
+ dimasvq <dimas.vq.2020@bristol.ac.uk>
1057
+ Sagar231 <sagarfeb298@gmail.com>
1058
+ Michael Chu <michael02chu@gmail.com>
1059
+ Abby Ng <abigailjng@gmail.com>
1060
+ Angad Sandhu <55819847+angadsinghsandhu@users.noreply.github.com>
1061
+ Alexander Cockburn <alexander_cockburn12@hotmail.com>
1062
+ Yaser AlOsh <yaseralosh@outlook.com>
1063
+ Davide Sandonà <sandona.davide@gmail.com>
1064
+ Jonathan Gutow <gutow@uwosh.edu>
1065
+ Nihir Agarwal <f20180701@pilani.bits-pilani.ac.in>
1066
+ Lee Johnston <lee.johnston.100@gmail.com>
1067
+ Zach Carmichael <20629897+craymichael@users.noreply.github.com>
1068
+ Vijairam Ganesh Moorthy <vijairamg@gmail.com>
1069
+ Hanspeter Schmid <hanspeter.schmid@fhnw.ch>
1070
+ Ben Oostendorp <oostben@umich.edu>
1071
+ Nikita <nikita.student.cse19@itbhu.ac.in>
1072
+ Aman <amanmourya295@gmail.com>
1073
+ Shashank KS <shashankks0987@gmail.com>
1074
+ Aman Sharma <amansharma110603@gmail.com>
1075
+ Anup Parikh <parikhanupk@gmail.com>
1076
+ Lucy Mountain <lucymountain1@icloud.com>
1077
+ Miguel Torres Costa <miguelptcosta1995@gmail.com>
1078
+ Rikard Nordgren <rikard.nordgren@farmaci.uu.se>
1079
+ Arun sanganal <74652697+ArunSanganal@users.noreply.github.com>
1080
+ Kamlesh Joshi <72374645+kamleshjoshi8102@users.noreply.github.com>
1081
+ Joseph Rance <56409230+Joseph-Rance@users.noreply.github.com>
1082
+ Huangduirong <huangduirong@huawei.com>
1083
+ Nils Schulte <47043622+Schnilz@users.noreply.github.com>
1084
+ Matt Bogosian <matt@bogosian.net>
1085
+ Elisha Hollander <just4now666666@gmail.com>
1086
+ Aditya Ravuri <infprobscix@gmail.com>
1087
+ Mamidi Ratna Praneeth <praneethratna@gmail.com>
1088
+ Jeffrey Ryan <jeffaryan7@gmail.com>
1089
+ Jonathan Daniel <36337649+jond01@users.noreply.github.com>
1090
+ Robin Richard <raisin@ecomail.fr>
1091
+ Gautam Menghani <gum3ng@protonmail.com>
1092
+ Remco de Boer <29308176+redeboer@users.noreply.github.com>
1093
+ Sebastian East <sebastianeast@ymail.com>
1094
+ Evani Balasubramanyam <balasubramanyam.evani@gmail.com>
1095
+ Rahil Parikh <r.parikh@somaiya.edu>
1096
+ Jason Ross <jasonross1024@gmail.com>
1097
+ Joannah Nanjekye <joannah.nanjekye@ibm.com>
1098
+ Ayush Kumar <ayushk7102@gmail.com>
1099
+ Kshitij <kshitijparwani.mat18@itbhu.ac.in>
1100
+ Daniel Hyams <dhyams@gmail.com>
1101
+ alijosephine <alijosephine@gmail.com>
1102
+ Matthias Köppe <mkoeppe@math.ucdavis.edu>
1103
+ mohajain <mohajain99@gmail.com>
1104
+ Anibal M. Medina-Mardones <ammedmar@gmail.com>
1105
+ Travis Ens <ens.travis@gmail.com>
1106
+ Evgenia Karunus <lakesare@gmail.com>
1107
+ Risiraj Dey <risirajdey@gmail.com>
1108
+ lastcodestanding <rohang71604@gmail.com>
1109
+ Andrey Lekar <andrey_lekar@adoriasoft.com>
1110
+ Abbas Mohammed <42001049+iam-abbas@users.noreply.github.com>
1111
+ Anutosh Bhat <andersonbhat491@gmail.com>
1112
+ Steve Kieffer <sk@skieffer.info>
1113
+ Paul Spiering <paul@spiering.org>
1114
+ Pieter Gijsbers <p.gijsbers@tue.nl>
1115
+ Wang Ran (汪然) <wangr@smail.nju.edu.cn>
1116
+ naelsondouglas <naelson17@gmail.com>
1117
+ Aman Thakur <thakuraman22july@gmail.com>
1118
+ S. Hanko <suzy.hanko@gmail.com>
1119
+ Dennis Sweeney <sweeney.427@osu.edu>
1120
+ Gurpartap Singh <dhaliwal.gurpartap@gmail.com>
1121
+ Hampus Malmberg <hampus.malmberg88@gmail.com>
1122
+ scimax <max.kellermeier@hotmail.de>
1123
+ Nikhil Date <nikhil.s.date@gmail.com>
1124
+ Kuldeep Borkar Jr <kuldeepborkarjr765@gmail.com>
1125
+ AkuBrain <76952313+Franck2111@users.noreply.github.com>
1126
+ Leo Battle <leowbattle@gmail.com>
1127
+ Advait Pote <apote2050@gmail.com>
1128
+ Anurag Bhat <bhat.1@iitj.ac.in>
1129
+ Jeremy Monat <jemonat@calalum.org>
1130
+ Diane Tchuindjo <dtchuindjo@gmail.com>
1131
+ Tom Fryers <61272761+TomFryers@users.noreply.github.com>
1132
+ Zouhair <zouhair.mahboubi@gmail.com>
1133
+ zzj <29055749+zjzh@users.noreply.github.com>
1134
+ shubhayu09 <guptashubhayu601@gmail.com>
1135
+ Siddhant Jain <siddhantashoknagar@gmail.com>
1136
+ Tirthankar Mazumder <63574588+wermos@users.noreply.github.com>
1137
+ Sumit Kumar <mr.sumitkrr@gmail.com>
1138
+ Shivam Sagar <technoshivam12@gmail.com>
1139
+ Gaurav Jain <gjain369@gmail.com>
1140
+ Andrii Oriekhov <andriyorehov@gmail.com>
1141
+ Luis Talavera <luisfertalavera15@gmail.com>
1142
+ Arie Bovenberg <a.c.bovenberg@gmail.com>
1143
+ Carson McManus <carson.mcmanus1@gmail.com>
1144
+ Jack Schmidt <1107865+jackschmidt@users.noreply.github.com>
1145
+ Riley Britten <nrb1324@hotmail.com>
1146
+ Georges Khaznadar <georgesk@debian.org>
1147
+ Donald Wilson <donwilson1029@gmail.com>
1148
+ Timo Stienstra <timostienstra00@gmail.com>
1149
+ dispasha <dispasha@users.noreply.github.com>
1150
+ Saksham Alok <sakshamalok13@gmail.com>
1151
+ Varenyam Bhardwaj <varenyambhardwaj123@gmail.com>
1152
+ oittaa <8972248+oittaa@users.noreply.github.com>
1153
+ Omkaar <79257339+Pysics@users.noreply.github.com>
1154
+ Islem BOUZENIA <fi_bouzenia@esi.dz>
1155
+ extraymond <extraymond@gmail.com>
1156
+ Alexander Behrens <alex.git@gmx.net>
1157
+ user202729 <25191436+user202729@users.noreply.github.com>
1158
+ Pieter Eendebak <pieter.eendebak@gmail.com>
1159
+ Zaz Brown <zazbrown@zazbrown.com>
1160
+ ritikBhandari <ritikbhandari68@gmail.com>
1161
+ viocha <66580331+viocha@users.noreply.github.com>
1162
+ Arthur Ryman <arthur.ryman@gmail.com>
1163
+ Xiang Wu <hsiangwu@fb.com>
1164
+ tttc3 <T.Coxon2@lboro.ac.uk>
1165
+ Seth Poulsen <poulsenseth@yahoo.com>
1166
+ cocolato <haiizhu@outlook.com>
1167
+ Anton Golovanov <agolovanov256@gmail.com>
1168
+ Gareth Ma <grhkm21@gmail.com>
1169
+ Clément M.T. Robert <cr52@protonmail.com>
1170
+ Glenn Horton-Smith <glenn.hortonsmith@gmail.com>
1171
+ Karan <grgkaran03@gmail.com>
1172
+ Stefan Behnle <84378403+behnle@users.noreply.github.com>
1173
+ Shreyash Mishra <72146041+Shreyash-cyber@users.noreply.github.com>
1174
+ Arthur Milchior <arthur@milchior.fr>
1175
+ NotWearingPants <26556598+NotWearingPants@users.noreply.github.com>
1176
+ Ishan Pandhare <ishan9096137017@gmail.com>
1177
+ Carlos García Montoro <TrilceAC@gmail.com>
1178
+ Parcly Taxel <reddeloostw@gmail.com>
1179
+ Saicharan <saicharanhahaha@gmail.com>
1180
+ Kunal Sheth <kunal@kunalsheth.info>
1181
+ Biswadeep Purkayastha <98874428+metabiswadeep@users.noreply.github.com>
1182
+ Jyn Spring 琴春 <me@vx.st>
1183
+ Phil LeMaitre <phil_lemaitre@live.ca>
1184
+ Chris Kerr <chris.kerr@mykolab.ch>
1185
+ José Senart <jose.senart@gmail.com>
1186
+ Uwe L. Korn <uwelk@xhochy.com>
1187
+ ForeverHaibara <69423537+ForeverHaibara@users.noreply.github.com>
1188
+ Yves Tumushimire <yvestumushimire@gmail.com>
1189
+ wookie184 <wookie1840@gmail.com>
1190
+ Costor <pcs2009@web.de>
1191
+ Klaus Rettinghaus <klaus.rettinghaus@enote.com>
1192
+ Sam Brockie <sambrockie@icloud.com>
1193
+ Abhishek Patidar <1e9abhi1e10@gmail.com>
1194
+ Eric Demer <demer@mailbox.org>
1195
+ Pontus von Brömssen <pontus.vonbromssen+github@gmail.com>
1196
+ Victor Immanuel <chrollolucilfer1402@gmail.com>
1197
+ Evandro Bernardes <evbernardes@gmail.com>
1198
+ Michele Ceccacci <michelececcacci1@gmail.com>
1199
+ Ayush Aryan <ayush.aryan71@gmail.com>
1200
+ Kishore Gopalakrishnan <kishore96@gmail.com>
1201
+ Jan-Philipp Hoffmann <sonntagsgesicht@icloud.com>
1202
+ Daiki Takahashi <haru.td@gmail.com>
1203
+ Sayan Mitra <ee18b156@smail.iitm.ac.in>
1204
+ Aman Kumar Shukla <theprofessionalaman@gmail.com>
1205
+ Zoufiné Lauer-Baré <raszoufine@gmail.com>
1206
+ Charles Harris <erdos4d@gmail.com>
1207
+ Tejaswini Sanapathi <sastejaswini2002@gmail.com>
1208
+ Devansh <be19b002@smail.iitm.ac.in>
1209
+ Aaron Gokaslan <aaronGokaslan@gmail.com>
1210
+ Daan Koning (he/him) <daanolivierkoning@gmail.com>
1211
+ Steven Burns <royalstream@hotmail.com>
1212
+ Jay Patankar <patankarjays@gmail.com>
1213
+ Vivek Soni <sonisheela1977@gmail.com>
1214
+ Le Cong Minh Hieu <hieu.lecongminh@gmail.com>
1215
+ Sam Ritchie <sam@mentat.org>
1216
+ Maciej Skórski <maciej.skorski@gmail.com>
1217
+ Tilo Reneau-Cardoso <tiloreneau@gmail.com>
1218
+ Laurence Warne <laurencewarne@gmail.com>
1219
+ Lukas Molleman <Lukas.Molleman@gmail.com>
1220
+ Konstantinos Riganas <kostasriganas24@gmail.com>
1221
+ Grace Su <grace.duansu@gmail.com>
1222
+ Pedro Rosa <pedro_sxbr@usp.br>
1223
+ Abhinav Cillanki <abhinavcillanki@kgpian.iitkgp.ac.in>
1224
+ Baiyuan Qiu <1061688677@qq.com>
1225
+ Liwei Cai <cai.lw123@gmail.com>
1226
+ Daniel Weindl <daniel.weindl@helmholtz-muenchen.de>
1227
+ Isidora Araya <iarayaday@gmail.com>
1228
+ Seb Tiburzio <sebtiburzio@gmail.com>
1229
+ Victory Omole <vtomole2@gmail.com>
1230
+ Abhishek Chaudhary <ac5003@columbia.edu>
1231
+ Alexander Zhura <nice.zhura@list.ru>
1232
+ Shuai Zhou <shuaivzhou@berkeley.edu>
1233
+ Martin Manns <mmanns@gmx.net>
1234
+ John Möller <john.moller@outlook.com>
1235
+ zzc <1378113190@qq.com>
1236
+ Pablo Galindo Salgado <pablogsal@gmail.com>
1237
+ Johannes Kasimir <johannes.kasimir@math.lu.se>
1238
+ Theodore Dias <theodore.dias@hotmail.co.uk>
1239
+ Kaustubh <90597818+kaustubh-765@users.noreply.github.com>
1240
+ Idan Pazi <idan.kp@gmail.com>
1241
+ Bobby Palmer <bobbyp@umich.edu>
1242
+ Saikat Das <saikatdchhe@gmail.com>
1243
+ Suman mondal <smondal.qwerty@gmail.com>
1244
+ Taylan Sahin <info@taylansahin.net>
1245
+ Fabio Luporini <fabio@devitocodes.com>
1246
+ Oriel Malihi <orielmalihi1@gmail.com>
1247
+ Geetika Vadali <geetika.vadali4@gmail.com>
1248
+ Matthias Rettl <matthias.rettl@stud.unileoben.ac.at>
1249
+ Mikhail Remnev <maremnev@gmail.com>
1250
+ philwillnyc <56197213+philwillnyc@users.noreply.github.com>
1251
+ Raphael Lehner <raphael.lehner@gmail.com>
1252
+ Harry Mountain <harrymountain1@icloud.com>
1253
+ Bhavik Sachdev <b.sachdev1904@gmail.com>
1254
+ 袁野 (Yuan Ye) <yuanyelele@tutanota.com>
1255
+ fazledyn-or <ataf@openrefactory.com>
1256
+ mohammedouahman <simofun85@gmail.com>
1257
+ K. Kraus <laqueray@googlemail.com>
1258
+ Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
1259
+ platypus <platypus.computerchip@gmail.com>
1260
+ codecruisader <nnisarg55@gmail.com>
1261
+ James Whitehead <whiteheadj@gmail.com>
1262
+ atharvParlikar <atharvparlikar@gmail.com>
1263
+ Ivan Petukhov <satels@gmail.com>
1264
+ Augusto Borges <borges.augustoar@gmail.com>
1265
+ Han Wei Ang <ang.h.w@u.nus.edu>
1266
+ Congxu Yang <u7189828@anu.edu.au>
1267
+ Saicharan <62512681+saicharan2804@users.noreply.github.com>
1268
+ Arnab Nandi <arnabnandi2002@gmail.com>
1269
+ Harrison Oates <48871176+HarrisonOates@users.noreply.github.com>
1270
+ Corey Cerovsek <corey@cerovsek.com>
1271
+ Harsh Kasat <hkasat@waymore.io>
1272
+ omahs <73983677+omahs@users.noreply.github.com>
1273
+ Pascal Gitz <pascal.gitz@hotmail.ch>
1274
+ Ravindu-Hirimuthugoda <ravindu.18@cse.mrt.ac.lk>
1275
+ Sophia Pustova <tripplezzed@gmail.com>
1276
+ George Pittock <gpittock4@gmail.com>
1277
+ Warren Jacinto <warrenjacinto@gmail.com>
1278
+ Sachin Singh <sachinishu02@gmail.com>
1279
+ Zedmat <104870914+harshkasat@users.noreply.github.com>
1280
+ Soumendra Ganguly <soumendraganguly@gmail.com>
1281
+ Samith Karunathilake <55777141+samithkavishke@users.noreply.github.com>
1282
+ Viraj Vekaria <virajv5593@gmail.com>
1283
+ Shishir Kushwaha <kushwahashishir1112@gmail.com>
1284
+ Ankit Kumar Singh <ankitdiswar10@gmail.com>
1285
+ Abhishek Kumar <abhishek.nitdelhi@gmail.com>
1286
+ Mohak Malviya <mohakmalviya2000@gmail.com>
1287
+ Matthias Liesenfeld <116307294+maliesen@users.noreply.github.com>
1288
+ dodo <palumbododo@gmail.com>
1289
+ Mohamed Rezk <mohrizq895@gmail.com>
1290
+ Tommaso Vaccari <05-gesto-follemente@icloud.com>
1291
+ Alexis Schotte <alexis.schotte@gmail.com>
1292
+ Lauren Yim <31467609+cherryblossom000@users.noreply.github.com>
1293
+ Prey Patel <patel.prey@iitgn.ac.in>
1294
+ Riccardo Di Girolamo <riccardodigirolamo01@gmail.com>
1295
+ Abhishek kumar <kumar325571@gmail.com>
1296
+ Sam Lubelsky <sammy56lt@gmail.com>
1297
+ Henrique Soares <henrique.c.soares@tecnico.ulisboa.pt>
1298
+ Vladimir Sereda <voffch@gmail.com>
1299
+ Hwayeon Kang <hwayeonniii@gmail.com>
1300
+ Raj Sapale <raj4sapale4@gmail.com>
1301
+ Gerald Teschl <gerald.teschl@univie.ac.at>
1302
+ Richard Samuel <98638849+samuelard7@users.noreply.github.com>
1303
+ HeeJae Chang <hechang@microsoft.com>
1304
+ Nick Harder <nharder@umich.edu>
1305
+ Ethan DeGuire <ethandeguire@gmail.com>
1306
+ Lorenz Winkler <lorenz.winkler@tuwien.ac.at>
1307
+ Richard Rodenbusch <rrodenbusch@gmail.com>
1308
+ Zhenxu Zhu <xzdlj@outlook.com>
1309
+ Mark van Gelder <m.j.vangelder@student.tudelft.nl>
1310
+ Mark van Gelder <mvgmvgmvg@live.com>
1311
+ Ishan Pandhare <91841626+Ishanned@users.noreply.github.com>
1312
+ James A. Preiss <jamesalanpreiss@gmail.com>
1313
+ Emile Fourcini <emile.fourcin1@gmail.com>
1314
+ Alberto Jiménez Ruiz <Alberto.Jimenez@uclm.es>
1315
+ João Bravo <joaocgbravo@tecnico.ulisboa.pt>
1316
+ Dean Price <dean1357price1357@gmail.com>
1317
+ Edward Z. Yang <ezyang@mit.edu>
1318
+ James Titus <titusjames299@gmail.com>
1319
+ Zhuoyuan Li <zy.li@stu.pku.edu.cn>
1320
+ Hugo Kerstens <hugo@kerstens.me>
1321
+ Jan Jancar <johny@neuromancer.sk>
1322
+ Andrew Mosson <amosson@yahoo.com>
1323
+ Marek Madejski <marekmadejski@yandex.com>
1324
+ Gonzalo Tornaría <tornaria@cmat.edu.uy>
1325
+ Peter Stahlecker <peter.stahlecker@gmail.com>
1326
+ Jean-François B <2589111+jfbu@users.noreply.github.com>
1327
+ Zexuan Zhou (Bruce) <zzx498636727@gmail.com>
1328
+ George Frolov <gosha@fro.lv>
1329
+ Corbet Elkins <corbet286@gmail.com>
1330
+ Håkon Kvernmoen <haakon.kvernmoen@gmail.com>
1331
+ Muhammad Maaz <mmaaz6004@gmail.com>
1332
+ Shishir Kushwaha <138311586+shishir-11@users.noreply.github.com>
1333
+ Matt Wang <mattwang44@gmail.com>
1334
+ bharatAmeria <21001019007@jcboseust.ac.in>
1335
+ Amir Ebrahimi <github@aebrahimi.com>
1336
+ Steven Esquea <steven.esquea@irreverente.net>
1337
+ Rishabh Kamboj <111004091+VectorNd@users.noreply.github.com>
1338
+ Aasim Ali <aasim250205@gmail.com>
1339
+ Ivan A. Melnikov <iv@altlinux.org>
1340
+ Borek Saheli <boreksaheli@gmail.com>
1341
+ Guido Roncarolo <guido.roncarolo@gmail.com>
1342
+ Quek Zi Yao <ziyaoqzy2001@gmail.com>
1343
+ Roelof Rietbroek <r.rietbroek@utwente.nl>
1344
+ MostafaGalal1 <mostafag649.mg@gmail.com>
1345
+ Au Huishan <huishan_au@outlook.com>
1346
+ Kris Katterjohn <katterjohn@gmail.com>
1347
+ Shiyao Guo <mivikq@gmail.com>
1348
+ Rushabh Mehta <mehtarushabh2005@gmail.com>
1349
+ Temiloluwa Yusuf ytemiloluwa@gmail.com ytemiloluwa <ytemiloluwa@gmail.com>
1350
+ Davi Laerte <davilae011@gmail.com>
1351
+ Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com>
1352
+ Harshit Gupta <harshithigh2001@gmail.com>
1353
+ Praveen Perumal <ppraveen98841@gmail.com>
1354
+ Kevin McWhirter <klmcw@yahoo.com>
1355
+ Prayag V <v.prayag2005@gmail.com>
1356
+ Lucas Kletzander <lucas.kletzander@gmail.com>
1357
+ Pratyksh Gupta <pratykshgupta9999@gmail.com>
1358
+ Leonardo Mangani <leomangani4@gmail.com>
1359
+ Karan Anand <anandkarancompsci@gmail.com>
1360
+ Gagan Mishra <simonsimple305@gmail.com>
1361
+ Krishnav Bajoria <bajoriakrishnav@gmail.com>
1362
+ Matt Ord <matthew.ord1@gmail.com>
1363
+ Jatin Bhardwaj <bhardwajjatin093@gmail.com>
1364
+ Prashant Tandon <tandonprashant101@gmail.com>
1365
+ Paramjit Singh <paramjit1071@gmail.com>
1366
+ João Rodrigues <abcjoao@hotmail.com>
1367
+ Alejandro García Prada <114813960+AlexGarciaPrada@users.noreply.github.com>
1368
+ Matthew Treinish <mtreinish@kortar.org>
1369
+ Clayton Rabideau <claytonrabideau@gmail.com>
1370
+ Victoria Koval <bictoriakoval16@gmail.com>
1371
+ Voaides Negustor Robert <134785947+voaidesr@users.noreply.github.com>
1372
+ Ovsk Mendov <bbb23exposed@gmail.com>
1373
+ David Brooks <dave@bcs.co.nz>
1374
+ Nicholas Laustrup <124007393+nicklaustrup@users.noreply.github.com>
1375
+ Harikrishna Srinivasan <harikrishnasri3@gmail.com>
1376
+ Mathis Cros <mathis.cros@telecom-paris.fr>
1377
+ Arnav Mummineni <45217840+RCoder01@users.noreply.github.com>
1378
+ Thangaraju Sibiraj <85477603+t-sibiraj@users.noreply.github.com>
1379
+ KJaybhaye <krushnajaybhaye01@gmail.com>
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy-1.14.0.dist-info/licenses/LICENSE ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2006-2023 SymPy Development Team
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ a. Redistributions of source code must retain the above copyright notice,
9
+ this list of conditions and the following disclaimer.
10
+ b. Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+ c. Neither the name of SymPy nor the names of its contributors
14
+ may be used to endorse or promote products derived from this software
15
+ without specific prior written permission.
16
+
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
+ ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
22
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
28
+ DAMAGE.
29
+
30
+ --------------------------------------------------------------------------------
31
+
32
+ Patches that were taken from the Diofant project (https://github.com/diofant/diofant)
33
+ are licensed as:
34
+
35
+ Copyright (c) 2006-2018 SymPy Development Team,
36
+ 2013-2023 Sergey B Kirpichev
37
+
38
+ All rights reserved.
39
+
40
+ Redistribution and use in source and binary forms, with or without
41
+ modification, are permitted provided that the following conditions are met:
42
+
43
+ a. Redistributions of source code must retain the above copyright notice,
44
+ this list of conditions and the following disclaimer.
45
+ b. Redistributions in binary form must reproduce the above copyright
46
+ notice, this list of conditions and the following disclaimer in the
47
+ documentation and/or other materials provided with the distribution.
48
+ c. Neither the name of Diofant or SymPy nor the names of its contributors
49
+ may be used to endorse or promote products derived from this software
50
+ without specific prior written permission.
51
+
52
+
53
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
54
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
55
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
56
+ ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
57
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
58
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
59
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
60
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
61
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
62
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
63
+ DAMAGE.
64
+
65
+ --------------------------------------------------------------------------------
66
+
67
+ Submodules taken from the multipledispatch project (https://github.com/mrocklin/multipledispatch)
68
+ are licensed as:
69
+
70
+ Copyright (c) 2014 Matthew Rocklin
71
+
72
+ All rights reserved.
73
+
74
+ Redistribution and use in source and binary forms, with or without
75
+ modification, are permitted provided that the following conditions are met:
76
+
77
+ a. Redistributions of source code must retain the above copyright notice,
78
+ this list of conditions and the following disclaimer.
79
+ b. Redistributions in binary form must reproduce the above copyright
80
+ notice, this list of conditions and the following disclaimer in the
81
+ documentation and/or other materials provided with the distribution.
82
+ c. Neither the name of multipledispatch nor the names of its contributors
83
+ may be used to endorse or promote products derived from this software
84
+ without specific prior written permission.
85
+
86
+
87
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
88
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
89
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
90
+ ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
91
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
92
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
93
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
94
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
95
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
96
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
97
+ DAMAGE.
98
+
99
+ --------------------------------------------------------------------------------
100
+
101
+ The files under the directory sympy/parsing/autolev/tests/pydy-example-repo
102
+ are directly copied from PyDy project and are licensed as:
103
+
104
+ Copyright (c) 2009-2023, PyDy Authors
105
+ All rights reserved.
106
+
107
+ Redistribution and use in source and binary forms, with or without
108
+ modification, are permitted provided that the following conditions are met:
109
+
110
+ * Redistributions of source code must retain the above copyright
111
+ notice, this list of conditions and the following disclaimer.
112
+ * Redistributions in binary form must reproduce the above copyright
113
+ notice, this list of conditions and the following disclaimer in the
114
+ documentation and/or other materials provided with the distribution.
115
+ * Neither the name of this project nor the names of its contributors may be
116
+ used to endorse or promote products derived from this software without
117
+ specific prior written permission.
118
+
119
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
120
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
121
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
122
+ DISCLAIMED. IN NO EVENT SHALL PYDY AUTHORS BE LIABLE FOR ANY DIRECT,
123
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
124
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
125
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
126
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
127
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
128
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
129
+
130
+ --------------------------------------------------------------------------------
131
+
132
+ The files under the directory sympy/parsing/latex
133
+ are directly copied from latex2sympy project and are licensed as:
134
+
135
+ Copyright 2016, latex2sympy
136
+
137
+ Permission is hereby granted, free of charge, to any person obtaining a copy
138
+ of this software and associated documentation files (the "Software"), to deal
139
+ in the Software without restriction, including without limitation the rights
140
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
141
+ copies of the Software, and to permit persons to whom the Software is
142
+ furnished to do so, subject to the following conditions:
143
+
144
+ The above copyright notice and this permission notice shall be included in all
145
+ copies or substantial portions of the Software.
146
+
147
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
148
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
149
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
150
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
151
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
152
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
153
+ SOFTWARE.
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy-1.14.0.dist-info/top_level.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ isympy
2
+ sympy
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_piab.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Tests for piab.py"""
2
+
3
+ from sympy.core.numbers import pi
4
+ from sympy.core.singleton import S
5
+ from sympy.core.symbol import symbols
6
+ from sympy.functions.elementary.miscellaneous import sqrt
7
+ from sympy.functions.elementary.trigonometric import sin
8
+ from sympy.sets.sets import Interval
9
+ from sympy.functions.special.tensor_functions import KroneckerDelta
10
+ from sympy.physics.quantum import L2, qapply, hbar, represent
11
+ from sympy.physics.quantum.piab import PIABHamiltonian, PIABKet, PIABBra, m, L
12
+
13
+ i, j, n, x = symbols('i j n x')
14
+
15
+
16
+ def test_H():
17
+ assert PIABHamiltonian('H').hilbert_space == \
18
+ L2(Interval(S.NegativeInfinity, S.Infinity))
19
+ assert qapply(PIABHamiltonian('H')*PIABKet(n)) == \
20
+ (n**2*pi**2*hbar**2)/(2*m*L**2)*PIABKet(n)
21
+
22
+
23
+ def test_states():
24
+ assert PIABKet(n).dual_class() == PIABBra
25
+ assert PIABKet(n).hilbert_space == \
26
+ L2(Interval(S.NegativeInfinity, S.Infinity))
27
+ assert represent(PIABKet(n)) == sqrt(2/L)*sin(n*pi*x/L)
28
+ assert (PIABBra(i)*PIABKet(j)).doit() == KroneckerDelta(i, j)
29
+ assert PIABBra(n).dual_class() == PIABKet
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_printing.py ADDED
@@ -0,0 +1,900 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- encoding: utf-8 -*-
2
+ """
3
+ TODO:
4
+ * Address Issue 2251, printing of spin states
5
+ """
6
+ from __future__ import annotations
7
+ from typing import Any
8
+
9
+ from sympy.physics.quantum.anticommutator import AntiCommutator
10
+ from sympy.physics.quantum.cg import CG, Wigner3j, Wigner6j, Wigner9j
11
+ from sympy.physics.quantum.commutator import Commutator
12
+ from sympy.physics.quantum.constants import hbar
13
+ from sympy.physics.quantum.dagger import Dagger
14
+ from sympy.physics.quantum.gate import CGate, CNotGate, IdentityGate, UGate, XGate
15
+ from sympy.physics.quantum.hilbert import ComplexSpace, FockSpace, HilbertSpace, L2
16
+ from sympy.physics.quantum.innerproduct import InnerProduct
17
+ from sympy.physics.quantum.operator import Operator, OuterProduct, DifferentialOperator
18
+ from sympy.physics.quantum.qexpr import QExpr
19
+ from sympy.physics.quantum.qubit import Qubit, IntQubit
20
+ from sympy.physics.quantum.spin import Jz, J2, JzBra, JzBraCoupled, JzKet, JzKetCoupled, Rotation, WignerD
21
+ from sympy.physics.quantum.state import Bra, Ket, TimeDepBra, TimeDepKet
22
+ from sympy.physics.quantum.tensorproduct import TensorProduct
23
+ from sympy.physics.quantum.sho1d import RaisingOp
24
+
25
+ from sympy.core.function import (Derivative, Function)
26
+ from sympy.core.numbers import oo
27
+ from sympy.core.power import Pow
28
+ from sympy.core.singleton import S
29
+ from sympy.core.symbol import (Symbol, symbols)
30
+ from sympy.matrices.dense import Matrix
31
+ from sympy.sets.sets import Interval
32
+ from sympy.testing.pytest import XFAIL
33
+
34
+ # Imports used in srepr strings
35
+ from sympy.physics.quantum.spin import JzOp
36
+
37
+ from sympy.printing import srepr
38
+ from sympy.printing.pretty import pretty as xpretty
39
+ from sympy.printing.latex import latex
40
+
41
+ MutableDenseMatrix = Matrix
42
+
43
+
44
+ ENV: dict[str, Any] = {}
45
+ exec('from sympy import *', ENV)
46
+ exec('from sympy.physics.quantum import *', ENV)
47
+ exec('from sympy.physics.quantum.cg import *', ENV)
48
+ exec('from sympy.physics.quantum.spin import *', ENV)
49
+ exec('from sympy.physics.quantum.hilbert import *', ENV)
50
+ exec('from sympy.physics.quantum.qubit import *', ENV)
51
+ exec('from sympy.physics.quantum.qexpr import *', ENV)
52
+ exec('from sympy.physics.quantum.gate import *', ENV)
53
+ exec('from sympy.physics.quantum.constants import *', ENV)
54
+
55
+
56
+ def sT(expr, string):
57
+ """
58
+ sT := sreprTest
59
+ from sympy/printing/tests/test_repr.py
60
+ """
61
+ assert srepr(expr) == string
62
+ assert eval(string, ENV) == expr
63
+
64
+
65
+ def pretty(expr):
66
+ """ASCII pretty-printing"""
67
+ return xpretty(expr, use_unicode=False, wrap_line=False)
68
+
69
+
70
+ def upretty(expr):
71
+ """Unicode pretty-printing"""
72
+ return xpretty(expr, use_unicode=True, wrap_line=False)
73
+
74
+
75
+ def test_anticommutator():
76
+ A = Operator('A')
77
+ B = Operator('B')
78
+ ac = AntiCommutator(A, B)
79
+ ac_tall = AntiCommutator(A**2, B)
80
+ assert str(ac) == '{A,B}'
81
+ assert pretty(ac) == '{A,B}'
82
+ assert upretty(ac) == '{A,B}'
83
+ assert latex(ac) == r'\left\{A,B\right\}'
84
+ sT(ac, "AntiCommutator(Operator(Symbol('A')),Operator(Symbol('B')))")
85
+ assert str(ac_tall) == '{A**2,B}'
86
+ ascii_str = \
87
+ """\
88
+ / 2 \\\n\
89
+ <A ,B>\n\
90
+ \\ /\
91
+ """
92
+ ucode_str = \
93
+ """\
94
+ ⎧ 2 ⎫\n\
95
+ ⎨A ,B⎬\n\
96
+ ⎩ ⎭\
97
+ """
98
+ assert pretty(ac_tall) == ascii_str
99
+ assert upretty(ac_tall) == ucode_str
100
+ assert latex(ac_tall) == r'\left\{A^{2},B\right\}'
101
+ sT(ac_tall, "AntiCommutator(Pow(Operator(Symbol('A')), Integer(2)),Operator(Symbol('B')))")
102
+
103
+
104
+ def test_cg():
105
+ cg = CG(1, 2, 3, 4, 5, 6)
106
+ wigner3j = Wigner3j(1, 2, 3, 4, 5, 6)
107
+ wigner6j = Wigner6j(1, 2, 3, 4, 5, 6)
108
+ wigner9j = Wigner9j(1, 2, 3, 4, 5, 6, 7, 8, 9)
109
+ assert str(cg) == 'CG(1, 2, 3, 4, 5, 6)'
110
+ ascii_str = \
111
+ """\
112
+ 5,6 \n\
113
+ C \n\
114
+ 1,2,3,4\
115
+ """
116
+ ucode_str = \
117
+ """\
118
+ 5,6 \n\
119
+ C \n\
120
+ 1,2,3,4\
121
+ """
122
+ assert pretty(cg) == ascii_str
123
+ assert upretty(cg) == ucode_str
124
+ assert latex(cg) == 'C^{5,6}_{1,2,3,4}'
125
+ assert latex(cg ** 2) == R'\left(C^{5,6}_{1,2,3,4}\right)^{2}'
126
+ sT(cg, "CG(Integer(1), Integer(2), Integer(3), Integer(4), Integer(5), Integer(6))")
127
+ assert str(wigner3j) == 'Wigner3j(1, 2, 3, 4, 5, 6)'
128
+ ascii_str = \
129
+ """\
130
+ /1 3 5\\\n\
131
+ | |\n\
132
+ \\2 4 6/\
133
+ """
134
+ ucode_str = \
135
+ """\
136
+ ⎛1 3 5⎞\n\
137
+ ⎜ ⎟\n\
138
+ ⎝2 4 6⎠\
139
+ """
140
+ assert pretty(wigner3j) == ascii_str
141
+ assert upretty(wigner3j) == ucode_str
142
+ assert latex(wigner3j) == \
143
+ r'\left(\begin{array}{ccc} 1 & 3 & 5 \\ 2 & 4 & 6 \end{array}\right)'
144
+ sT(wigner3j, "Wigner3j(Integer(1), Integer(2), Integer(3), Integer(4), Integer(5), Integer(6))")
145
+ assert str(wigner6j) == 'Wigner6j(1, 2, 3, 4, 5, 6)'
146
+ ascii_str = \
147
+ """\
148
+ /1 2 3\\\n\
149
+ < >\n\
150
+ \\4 5 6/\
151
+ """
152
+ ucode_str = \
153
+ """\
154
+ ⎧1 2 3⎫\n\
155
+ ⎨ ⎬\n\
156
+ ⎩4 5 6⎭\
157
+ """
158
+ assert pretty(wigner6j) == ascii_str
159
+ assert upretty(wigner6j) == ucode_str
160
+ assert latex(wigner6j) == \
161
+ r'\left\{\begin{array}{ccc} 1 & 2 & 3 \\ 4 & 5 & 6 \end{array}\right\}'
162
+ sT(wigner6j, "Wigner6j(Integer(1), Integer(2), Integer(3), Integer(4), Integer(5), Integer(6))")
163
+ assert str(wigner9j) == 'Wigner9j(1, 2, 3, 4, 5, 6, 7, 8, 9)'
164
+ ascii_str = \
165
+ """\
166
+ /1 2 3\\\n\
167
+ | |\n\
168
+ <4 5 6>\n\
169
+ | |\n\
170
+ \\7 8 9/\
171
+ """
172
+ ucode_str = \
173
+ """\
174
+ ⎧1 2 3⎫\n\
175
+ ⎪ ⎪\n\
176
+ ⎨4 5 6⎬\n\
177
+ ⎪ ⎪\n\
178
+ ⎩7 8 9⎭\
179
+ """
180
+ assert pretty(wigner9j) == ascii_str
181
+ assert upretty(wigner9j) == ucode_str
182
+ assert latex(wigner9j) == \
183
+ r'\left\{\begin{array}{ccc} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{array}\right\}'
184
+ sT(wigner9j, "Wigner9j(Integer(1), Integer(2), Integer(3), Integer(4), Integer(5), Integer(6), Integer(7), Integer(8), Integer(9))")
185
+
186
+
187
+ def test_commutator():
188
+ A = Operator('A')
189
+ B = Operator('B')
190
+ c = Commutator(A, B)
191
+ c_tall = Commutator(A**2, B)
192
+ assert str(c) == '[A,B]'
193
+ assert pretty(c) == '[A,B]'
194
+ assert upretty(c) == '[A,B]'
195
+ assert latex(c) == r'\left[A,B\right]'
196
+ sT(c, "Commutator(Operator(Symbol('A')),Operator(Symbol('B')))")
197
+ assert str(c_tall) == '[A**2,B]'
198
+ ascii_str = \
199
+ """\
200
+ [ 2 ]\n\
201
+ [A ,B]\
202
+ """
203
+ ucode_str = \
204
+ """\
205
+ ⎡ 2 ⎤\n\
206
+ ⎣A ,B⎦\
207
+ """
208
+ assert pretty(c_tall) == ascii_str
209
+ assert upretty(c_tall) == ucode_str
210
+ assert latex(c_tall) == r'\left[A^{2},B\right]'
211
+ sT(c_tall, "Commutator(Pow(Operator(Symbol('A')), Integer(2)),Operator(Symbol('B')))")
212
+
213
+
214
+ def test_constants():
215
+ assert str(hbar) == 'hbar'
216
+ assert pretty(hbar) == 'hbar'
217
+ assert upretty(hbar) == 'ℏ'
218
+ assert latex(hbar) == r'\hbar'
219
+ sT(hbar, "HBar()")
220
+
221
+
222
+ def test_dagger():
223
+ x = symbols('x', commutative=False)
224
+ expr = Dagger(x)
225
+ assert str(expr) == 'Dagger(x)'
226
+ ascii_str = \
227
+ """\
228
+ +\n\
229
+ x \
230
+ """
231
+ ucode_str = \
232
+ """\
233
+ †\n\
234
+ x \
235
+ """
236
+ assert pretty(expr) == ascii_str
237
+ assert upretty(expr) == ucode_str
238
+ assert latex(expr) == r'x^{\dagger}'
239
+ sT(expr, "Dagger(Symbol('x', commutative=False))")
240
+
241
+
242
+ @XFAIL
243
+ def test_gate_failing():
244
+ a, b, c, d = symbols('a,b,c,d')
245
+ uMat = Matrix([[a, b], [c, d]])
246
+ g = UGate((0,), uMat)
247
+ assert str(g) == 'U(0)'
248
+
249
+
250
+ def test_gate():
251
+ a, b, c, d = symbols('a,b,c,d')
252
+ uMat = Matrix([[a, b], [c, d]])
253
+ q = Qubit(1, 0, 1, 0, 1)
254
+ g1 = IdentityGate(2)
255
+ g2 = CGate((3, 0), XGate(1))
256
+ g3 = CNotGate(1, 0)
257
+ g4 = UGate((0,), uMat)
258
+ assert str(g1) == '1(2)'
259
+ assert pretty(g1) == '1 \n 2'
260
+ assert upretty(g1) == '1 \n 2'
261
+ assert latex(g1) == r'1_{2}'
262
+ sT(g1, "IdentityGate(Integer(2))")
263
+ assert str(g1*q) == '1(2)*|10101>'
264
+ ascii_str = \
265
+ """\
266
+ 1 *|10101>\n\
267
+ 2 \
268
+ """
269
+ ucode_str = \
270
+ """\
271
+ 1 ⋅❘10101⟩\n\
272
+ 2 \
273
+ """
274
+ assert pretty(g1*q) == ascii_str
275
+ assert upretty(g1*q) == ucode_str
276
+ assert latex(g1*q) == r'1_{2} {\left|10101\right\rangle }'
277
+ sT(g1*q, "Mul(IdentityGate(Integer(2)), Qubit(Integer(1),Integer(0),Integer(1),Integer(0),Integer(1)))")
278
+ assert str(g2) == 'C((3,0),X(1))'
279
+ ascii_str = \
280
+ """\
281
+ C /X \\\n\
282
+ 3,0\\ 1/\
283
+ """
284
+ ucode_str = \
285
+ """\
286
+ C ⎛X ⎞\n\
287
+ 3,0⎝ 1⎠\
288
+ """
289
+ assert pretty(g2) == ascii_str
290
+ assert upretty(g2) == ucode_str
291
+ assert latex(g2) == r'C_{3,0}{\left(X_{1}\right)}'
292
+ sT(g2, "CGate(Tuple(Integer(3), Integer(0)),XGate(Integer(1)))")
293
+ assert str(g3) == 'CNOT(1,0)'
294
+ ascii_str = \
295
+ """\
296
+ CNOT \n\
297
+ 1,0\
298
+ """
299
+ ucode_str = \
300
+ """\
301
+ CNOT \n\
302
+ 1,0\
303
+ """
304
+ assert pretty(g3) == ascii_str
305
+ assert upretty(g3) == ucode_str
306
+ assert latex(g3) == r'\text{CNOT}_{1,0}'
307
+ sT(g3, "CNotGate(Integer(1),Integer(0))")
308
+ ascii_str = \
309
+ """\
310
+ U \n\
311
+ 0\
312
+ """
313
+ ucode_str = \
314
+ """\
315
+ U \n\
316
+ 0\
317
+ """
318
+ assert str(g4) == \
319
+ """\
320
+ U((0,),Matrix([\n\
321
+ [a, b],\n\
322
+ [c, d]]))\
323
+ """
324
+ assert pretty(g4) == ascii_str
325
+ assert upretty(g4) == ucode_str
326
+ assert latex(g4) == r'U_{0}'
327
+ sT(g4, "UGate(Tuple(Integer(0)),ImmutableDenseMatrix([[Symbol('a'), Symbol('b')], [Symbol('c'), Symbol('d')]]))")
328
+
329
+
330
+ def test_hilbert():
331
+ h1 = HilbertSpace()
332
+ h2 = ComplexSpace(2)
333
+ h3 = FockSpace()
334
+ h4 = L2(Interval(0, oo))
335
+ assert str(h1) == 'H'
336
+ assert pretty(h1) == 'H'
337
+ assert upretty(h1) == 'H'
338
+ assert latex(h1) == r'\mathcal{H}'
339
+ sT(h1, "HilbertSpace()")
340
+ assert str(h2) == 'C(2)'
341
+ ascii_str = \
342
+ """\
343
+ 2\n\
344
+ C \
345
+ """
346
+ ucode_str = \
347
+ """\
348
+ 2\n\
349
+ C \
350
+ """
351
+ assert pretty(h2) == ascii_str
352
+ assert upretty(h2) == ucode_str
353
+ assert latex(h2) == r'\mathcal{C}^{2}'
354
+ sT(h2, "ComplexSpace(Integer(2))")
355
+ assert str(h3) == 'F'
356
+ assert pretty(h3) == 'F'
357
+ assert upretty(h3) == 'F'
358
+ assert latex(h3) == r'\mathcal{F}'
359
+ sT(h3, "FockSpace()")
360
+ assert str(h4) == 'L2(Interval(0, oo))'
361
+ ascii_str = \
362
+ """\
363
+ 2\n\
364
+ L \
365
+ """
366
+ ucode_str = \
367
+ """\
368
+ 2\n\
369
+ L \
370
+ """
371
+ assert pretty(h4) == ascii_str
372
+ assert upretty(h4) == ucode_str
373
+ assert latex(h4) == r'{\mathcal{L}^2}\left( \left[0, \infty\right) \right)'
374
+ sT(h4, "L2(Interval(Integer(0), oo, false, true))")
375
+ assert str(h1 + h2) == 'H+C(2)'
376
+ ascii_str = \
377
+ """\
378
+ 2\n\
379
+ H + C \
380
+ """
381
+ ucode_str = \
382
+ """\
383
+ 2\n\
384
+ H ⊕ C \
385
+ """
386
+ assert pretty(h1 + h2) == ascii_str
387
+ assert upretty(h1 + h2) == ucode_str
388
+ assert latex(h1 + h2)
389
+ sT(h1 + h2, "DirectSumHilbertSpace(HilbertSpace(),ComplexSpace(Integer(2)))")
390
+ assert str(h1*h2) == "H*C(2)"
391
+ ascii_str = \
392
+ """\
393
+ 2\n\
394
+ H x C \
395
+ """
396
+ ucode_str = \
397
+ """\
398
+ 2\n\
399
+ H ⨂ C \
400
+ """
401
+ assert pretty(h1*h2) == ascii_str
402
+ assert upretty(h1*h2) == ucode_str
403
+ assert latex(h1*h2)
404
+ sT(h1*h2,
405
+ "TensorProductHilbertSpace(HilbertSpace(),ComplexSpace(Integer(2)))")
406
+ assert str(h1**2) == 'H**2'
407
+ ascii_str = \
408
+ """\
409
+ x2\n\
410
+ H \
411
+ """
412
+ ucode_str = \
413
+ """\
414
+ ⨂2\n\
415
+ H \
416
+ """
417
+ assert pretty(h1**2) == ascii_str
418
+ assert upretty(h1**2) == ucode_str
419
+ assert latex(h1**2) == r'{\mathcal{H}}^{\otimes 2}'
420
+ sT(h1**2, "TensorPowerHilbertSpace(HilbertSpace(),Integer(2))")
421
+
422
+
423
+ def test_innerproduct():
424
+ x = symbols('x')
425
+ ip1 = InnerProduct(Bra(), Ket())
426
+ ip2 = InnerProduct(TimeDepBra(), TimeDepKet())
427
+ ip3 = InnerProduct(JzBra(1, 1), JzKet(1, 1))
428
+ ip4 = InnerProduct(JzBraCoupled(1, 1, (1, 1)), JzKetCoupled(1, 1, (1, 1)))
429
+ ip_tall1 = InnerProduct(Bra(x/2), Ket(x/2))
430
+ ip_tall2 = InnerProduct(Bra(x), Ket(x/2))
431
+ ip_tall3 = InnerProduct(Bra(x/2), Ket(x))
432
+ assert str(ip1) == '<psi|psi>'
433
+ assert pretty(ip1) == '<psi|psi>'
434
+ assert upretty(ip1) == '⟨ψ❘ψ⟩'
435
+ assert latex(
436
+ ip1) == r'\left\langle \psi \right. {\left|\psi\right\rangle }'
437
+ sT(ip1, "InnerProduct(Bra(Symbol('psi')),Ket(Symbol('psi')))")
438
+ assert str(ip2) == '<psi;t|psi;t>'
439
+ assert pretty(ip2) == '<psi;t|psi;t>'
440
+ assert upretty(ip2) == '⟨ψ;t❘ψ;t⟩'
441
+ assert latex(ip2) == \
442
+ r'\left\langle \psi;t \right. {\left|\psi;t\right\rangle }'
443
+ sT(ip2, "InnerProduct(TimeDepBra(Symbol('psi'),Symbol('t')),TimeDepKet(Symbol('psi'),Symbol('t')))")
444
+ assert str(ip3) == "<1,1|1,1>"
445
+ assert pretty(ip3) == '<1,1|1,1>'
446
+ assert upretty(ip3) == '⟨1,1❘1,1⟩'
447
+ assert latex(ip3) == r'\left\langle 1,1 \right. {\left|1,1\right\rangle }'
448
+ sT(ip3, "InnerProduct(JzBra(Integer(1),Integer(1)),JzKet(Integer(1),Integer(1)))")
449
+ assert str(ip4) == "<1,1,j1=1,j2=1|1,1,j1=1,j2=1>"
450
+ assert pretty(ip4) == '<1,1,j1=1,j2=1|1,1,j1=1,j2=1>'
451
+ assert upretty(ip4) == '⟨1,1,j₁=1,j₂=1❘1,1,j₁=1,j₂=1⟩'
452
+ assert latex(ip4) == \
453
+ r'\left\langle 1,1,j_{1}=1,j_{2}=1 \right. {\left|1,1,j_{1}=1,j_{2}=1\right\rangle }'
454
+ sT(ip4, "InnerProduct(JzBraCoupled(Integer(1),Integer(1),Tuple(Integer(1), Integer(1)),Tuple(Tuple(Integer(1), Integer(2), Integer(1)))),JzKetCoupled(Integer(1),Integer(1),Tuple(Integer(1), Integer(1)),Tuple(Tuple(Integer(1), Integer(2), Integer(1)))))")
455
+ assert str(ip_tall1) == '<x/2|x/2>'
456
+ ascii_str = \
457
+ """\
458
+ / | \\ \n\
459
+ / x|x \\\n\
460
+ \\ -|- /\n\
461
+ \\2|2/ \
462
+ """
463
+ ucode_str = \
464
+ """\
465
+ ╱ │ ╲ \n\
466
+ ╱ x│x ╲\n\
467
+ ╲ ─│─ ╱\n\
468
+ ╲2│2╱ \
469
+ """
470
+ assert pretty(ip_tall1) == ascii_str
471
+ assert upretty(ip_tall1) == ucode_str
472
+ assert latex(ip_tall1) == \
473
+ r'\left\langle \frac{x}{2} \right. {\left|\frac{x}{2}\right\rangle }'
474
+ sT(ip_tall1, "InnerProduct(Bra(Mul(Rational(1, 2), Symbol('x'))),Ket(Mul(Rational(1, 2), Symbol('x'))))")
475
+ assert str(ip_tall2) == '<x|x/2>'
476
+ ascii_str = \
477
+ """\
478
+ / | \\ \n\
479
+ / |x \\\n\
480
+ \\ x|- /\n\
481
+ \\ |2/ \
482
+ """
483
+ ucode_str = \
484
+ """\
485
+ ╱ │ ╲ \n\
486
+ ╱ │x ╲\n\
487
+ ╲ x│─ ╱\n\
488
+ ╲ │2╱ \
489
+ """
490
+ assert pretty(ip_tall2) == ascii_str
491
+ assert upretty(ip_tall2) == ucode_str
492
+ assert latex(ip_tall2) == \
493
+ r'\left\langle x \right. {\left|\frac{x}{2}\right\rangle }'
494
+ sT(ip_tall2,
495
+ "InnerProduct(Bra(Symbol('x')),Ket(Mul(Rational(1, 2), Symbol('x'))))")
496
+ assert str(ip_tall3) == '<x/2|x>'
497
+ ascii_str = \
498
+ """\
499
+ / | \\ \n\
500
+ / x| \\\n\
501
+ \\ -|x /\n\
502
+ \\2| / \
503
+ """
504
+ ucode_str = \
505
+ """\
506
+ ╱ │ ╲ \n\
507
+ ╱ x│ ╲\n\
508
+ ╲ ─│x ╱\n\
509
+ ╲2│ ╱ \
510
+ """
511
+ assert pretty(ip_tall3) == ascii_str
512
+ assert upretty(ip_tall3) == ucode_str
513
+ assert latex(ip_tall3) == \
514
+ r'\left\langle \frac{x}{2} \right. {\left|x\right\rangle }'
515
+ sT(ip_tall3,
516
+ "InnerProduct(Bra(Mul(Rational(1, 2), Symbol('x'))),Ket(Symbol('x')))")
517
+
518
+
519
+ def test_operator():
520
+ a = Operator('A')
521
+ b = Operator('B', Symbol('t'), S.Half)
522
+ inv = a.inv()
523
+ f = Function('f')
524
+ x = symbols('x')
525
+ d = DifferentialOperator(Derivative(f(x), x), f(x))
526
+ op = OuterProduct(Ket(), Bra())
527
+ assert str(a) == 'A'
528
+ assert pretty(a) == 'A'
529
+ assert upretty(a) == 'A'
530
+ assert latex(a) == 'A'
531
+ sT(a, "Operator(Symbol('A'))")
532
+ assert str(inv) == 'A**(-1)'
533
+ ascii_str = \
534
+ """\
535
+ -1\n\
536
+ A \
537
+ """
538
+ ucode_str = \
539
+ """\
540
+ -1\n\
541
+ A \
542
+ """
543
+ assert pretty(inv) == ascii_str
544
+ assert upretty(inv) == ucode_str
545
+ assert latex(inv) == r'A^{-1}'
546
+ sT(inv, "Pow(Operator(Symbol('A')), Integer(-1))")
547
+ assert str(d) == 'DifferentialOperator(Derivative(f(x), x),f(x))'
548
+ ascii_str = \
549
+ """\
550
+ /d \\\n\
551
+ DifferentialOperator|--(f(x)),f(x)|\n\
552
+ \\dx /\
553
+ """
554
+ ucode_str = \
555
+ """\
556
+ ⎛d ⎞\n\
557
+ DifferentialOperator⎜──(f(x)),f(x)⎟\n\
558
+ ⎝dx ⎠\
559
+ """
560
+ assert pretty(d) == ascii_str
561
+ assert upretty(d) == ucode_str
562
+ assert latex(d) == \
563
+ r'DifferentialOperator\left(\frac{d}{d x} f{\left(x \right)},f{\left(x \right)}\right)'
564
+ sT(d, "DifferentialOperator(Derivative(Function('f')(Symbol('x')), Tuple(Symbol('x'), Integer(1))),Function('f')(Symbol('x')))")
565
+ assert str(b) == 'Operator(B,t,1/2)'
566
+ assert pretty(b) == 'Operator(B,t,1/2)'
567
+ assert upretty(b) == 'Operator(B,t,1/2)'
568
+ assert latex(b) == r'Operator\left(B,t,\frac{1}{2}\right)'
569
+ sT(b, "Operator(Symbol('B'),Symbol('t'),Rational(1, 2))")
570
+ assert str(op) == '|psi><psi|'
571
+ assert pretty(op) == '|psi><psi|'
572
+ assert upretty(op) == '❘ψ⟩⟨ψ❘'
573
+ assert latex(op) == r'{\left|\psi\right\rangle }{\left\langle \psi\right|}'
574
+ sT(op, "OuterProduct(Ket(Symbol('psi')),Bra(Symbol('psi')))")
575
+
576
+
577
+ def test_qexpr():
578
+ q = QExpr('q')
579
+ assert str(q) == 'q'
580
+ assert pretty(q) == 'q'
581
+ assert upretty(q) == 'q'
582
+ assert latex(q) == r'q'
583
+ sT(q, "QExpr(Symbol('q'))")
584
+
585
+
586
+ def test_qubit():
587
+ q1 = Qubit('0101')
588
+ q2 = IntQubit(8)
589
+ assert str(q1) == '|0101>'
590
+ assert pretty(q1) == '|0101>'
591
+ assert upretty(q1) == '❘0101⟩'
592
+ assert latex(q1) == r'{\left|0101\right\rangle }'
593
+ sT(q1, "Qubit(Integer(0),Integer(1),Integer(0),Integer(1))")
594
+ assert str(q2) == '|8>'
595
+ assert pretty(q2) == '|8>'
596
+ assert upretty(q2) == '❘8⟩'
597
+ assert latex(q2) == r'{\left|8\right\rangle }'
598
+ sT(q2, "IntQubit(8)")
599
+
600
+
601
+ def test_spin():
602
+ lz = JzOp('L')
603
+ ket = JzKet(1, 0)
604
+ bra = JzBra(1, 0)
605
+ cket = JzKetCoupled(1, 0, (1, 2))
606
+ cbra = JzBraCoupled(1, 0, (1, 2))
607
+ cket_big = JzKetCoupled(1, 0, (1, 2, 3))
608
+ cbra_big = JzBraCoupled(1, 0, (1, 2, 3))
609
+ rot = Rotation(1, 2, 3)
610
+ bigd = WignerD(1, 2, 3, 4, 5, 6)
611
+ smalld = WignerD(1, 2, 3, 0, 4, 0)
612
+ assert str(lz) == 'Lz'
613
+ ascii_str = \
614
+ """\
615
+ L \n\
616
+ z\
617
+ """
618
+ ucode_str = \
619
+ """\
620
+ L \n\
621
+ z\
622
+ """
623
+ assert pretty(lz) == ascii_str
624
+ assert upretty(lz) == ucode_str
625
+ assert latex(lz) == 'L_z'
626
+ sT(lz, "JzOp(Symbol('L'))")
627
+ assert str(J2) == 'J2'
628
+ ascii_str = \
629
+ """\
630
+ 2\n\
631
+ J \
632
+ """
633
+ ucode_str = \
634
+ """\
635
+ 2\n\
636
+ J \
637
+ """
638
+ assert pretty(J2) == ascii_str
639
+ assert upretty(J2) == ucode_str
640
+ assert latex(J2) == r'J^2'
641
+ sT(J2, "J2Op(Symbol('J'))")
642
+ assert str(Jz) == 'Jz'
643
+ ascii_str = \
644
+ """\
645
+ J \n\
646
+ z\
647
+ """
648
+ ucode_str = \
649
+ """\
650
+ J \n\
651
+ z\
652
+ """
653
+ assert pretty(Jz) == ascii_str
654
+ assert upretty(Jz) == ucode_str
655
+ assert latex(Jz) == 'J_z'
656
+ sT(Jz, "JzOp(Symbol('J'))")
657
+ assert str(ket) == '|1,0>'
658
+ assert pretty(ket) == '|1,0>'
659
+ assert upretty(ket) == '❘1,0⟩'
660
+ assert latex(ket) == r'{\left|1,0\right\rangle }'
661
+ sT(ket, "JzKet(Integer(1),Integer(0))")
662
+ assert str(bra) == '<1,0|'
663
+ assert pretty(bra) == '<1,0|'
664
+ assert upretty(bra) == '⟨1,0❘'
665
+ assert latex(bra) == r'{\left\langle 1,0\right|}'
666
+ sT(bra, "JzBra(Integer(1),Integer(0))")
667
+ assert str(cket) == '|1,0,j1=1,j2=2>'
668
+ assert pretty(cket) == '|1,0,j1=1,j2=2>'
669
+ assert upretty(cket) == '❘1,0,j₁=1,j₂=2⟩'
670
+ assert latex(cket) == r'{\left|1,0,j_{1}=1,j_{2}=2\right\rangle }'
671
+ sT(cket, "JzKetCoupled(Integer(1),Integer(0),Tuple(Integer(1), Integer(2)),Tuple(Tuple(Integer(1), Integer(2), Integer(1))))")
672
+ assert str(cbra) == '<1,0,j1=1,j2=2|'
673
+ assert pretty(cbra) == '<1,0,j1=1,j2=2|'
674
+ assert upretty(cbra) == '⟨1,0,j₁=1,j₂=2❘'
675
+ assert latex(cbra) == r'{\left\langle 1,0,j_{1}=1,j_{2}=2\right|}'
676
+ sT(cbra, "JzBraCoupled(Integer(1),Integer(0),Tuple(Integer(1), Integer(2)),Tuple(Tuple(Integer(1), Integer(2), Integer(1))))")
677
+ assert str(cket_big) == '|1,0,j1=1,j2=2,j3=3,j(1,2)=3>'
678
+ # TODO: Fix non-unicode pretty printing
679
+ # i.e. j1,2 -> j(1,2)
680
+ assert pretty(cket_big) == '|1,0,j1=1,j2=2,j3=3,j1,2=3>'
681
+ assert upretty(cket_big) == '❘1,0,j₁=1,j₂=2,j₃=3,j₁,₂=3⟩'
682
+ assert latex(cket_big) == \
683
+ r'{\left|1,0,j_{1}=1,j_{2}=2,j_{3}=3,j_{1,2}=3\right\rangle }'
684
+ sT(cket_big, "JzKetCoupled(Integer(1),Integer(0),Tuple(Integer(1), Integer(2), Integer(3)),Tuple(Tuple(Integer(1), Integer(2), Integer(3)), Tuple(Integer(1), Integer(3), Integer(1))))")
685
+ assert str(cbra_big) == '<1,0,j1=1,j2=2,j3=3,j(1,2)=3|'
686
+ assert pretty(cbra_big) == '<1,0,j1=1,j2=2,j3=3,j1,2=3|'
687
+ assert upretty(cbra_big) == '⟨1,0,j₁=1,j₂=2,j₃=3,j₁,₂=3❘'
688
+ assert latex(cbra_big) == \
689
+ r'{\left\langle 1,0,j_{1}=1,j_{2}=2,j_{3}=3,j_{1,2}=3\right|}'
690
+ sT(cbra_big, "JzBraCoupled(Integer(1),Integer(0),Tuple(Integer(1), Integer(2), Integer(3)),Tuple(Tuple(Integer(1), Integer(2), Integer(3)), Tuple(Integer(1), Integer(3), Integer(1))))")
691
+ assert str(rot) == 'R(1,2,3)'
692
+ assert pretty(rot) == 'R (1,2,3)'
693
+ assert upretty(rot) == 'ℛ (1,2,3)'
694
+ assert latex(rot) == r'\mathcal{R}\left(1,2,3\right)'
695
+ sT(rot, "Rotation(Integer(1),Integer(2),Integer(3))")
696
+ assert str(bigd) == 'WignerD(1, 2, 3, 4, 5, 6)'
697
+ ascii_str = \
698
+ """\
699
+ 1 \n\
700
+ D (4,5,6)\n\
701
+ 2,3 \
702
+ """
703
+ ucode_str = \
704
+ """\
705
+ 1 \n\
706
+ D (4,5,6)\n\
707
+ 2,3 \
708
+ """
709
+ assert pretty(bigd) == ascii_str
710
+ assert upretty(bigd) == ucode_str
711
+ assert latex(bigd) == r'D^{1}_{2,3}\left(4,5,6\right)'
712
+ sT(bigd, "WignerD(Integer(1), Integer(2), Integer(3), Integer(4), Integer(5), Integer(6))")
713
+ assert str(smalld) == 'WignerD(1, 2, 3, 0, 4, 0)'
714
+ ascii_str = \
715
+ """\
716
+ 1 \n\
717
+ d (4)\n\
718
+ 2,3 \
719
+ """
720
+ ucode_str = \
721
+ """\
722
+ 1 \n\
723
+ d (4)\n\
724
+ 2,3 \
725
+ """
726
+ assert pretty(smalld) == ascii_str
727
+ assert upretty(smalld) == ucode_str
728
+ assert latex(smalld) == r'd^{1}_{2,3}\left(4\right)'
729
+ sT(smalld, "WignerD(Integer(1), Integer(2), Integer(3), Integer(0), Integer(4), Integer(0))")
730
+
731
+
732
+ def test_state():
733
+ x = symbols('x')
734
+ bra = Bra()
735
+ ket = Ket()
736
+ bra_tall = Bra(x/2)
737
+ ket_tall = Ket(x/2)
738
+ tbra = TimeDepBra()
739
+ tket = TimeDepKet()
740
+ assert str(bra) == '<psi|'
741
+ assert pretty(bra) == '<psi|'
742
+ assert upretty(bra) == '⟨ψ❘'
743
+ assert latex(bra) == r'{\left\langle \psi\right|}'
744
+ sT(bra, "Bra(Symbol('psi'))")
745
+ assert str(ket) == '|psi>'
746
+ assert pretty(ket) == '|psi>'
747
+ assert upretty(ket) == '❘ψ⟩'
748
+ assert latex(ket) == r'{\left|\psi\right\rangle }'
749
+ sT(ket, "Ket(Symbol('psi'))")
750
+ assert str(bra_tall) == '<x/2|'
751
+ ascii_str = \
752
+ """\
753
+ / |\n\
754
+ / x|\n\
755
+ \\ -|\n\
756
+ \\2|\
757
+ """
758
+ ucode_str = \
759
+ """\
760
+ ╱ │\n\
761
+ ╱ x│\n\
762
+ ╲ ─│\n\
763
+ ╲2│\
764
+ """
765
+ assert pretty(bra_tall) == ascii_str
766
+ assert upretty(bra_tall) == ucode_str
767
+ assert latex(bra_tall) == r'{\left\langle \frac{x}{2}\right|}'
768
+ sT(bra_tall, "Bra(Mul(Rational(1, 2), Symbol('x')))")
769
+ assert str(ket_tall) == '|x/2>'
770
+ ascii_str = \
771
+ """\
772
+ | \\ \n\
773
+ |x \\\n\
774
+ |- /\n\
775
+ |2/ \
776
+ """
777
+ ucode_str = \
778
+ """\
779
+ │ ╲ \n\
780
+ │x ╲\n\
781
+ │─ ╱\n\
782
+ │2╱ \
783
+ """
784
+ assert pretty(ket_tall) == ascii_str
785
+ assert upretty(ket_tall) == ucode_str
786
+ assert latex(ket_tall) == r'{\left|\frac{x}{2}\right\rangle }'
787
+ sT(ket_tall, "Ket(Mul(Rational(1, 2), Symbol('x')))")
788
+ assert str(tbra) == '<psi;t|'
789
+ assert pretty(tbra) == '<psi;t|'
790
+ assert upretty(tbra) == '⟨ψ;t❘'
791
+ assert latex(tbra) == r'{\left\langle \psi;t\right|}'
792
+ sT(tbra, "TimeDepBra(Symbol('psi'),Symbol('t'))")
793
+ assert str(tket) == '|psi;t>'
794
+ assert pretty(tket) == '|psi;t>'
795
+ assert upretty(tket) == '❘ψ;t⟩'
796
+ assert latex(tket) == r'{\left|\psi;t\right\rangle }'
797
+ sT(tket, "TimeDepKet(Symbol('psi'),Symbol('t'))")
798
+
799
+
800
+ def test_tensorproduct():
801
+ tp = TensorProduct(JzKet(1, 1), JzKet(1, 0))
802
+ assert str(tp) == '|1,1>x|1,0>'
803
+ assert pretty(tp) == '|1,1>x |1,0>'
804
+ assert upretty(tp) == '❘1,1⟩⨂ ❘1,0⟩'
805
+ assert latex(tp) == \
806
+ r'{{\left|1,1\right\rangle }}\otimes {{\left|1,0\right\rangle }}'
807
+ sT(tp, "TensorProduct(JzKet(Integer(1),Integer(1)), JzKet(Integer(1),Integer(0)))")
808
+
809
+
810
+ def test_big_expr():
811
+ f = Function('f')
812
+ x = symbols('x')
813
+ e1 = Dagger(AntiCommutator(Operator('A') + Operator('B'), Pow(DifferentialOperator(Derivative(f(x), x), f(x)), 3))*TensorProduct(Jz**2, Operator('A') + Operator('B')))*(JzBra(1, 0) + JzBra(1, 1))*(JzKet(0, 0) + JzKet(1, -1))
814
+ e2 = Commutator(Jz**2, Operator('A') + Operator('B'))*AntiCommutator(Dagger(Operator('C')*Operator('D')), Operator('E').inv()**2)*Dagger(Commutator(Jz, J2))
815
+ e3 = Wigner3j(1, 2, 3, 4, 5, 6)*TensorProduct(Commutator(Operator('A') + Dagger(Operator('B')), Operator('C') + Operator('D')), Jz - J2)*Dagger(OuterProduct(Dagger(JzBra(1, 1)), JzBra(1, 0)))*TensorProduct(JzKetCoupled(1, 1, (1, 1)) + JzKetCoupled(1, 0, (1, 1)), JzKetCoupled(1, -1, (1, 1)))
816
+ e4 = (ComplexSpace(1)*ComplexSpace(2) + FockSpace()**2)*(L2(Interval(
817
+ 0, oo)) + HilbertSpace())
818
+ assert str(e1) == '(Jz**2)x(Dagger(A) + Dagger(B))*{Dagger(DifferentialOperator(Derivative(f(x), x),f(x)))**3,Dagger(A) + Dagger(B)}*(<1,0| + <1,1|)*(|0,0> + |1,-1>)'
819
+ ascii_str = \
820
+ """\
821
+ / 3 \\ \n\
822
+ |/ +\\ | \n\
823
+ 2 / + +\\ <| /d \\ | + +> \n\
824
+ /J \\ x \\A + B /*||DifferentialOperator|--(f(x)),f(x)| | ,A + B |*(<1,0| + <1,1|)*(|0,0> + |1,-1>)\n\
825
+ \\ z/ \\\\ \\dx / / / \
826
+ """
827
+ ucode_str = \
828
+ """\
829
+ ⎧ 3 ⎫ \n\
830
+ ⎪⎛ †⎞ ⎪ \n\
831
+ 2 ⎛ † †⎞ ⎨⎜ ⎛d ⎞ ⎟ † †⎬ \n\
832
+ ⎛J ⎞ ⨂ ⎝A + B ⎠⋅⎪⎜DifferentialOperator⎜──(f(x)),f(x)⎟ ⎟ ,A + B ⎪⋅(⟨1,0❘ + ⟨1,1❘)⋅(❘0,0⟩ + ❘1,-1⟩)\n\
833
+ ⎝ z⎠ ⎩⎝ ⎝dx ⎠ ⎠ ⎭ \
834
+ """
835
+ assert pretty(e1) == ascii_str
836
+ assert upretty(e1) == ucode_str
837
+ assert latex(e1) == \
838
+ r'{J_z^{2}}\otimes \left({A^{\dagger} + B^{\dagger}}\right) \left\{\left(DifferentialOperator\left(\frac{d}{d x} f{\left(x \right)},f{\left(x \right)}\right)^{\dagger}\right)^{3},A^{\dagger} + B^{\dagger}\right\} \left({\left\langle 1,0\right|} + {\left\langle 1,1\right|}\right) \left({\left|0,0\right\rangle } + {\left|1,-1\right\rangle }\right)'
839
+ sT(e1, "Mul(TensorProduct(Pow(JzOp(Symbol('J')), Integer(2)), Add(Dagger(Operator(Symbol('A'))), Dagger(Operator(Symbol('B'))))), AntiCommutator(Pow(Dagger(DifferentialOperator(Derivative(Function('f')(Symbol('x')), Tuple(Symbol('x'), Integer(1))),Function('f')(Symbol('x')))), Integer(3)),Add(Dagger(Operator(Symbol('A'))), Dagger(Operator(Symbol('B'))))), Add(JzBra(Integer(1),Integer(0)), JzBra(Integer(1),Integer(1))), Add(JzKet(Integer(0),Integer(0)), JzKet(Integer(1),Integer(-1))))")
840
+ assert str(e2) == '[Jz**2,A + B]*{E**(-2),Dagger(D)*Dagger(C)}*[J2,Jz]'
841
+ ascii_str = \
842
+ """\
843
+ [ 2 ] / -2 + +\\ [ 2 ]\n\
844
+ [/J \\ ,A + B]*<E ,D *C >*[J ,J ]\n\
845
+ [\\ z/ ] \\ / [ z]\
846
+ """
847
+ ucode_str = \
848
+ """\
849
+ ⎡ 2 ⎤ ⎧ -2 † †⎫ ⎡ 2 ⎤\n\
850
+ ⎢⎛J ⎞ ,A + B⎥⋅⎨E ,D ⋅C ⎬⋅⎢J ,J ⎥\n\
851
+ ⎣⎝ z⎠ ⎦ ⎩ ⎭ ⎣ z⎦\
852
+ """
853
+ assert pretty(e2) == ascii_str
854
+ assert upretty(e2) == ucode_str
855
+ assert latex(e2) == \
856
+ r'\left[J_z^{2},A + B\right] \left\{E^{-2},D^{\dagger} C^{\dagger}\right\} \left[J^2,J_z\right]'
857
+ sT(e2, "Mul(Commutator(Pow(JzOp(Symbol('J')), Integer(2)),Add(Operator(Symbol('A')), Operator(Symbol('B')))), AntiCommutator(Pow(Operator(Symbol('E')), Integer(-2)),Mul(Dagger(Operator(Symbol('D'))), Dagger(Operator(Symbol('C'))))), Commutator(J2Op(Symbol('J')),JzOp(Symbol('J'))))")
858
+ assert str(e3) == \
859
+ "Wigner3j(1, 2, 3, 4, 5, 6)*[Dagger(B) + A,C + D]x(-J2 + Jz)*|1,0><1,1|*(|1,0,j1=1,j2=1> + |1,1,j1=1,j2=1>)x|1,-1,j1=1,j2=1>"
860
+ ascii_str = \
861
+ """\
862
+ [ + ] / 2 \\ \n\
863
+ /1 3 5\\*[B + A,C + D]x |- J + J |*|1,0><1,1|*(|1,0,j1=1,j2=1> + |1,1,j1=1,j2=1>)x |1,-1,j1=1,j2=1>\n\
864
+ | | \\ z/ \n\
865
+ \\2 4 6/ \
866
+ """
867
+ ucode_str = \
868
+ """\
869
+ ⎡ † ⎤ ⎛ 2 ⎞ \n\
870
+ ⎛1 3 5⎞⋅⎣B + A,C + D⎦⨂ ⎜- J + J ⎟⋅❘1,0⟩⟨1,1❘⋅(❘1,0,j₁=1,j₂=1⟩ + ❘1,1,j₁=1,j₂=1⟩)⨂ ❘1,-1,j₁=1,j₂=1⟩\n\
871
+ ⎜ ⎟ ⎝ z⎠ \n\
872
+ ⎝2 4 6⎠ \
873
+ """
874
+ assert pretty(e3) == ascii_str
875
+ assert upretty(e3) == ucode_str
876
+ assert latex(e3) == \
877
+ r'\left(\begin{array}{ccc} 1 & 3 & 5 \\ 2 & 4 & 6 \end{array}\right) {\left[B^{\dagger} + A,C + D\right]}\otimes \left({- J^2 + J_z}\right) {\left|1,0\right\rangle }{\left\langle 1,1\right|} \left({{\left|1,0,j_{1}=1,j_{2}=1\right\rangle } + {\left|1,1,j_{1}=1,j_{2}=1\right\rangle }}\right)\otimes {{\left|1,-1,j_{1}=1,j_{2}=1\right\rangle }}'
878
+ sT(e3, "Mul(Wigner3j(Integer(1), Integer(2), Integer(3), Integer(4), Integer(5), Integer(6)), TensorProduct(Commutator(Add(Dagger(Operator(Symbol('B'))), Operator(Symbol('A'))),Add(Operator(Symbol('C')), Operator(Symbol('D')))), Add(Mul(Integer(-1), J2Op(Symbol('J'))), JzOp(Symbol('J')))), OuterProduct(JzKet(Integer(1),Integer(0)),JzBra(Integer(1),Integer(1))), TensorProduct(Add(JzKetCoupled(Integer(1),Integer(0),Tuple(Integer(1), Integer(1)),Tuple(Tuple(Integer(1), Integer(2), Integer(1)))), JzKetCoupled(Integer(1),Integer(1),Tuple(Integer(1), Integer(1)),Tuple(Tuple(Integer(1), Integer(2), Integer(1))))), JzKetCoupled(Integer(1),Integer(-1),Tuple(Integer(1), Integer(1)),Tuple(Tuple(Integer(1), Integer(2), Integer(1))))))")
879
+ assert str(e4) == '(C(1)*C(2)+F**2)*(L2(Interval(0, oo))+H)'
880
+ ascii_str = \
881
+ """\
882
+ // 1 2\\ x2\\ / 2 \\\n\
883
+ \\\\C x C / + F / x \\L + H/\
884
+ """
885
+ ucode_str = \
886
+ """\
887
+ ⎛⎛ 1 2⎞ ⨂2⎞ ⎛ 2 ⎞\n\
888
+ ⎝⎝C ⨂ C ⎠ ⊕ F ⎠ ⨂ ⎝L ⊕ H⎠\
889
+ """
890
+ assert pretty(e4) == ascii_str
891
+ assert upretty(e4) == ucode_str
892
+ assert latex(e4) == \
893
+ r'\left(\left(\mathcal{C}^{1}\otimes \mathcal{C}^{2}\right)\oplus {\mathcal{F}}^{\otimes 2}\right)\otimes \left({\mathcal{L}^2}\left( \left[0, \infty\right) \right)\oplus \mathcal{H}\right)'
894
+ sT(e4, "TensorProductHilbertSpace((DirectSumHilbertSpace(TensorProductHilbertSpace(ComplexSpace(Integer(1)),ComplexSpace(Integer(2))),TensorPowerHilbertSpace(FockSpace(),Integer(2)))),(DirectSumHilbertSpace(L2(Interval(Integer(0), oo, false, true)),HilbertSpace())))")
895
+
896
+
897
+ def _test_sho1d():
898
+ ad = RaisingOp('a')
899
+ assert pretty(ad) == ' \N{DAGGER}\na '
900
+ assert latex(ad) == 'a^{\\dagger}'
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_qapply.py ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.core.mul import Mul
2
+ from sympy.core.numbers import (I, Integer, Rational)
3
+ from sympy.core.singleton import S
4
+ from sympy.core.symbol import symbols
5
+ from sympy.functions.elementary.miscellaneous import sqrt
6
+
7
+ from sympy.physics.quantum.anticommutator import AntiCommutator
8
+ from sympy.physics.quantum.commutator import Commutator
9
+ from sympy.physics.quantum.constants import hbar
10
+ from sympy.physics.quantum.dagger import Dagger
11
+ from sympy.physics.quantum.gate import H, XGate, IdentityGate
12
+ from sympy.physics.quantum.operator import Operator, IdentityOperator
13
+ from sympy.physics.quantum.qapply import qapply
14
+ from sympy.physics.quantum.spin import Jx, Jy, Jz, Jplus, Jminus, J2, JzKet
15
+ from sympy.physics.quantum.tensorproduct import TensorProduct
16
+ from sympy.physics.quantum.state import Ket
17
+ from sympy.physics.quantum.density import Density
18
+ from sympy.physics.quantum.qubit import Qubit, QubitBra
19
+ from sympy.physics.quantum.boson import BosonOp, BosonFockKet, BosonFockBra
20
+ from sympy.testing.pytest import warns_deprecated_sympy
21
+
22
+
23
+ j, jp, m, mp = symbols("j j' m m'")
24
+
25
+ z = JzKet(1, 0)
26
+ po = JzKet(1, 1)
27
+ mo = JzKet(1, -1)
28
+
29
+ A = Operator('A')
30
+
31
+
32
+ class Foo(Operator):
33
+ def _apply_operator_JzKet(self, ket, **options):
34
+ return ket
35
+
36
+
37
+ def test_basic():
38
+ assert qapply(Jz*po) == hbar*po
39
+ assert qapply(Jx*z) == hbar*po/sqrt(2) + hbar*mo/sqrt(2)
40
+ assert qapply((Jplus + Jminus)*z/sqrt(2)) == hbar*po + hbar*mo
41
+ assert qapply(Jz*(po + mo)) == hbar*po - hbar*mo
42
+ assert qapply(Jz*po + Jz*mo) == hbar*po - hbar*mo
43
+ assert qapply(Jminus*Jminus*po) == 2*hbar**2*mo
44
+ assert qapply(Jplus**2*mo) == 2*hbar**2*po
45
+ assert qapply(Jplus**2*Jminus**2*po) == 4*hbar**4*po
46
+
47
+
48
+ def test_extra():
49
+ extra = z.dual*A*z
50
+ assert qapply(Jz*po*extra) == hbar*po*extra
51
+ assert qapply(Jx*z*extra) == (hbar*po/sqrt(2) + hbar*mo/sqrt(2))*extra
52
+ assert qapply(
53
+ (Jplus + Jminus)*z/sqrt(2)*extra) == hbar*po*extra + hbar*mo*extra
54
+ assert qapply(Jz*(po + mo)*extra) == hbar*po*extra - hbar*mo*extra
55
+ assert qapply(Jz*po*extra + Jz*mo*extra) == hbar*po*extra - hbar*mo*extra
56
+ assert qapply(Jminus*Jminus*po*extra) == 2*hbar**2*mo*extra
57
+ assert qapply(Jplus**2*mo*extra) == 2*hbar**2*po*extra
58
+ assert qapply(Jplus**2*Jminus**2*po*extra) == 4*hbar**4*po*extra
59
+
60
+
61
+ def test_innerproduct():
62
+ assert qapply(po.dual*Jz*po, ip_doit=False) == hbar*(po.dual*po)
63
+ assert qapply(po.dual*Jz*po) == hbar
64
+
65
+
66
+ def test_zero():
67
+ assert qapply(0) == 0
68
+ assert qapply(Integer(0)) == 0
69
+
70
+
71
+ def test_commutator():
72
+ assert qapply(Commutator(Jx, Jy)*Jz*po) == I*hbar**3*po
73
+ assert qapply(Commutator(J2, Jz)*Jz*po) == 0
74
+ assert qapply(Commutator(Jz, Foo('F'))*po) == 0
75
+ assert qapply(Commutator(Foo('F'), Jz)*po) == 0
76
+
77
+
78
+ def test_anticommutator():
79
+ assert qapply(AntiCommutator(Jz, Foo('F'))*po) == 2*hbar*po
80
+ assert qapply(AntiCommutator(Foo('F'), Jz)*po) == 2*hbar*po
81
+
82
+
83
+ def test_outerproduct():
84
+ e = Jz*(mo*po.dual)*Jz*po
85
+ assert qapply(e) == -hbar**2*mo
86
+ assert qapply(e, ip_doit=False) == -hbar**2*(po.dual*po)*mo
87
+ assert qapply(e).doit() == -hbar**2*mo
88
+
89
+
90
+ def test_tensorproduct():
91
+ a = BosonOp("a")
92
+ b = BosonOp("b")
93
+ ket1 = TensorProduct(BosonFockKet(1), BosonFockKet(2))
94
+ ket2 = TensorProduct(BosonFockKet(0), BosonFockKet(0))
95
+ ket3 = TensorProduct(BosonFockKet(0), BosonFockKet(2))
96
+ bra1 = TensorProduct(BosonFockBra(0), BosonFockBra(0))
97
+ bra2 = TensorProduct(BosonFockBra(1), BosonFockBra(2))
98
+ assert qapply(TensorProduct(a, b ** 2) * ket1) == sqrt(2) * ket2
99
+ assert qapply(TensorProduct(a, Dagger(b) * b) * ket1) == 2 * ket3
100
+ assert qapply(bra1 * TensorProduct(a, b * b),
101
+ dagger=True) == sqrt(2) * bra2
102
+ assert qapply(bra2 * ket1).doit() == S.One
103
+ assert qapply(TensorProduct(a, b * b) * ket1) == sqrt(2) * ket2
104
+ assert qapply(Dagger(TensorProduct(a, b * b) * ket1),
105
+ dagger=True) == sqrt(2) * Dagger(ket2)
106
+
107
+
108
+ def test_dagger():
109
+ lhs = Dagger(Qubit(0))*Dagger(H(0))
110
+ rhs = Dagger(Qubit(1))/sqrt(2) + Dagger(Qubit(0))/sqrt(2)
111
+ assert qapply(lhs, dagger=True) == rhs
112
+
113
+
114
+ def test_issue_6073():
115
+ x, y = symbols('x y', commutative=False)
116
+ A = Ket(x, y)
117
+ B = Operator('B')
118
+ assert qapply(A) == A
119
+ assert qapply(A.dual*B) == A.dual*B
120
+
121
+
122
+ def test_density():
123
+ d = Density([Jz*mo, 0.5], [Jz*po, 0.5])
124
+ assert qapply(d) == Density([-hbar*mo, 0.5], [hbar*po, 0.5])
125
+
126
+
127
+ def test_issue3044():
128
+ expr1 = TensorProduct(Jz*JzKet(S(2),S.NegativeOne)/sqrt(2), Jz*JzKet(S.Half,S.Half))
129
+ result = Mul(S.NegativeOne, Rational(1, 4), 2**S.Half, hbar**2)
130
+ result *= TensorProduct(JzKet(2,-1), JzKet(S.Half,S.Half))
131
+ assert qapply(expr1) == result
132
+
133
+
134
+ # Issue 24158: Tests whether qapply incorrectly evaluates some ket*op as op*ket
135
+ def test_issue24158_ket_times_op():
136
+ P = BosonFockKet(0) * BosonOp("a") # undefined term
137
+ # Does lhs._apply_operator_BosonOp(rhs) still evaluate ket*op as op*ket?
138
+ assert qapply(P) == P # qapply(P) -> BosonOp("a")*BosonFockKet(0) = 0 before fix
139
+ P = Qubit(1) * XGate(0) # undefined term
140
+ # Does rhs._apply_operator_Qubit(lhs) still evaluate ket*op as op*ket?
141
+ assert qapply(P) == P # qapply(P) -> Qubit(0) before fix
142
+ P1 = Mul(QubitBra(0), Mul(QubitBra(0), Qubit(0)), XGate(0)) # legal expr <0| * (<1|*|1>) * X
143
+ assert qapply(P1) == QubitBra(0) * XGate(0) # qapply(P1) -> 0 before fix
144
+ P1 = qapply(P1, dagger = True) # unsatisfactorily -> <0|*X(0), expect <1| since dagger=True
145
+ assert qapply(P1, dagger = True) == QubitBra(1) # qapply(P1, dagger=True) -> 0 before fix
146
+ P2 = QubitBra(0) * (QubitBra(0) * Qubit(0)) * XGate(0) # 'forgot' to set brackets
147
+ P2 = qapply(P2, dagger = True) # unsatisfactorily -> <0|*X(0), expect <1| since dagger=True
148
+ assert P2 == QubitBra(1) # qapply(P1) -> 0 before fix
149
+ # Pull Request 24237: IdentityOperator from the right without dagger=True option
150
+ with warns_deprecated_sympy():
151
+ assert qapply(QubitBra(1)*IdentityOperator()) == QubitBra(1)
152
+ assert qapply(IdentityGate(0)*(Qubit(0) + Qubit(1))) == Qubit(0) + Qubit(1)
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_qasm.py ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.physics.quantum.qasm import Qasm, flip_index, trim,\
2
+ get_index, nonblank, fullsplit, fixcommand, stripquotes, read_qasm
3
+ from sympy.physics.quantum.gate import X, Z, H, S, T
4
+ from sympy.physics.quantum.gate import CNOT, SWAP, CPHASE, CGate, CGateS
5
+ from sympy.physics.quantum.circuitplot import Mz
6
+
7
+ def test_qasm_readqasm():
8
+ qasm_lines = """\
9
+ qubit q_0
10
+ qubit q_1
11
+ h q_0
12
+ cnot q_0,q_1
13
+ """
14
+ q = read_qasm(qasm_lines)
15
+ assert q.get_circuit() == CNOT(1,0)*H(1)
16
+
17
+ def test_qasm_ex1():
18
+ q = Qasm('qubit q0', 'qubit q1', 'h q0', 'cnot q0,q1')
19
+ assert q.get_circuit() == CNOT(1,0)*H(1)
20
+
21
+ def test_qasm_ex1_methodcalls():
22
+ q = Qasm()
23
+ q.qubit('q_0')
24
+ q.qubit('q_1')
25
+ q.h('q_0')
26
+ q.cnot('q_0', 'q_1')
27
+ assert q.get_circuit() == CNOT(1,0)*H(1)
28
+
29
+ def test_qasm_swap():
30
+ q = Qasm('qubit q0', 'qubit q1', 'cnot q0,q1', 'cnot q1,q0', 'cnot q0,q1')
31
+ assert q.get_circuit() == CNOT(1,0)*CNOT(0,1)*CNOT(1,0)
32
+
33
+
34
+ def test_qasm_ex2():
35
+ q = Qasm('qubit q_0', 'qubit q_1', 'qubit q_2', 'h q_1',
36
+ 'cnot q_1,q_2', 'cnot q_0,q_1', 'h q_0',
37
+ 'measure q_1', 'measure q_0',
38
+ 'c-x q_1,q_2', 'c-z q_0,q_2')
39
+ assert q.get_circuit() == CGate(2,Z(0))*CGate(1,X(0))*Mz(2)*Mz(1)*H(2)*CNOT(2,1)*CNOT(1,0)*H(1)
40
+
41
+ def test_qasm_1q():
42
+ for symbol, gate in [('x', X), ('z', Z), ('h', H), ('s', S), ('t', T), ('measure', Mz)]:
43
+ q = Qasm('qubit q_0', '%s q_0' % symbol)
44
+ assert q.get_circuit() == gate(0)
45
+
46
+ def test_qasm_2q():
47
+ for symbol, gate in [('cnot', CNOT), ('swap', SWAP), ('cphase', CPHASE)]:
48
+ q = Qasm('qubit q_0', 'qubit q_1', '%s q_0,q_1' % symbol)
49
+ assert q.get_circuit() == gate(1,0)
50
+
51
+ def test_qasm_3q():
52
+ q = Qasm('qubit q0', 'qubit q1', 'qubit q2', 'toffoli q2,q1,q0')
53
+ assert q.get_circuit() == CGateS((0,1),X(2))
54
+
55
+ def test_qasm_flip_index():
56
+ assert flip_index(0, 2) == 1
57
+ assert flip_index(1, 2) == 0
58
+
59
+ def test_qasm_trim():
60
+ assert trim('nothing happens here') == 'nothing happens here'
61
+ assert trim("Something #happens here") == "Something "
62
+
63
+ def test_qasm_get_index():
64
+ assert get_index('q0', ['q0', 'q1']) == 1
65
+ assert get_index('q1', ['q0', 'q1']) == 0
66
+
67
+ def test_qasm_nonblank():
68
+ assert list(nonblank('abcd')) == list('abcd')
69
+ assert list(nonblank('abc ')) == list('abc')
70
+
71
+ def test_qasm_fullsplit():
72
+ assert fullsplit('g q0,q1,q2, q3') == ('g', ['q0', 'q1', 'q2', 'q3'])
73
+
74
+ def test_qasm_fixcommand():
75
+ assert fixcommand('foo') == 'foo'
76
+ assert fixcommand('def') == 'qdef'
77
+
78
+ def test_qasm_stripquotes():
79
+ assert stripquotes("'S'") == 'S'
80
+ assert stripquotes('"S"') == 'S'
81
+ assert stripquotes('S') == 'S'
82
+
83
+ def test_qasm_qdef():
84
+ # weaker test condition (str) since we don't have access to the actual class
85
+ q = Qasm("def Q,0,Q",'qubit q0','Q q0')
86
+ assert str(q.get_circuit()) == 'Q(0)'
87
+
88
+ q = Qasm("def CQ,1,Q", 'qubit q0', 'qubit q1', 'CQ q0,q1')
89
+ assert str(q.get_circuit()) == 'C((1),Q(0))'
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_qexpr.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.core.numbers import Integer
2
+ from sympy.core.symbol import Symbol
3
+ from sympy.concrete import Sum
4
+ from sympy.physics.quantum.qexpr import QExpr, _qsympify_sequence
5
+ from sympy.physics.quantum.hilbert import HilbertSpace
6
+ from sympy.core.containers import Tuple
7
+
8
+ x = Symbol('x')
9
+ y = Symbol('y')
10
+ n = Symbol('n', integer=True)
11
+ m = Symbol('m', integer=True)
12
+
13
+
14
+ def test_qexpr_new():
15
+ q = QExpr(0)
16
+ assert q.label == (0,)
17
+ assert q.hilbert_space == HilbertSpace()
18
+ assert q.is_commutative is False
19
+
20
+ q = QExpr(0, 1)
21
+ assert q.label == (Integer(0), Integer(1))
22
+
23
+ q = QExpr._new_rawargs(HilbertSpace(), Integer(0), Integer(1))
24
+ assert q.label == (Integer(0), Integer(1))
25
+ assert q.hilbert_space == HilbertSpace()
26
+
27
+
28
+ def test_qexpr_commutative():
29
+ q1 = QExpr(x)
30
+ q2 = QExpr(y)
31
+ assert q1.is_commutative is False
32
+ assert q2.is_commutative is False
33
+ assert q1*q2 != q2*q1
34
+
35
+ q = QExpr._new_rawargs(Integer(0), Integer(1), HilbertSpace())
36
+ assert q.is_commutative is False
37
+
38
+
39
+ def test_qexpr_free_symbols():
40
+ q1 = QExpr(x, y)
41
+ assert q1.free_symbols == {x, y}
42
+
43
+
44
+ def test_qexpr_sum():
45
+ q1 = Sum(QExpr(n), (n,0,2))
46
+ assert q1.doit() == QExpr(0) + QExpr(1) + QExpr(2)
47
+
48
+ q2 = Sum(QExpr(n, m), (n, 0, 2), (m, 0, 2))
49
+ assert q2.doit() == QExpr(0, 0) + QExpr(0, 1) + QExpr(0, 2) + \
50
+ QExpr(1, 0) + QExpr(1, 1) + QExpr(1, 2) + \
51
+ QExpr(2, 0) + QExpr(2, 1) + QExpr(2, 2)
52
+
53
+
54
+ def test_qexpr_subs():
55
+ q1 = QExpr(x, y)
56
+ assert q1.subs(x, y) == QExpr(y, y)
57
+ assert q1.subs({x: 1, y: 2}) == QExpr(1, 2)
58
+
59
+
60
+ def test_qsympify():
61
+ assert _qsympify_sequence([[1, 2], [1, 3]]) == (Tuple(1, 2), Tuple(1, 3))
62
+ assert _qsympify_sequence(([1, 2, [3, 4, [2, ]], 1], 3)) == \
63
+ (Tuple(1, 2, Tuple(3, 4, Tuple(2,)), 1), 3)
64
+ assert _qsympify_sequence((1,)) == (1,)
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_qft.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.core.numbers import (I, pi)
2
+ from sympy.core.symbol import Symbol
3
+ from sympy.functions.elementary.exponential import exp
4
+ from sympy.functions.elementary.miscellaneous import sqrt
5
+ from sympy.matrices.dense import Matrix
6
+
7
+ from sympy.physics.quantum.qft import QFT, IQFT, RkGate
8
+ from sympy.physics.quantum.gate import (ZGate, SwapGate, HadamardGate, CGate,
9
+ PhaseGate, TGate)
10
+ from sympy.physics.quantum.qubit import Qubit
11
+ from sympy.physics.quantum.qapply import qapply
12
+ from sympy.physics.quantum.represent import represent
13
+
14
+ from sympy.functions.elementary.complexes import sign
15
+
16
+
17
+ def test_RkGate():
18
+ x = Symbol('x')
19
+ assert RkGate(1, x).k == x
20
+ assert RkGate(1, x).targets == (1,)
21
+ assert RkGate(1, 1) == ZGate(1)
22
+ assert RkGate(2, 2) == PhaseGate(2)
23
+ assert RkGate(3, 3) == TGate(3)
24
+
25
+ assert represent(
26
+ RkGate(0, x), nqubits=1) == Matrix([[1, 0], [0, exp(sign(x)*2*pi*I/(2**abs(x)))]])
27
+
28
+
29
+ def test_quantum_fourier():
30
+ assert QFT(0, 3).decompose() == \
31
+ SwapGate(0, 2)*HadamardGate(0)*CGate((0,), PhaseGate(1)) * \
32
+ HadamardGate(1)*CGate((0,), TGate(2))*CGate((1,), PhaseGate(2)) * \
33
+ HadamardGate(2)
34
+
35
+ assert IQFT(0, 3).decompose() == \
36
+ HadamardGate(2)*CGate((1,), RkGate(2, -2))*CGate((0,), RkGate(2, -3)) * \
37
+ HadamardGate(1)*CGate((0,), RkGate(1, -2))*HadamardGate(0)*SwapGate(0, 2)
38
+
39
+ assert represent(QFT(0, 3), nqubits=3) == \
40
+ Matrix([[exp(2*pi*I/8)**(i*j % 8)/sqrt(8) for i in range(8)] for j in range(8)])
41
+
42
+ assert QFT(0, 4).decompose() # non-trivial decomposition
43
+ assert qapply(QFT(0, 3).decompose()*Qubit(0, 0, 0)).expand() == qapply(
44
+ HadamardGate(0)*HadamardGate(1)*HadamardGate(2)*Qubit(0, 0, 0)
45
+ ).expand()
46
+
47
+
48
+ def test_qft_represent():
49
+ c = QFT(0, 3)
50
+ a = represent(c, nqubits=3)
51
+ b = represent(c.decompose(), nqubits=3)
52
+ assert a.evalf(n=10) == b.evalf(n=10)
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_qubit.py ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import random
2
+
3
+ from sympy.core.numbers import (Integer, Rational)
4
+ from sympy.core.singleton import S
5
+ from sympy.core.symbol import symbols
6
+ from sympy.functions.elementary.miscellaneous import sqrt
7
+ from sympy.matrices.dense import Matrix
8
+ from sympy.physics.quantum.qubit import (measure_all, measure_all_oneshot, measure_partial,
9
+ matrix_to_qubit, matrix_to_density,
10
+ qubit_to_matrix, IntQubit,
11
+ IntQubitBra, QubitBra)
12
+ from sympy.physics.quantum.gate import (HadamardGate, CNOT, XGate, YGate,
13
+ ZGate, PhaseGate)
14
+ from sympy.physics.quantum.qapply import qapply
15
+ from sympy.physics.quantum.represent import represent
16
+ from sympy.physics.quantum.shor import Qubit
17
+ from sympy.testing.pytest import raises
18
+ from sympy.physics.quantum.density import Density
19
+ from sympy.physics.quantum.trace import Tr
20
+
21
+ x, y = symbols('x,y')
22
+
23
+ epsilon = .000001
24
+
25
+
26
+ def test_Qubit():
27
+ array = [0, 0, 1, 1, 0]
28
+ qb = Qubit('00110')
29
+ assert qb.flip(0) == Qubit('00111')
30
+ assert qb.flip(1) == Qubit('00100')
31
+ assert qb.flip(4) == Qubit('10110')
32
+ assert qb.qubit_values == (0, 0, 1, 1, 0)
33
+ assert qb.dimension == 5
34
+ for i in range(5):
35
+ assert qb[i] == array[4 - i]
36
+ assert len(qb) == 5
37
+ qb = Qubit('110')
38
+
39
+
40
+ def test_QubitBra():
41
+ qb = Qubit(0)
42
+ qb_bra = QubitBra(0)
43
+ assert qb.dual_class() == QubitBra
44
+ assert qb_bra.dual_class() == Qubit
45
+
46
+ qb = Qubit(1, 1, 0)
47
+ qb_bra = QubitBra(1, 1, 0)
48
+ assert represent(qb, nqubits=3).H == represent(qb_bra, nqubits=3)
49
+
50
+ qb = Qubit(0, 1)
51
+ qb_bra = QubitBra(1,0)
52
+ assert qb._eval_innerproduct_QubitBra(qb_bra) == Integer(0)
53
+
54
+ qb_bra = QubitBra(0, 1)
55
+ assert qb._eval_innerproduct_QubitBra(qb_bra) == Integer(1)
56
+
57
+
58
+ def test_IntQubit():
59
+ # issue 9136
60
+ iqb = IntQubit(0, nqubits=1)
61
+ assert qubit_to_matrix(Qubit('0')) == qubit_to_matrix(iqb)
62
+
63
+ qb = Qubit('1010')
64
+ assert qubit_to_matrix(IntQubit(qb)) == qubit_to_matrix(qb)
65
+
66
+ iqb = IntQubit(1, nqubits=1)
67
+ assert qubit_to_matrix(Qubit('1')) == qubit_to_matrix(iqb)
68
+ assert qubit_to_matrix(IntQubit(1)) == qubit_to_matrix(iqb)
69
+
70
+ iqb = IntQubit(7, nqubits=4)
71
+ assert qubit_to_matrix(Qubit('0111')) == qubit_to_matrix(iqb)
72
+ assert qubit_to_matrix(IntQubit(7, 4)) == qubit_to_matrix(iqb)
73
+
74
+ iqb = IntQubit(8)
75
+ assert iqb.as_int() == 8
76
+ assert iqb.qubit_values == (1, 0, 0, 0)
77
+
78
+ iqb = IntQubit(7, 4)
79
+ assert iqb.qubit_values == (0, 1, 1, 1)
80
+ assert IntQubit(3) == IntQubit(3, 2)
81
+
82
+ #test Dual Classes
83
+ iqb = IntQubit(3)
84
+ iqb_bra = IntQubitBra(3)
85
+ assert iqb.dual_class() == IntQubitBra
86
+ assert iqb_bra.dual_class() == IntQubit
87
+
88
+ iqb = IntQubit(5)
89
+ iqb_bra = IntQubitBra(5)
90
+ assert iqb._eval_innerproduct_IntQubitBra(iqb_bra) == Integer(1)
91
+
92
+ iqb = IntQubit(4)
93
+ iqb_bra = IntQubitBra(5)
94
+ assert iqb._eval_innerproduct_IntQubitBra(iqb_bra) == Integer(0)
95
+ raises(ValueError, lambda: IntQubit(4, 1))
96
+
97
+ raises(ValueError, lambda: IntQubit('5'))
98
+ raises(ValueError, lambda: IntQubit(5, '5'))
99
+ raises(ValueError, lambda: IntQubit(5, nqubits='5'))
100
+ raises(TypeError, lambda: IntQubit(5, bad_arg=True))
101
+
102
+ def test_superposition_of_states():
103
+ state = 1/sqrt(2)*Qubit('01') + 1/sqrt(2)*Qubit('10')
104
+ state_gate = CNOT(0, 1)*HadamardGate(0)*state
105
+ state_expanded = Qubit('01')/2 + Qubit('00')/2 - Qubit('11')/2 + Qubit('10')/2
106
+ assert qapply(state_gate).expand() == state_expanded
107
+ assert matrix_to_qubit(represent(state_gate, nqubits=2)) == state_expanded
108
+
109
+
110
+ #test apply methods
111
+ def test_apply_represent_equality():
112
+ gates = [HadamardGate(int(3*random.random())),
113
+ XGate(int(3*random.random())), ZGate(int(3*random.random())),
114
+ YGate(int(3*random.random())), ZGate(int(3*random.random())),
115
+ PhaseGate(int(3*random.random()))]
116
+
117
+ circuit = Qubit(int(random.random()*2), int(random.random()*2),
118
+ int(random.random()*2), int(random.random()*2), int(random.random()*2),
119
+ int(random.random()*2))
120
+ for i in range(int(random.random()*6)):
121
+ circuit = gates[int(random.random()*6)]*circuit
122
+
123
+ mat = represent(circuit, nqubits=6)
124
+ states = qapply(circuit)
125
+ state_rep = matrix_to_qubit(mat)
126
+ states = states.expand()
127
+ state_rep = state_rep.expand()
128
+ assert state_rep == states
129
+
130
+
131
+ def test_matrix_to_qubits():
132
+ qb = Qubit(0, 0, 0, 0)
133
+ mat = Matrix([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
134
+ assert matrix_to_qubit(mat) == qb
135
+ assert qubit_to_matrix(qb) == mat
136
+
137
+ state = 2*sqrt(2)*(Qubit(0, 0, 0) + Qubit(0, 0, 1) + Qubit(0, 1, 0) +
138
+ Qubit(0, 1, 1) + Qubit(1, 0, 0) + Qubit(1, 0, 1) +
139
+ Qubit(1, 1, 0) + Qubit(1, 1, 1))
140
+ ones = sqrt(2)*2*Matrix([1, 1, 1, 1, 1, 1, 1, 1])
141
+ assert matrix_to_qubit(ones) == state.expand()
142
+ assert qubit_to_matrix(state) == ones
143
+
144
+
145
+ def test_measure_normalize():
146
+ a, b = symbols('a b')
147
+ state = a*Qubit('110') + b*Qubit('111')
148
+ assert measure_partial(state, (0,), normalize=False) == \
149
+ [(a*Qubit('110'), a*a.conjugate()), (b*Qubit('111'), b*b.conjugate())]
150
+ assert measure_all(state, normalize=False) == \
151
+ [(Qubit('110'), a*a.conjugate()), (Qubit('111'), b*b.conjugate())]
152
+
153
+
154
+ def test_measure_partial():
155
+ #Basic test of collapse of entangled two qubits (Bell States)
156
+ state = Qubit('01') + Qubit('10')
157
+ assert measure_partial(state, (0,)) == \
158
+ [(Qubit('10'), S.Half), (Qubit('01'), S.Half)]
159
+ assert measure_partial(state, int(0)) == \
160
+ [(Qubit('10'), S.Half), (Qubit('01'), S.Half)]
161
+ assert measure_partial(state, (0,)) == \
162
+ measure_partial(state, (1,))[::-1]
163
+
164
+ #Test of more complex collapse and probability calculation
165
+ state1 = sqrt(2)/sqrt(3)*Qubit('00001') + 1/sqrt(3)*Qubit('11111')
166
+ assert measure_partial(state1, (0,)) == \
167
+ [(sqrt(2)/sqrt(3)*Qubit('00001') + 1/sqrt(3)*Qubit('11111'), 1)]
168
+ assert measure_partial(state1, (1, 2)) == measure_partial(state1, (3, 4))
169
+ assert measure_partial(state1, (1, 2, 3)) == \
170
+ [(Qubit('00001'), Rational(2, 3)), (Qubit('11111'), Rational(1, 3))]
171
+
172
+ #test of measuring multiple bits at once
173
+ state2 = Qubit('1111') + Qubit('1101') + Qubit('1011') + Qubit('1000')
174
+ assert measure_partial(state2, (0, 1, 3)) == \
175
+ [(Qubit('1000'), Rational(1, 4)), (Qubit('1101'), Rational(1, 4)),
176
+ (Qubit('1011')/sqrt(2) + Qubit('1111')/sqrt(2), S.Half)]
177
+ assert measure_partial(state2, (0,)) == \
178
+ [(Qubit('1000'), Rational(1, 4)),
179
+ (Qubit('1111')/sqrt(3) + Qubit('1101')/sqrt(3) +
180
+ Qubit('1011')/sqrt(3), Rational(3, 4))]
181
+
182
+
183
+ def test_measure_all():
184
+ assert measure_all(Qubit('11')) == [(Qubit('11'), 1)]
185
+ state = Qubit('11') + Qubit('10')
186
+ assert measure_all(state) == [(Qubit('10'), S.Half),
187
+ (Qubit('11'), S.Half)]
188
+ state2 = Qubit('11')/sqrt(5) + 2*Qubit('00')/sqrt(5)
189
+ assert measure_all(state2) == \
190
+ [(Qubit('00'), Rational(4, 5)), (Qubit('11'), Rational(1, 5))]
191
+
192
+ # from issue #12585
193
+ assert measure_all(qapply(Qubit('0'))) == [(Qubit('0'), 1)]
194
+
195
+
196
+ def test_measure_all_oneshot():
197
+ random.seed(42)
198
+ # for issue #27092
199
+ assert measure_all_oneshot(Qubit('11')) == Qubit('11')
200
+ assert measure_all_oneshot(Qubit('1')) == Qubit('1')
201
+ assert measure_all_oneshot(Qubit('0')/sqrt(2) + Qubit('1')/sqrt(2)) == \
202
+ Qubit('0')
203
+
204
+
205
+ def test_eval_trace():
206
+ q1 = Qubit('10110')
207
+ q2 = Qubit('01010')
208
+ d = Density([q1, 0.6], [q2, 0.4])
209
+
210
+ t = Tr(d)
211
+ assert t.doit() == 1.0
212
+
213
+ # extreme bits
214
+ t = Tr(d, 0)
215
+ assert t.doit() == (0.4*Density([Qubit('0101'), 1]) +
216
+ 0.6*Density([Qubit('1011'), 1]))
217
+ t = Tr(d, 4)
218
+ assert t.doit() == (0.4*Density([Qubit('1010'), 1]) +
219
+ 0.6*Density([Qubit('0110'), 1]))
220
+ # index somewhere in between
221
+ t = Tr(d, 2)
222
+ assert t.doit() == (0.4*Density([Qubit('0110'), 1]) +
223
+ 0.6*Density([Qubit('1010'), 1]))
224
+ #trace all indices
225
+ t = Tr(d, [0, 1, 2, 3, 4])
226
+ assert t.doit() == 1.0
227
+
228
+ # trace some indices, initialized in
229
+ # non-canonical order
230
+ t = Tr(d, [2, 1, 3])
231
+ assert t.doit() == (0.4*Density([Qubit('00'), 1]) +
232
+ 0.6*Density([Qubit('10'), 1]))
233
+
234
+ # mixed states
235
+ q = (1/sqrt(2)) * (Qubit('00') + Qubit('11'))
236
+ d = Density( [q, 1.0] )
237
+ t = Tr(d, 0)
238
+ assert t.doit() == (0.5*Density([Qubit('0'), 1]) +
239
+ 0.5*Density([Qubit('1'), 1]))
240
+
241
+
242
+ def test_matrix_to_density():
243
+ mat = Matrix([[0, 0], [0, 1]])
244
+ assert matrix_to_density(mat) == Density([Qubit('1'), 1])
245
+
246
+ mat = Matrix([[1, 0], [0, 0]])
247
+ assert matrix_to_density(mat) == Density([Qubit('0'), 1])
248
+
249
+ mat = Matrix([[0, 0], [0, 0]])
250
+ assert matrix_to_density(mat) == 0
251
+
252
+ mat = Matrix([[0, 0, 0, 0],
253
+ [0, 0, 0, 0],
254
+ [0, 0, 1, 0],
255
+ [0, 0, 0, 0]])
256
+
257
+ assert matrix_to_density(mat) == Density([Qubit('10'), 1])
258
+
259
+ mat = Matrix([[1, 0, 0, 0],
260
+ [0, 0, 0, 0],
261
+ [0, 0, 0, 0],
262
+ [0, 0, 0, 0]])
263
+
264
+ assert matrix_to_density(mat) == Density([Qubit('00'), 1])
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_represent.py ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.core.numbers import (Float, I, Integer)
2
+ from sympy.matrices.dense import Matrix
3
+ from sympy.external import import_module
4
+ from sympy.testing.pytest import skip
5
+
6
+ from sympy.physics.quantum.dagger import Dagger
7
+ from sympy.physics.quantum.represent import (represent, rep_innerproduct,
8
+ rep_expectation, enumerate_states)
9
+ from sympy.physics.quantum.state import Bra, Ket
10
+ from sympy.physics.quantum.operator import Operator, OuterProduct
11
+ from sympy.physics.quantum.tensorproduct import TensorProduct
12
+ from sympy.physics.quantum.tensorproduct import matrix_tensor_product
13
+ from sympy.physics.quantum.commutator import Commutator
14
+ from sympy.physics.quantum.anticommutator import AntiCommutator
15
+ from sympy.physics.quantum.innerproduct import InnerProduct
16
+ from sympy.physics.quantum.matrixutils import (numpy_ndarray,
17
+ scipy_sparse_matrix, to_numpy,
18
+ to_scipy_sparse, to_sympy)
19
+ from sympy.physics.quantum.cartesian import XKet, XOp, XBra
20
+ from sympy.physics.quantum.qapply import qapply
21
+ from sympy.physics.quantum.operatorset import operators_to_state
22
+ from sympy.testing.pytest import raises
23
+
24
+ Amat = Matrix([[1, I], [-I, 1]])
25
+ Bmat = Matrix([[1, 2], [3, 4]])
26
+ Avec = Matrix([[1], [I]])
27
+
28
+
29
+ class AKet(Ket):
30
+
31
+ @classmethod
32
+ def dual_class(self):
33
+ return ABra
34
+
35
+ def _represent_default_basis(self, **options):
36
+ return self._represent_AOp(None, **options)
37
+
38
+ def _represent_AOp(self, basis, **options):
39
+ return Avec
40
+
41
+
42
+ class ABra(Bra):
43
+
44
+ @classmethod
45
+ def dual_class(self):
46
+ return AKet
47
+
48
+
49
+ class AOp(Operator):
50
+
51
+ def _represent_default_basis(self, **options):
52
+ return self._represent_AOp(None, **options)
53
+
54
+ def _represent_AOp(self, basis, **options):
55
+ return Amat
56
+
57
+
58
+ class BOp(Operator):
59
+
60
+ def _represent_default_basis(self, **options):
61
+ return self._represent_AOp(None, **options)
62
+
63
+ def _represent_AOp(self, basis, **options):
64
+ return Bmat
65
+
66
+
67
+ k = AKet('a')
68
+ b = ABra('a')
69
+ A = AOp('A')
70
+ B = BOp('B')
71
+
72
+ _tests = [
73
+ # Bra
74
+ (b, Dagger(Avec)),
75
+ (Dagger(b), Avec),
76
+ # Ket
77
+ (k, Avec),
78
+ (Dagger(k), Dagger(Avec)),
79
+ # Operator
80
+ (A, Amat),
81
+ (Dagger(A), Dagger(Amat)),
82
+ # OuterProduct
83
+ (OuterProduct(k, b), Avec*Avec.H),
84
+ # TensorProduct
85
+ (TensorProduct(A, B), matrix_tensor_product(Amat, Bmat)),
86
+ # Pow
87
+ (A**2, Amat**2),
88
+ # Add/Mul
89
+ (A*B + 2*A, Amat*Bmat + 2*Amat),
90
+ # Commutator
91
+ (Commutator(A, B), Amat*Bmat - Bmat*Amat),
92
+ # AntiCommutator
93
+ (AntiCommutator(A, B), Amat*Bmat + Bmat*Amat),
94
+ # InnerProduct
95
+ (InnerProduct(b, k), (Avec.H*Avec)[0])
96
+ ]
97
+
98
+
99
+ def test_format_sympy():
100
+ for test in _tests:
101
+ lhs = represent(test[0], basis=A, format='sympy')
102
+ rhs = to_sympy(test[1])
103
+ assert lhs == rhs
104
+
105
+
106
+ def test_scalar_sympy():
107
+ assert represent(Integer(1)) == Integer(1)
108
+ assert represent(Float(1.0)) == Float(1.0)
109
+ assert represent(1.0 + I) == 1.0 + I
110
+
111
+
112
+ np = import_module('numpy')
113
+
114
+
115
+ def test_format_numpy():
116
+ if not np:
117
+ skip("numpy not installed.")
118
+
119
+ for test in _tests:
120
+ lhs = represent(test[0], basis=A, format='numpy')
121
+ rhs = to_numpy(test[1])
122
+ if isinstance(lhs, numpy_ndarray):
123
+ assert (lhs == rhs).all()
124
+ else:
125
+ assert lhs == rhs
126
+
127
+
128
+ def test_scalar_numpy():
129
+ if not np:
130
+ skip("numpy not installed.")
131
+
132
+ assert represent(Integer(1), format='numpy') == 1
133
+ assert represent(Float(1.0), format='numpy') == 1.0
134
+ assert represent(1.0 + I, format='numpy') == 1.0 + 1.0j
135
+
136
+
137
+ scipy = import_module('scipy', import_kwargs={'fromlist': ['sparse']})
138
+
139
+
140
+ def test_format_scipy_sparse():
141
+ if not np:
142
+ skip("numpy not installed.")
143
+ if not scipy:
144
+ skip("scipy not installed.")
145
+
146
+ for test in _tests:
147
+ lhs = represent(test[0], basis=A, format='scipy.sparse')
148
+ rhs = to_scipy_sparse(test[1])
149
+ if isinstance(lhs, scipy_sparse_matrix):
150
+ assert np.linalg.norm((lhs - rhs).todense()) == 0.0
151
+ else:
152
+ assert lhs == rhs
153
+
154
+
155
+ def test_scalar_scipy_sparse():
156
+ if not np:
157
+ skip("numpy not installed.")
158
+ if not scipy:
159
+ skip("scipy not installed.")
160
+
161
+ assert represent(Integer(1), format='scipy.sparse') == 1
162
+ assert represent(Float(1.0), format='scipy.sparse') == 1.0
163
+ assert represent(1.0 + I, format='scipy.sparse') == 1.0 + 1.0j
164
+
165
+ x_ket = XKet('x')
166
+ x_bra = XBra('x')
167
+ x_op = XOp('X')
168
+
169
+
170
+ def test_innerprod_represent():
171
+ assert rep_innerproduct(x_ket) == InnerProduct(XBra("x_1"), x_ket).doit()
172
+ assert rep_innerproduct(x_bra) == InnerProduct(x_bra, XKet("x_1")).doit()
173
+ raises(TypeError, lambda: rep_innerproduct(x_op))
174
+
175
+
176
+ def test_operator_represent():
177
+ basis_kets = enumerate_states(operators_to_state(x_op), 1, 2)
178
+ assert rep_expectation(
179
+ x_op) == qapply(basis_kets[1].dual*x_op*basis_kets[0])
180
+
181
+
182
+ def test_enumerate_states():
183
+ test = XKet("foo")
184
+ assert enumerate_states(test, 1, 1) == [XKet("foo_1")]
185
+ assert enumerate_states(
186
+ test, [1, 2, 4]) == [XKet("foo_1"), XKet("foo_2"), XKet("foo_4")]
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_sho1d.py ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Tests for sho1d.py"""
2
+
3
+ from sympy.concrete import Sum
4
+ from sympy.core import oo
5
+ from sympy.core.numbers import (I, Integer)
6
+ from sympy.core.singleton import S
7
+ from sympy.core.symbol import Symbol, symbols
8
+ from sympy.functions.combinatorial.factorials import factorial
9
+ from sympy.functions.elementary.exponential import exp
10
+ from sympy.functions.elementary.miscellaneous import sqrt
11
+ from sympy.functions.elementary.complexes import Abs
12
+ from sympy.functions.special.tensor_functions import KroneckerDelta
13
+ from sympy.physics.quantum import Dagger
14
+ from sympy.physics.quantum.constants import hbar
15
+ from sympy.physics.quantum import Commutator
16
+ from sympy.physics.quantum.qapply import qapply
17
+ from sympy.physics.quantum.innerproduct import InnerProduct
18
+ from sympy.physics.quantum.cartesian import X, Px
19
+ from sympy.physics.quantum.hilbert import ComplexSpace
20
+ from sympy.physics.quantum.represent import represent
21
+ from sympy.simplify import simplify
22
+ from sympy.external import import_module
23
+ from sympy.tensor import IndexedBase, Idx
24
+ from sympy.testing.pytest import skip, raises
25
+
26
+ from sympy.physics.quantum.sho1d import (RaisingOp, LoweringOp,
27
+ SHOKet, SHOBra,
28
+ Hamiltonian, NumberOp)
29
+
30
+ ad = RaisingOp('a')
31
+ a = LoweringOp('a')
32
+ k = SHOKet('k')
33
+ kz = SHOKet(0)
34
+ kf = SHOKet(1)
35
+ k3 = SHOKet(3)
36
+ b = SHOBra('b')
37
+ b3 = SHOBra(3)
38
+ H = Hamiltonian('H')
39
+ N = NumberOp('N')
40
+ omega = Symbol('omega')
41
+ m = Symbol('m')
42
+ ndim = Integer(4)
43
+ p = Symbol('p', integer=True)
44
+ q = Symbol('q', nonnegative=True, integer=True)
45
+
46
+
47
+ np = import_module('numpy')
48
+ scipy = import_module('scipy', import_kwargs={'fromlist': ['sparse']})
49
+
50
+ ad_rep_sympy = represent(ad, basis=N, ndim=4, format='sympy')
51
+ a_rep = represent(a, basis=N, ndim=4, format='sympy')
52
+ N_rep = represent(N, basis=N, ndim=4, format='sympy')
53
+ H_rep = represent(H, basis=N, ndim=4, format='sympy')
54
+ k3_rep = represent(k3, basis=N, ndim=4, format='sympy')
55
+ b3_rep = represent(b3, basis=N, ndim=4, format='sympy')
56
+
57
+ def test_RaisingOp():
58
+ assert Dagger(ad) == a
59
+ assert Commutator(ad, a).doit() == Integer(-1)
60
+ assert Commutator(ad, N).doit() == Integer(-1)*ad
61
+ assert qapply(ad*k) == (sqrt(k.n + 1)*SHOKet(k.n + 1)).expand()
62
+ assert qapply(ad*kz) == (sqrt(kz.n + 1)*SHOKet(kz.n + 1)).expand()
63
+ assert qapply(ad*kf) == (sqrt(kf.n + 1)*SHOKet(kf.n + 1)).expand()
64
+ assert ad.rewrite('xp').doit() == \
65
+ (Integer(1)/sqrt(Integer(2)*hbar*m*omega))*(Integer(-1)*I*Px + m*omega*X)
66
+ assert ad.hilbert_space == ComplexSpace(S.Infinity)
67
+ for i in range(ndim - 1):
68
+ assert ad_rep_sympy[i + 1,i] == sqrt(i + 1)
69
+
70
+ if not np:
71
+ skip("numpy not installed.")
72
+
73
+ ad_rep_numpy = represent(ad, basis=N, ndim=4, format='numpy')
74
+ for i in range(ndim - 1):
75
+ assert ad_rep_numpy[i + 1,i] == float(sqrt(i + 1))
76
+
77
+ if not np:
78
+ skip("numpy not installed.")
79
+ if not scipy:
80
+ skip("scipy not installed.")
81
+
82
+ ad_rep_scipy = represent(ad, basis=N, ndim=4, format='scipy.sparse', spmatrix='lil')
83
+ for i in range(ndim - 1):
84
+ assert ad_rep_scipy[i + 1,i] == float(sqrt(i + 1))
85
+
86
+ assert ad_rep_numpy.dtype == 'float64'
87
+ assert ad_rep_scipy.dtype == 'float64'
88
+
89
+ def test_LoweringOp():
90
+ assert Dagger(a) == ad
91
+ assert Commutator(a, ad).doit() == Integer(1)
92
+ assert Commutator(a, N).doit() == a
93
+ assert qapply(a*k) == (sqrt(k.n)*SHOKet(k.n-Integer(1))).expand()
94
+ assert qapply(a*kz) == Integer(0)
95
+ assert qapply(a*kf) == (sqrt(kf.n)*SHOKet(kf.n-Integer(1))).expand()
96
+ assert a.rewrite('xp').doit() == \
97
+ (Integer(1)/sqrt(Integer(2)*hbar*m*omega))*(I*Px + m*omega*X)
98
+ for i in range(ndim - 1):
99
+ assert a_rep[i,i + 1] == sqrt(i + 1)
100
+
101
+ def test_NumberOp():
102
+ assert Commutator(N, ad).doit() == ad
103
+ assert Commutator(N, a).doit() == Integer(-1)*a
104
+ assert Commutator(N, H).doit() == Integer(0)
105
+ assert qapply(N*k) == (k.n*k).expand()
106
+ assert N.rewrite('a').doit() == ad*a
107
+ assert N.rewrite('xp').doit() == (Integer(1)/(Integer(2)*m*hbar*omega))*(
108
+ Px**2 + (m*omega*X)**2) - Integer(1)/Integer(2)
109
+ assert N.rewrite('H').doit() == H/(hbar*omega) - Integer(1)/Integer(2)
110
+ for i in range(ndim):
111
+ assert N_rep[i,i] == i
112
+ assert N_rep == ad_rep_sympy*a_rep
113
+
114
+ def test_Hamiltonian():
115
+ assert Commutator(H, N).doit() == Integer(0)
116
+ assert qapply(H*k) == ((hbar*omega*(k.n + Integer(1)/Integer(2)))*k).expand()
117
+ assert H.rewrite('a').doit() == hbar*omega*(ad*a + Integer(1)/Integer(2))
118
+ assert H.rewrite('xp').doit() == \
119
+ (Integer(1)/(Integer(2)*m))*(Px**2 + (m*omega*X)**2)
120
+ assert H.rewrite('N').doit() == hbar*omega*(N + Integer(1)/Integer(2))
121
+ for i in range(ndim):
122
+ assert H_rep[i,i] == hbar*omega*(i + Integer(1)/Integer(2))
123
+
124
+ def test_SHOKet():
125
+ assert SHOKet('k').dual_class() == SHOBra
126
+ assert SHOBra('b').dual_class() == SHOKet
127
+ assert InnerProduct(b,k).doit() == KroneckerDelta(k.n, b.n)
128
+ assert k.hilbert_space == ComplexSpace(S.Infinity)
129
+ assert k3_rep[k3.n, 0] == Integer(1)
130
+ assert b3_rep[0, b3.n] == Integer(1)
131
+
132
+ def test_sho_sums():
133
+ e1 = Sum(SHOKet(p)*SHOBra(p), (p, 0, 1))
134
+ assert e1.doit() == SHOKet(0)*SHOBra(0) + SHOKet(1)*SHOBra(1)
135
+
136
+ # Test qapply with Sum on the left
137
+ assert qapply(
138
+ Sum(SHOKet(p)*SHOBra(p), (p, 0, oo))*SHOKet(q),
139
+ sum_doit=True
140
+ ) == SHOKet(q)
141
+
142
+ # Test qapply with Sum on the right
143
+ a = IndexedBase('a')
144
+ n = symbols('n', cls=Idx)
145
+ result = qapply(SHOBra(q)*Sum(a[n]*SHOKet(n), (n,0,oo)), sum_doit=True)
146
+ assert result == a[q]
147
+
148
+ # Test qapply with a product of Sums
149
+ result = qapply(
150
+ SHOBra(q)*Sum(SHOKet(p)*SHOBra(p), (p, 0, oo))*Sum(a[n]*SHOKet(n), (n,0,oo)),
151
+ sum_doit=True
152
+ )
153
+ assert result == a[q]
154
+
155
+ with raises(ValueError):
156
+ result = qapply(
157
+ SHOBra(q)*Sum(SHOKet(p)*SHOBra(p), (p, 0, oo))*Sum(a[p]*SHOKet(p), (p,0,oo)),
158
+ sum_doit=True
159
+ )
160
+
161
+ def test_sho_coherant_state():
162
+ alpha = Symbol('alpha', is_complex=True)
163
+ cstate = exp(-Abs(alpha)**2/S(2))*Sum(((alpha**p)/sqrt(factorial(p)))*SHOKet(p), (p,0,oo))
164
+ # Projection onto the number eigenstate
165
+ assert qapply(SHOBra(q)*cstate, sum_doit=True) == exp(-Abs(alpha)**2/S(2))*alpha**q/sqrt(factorial(q))
166
+ # Ensure that the coherent state is an eigenstate of annihilation operator
167
+ assert simplify(qapply(SHOBra(q)*a*cstate, sum_doit=True)) == simplify(qapply(SHOBra(q)*alpha*cstate, sum_doit=True))
168
+
169
+ def test_issue_26495():
170
+ nbar = Symbol('nbar', real=True, nonnegative=True)
171
+ n = Symbol('n', integer=True)
172
+ i = Symbol('i', integer=True, nonnegative=True)
173
+ j = Symbol('j', integer=True, nonnegative=True)
174
+ rho = Sum((nbar/(1+nbar))**n*SHOKet(n)*SHOBra(n), (n,0,oo))
175
+ result = qapply(SHOBra(i)*rho*SHOKet(j), sum_doit=True)
176
+ assert simplify(result) == (nbar/(nbar+1))**i*KroneckerDelta(i,j)
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_shor.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.testing.pytest import XFAIL
2
+
3
+ from sympy.physics.quantum.qapply import qapply
4
+ from sympy.physics.quantum.qubit import Qubit
5
+ from sympy.physics.quantum.shor import CMod, getr
6
+
7
+
8
+ @XFAIL
9
+ def test_CMod():
10
+ assert qapply(CMod(4, 2, 2)*Qubit(0, 0, 1, 0, 0, 0, 0, 0)) == \
11
+ Qubit(0, 0, 1, 0, 0, 0, 0, 0)
12
+ assert qapply(CMod(5, 5, 7)*Qubit(0, 0, 1, 0, 0, 0, 0, 0, 0, 0)) == \
13
+ Qubit(0, 0, 1, 0, 0, 0, 0, 0, 1, 0)
14
+ assert qapply(CMod(3, 2, 3)*Qubit(0, 1, 0, 0, 0, 0)) == \
15
+ Qubit(0, 1, 0, 0, 0, 1)
16
+
17
+
18
+ def test_continued_frac():
19
+ assert getr(513, 1024, 10) == 2
20
+ assert getr(169, 1024, 11) == 6
21
+ assert getr(314, 4096, 16) == 13
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_spin.py ADDED
The diff for this file is too large to render. See raw diff
 
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_state.py ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.core.add import Add
2
+ from sympy.core.function import diff
3
+ from sympy.core.mul import Mul
4
+ from sympy.core.numbers import (I, Integer, Rational, oo, pi)
5
+ from sympy.core.power import Pow
6
+ from sympy.core.singleton import S
7
+ from sympy.core.symbol import (Symbol, symbols)
8
+ from sympy.core.sympify import sympify
9
+ from sympy.functions.elementary.complexes import conjugate
10
+ from sympy.functions.elementary.miscellaneous import sqrt
11
+ from sympy.functions.elementary.trigonometric import sin
12
+ from sympy.testing.pytest import raises
13
+
14
+ from sympy.physics.quantum.dagger import Dagger
15
+ from sympy.physics.quantum.qexpr import QExpr
16
+ from sympy.physics.quantum.state import (
17
+ Ket, Bra, TimeDepKet, TimeDepBra,
18
+ KetBase, BraBase, StateBase, Wavefunction,
19
+ OrthogonalKet, OrthogonalBra
20
+ )
21
+ from sympy.physics.quantum.hilbert import HilbertSpace
22
+
23
+ x, y, t = symbols('x,y,t')
24
+
25
+
26
+ class CustomKet(Ket):
27
+ @classmethod
28
+ def default_args(self):
29
+ return ("test",)
30
+
31
+
32
+ class CustomKetMultipleLabels(Ket):
33
+ @classmethod
34
+ def default_args(self):
35
+ return ("r", "theta", "phi")
36
+
37
+
38
+ class CustomTimeDepKet(TimeDepKet):
39
+ @classmethod
40
+ def default_args(self):
41
+ return ("test", "t")
42
+
43
+
44
+ class CustomTimeDepKetMultipleLabels(TimeDepKet):
45
+ @classmethod
46
+ def default_args(self):
47
+ return ("r", "theta", "phi", "t")
48
+
49
+
50
+ def test_ket():
51
+ k = Ket('0')
52
+
53
+ assert isinstance(k, Ket)
54
+ assert isinstance(k, KetBase)
55
+ assert isinstance(k, StateBase)
56
+ assert isinstance(k, QExpr)
57
+
58
+ assert k.label == (Symbol('0'),)
59
+ assert k.hilbert_space == HilbertSpace()
60
+ assert k.is_commutative is False
61
+
62
+ # Make sure this doesn't get converted to the number pi.
63
+ k = Ket('pi')
64
+ assert k.label == (Symbol('pi'),)
65
+
66
+ k = Ket(x, y)
67
+ assert k.label == (x, y)
68
+ assert k.hilbert_space == HilbertSpace()
69
+ assert k.is_commutative is False
70
+
71
+ assert k.dual_class() == Bra
72
+ assert k.dual == Bra(x, y)
73
+ assert k.subs(x, y) == Ket(y, y)
74
+
75
+ k = CustomKet()
76
+ assert k == CustomKet("test")
77
+
78
+ k = CustomKetMultipleLabels()
79
+ assert k == CustomKetMultipleLabels("r", "theta", "phi")
80
+
81
+ assert Ket() == Ket('psi')
82
+
83
+
84
+ def test_bra():
85
+ b = Bra('0')
86
+
87
+ assert isinstance(b, Bra)
88
+ assert isinstance(b, BraBase)
89
+ assert isinstance(b, StateBase)
90
+ assert isinstance(b, QExpr)
91
+
92
+ assert b.label == (Symbol('0'),)
93
+ assert b.hilbert_space == HilbertSpace()
94
+ assert b.is_commutative is False
95
+
96
+ # Make sure this doesn't get converted to the number pi.
97
+ b = Bra('pi')
98
+ assert b.label == (Symbol('pi'),)
99
+
100
+ b = Bra(x, y)
101
+ assert b.label == (x, y)
102
+ assert b.hilbert_space == HilbertSpace()
103
+ assert b.is_commutative is False
104
+
105
+ assert b.dual_class() == Ket
106
+ assert b.dual == Ket(x, y)
107
+ assert b.subs(x, y) == Bra(y, y)
108
+
109
+ assert Bra() == Bra('psi')
110
+
111
+
112
+ def test_ops():
113
+ k0 = Ket(0)
114
+ k1 = Ket(1)
115
+ k = 2*I*k0 - (x/sqrt(2))*k1
116
+ assert k == Add(Mul(2, I, k0),
117
+ Mul(Rational(-1, 2), x, Pow(2, S.Half), k1))
118
+
119
+
120
+ def test_time_dep_ket():
121
+ k = TimeDepKet(0, t)
122
+
123
+ assert isinstance(k, TimeDepKet)
124
+ assert isinstance(k, KetBase)
125
+ assert isinstance(k, StateBase)
126
+ assert isinstance(k, QExpr)
127
+
128
+ assert k.label == (Integer(0),)
129
+ assert k.args == (Integer(0), t)
130
+ assert k.time == t
131
+
132
+ assert k.dual_class() == TimeDepBra
133
+ assert k.dual == TimeDepBra(0, t)
134
+
135
+ assert k.subs(t, 2) == TimeDepKet(0, 2)
136
+
137
+ k = TimeDepKet(x, 0.5)
138
+ assert k.label == (x,)
139
+ assert k.args == (x, sympify(0.5))
140
+
141
+ k = CustomTimeDepKet()
142
+ assert k.label == (Symbol("test"),)
143
+ assert k.time == Symbol("t")
144
+ assert k == CustomTimeDepKet("test", "t")
145
+
146
+ k = CustomTimeDepKetMultipleLabels()
147
+ assert k.label == (Symbol("r"), Symbol("theta"), Symbol("phi"))
148
+ assert k.time == Symbol("t")
149
+ assert k == CustomTimeDepKetMultipleLabels("r", "theta", "phi", "t")
150
+
151
+ assert TimeDepKet() == TimeDepKet("psi", "t")
152
+
153
+
154
+ def test_time_dep_bra():
155
+ b = TimeDepBra(0, t)
156
+
157
+ assert isinstance(b, TimeDepBra)
158
+ assert isinstance(b, BraBase)
159
+ assert isinstance(b, StateBase)
160
+ assert isinstance(b, QExpr)
161
+
162
+ assert b.label == (Integer(0),)
163
+ assert b.args == (Integer(0), t)
164
+ assert b.time == t
165
+
166
+ assert b.dual_class() == TimeDepKet
167
+ assert b.dual == TimeDepKet(0, t)
168
+
169
+ k = TimeDepBra(x, 0.5)
170
+ assert k.label == (x,)
171
+ assert k.args == (x, sympify(0.5))
172
+
173
+ assert TimeDepBra() == TimeDepBra("psi", "t")
174
+
175
+
176
+ def test_bra_ket_dagger():
177
+ x = symbols('x', complex=True)
178
+ k = Ket('k')
179
+ b = Bra('b')
180
+ assert Dagger(k) == Bra('k')
181
+ assert Dagger(b) == Ket('b')
182
+ assert Dagger(k).is_commutative is False
183
+
184
+ k2 = Ket('k2')
185
+ e = 2*I*k + x*k2
186
+ assert Dagger(e) == conjugate(x)*Dagger(k2) - 2*I*Dagger(k)
187
+
188
+
189
+ def test_wavefunction():
190
+ x, y = symbols('x y', real=True)
191
+ L = symbols('L', positive=True)
192
+ n = symbols('n', integer=True, positive=True)
193
+
194
+ f = Wavefunction(x**2, x)
195
+ p = f.prob()
196
+ lims = f.limits
197
+
198
+ assert f.is_normalized is False
199
+ assert f.norm is oo
200
+ assert f(10) == 100
201
+ assert p(10) == 10000
202
+ assert lims[x] == (-oo, oo)
203
+ assert diff(f, x) == Wavefunction(2*x, x)
204
+ raises(NotImplementedError, lambda: f.normalize())
205
+ assert conjugate(f) == Wavefunction(conjugate(f.expr), x)
206
+ assert conjugate(f) == Dagger(f)
207
+
208
+ g = Wavefunction(x**2*y + y**2*x, (x, 0, 1), (y, 0, 2))
209
+ lims_g = g.limits
210
+
211
+ assert lims_g[x] == (0, 1)
212
+ assert lims_g[y] == (0, 2)
213
+ assert g.is_normalized is False
214
+ assert g.norm == sqrt(42)/3
215
+ assert g(2, 4) == 0
216
+ assert g(1, 1) == 2
217
+ assert diff(diff(g, x), y) == Wavefunction(2*x + 2*y, (x, 0, 1), (y, 0, 2))
218
+ assert conjugate(g) == Wavefunction(conjugate(g.expr), *g.args[1:])
219
+ assert conjugate(g) == Dagger(g)
220
+
221
+ h = Wavefunction(sqrt(5)*x**2, (x, 0, 1))
222
+ assert h.is_normalized is True
223
+ assert h.normalize() == h
224
+ assert conjugate(h) == Wavefunction(conjugate(h.expr), (x, 0, 1))
225
+ assert conjugate(h) == Dagger(h)
226
+
227
+ piab = Wavefunction(sin(n*pi*x/L), (x, 0, L))
228
+ assert piab.norm == sqrt(L/2)
229
+ assert piab(L + 1) == 0
230
+ assert piab(0.5) == sin(0.5*n*pi/L)
231
+ assert piab(0.5, n=1, L=1) == sin(0.5*pi)
232
+ assert piab.normalize() == \
233
+ Wavefunction(sqrt(2)/sqrt(L)*sin(n*pi*x/L), (x, 0, L))
234
+ assert conjugate(piab) == Wavefunction(conjugate(piab.expr), (x, 0, L))
235
+ assert conjugate(piab) == Dagger(piab)
236
+
237
+ k = Wavefunction(x**2, 'x')
238
+ assert type(k.variables[0]) == Symbol
239
+
240
+ def test_orthogonal_states():
241
+ bracket = OrthogonalBra(x) * OrthogonalKet(x)
242
+ assert bracket.doit() == 1
243
+
244
+ bracket = OrthogonalBra(x) * OrthogonalKet(x+1)
245
+ assert bracket.doit() == 0
246
+
247
+ bracket = OrthogonalBra(x) * OrthogonalKet(y)
248
+ assert bracket.doit() == bracket
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_tensorproduct.py ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.core.numbers import I
2
+ from sympy.core.symbol import symbols
3
+ from sympy.core.expr import unchanged
4
+ from sympy.matrices import Matrix, SparseMatrix, ImmutableMatrix
5
+ from sympy.testing.pytest import warns_deprecated_sympy
6
+
7
+ from sympy.physics.quantum.commutator import Commutator as Comm
8
+ from sympy.physics.quantum.tensorproduct import TensorProduct
9
+ from sympy.physics.quantum.tensorproduct import TensorProduct as TP
10
+ from sympy.physics.quantum.tensorproduct import tensor_product_simp
11
+ from sympy.physics.quantum.dagger import Dagger
12
+ from sympy.physics.quantum.qubit import Qubit, QubitBra
13
+ from sympy.physics.quantum.operator import OuterProduct, Operator
14
+ from sympy.physics.quantum.density import Density
15
+ from sympy.physics.quantum.trace import Tr
16
+
17
+ A = Operator('A')
18
+ B = Operator('B')
19
+ C = Operator('C')
20
+ D = Operator('D')
21
+ x = symbols('x')
22
+ y = symbols('y', integer=True, positive=True)
23
+
24
+ mat1 = Matrix([[1, 2*I], [1 + I, 3]])
25
+ mat2 = Matrix([[2*I, 3], [4*I, 2]])
26
+
27
+
28
+ def test_sparse_matrices():
29
+ spm = SparseMatrix.diag(1, 0)
30
+ assert unchanged(TensorProduct, spm, spm)
31
+
32
+
33
+ def test_tensor_product_dagger():
34
+ assert Dagger(TensorProduct(I*A, B)) == \
35
+ -I*TensorProduct(Dagger(A), Dagger(B))
36
+ assert Dagger(TensorProduct(mat1, mat2)) == \
37
+ TensorProduct(Dagger(mat1), Dagger(mat2))
38
+
39
+
40
+ def test_tensor_product_abstract():
41
+
42
+ assert TP(x*A, 2*B) == x*2*TP(A, B)
43
+ assert TP(A, B) != TP(B, A)
44
+ assert TP(A, B).is_commutative is False
45
+ assert isinstance(TP(A, B), TP)
46
+ assert TP(A, B).subs(A, C) == TP(C, B)
47
+
48
+
49
+ def test_tensor_product_expand():
50
+ assert TP(A + B, B + C).expand(tensorproduct=True) == \
51
+ TP(A, B) + TP(A, C) + TP(B, B) + TP(B, C)
52
+ #Tests for fix of issue #24142
53
+ assert TP(A-B, B-A).expand(tensorproduct=True) == \
54
+ TP(A, B) - TP(A, A) - TP(B, B) + TP(B, A)
55
+ assert TP(2*A + B, A + B).expand(tensorproduct=True) == \
56
+ 2 * TP(A, A) + 2 * TP(A, B) + TP(B, A) + TP(B, B)
57
+ assert TP(2 * A * B + A, A + B).expand(tensorproduct=True) == \
58
+ 2 * TP(A*B, A) + 2 * TP(A*B, B) + TP(A, A) + TP(A, B)
59
+
60
+
61
+ def test_tensor_product_commutator():
62
+ assert TP(Comm(A, B), C).doit().expand(tensorproduct=True) == \
63
+ TP(A*B, C) - TP(B*A, C)
64
+ assert Comm(TP(A, B), TP(B, C)).doit() == \
65
+ TP(A, B)*TP(B, C) - TP(B, C)*TP(A, B)
66
+
67
+
68
+ def test_tensor_product_simp():
69
+ with warns_deprecated_sympy():
70
+ assert tensor_product_simp(TP(A, B)*TP(B, C)) == TP(A*B, B*C)
71
+ # tests for Pow-expressions
72
+ assert TP(A, B)**y == TP(A**y, B**y)
73
+ assert tensor_product_simp(TP(A, B)**y) == TP(A**y, B**y)
74
+ assert tensor_product_simp(x*TP(A, B)**2) == x*TP(A**2,B**2)
75
+ assert tensor_product_simp(x*(TP(A, B)**2)*TP(C,D)) == x*TP(A**2*C,B**2*D)
76
+ assert tensor_product_simp(TP(A,B)-TP(C,D)**y) == TP(A,B)-TP(C**y,D**y)
77
+
78
+
79
+ def test_issue_5923():
80
+ # most of the issue regarding sympification of args has been handled
81
+ # and is tested internally by the use of args_cnc through the quantum
82
+ # module, but the following is a test from the issue that used to raise.
83
+ assert TensorProduct(1, Qubit('1')*Qubit('1').dual) == \
84
+ TensorProduct(1, OuterProduct(Qubit(1), QubitBra(1)))
85
+
86
+
87
+ def test_eval_trace():
88
+ # This test includes tests with dependencies between TensorProducts
89
+ #and density operators. Since, the test is more to test the behavior of
90
+ #TensorProducts it remains here
91
+
92
+ # Density with simple tensor products as args
93
+ t = TensorProduct(A, B)
94
+ d = Density([t, 1.0])
95
+ tr = Tr(d)
96
+ assert tr.doit() == 1.0*Tr(A*Dagger(A))*Tr(B*Dagger(B))
97
+
98
+ ## partial trace with simple tensor products as args
99
+ t = TensorProduct(A, B, C)
100
+ d = Density([t, 1.0])
101
+ tr = Tr(d, [1])
102
+ assert tr.doit() == 1.0*A*Dagger(A)*Tr(B*Dagger(B))*C*Dagger(C)
103
+
104
+ tr = Tr(d, [0, 2])
105
+ assert tr.doit() == 1.0*Tr(A*Dagger(A))*B*Dagger(B)*Tr(C*Dagger(C))
106
+
107
+ # Density with multiple Tensorproducts as states
108
+ t2 = TensorProduct(A, B)
109
+ t3 = TensorProduct(C, D)
110
+
111
+ d = Density([t2, 0.5], [t3, 0.5])
112
+ t = Tr(d)
113
+ assert t.doit() == (0.5*Tr(A*Dagger(A))*Tr(B*Dagger(B)) +
114
+ 0.5*Tr(C*Dagger(C))*Tr(D*Dagger(D)))
115
+
116
+ t = Tr(d, [0])
117
+ assert t.doit() == (0.5*Tr(A*Dagger(A))*B*Dagger(B) +
118
+ 0.5*Tr(C*Dagger(C))*D*Dagger(D))
119
+
120
+ #Density with mixed states
121
+ d = Density([t2 + t3, 1.0])
122
+ t = Tr(d)
123
+ assert t.doit() == ( 1.0*Tr(A*Dagger(A))*Tr(B*Dagger(B)) +
124
+ 1.0*Tr(A*Dagger(C))*Tr(B*Dagger(D)) +
125
+ 1.0*Tr(C*Dagger(A))*Tr(D*Dagger(B)) +
126
+ 1.0*Tr(C*Dagger(C))*Tr(D*Dagger(D)))
127
+
128
+ t = Tr(d, [1] )
129
+ assert t.doit() == ( 1.0*A*Dagger(A)*Tr(B*Dagger(B)) +
130
+ 1.0*A*Dagger(C)*Tr(B*Dagger(D)) +
131
+ 1.0*C*Dagger(A)*Tr(D*Dagger(B)) +
132
+ 1.0*C*Dagger(C)*Tr(D*Dagger(D)))
133
+
134
+
135
+ def test_pr24993():
136
+ from sympy.matrices.expressions.kronecker import matrix_kronecker_product
137
+ from sympy.physics.quantum.matrixutils import matrix_tensor_product
138
+ X = Matrix([[0, 1], [1, 0]])
139
+ Xi = ImmutableMatrix(X)
140
+ assert TensorProduct(Xi, Xi) == TensorProduct(X, X)
141
+ assert TensorProduct(Xi, Xi) == matrix_tensor_product(X, X)
142
+ assert TensorProduct(Xi, Xi) == matrix_kronecker_product(X, X)
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_trace.py ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.core.containers import Tuple
2
+ from sympy.core.symbol import symbols
3
+ from sympy.matrices.dense import Matrix
4
+ from sympy.physics.quantum.trace import Tr
5
+ from sympy.testing.pytest import raises, warns_deprecated_sympy
6
+
7
+
8
+ def test_trace_new():
9
+ a, b, c, d, Y = symbols('a b c d Y')
10
+ A, B, C, D = symbols('A B C D', commutative=False)
11
+
12
+ assert Tr(a + b) == a + b
13
+ assert Tr(A + B) == Tr(A) + Tr(B)
14
+
15
+ #check trace args not implicitly permuted
16
+ assert Tr(C*D*A*B).args[0].args == (C, D, A, B)
17
+
18
+ # check for mul and adds
19
+ assert Tr((a*b) + ( c*d)) == (a*b) + (c*d)
20
+ # Tr(scalar*A) = scalar*Tr(A)
21
+ assert Tr(a*A) == a*Tr(A)
22
+ assert Tr(a*A*B*b) == a*b*Tr(A*B)
23
+
24
+ # since A is symbol and not commutative
25
+ assert isinstance(Tr(A), Tr)
26
+
27
+ #POW
28
+ assert Tr(pow(a, b)) == a**b
29
+ assert isinstance(Tr(pow(A, a)), Tr)
30
+
31
+ #Matrix
32
+ M = Matrix([[1, 1], [2, 2]])
33
+ assert Tr(M) == 3
34
+
35
+ ##test indices in different forms
36
+ #no index
37
+ t = Tr(A)
38
+ assert t.args[1] == Tuple()
39
+
40
+ #single index
41
+ t = Tr(A, 0)
42
+ assert t.args[1] == Tuple(0)
43
+
44
+ #index in a list
45
+ t = Tr(A, [0])
46
+ assert t.args[1] == Tuple(0)
47
+
48
+ t = Tr(A, [0, 1, 2])
49
+ assert t.args[1] == Tuple(0, 1, 2)
50
+
51
+ #index is tuple
52
+ t = Tr(A, (0))
53
+ assert t.args[1] == Tuple(0)
54
+
55
+ t = Tr(A, (1, 2))
56
+ assert t.args[1] == Tuple(1, 2)
57
+
58
+ #trace indices test
59
+ t = Tr((A + B), [2])
60
+ assert t.args[0].args[1] == Tuple(2) and t.args[1].args[1] == Tuple(2)
61
+
62
+ t = Tr(a*A, [2, 3])
63
+ assert t.args[1].args[1] == Tuple(2, 3)
64
+
65
+ #class with trace method defined
66
+ #to simulate numpy objects
67
+ class Foo:
68
+ def trace(self):
69
+ return 1
70
+ assert Tr(Foo()) == 1
71
+
72
+ #argument test
73
+ # check for value error, when either/both arguments are not provided
74
+ raises(ValueError, lambda: Tr())
75
+ raises(ValueError, lambda: Tr(A, 1, 2))
76
+
77
+
78
+ def test_trace_doit():
79
+ a, b, c, d = symbols('a b c d')
80
+ A, B, C, D = symbols('A B C D', commutative=False)
81
+
82
+ #TODO: needed while testing reduced density operations, etc.
83
+
84
+
85
+ def test_permute():
86
+ A, B, C, D, E, F, G = symbols('A B C D E F G', commutative=False)
87
+ t = Tr(A*B*C*D*E*F*G)
88
+
89
+ assert t.permute(0).args[0].args == (A, B, C, D, E, F, G)
90
+ assert t.permute(2).args[0].args == (F, G, A, B, C, D, E)
91
+ assert t.permute(4).args[0].args == (D, E, F, G, A, B, C)
92
+ assert t.permute(6).args[0].args == (B, C, D, E, F, G, A)
93
+ assert t.permute(8).args[0].args == t.permute(1).args[0].args
94
+
95
+ assert t.permute(-1).args[0].args == (B, C, D, E, F, G, A)
96
+ assert t.permute(-3).args[0].args == (D, E, F, G, A, B, C)
97
+ assert t.permute(-5).args[0].args == (F, G, A, B, C, D, E)
98
+ assert t.permute(-8).args[0].args == t.permute(-1).args[0].args
99
+
100
+ t = Tr((A + B)*(B*B)*C*D)
101
+ assert t.permute(2).args[0].args == (C, D, (A + B), (B**2))
102
+
103
+ t1 = Tr(A*B)
104
+ t2 = t1.permute(1)
105
+ assert id(t1) != id(t2) and t1 == t2
106
+
107
+ def test_deprecated_core_trace():
108
+ with warns_deprecated_sympy():
109
+ from sympy.core.trace import Tr # noqa:F401
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/quantum/tests/test_transforms.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Tests of transforms of quantum expressions for Mul and Pow."""
2
+
3
+ from sympy.core.symbol import symbols
4
+ from sympy.testing.pytest import raises
5
+
6
+ from sympy.physics.quantum.operator import (
7
+ Operator, OuterProduct
8
+ )
9
+ from sympy.physics.quantum.state import Ket, Bra
10
+ from sympy.physics.quantum.innerproduct import InnerProduct
11
+ from sympy.physics.quantum.tensorproduct import TensorProduct
12
+
13
+
14
+ k1 = Ket('k1')
15
+ k2 = Ket('k2')
16
+ k3 = Ket('k3')
17
+ b1 = Bra('b1')
18
+ b2 = Bra('b2')
19
+ b3 = Bra('b3')
20
+ A = Operator('A')
21
+ B = Operator('B')
22
+ C = Operator('C')
23
+ x, y, z = symbols('x y z')
24
+
25
+
26
+ def test_bra_ket():
27
+ assert b1*k1 == InnerProduct(b1, k1)
28
+ assert k1*b1 == OuterProduct(k1, b1)
29
+ # Test priority of inner product
30
+ assert OuterProduct(k1, b1)*k2 == InnerProduct(b1, k2)*k1
31
+ assert b1*OuterProduct(k1, b2) == InnerProduct(b1, k1)*b2
32
+
33
+
34
+ def test_tensor_product():
35
+ # We are attempting to be rigourous and raise TypeError when a user tries
36
+ # to combine bras, kets, and operators in a manner that doesn't make sense.
37
+ # In particular, we are not trying to interpret regular ``*`` multiplication
38
+ # as a tensor product.
39
+ with raises(TypeError):
40
+ k1*k1
41
+ with raises(TypeError):
42
+ b1*b1
43
+ with raises(TypeError):
44
+ k1*TensorProduct(k2, k3)
45
+ with raises(TypeError):
46
+ b1*TensorProduct(b2, b3)
47
+ with raises(TypeError):
48
+ TensorProduct(k2, k3)*k1
49
+ with raises(TypeError):
50
+ TensorProduct(b2, b3)*b1
51
+
52
+ assert TensorProduct(A, B, C)*TensorProduct(k1, k2, k3) == \
53
+ TensorProduct(A*k1, B*k2, C*k3)
54
+ assert TensorProduct(b1, b2, b3)*TensorProduct(A, B, C) == \
55
+ TensorProduct(b1*A, b2*B, b3*C)
56
+ assert TensorProduct(b1, b2, b3)*TensorProduct(k1, k2, k3) == \
57
+ InnerProduct(b1, k1)*InnerProduct(b2, k2)*InnerProduct(b3, k3)
58
+ assert TensorProduct(b1, b2, b3)*TensorProduct(A, B, C)*TensorProduct(k1, k2, k3) == \
59
+ TensorProduct(b1*A*k1, b2*B*k2, b3*C*k3)
60
+
61
+
62
+ def test_outer_product():
63
+ assert OuterProduct(k1, b1)*OuterProduct(k2, b2) == \
64
+ InnerProduct(b1, k2)*OuterProduct(k1, b2)
65
+
66
+
67
+ def test_compound():
68
+ e1 = b1*A*B*k1*b2*k2*b3
69
+ assert e1 == InnerProduct(b2, k2)*b1*A*B*OuterProduct(k1, b3)
70
+
71
+ e2 = TensorProduct(k1, k2)*TensorProduct(b1, b2)
72
+ assert e2 == TensorProduct(
73
+ OuterProduct(k1, b1),
74
+ OuterProduct(k2, b2)
75
+ )
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/tests/__init__.py ADDED
File without changes
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/tests/test_clebsch_gordan.py ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.core.numbers import (I, pi, Rational)
2
+ from sympy.core.singleton import S
3
+ from sympy.core.symbol import symbols
4
+ from sympy.functions.elementary.exponential import exp
5
+ from sympy.functions.elementary.miscellaneous import sqrt
6
+ from sympy.functions.elementary.trigonometric import (cos, sin)
7
+ from sympy.functions.special.spherical_harmonics import Ynm
8
+ from sympy.matrices.dense import Matrix
9
+ from sympy.physics.wigner import (clebsch_gordan, wigner_9j, wigner_6j, gaunt,
10
+ real_gaunt, racah, dot_rot_grad_Ynm, wigner_3j, wigner_d_small, wigner_d)
11
+ from sympy.testing.pytest import raises, skip
12
+
13
+ # for test cases, refer : https://en.wikipedia.org/wiki/Table_of_Clebsch%E2%80%93Gordan_coefficients
14
+
15
+ def test_clebsch_gordan_docs():
16
+ assert clebsch_gordan(Rational(3, 2), S.Half, 2, Rational(3, 2), S.Half, 2) == 1
17
+ assert clebsch_gordan(Rational(3, 2), S.Half, 1, Rational(3, 2), Rational(-1, 2), 1) == sqrt(3)/2
18
+ assert clebsch_gordan(Rational(3, 2), S.Half, 1, Rational(-1, 2), S.Half, 0) == -sqrt(2)/2
19
+
20
+
21
+ def test_clebsch_gordan():
22
+ # Argument order: (j_1, j_2, j, m_1, m_2, m)
23
+
24
+ h = S.One
25
+ k = S.Half
26
+ l = Rational(3, 2)
27
+ i = Rational(-1, 2)
28
+ n = Rational(7, 2)
29
+ p = Rational(5, 2)
30
+ assert clebsch_gordan(k, k, 1, k, k, 1) == 1
31
+ assert clebsch_gordan(k, k, 1, k, k, 0) == 0
32
+ assert clebsch_gordan(k, k, 1, i, i, -1) == 1
33
+ assert clebsch_gordan(k, k, 1, k, i, 0) == sqrt(2)/2
34
+ assert clebsch_gordan(k, k, 0, k, i, 0) == sqrt(2)/2
35
+ assert clebsch_gordan(k, k, 1, i, k, 0) == sqrt(2)/2
36
+ assert clebsch_gordan(k, k, 0, i, k, 0) == -sqrt(2)/2
37
+ assert clebsch_gordan(h, k, l, 1, k, l) == 1
38
+ assert clebsch_gordan(h, k, l, 1, i, k) == 1/sqrt(3)
39
+ assert clebsch_gordan(h, k, k, 1, i, k) == sqrt(2)/sqrt(3)
40
+ assert clebsch_gordan(h, k, k, 0, k, k) == -1/sqrt(3)
41
+ assert clebsch_gordan(h, k, l, 0, k, k) == sqrt(2)/sqrt(3)
42
+ assert clebsch_gordan(h, h, S(2), 1, 1, S(2)) == 1
43
+ assert clebsch_gordan(h, h, S(2), 1, 0, 1) == 1/sqrt(2)
44
+ assert clebsch_gordan(h, h, S(2), 0, 1, 1) == 1/sqrt(2)
45
+ assert clebsch_gordan(h, h, 1, 1, 0, 1) == 1/sqrt(2)
46
+ assert clebsch_gordan(h, h, 1, 0, 1, 1) == -1/sqrt(2)
47
+ assert clebsch_gordan(l, l, S(3), l, l, S(3)) == 1
48
+ assert clebsch_gordan(l, l, S(2), l, k, S(2)) == 1/sqrt(2)
49
+ assert clebsch_gordan(l, l, S(3), l, k, S(2)) == 1/sqrt(2)
50
+ assert clebsch_gordan(S(2), S(2), S(4), S(2), S(2), S(4)) == 1
51
+ assert clebsch_gordan(S(2), S(2), S(3), S(2), 1, S(3)) == 1/sqrt(2)
52
+ assert clebsch_gordan(S(2), S(2), S(3), 1, 1, S(2)) == 0
53
+ assert clebsch_gordan(p, h, n, p, 1, n) == 1
54
+ assert clebsch_gordan(p, h, p, p, 0, p) == sqrt(5)/sqrt(7)
55
+ assert clebsch_gordan(p, h, l, k, 1, l) == 1/sqrt(15)
56
+
57
+
58
+ def test_clebsch_gordan_numpy():
59
+ try:
60
+ import numpy as np
61
+ except ImportError:
62
+ skip("numpy not installed")
63
+ assert clebsch_gordan(*np.zeros(6).astype(np.int64)) == 1
64
+ assert wigner_3j(2, np.float64(6.0), 4.0, 0, 0, 0) == sqrt(715)/143
65
+ assert wigner_3j(0, 0.5, 0.5, 0, 0.5, -0.5) == sqrt(2)/2
66
+ raises(ValueError, lambda: wigner_3j(2.1, 6, 4, 0, 0, 0))
67
+
68
+
69
+ def test_wigner():
70
+ try:
71
+ import numpy as np
72
+ except ImportError:
73
+ skip("numpy not installed")
74
+ def tn(a, b):
75
+ return (a - b).n(64) < S('1e-64')
76
+ assert tn(wigner_9j(1, 1, 1, 1, 1, 1, 1, 1, 0, prec=64), Rational(1, 18))
77
+ assert wigner_9j(3, 3, 2, 3, 3, 2, 3, 3, 2) == 3221*sqrt(
78
+ 70)/(246960*sqrt(105)) - 365/(3528*sqrt(70)*sqrt(105))
79
+ assert wigner_6j(5, 5, 5, 5, 5, 5) == Rational(1, 52)
80
+ assert tn(wigner_6j(8, 8, 8, 8, 8, 8, prec=64), Rational(-12219, 965770))
81
+ assert wigner_6j(1, 1, 1, 1.0, np.float64(1.0), 1) == Rational(1, 6)
82
+ assert wigner_6j(3.0, np.float32(3), 3.0, 3, 3, 3) == Rational(-1, 14)
83
+ # regression test for #8747
84
+ half = S.Half
85
+ assert wigner_9j(0, 0, 0, 0, half, half, 0, half, half) == half
86
+ assert (wigner_9j(3, 5, 4,
87
+ 7 * half, 5 * half, 4,
88
+ 9 * half, 9 * half, 0)
89
+ == -sqrt(Rational(361, 205821000)))
90
+ assert (wigner_9j(1, 4, 3,
91
+ 5 * half, 4, 5 * half,
92
+ 5 * half, 2, 7 * half)
93
+ == -sqrt(Rational(3971, 373403520)))
94
+ assert (wigner_9j(4, 9 * half, 5 * half,
95
+ 2, 4, 4,
96
+ 5, 7 * half, 7 * half)
97
+ == -sqrt(Rational(3481, 5042614500)))
98
+ assert (wigner_9j(5, 5, 5.0,
99
+ np.float64(5.0), 5, 5,
100
+ 5, 5, 5)
101
+ == 0)
102
+ assert (wigner_9j(1.0, 2.0, 3.0,
103
+ 3, 2, 1,
104
+ 2, 1, 3)
105
+ == -4*sqrt(70)/11025)
106
+
107
+
108
+ def test_gaunt():
109
+ def tn(a, b):
110
+ return (a - b).n(64) < S('1e-64')
111
+ assert gaunt(1, 0, 1, 1, 0, -1) == -1/(2*sqrt(pi))
112
+ assert isinstance(gaunt(1, 1, 0, -1, 1, 0).args[0], Rational)
113
+ assert isinstance(gaunt(0, 1, 1, 0, -1, 1).args[0], Rational)
114
+
115
+ assert tn(gaunt(
116
+ 10, 10, 12, 9, 3, -12, prec=64), (Rational(-98, 62031)) * sqrt(6279)/sqrt(pi))
117
+ def gaunt_ref(l1, l2, l3, m1, m2, m3):
118
+ return (
119
+ sqrt((2 * l1 + 1) * (2 * l2 + 1) * (2 * l3 + 1) / (4 * pi)) *
120
+ wigner_3j(l1, l2, l3, 0, 0, 0) *
121
+ wigner_3j(l1, l2, l3, m1, m2, m3)
122
+ )
123
+ threshold = 1e-10
124
+ l_max = 3
125
+ l3_max = 24
126
+ for l1 in range(l_max + 1):
127
+ for l2 in range(l_max + 1):
128
+ for l3 in range(l3_max + 1):
129
+ for m1 in range(-l1, l1 + 1):
130
+ for m2 in range(-l2, l2 + 1):
131
+ for m3 in range(-l3, l3 + 1):
132
+ args = l1, l2, l3, m1, m2, m3
133
+ g = gaunt(*args)
134
+ g0 = gaunt_ref(*args)
135
+ assert abs(g - g0) < threshold
136
+ if m1 + m2 + m3 != 0:
137
+ assert abs(g) < threshold
138
+ if (l1 + l2 + l3) % 2:
139
+ assert abs(g) < threshold
140
+ assert gaunt(1, 1, 0, 0, 2, -2) is S.Zero
141
+
142
+
143
+ def test_realgaunt():
144
+ # All non-zero values corresponding to l values from 0 to 2
145
+ for l in range(3):
146
+ for m in range(-l, l+1):
147
+ assert real_gaunt(0, l, l, 0, m, m) == 1/(2*sqrt(pi))
148
+ assert real_gaunt(1, 1, 2, 0, 0, 0) == sqrt(5)/(5*sqrt(pi))
149
+ assert real_gaunt(1, 1, 2, 1, 1, 0) == -sqrt(5)/(10*sqrt(pi))
150
+ assert real_gaunt(2, 2, 2, 0, 0, 0) == sqrt(5)/(7*sqrt(pi))
151
+ assert real_gaunt(2, 2, 2, 0, 2, 2) == -sqrt(5)/(7*sqrt(pi))
152
+ assert real_gaunt(2, 2, 2, -2, -2, 0) == -sqrt(5)/(7*sqrt(pi))
153
+ assert real_gaunt(1, 1, 2, -1, 0, -1) == sqrt(15)/(10*sqrt(pi))
154
+ assert real_gaunt(1, 1, 2, 0, 1, 1) == sqrt(15)/(10*sqrt(pi))
155
+ assert real_gaunt(1, 1, 2, 1, 1, 2) == sqrt(15)/(10*sqrt(pi))
156
+ assert real_gaunt(1, 1, 2, -1, 1, -2) == sqrt(15)/(10*sqrt(pi))
157
+ assert real_gaunt(1, 1, 2, -1, -1, 2) == -sqrt(15)/(10*sqrt(pi))
158
+ assert real_gaunt(2, 2, 2, 0, 1, 1) == sqrt(5)/(14*sqrt(pi))
159
+ assert real_gaunt(2, 2, 2, 1, 1, 2) == sqrt(15)/(14*sqrt(pi))
160
+ assert real_gaunt(2, 2, 2, -1, -1, 2) == -sqrt(15)/(14*sqrt(pi))
161
+
162
+ assert real_gaunt(-2, -2, -2, -2, -2, 0) is S.Zero # m test
163
+ assert real_gaunt(-2, 1, 0, 1, 1, 1) is S.Zero # l test
164
+ assert real_gaunt(-2, -1, -2, -1, -1, 0) is S.Zero # m and l test
165
+ assert real_gaunt(-2, -2, -2, -2, -2, -2) is S.Zero # m and k test
166
+ assert real_gaunt(-2, -1, -2, -1, -1, -1) is S.Zero # m, l and k test
167
+
168
+ x = symbols('x', integer=True)
169
+ v = [0]*6
170
+ for i in range(len(v)):
171
+ v[i] = x # non literal ints fail
172
+ raises(ValueError, lambda: real_gaunt(*v))
173
+ v[i] = 0
174
+
175
+
176
+ def test_racah():
177
+ assert racah(3,3,3,3,3,3) == Rational(-1,14)
178
+ assert racah(2,2,2,2,2,2) == Rational(-3,70)
179
+ assert racah(7,8,7,1,7,7, prec=4).is_Float
180
+ assert racah(5.5,7.5,9.5,6.5,8,9) == -719*sqrt(598)/1158924
181
+ assert abs(racah(5.5,7.5,9.5,6.5,8,9, prec=4) - (-0.01517)) < S('1e-4')
182
+
183
+
184
+ def test_dot_rota_grad_SH():
185
+ theta, phi = symbols("theta phi")
186
+ assert dot_rot_grad_Ynm(1, 1, 1, 1, 1, 0) != \
187
+ sqrt(30)*Ynm(2, 2, 1, 0)/(10*sqrt(pi))
188
+ assert dot_rot_grad_Ynm(1, 1, 1, 1, 1, 0).doit() == \
189
+ sqrt(30)*Ynm(2, 2, 1, 0)/(10*sqrt(pi))
190
+ assert dot_rot_grad_Ynm(1, 5, 1, 1, 1, 2) != \
191
+ 0
192
+ assert dot_rot_grad_Ynm(1, 5, 1, 1, 1, 2).doit() == \
193
+ 0
194
+ assert dot_rot_grad_Ynm(3, 3, 3, 3, theta, phi).doit() == \
195
+ 15*sqrt(3003)*Ynm(6, 6, theta, phi)/(143*sqrt(pi))
196
+ assert dot_rot_grad_Ynm(3, 3, 1, 1, theta, phi).doit() == \
197
+ sqrt(3)*Ynm(4, 4, theta, phi)/sqrt(pi)
198
+ assert dot_rot_grad_Ynm(3, 2, 2, 0, theta, phi).doit() == \
199
+ 3*sqrt(55)*Ynm(5, 2, theta, phi)/(11*sqrt(pi))
200
+ assert dot_rot_grad_Ynm(3, 2, 3, 2, theta, phi).doit().expand() == \
201
+ -sqrt(70)*Ynm(4, 4, theta, phi)/(11*sqrt(pi)) + \
202
+ 45*sqrt(182)*Ynm(6, 4, theta, phi)/(143*sqrt(pi))
203
+
204
+
205
+ def test_wigner_d():
206
+ half = S(1)/2
207
+ assert wigner_d_small(half, 0) == Matrix([[1, 0], [0, 1]])
208
+ assert wigner_d_small(half, pi/2) == Matrix([[1, 1], [-1, 1]])/sqrt(2)
209
+ assert wigner_d_small(half, pi) == Matrix([[0, 1], [-1, 0]])
210
+
211
+ alpha, beta, gamma = symbols("alpha, beta, gamma", real=True)
212
+ D = wigner_d(half, alpha, beta, gamma)
213
+ assert D[0, 0] == exp(I*alpha/2)*exp(I*gamma/2)*cos(beta/2)
214
+ assert D[0, 1] == exp(I*alpha/2)*exp(-I*gamma/2)*sin(beta/2)
215
+ assert D[1, 0] == -exp(-I*alpha/2)*exp(I*gamma/2)*sin(beta/2)
216
+ assert D[1, 1] == exp(-I*alpha/2)*exp(-I*gamma/2)*cos(beta/2)
217
+
218
+ # Test Y_{n mi}(g*x)=\sum_{mj}D^n_{mi mj}*Y_{n mj}(x)
219
+ theta, phi = symbols("theta phi", real=True)
220
+ v = Matrix([Ynm(1, mj, theta, phi) for mj in range(1, -2, -1)])
221
+ w = wigner_d(1, -pi/2, pi/2, -pi/2)@v.subs({theta: pi/4, phi: pi})
222
+ w_ = v.subs({theta: pi/2, phi: pi/4})
223
+ assert w.expand(func=True).as_real_imag() == w_.expand(func=True).as_real_imag()
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/tests/test_hydrogen.py ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.core.numbers import (I, Rational, oo, pi)
2
+ from sympy.core.singleton import S
3
+ from sympy.core.symbol import symbols
4
+ from sympy.functions.elementary.exponential import exp
5
+ from sympy.functions.elementary.miscellaneous import sqrt
6
+ from sympy.functions.elementary.trigonometric import (cos, sin)
7
+ from sympy.integrals.integrals import integrate
8
+ from sympy.simplify.simplify import simplify
9
+ from sympy.physics.hydrogen import R_nl, E_nl, E_nl_dirac, Psi_nlm
10
+ from sympy.testing.pytest import raises
11
+
12
+ n, r, Z = symbols('n r Z')
13
+
14
+
15
+ def feq(a, b, max_relative_error=1e-12, max_absolute_error=1e-12):
16
+ a = float(a)
17
+ b = float(b)
18
+ # if the numbers are close enough (absolutely), then they are equal
19
+ if abs(a - b) < max_absolute_error:
20
+ return True
21
+ # if not, they can still be equal if their relative error is small
22
+ if abs(b) > abs(a):
23
+ relative_error = abs((a - b)/b)
24
+ else:
25
+ relative_error = abs((a - b)/a)
26
+ return relative_error <= max_relative_error
27
+
28
+
29
+ def test_wavefunction():
30
+ a = 1/Z
31
+ R = {
32
+ (1, 0): 2*sqrt(1/a**3) * exp(-r/a),
33
+ (2, 0): sqrt(1/(2*a**3)) * exp(-r/(2*a)) * (1 - r/(2*a)),
34
+ (2, 1): S.Half * sqrt(1/(6*a**3)) * exp(-r/(2*a)) * r/a,
35
+ (3, 0): Rational(2, 3) * sqrt(1/(3*a**3)) * exp(-r/(3*a)) *
36
+ (1 - 2*r/(3*a) + Rational(2, 27) * (r/a)**2),
37
+ (3, 1): Rational(4, 27) * sqrt(2/(3*a**3)) * exp(-r/(3*a)) *
38
+ (1 - r/(6*a)) * r/a,
39
+ (3, 2): Rational(2, 81) * sqrt(2/(15*a**3)) * exp(-r/(3*a)) * (r/a)**2,
40
+ (4, 0): Rational(1, 4) * sqrt(1/a**3) * exp(-r/(4*a)) *
41
+ (1 - 3*r/(4*a) + Rational(1, 8) * (r/a)**2 - Rational(1, 192) * (r/a)**3),
42
+ (4, 1): Rational(1, 16) * sqrt(5/(3*a**3)) * exp(-r/(4*a)) *
43
+ (1 - r/(4*a) + Rational(1, 80) * (r/a)**2) * (r/a),
44
+ (4, 2): Rational(1, 64) * sqrt(1/(5*a**3)) * exp(-r/(4*a)) *
45
+ (1 - r/(12*a)) * (r/a)**2,
46
+ (4, 3): Rational(1, 768) * sqrt(1/(35*a**3)) * exp(-r/(4*a)) * (r/a)**3,
47
+ }
48
+ for n, l in R:
49
+ assert simplify(R_nl(n, l, r, Z) - R[(n, l)]) == 0
50
+
51
+
52
+ def test_norm():
53
+ # Maximum "n" which is tested:
54
+ n_max = 2 # it works, but is slow, for n_max > 2
55
+ for n in range(n_max + 1):
56
+ for l in range(n):
57
+ assert integrate(R_nl(n, l, r)**2 * r**2, (r, 0, oo)) == 1
58
+
59
+ def test_psi_nlm():
60
+ r=S('r')
61
+ phi=S('phi')
62
+ theta=S('theta')
63
+ assert (Psi_nlm(1, 0, 0, r, phi, theta) == exp(-r) / sqrt(pi))
64
+ assert (Psi_nlm(2, 1, -1, r, phi, theta)) == S.Half * exp(-r / (2)) * r \
65
+ * (sin(theta) * exp(-I * phi) / (4 * sqrt(pi)))
66
+ assert (Psi_nlm(3, 2, 1, r, phi, theta, 2) == -sqrt(2) * sin(theta) \
67
+ * exp(I * phi) * cos(theta) / (4 * sqrt(pi)) * S(2) / 81 \
68
+ * sqrt(2 * 2 ** 3) * exp(-2 * r / (3)) * (r * 2) ** 2)
69
+
70
+ def test_hydrogen_energies():
71
+ assert E_nl(n, Z) == -Z**2/(2*n**2)
72
+ assert E_nl(n) == -1/(2*n**2)
73
+
74
+ assert E_nl(1, 47) == -S(47)**2/(2*1**2)
75
+ assert E_nl(2, 47) == -S(47)**2/(2*2**2)
76
+
77
+ assert E_nl(1) == -S.One/(2*1**2)
78
+ assert E_nl(2) == -S.One/(2*2**2)
79
+ assert E_nl(3) == -S.One/(2*3**2)
80
+ assert E_nl(4) == -S.One/(2*4**2)
81
+ assert E_nl(100) == -S.One/(2*100**2)
82
+
83
+ raises(ValueError, lambda: E_nl(0))
84
+
85
+
86
+ def test_hydrogen_energies_relat():
87
+ # First test exact formulas for small "c" so that we get nice expressions:
88
+ assert E_nl_dirac(2, 0, Z=1, c=1) == 1/sqrt(2) - 1
89
+ assert simplify(E_nl_dirac(2, 0, Z=1, c=2) - ( (8*sqrt(3) + 16)
90
+ / sqrt(16*sqrt(3) + 32) - 4)) == 0
91
+ assert simplify(E_nl_dirac(2, 0, Z=1, c=3) - ( (54*sqrt(2) + 81)
92
+ / sqrt(108*sqrt(2) + 162) - 9)) == 0
93
+
94
+ # Now test for almost the correct speed of light, without floating point
95
+ # numbers:
96
+ assert simplify(E_nl_dirac(2, 0, Z=1, c=137) - ( (352275361 + 10285412 *
97
+ sqrt(1173)) / sqrt(704550722 + 20570824 * sqrt(1173)) - 18769)) == 0
98
+ assert simplify(E_nl_dirac(2, 0, Z=82, c=137) - ( (352275361 + 2571353 *
99
+ sqrt(12045)) / sqrt(704550722 + 5142706*sqrt(12045)) - 18769)) == 0
100
+
101
+ # Test using exact speed of light, and compare against the nonrelativistic
102
+ # energies:
103
+ for n in range(1, 5):
104
+ for l in range(n):
105
+ assert feq(E_nl_dirac(n, l), E_nl(n), 1e-5, 1e-5)
106
+ if l > 0:
107
+ assert feq(E_nl_dirac(n, l, False), E_nl(n), 1e-5, 1e-5)
108
+
109
+ Z = 2
110
+ for n in range(1, 5):
111
+ for l in range(n):
112
+ assert feq(E_nl_dirac(n, l, Z=Z), E_nl(n, Z), 1e-4, 1e-4)
113
+ if l > 0:
114
+ assert feq(E_nl_dirac(n, l, False, Z), E_nl(n, Z), 1e-4, 1e-4)
115
+
116
+ Z = 3
117
+ for n in range(1, 5):
118
+ for l in range(n):
119
+ assert feq(E_nl_dirac(n, l, Z=Z), E_nl(n, Z), 1e-3, 1e-3)
120
+ if l > 0:
121
+ assert feq(E_nl_dirac(n, l, False, Z), E_nl(n, Z), 1e-3, 1e-3)
122
+
123
+ # Test the exceptions:
124
+ raises(ValueError, lambda: E_nl_dirac(0, 0))
125
+ raises(ValueError, lambda: E_nl_dirac(1, -1))
126
+ raises(ValueError, lambda: E_nl_dirac(1, 0, False))
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/tests/test_paulialgebra.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.core.numbers import I
2
+ from sympy.core.symbol import symbols
3
+ from sympy.physics.paulialgebra import Pauli
4
+ from sympy.testing.pytest import XFAIL
5
+ from sympy.physics.quantum import TensorProduct
6
+
7
+ sigma1 = Pauli(1)
8
+ sigma2 = Pauli(2)
9
+ sigma3 = Pauli(3)
10
+
11
+ tau1 = symbols("tau1", commutative = False)
12
+
13
+
14
+ def test_Pauli():
15
+
16
+ assert sigma1 == sigma1
17
+ assert sigma1 != sigma2
18
+
19
+ assert sigma1*sigma2 == I*sigma3
20
+ assert sigma3*sigma1 == I*sigma2
21
+ assert sigma2*sigma3 == I*sigma1
22
+
23
+ assert sigma1*sigma1 == 1
24
+ assert sigma2*sigma2 == 1
25
+ assert sigma3*sigma3 == 1
26
+
27
+ assert sigma1**0 == 1
28
+ assert sigma1**1 == sigma1
29
+ assert sigma1**2 == 1
30
+ assert sigma1**3 == sigma1
31
+ assert sigma1**4 == 1
32
+
33
+ assert sigma3**2 == 1
34
+
35
+ assert sigma1*2*sigma1 == 2
36
+
37
+
38
+ def test_evaluate_pauli_product():
39
+ from sympy.physics.paulialgebra import evaluate_pauli_product
40
+
41
+ assert evaluate_pauli_product(I*sigma2*sigma3) == -sigma1
42
+
43
+ # Check issue 6471
44
+ assert evaluate_pauli_product(-I*4*sigma1*sigma2) == 4*sigma3
45
+
46
+ assert evaluate_pauli_product(
47
+ 1 + I*sigma1*sigma2*sigma1*sigma2 + \
48
+ I*sigma1*sigma2*tau1*sigma1*sigma3 + \
49
+ ((tau1**2).subs(tau1, I*sigma1)) + \
50
+ sigma3*((tau1**2).subs(tau1, I*sigma1)) + \
51
+ TensorProduct(I*sigma1*sigma2*sigma1*sigma2, 1)
52
+ ) == 1 -I + I*sigma3*tau1*sigma2 - 1 - sigma3 - I*TensorProduct(1,1)
53
+
54
+
55
+ @XFAIL
56
+ def test_Pauli_should_work():
57
+ assert sigma1*sigma3*sigma1 == -sigma3
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/tests/test_physics_matrices.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.physics.matrices import msigma, mgamma, minkowski_tensor, pat_matrix, mdft
2
+ from sympy.core.numbers import (I, Rational)
3
+ from sympy.core.singleton import S
4
+ from sympy.functions.elementary.miscellaneous import sqrt
5
+ from sympy.matrices.dense import (Matrix, eye, zeros)
6
+ from sympy.testing.pytest import warns_deprecated_sympy
7
+
8
+
9
+ def test_parallel_axis_theorem():
10
+ # This tests the parallel axis theorem matrix by comparing to test
11
+ # matrices.
12
+
13
+ # First case, 1 in all directions.
14
+ mat1 = Matrix(((2, -1, -1), (-1, 2, -1), (-1, -1, 2)))
15
+ assert pat_matrix(1, 1, 1, 1) == mat1
16
+ assert pat_matrix(2, 1, 1, 1) == 2*mat1
17
+
18
+ # Second case, 1 in x, 0 in all others
19
+ mat2 = Matrix(((0, 0, 0), (0, 1, 0), (0, 0, 1)))
20
+ assert pat_matrix(1, 1, 0, 0) == mat2
21
+ assert pat_matrix(2, 1, 0, 0) == 2*mat2
22
+
23
+ # Third case, 1 in y, 0 in all others
24
+ mat3 = Matrix(((1, 0, 0), (0, 0, 0), (0, 0, 1)))
25
+ assert pat_matrix(1, 0, 1, 0) == mat3
26
+ assert pat_matrix(2, 0, 1, 0) == 2*mat3
27
+
28
+ # Fourth case, 1 in z, 0 in all others
29
+ mat4 = Matrix(((1, 0, 0), (0, 1, 0), (0, 0, 0)))
30
+ assert pat_matrix(1, 0, 0, 1) == mat4
31
+ assert pat_matrix(2, 0, 0, 1) == 2*mat4
32
+
33
+
34
+ def test_Pauli():
35
+ #this and the following test are testing both Pauli and Dirac matrices
36
+ #and also that the general Matrix class works correctly in a real world
37
+ #situation
38
+ sigma1 = msigma(1)
39
+ sigma2 = msigma(2)
40
+ sigma3 = msigma(3)
41
+
42
+ assert sigma1 == sigma1
43
+ assert sigma1 != sigma2
44
+
45
+ # sigma*I -> I*sigma (see #354)
46
+ assert sigma1*sigma2 == sigma3*I
47
+ assert sigma3*sigma1 == sigma2*I
48
+ assert sigma2*sigma3 == sigma1*I
49
+
50
+ assert sigma1*sigma1 == eye(2)
51
+ assert sigma2*sigma2 == eye(2)
52
+ assert sigma3*sigma3 == eye(2)
53
+
54
+ assert sigma1*2*sigma1 == 2*eye(2)
55
+ assert sigma1*sigma3*sigma1 == -sigma3
56
+
57
+
58
+ def test_Dirac():
59
+ gamma0 = mgamma(0)
60
+ gamma1 = mgamma(1)
61
+ gamma2 = mgamma(2)
62
+ gamma3 = mgamma(3)
63
+ gamma5 = mgamma(5)
64
+
65
+ # gamma*I -> I*gamma (see #354)
66
+ assert gamma5 == gamma0 * gamma1 * gamma2 * gamma3 * I
67
+ assert gamma1 * gamma2 + gamma2 * gamma1 == zeros(4)
68
+ assert gamma0 * gamma0 == eye(4) * minkowski_tensor[0, 0]
69
+ assert gamma2 * gamma2 != eye(4) * minkowski_tensor[0, 0]
70
+ assert gamma2 * gamma2 == eye(4) * minkowski_tensor[2, 2]
71
+
72
+ assert mgamma(5, True) == \
73
+ mgamma(0, True)*mgamma(1, True)*mgamma(2, True)*mgamma(3, True)*I
74
+
75
+ def test_mdft():
76
+ with warns_deprecated_sympy():
77
+ assert mdft(1) == Matrix([[1]])
78
+ with warns_deprecated_sympy():
79
+ assert mdft(2) == 1/sqrt(2)*Matrix([[1,1],[1,-1]])
80
+ with warns_deprecated_sympy():
81
+ assert mdft(4) == Matrix([[S.Half, S.Half, S.Half, S.Half],
82
+ [S.Half, -I/2, Rational(-1,2), I/2],
83
+ [S.Half, Rational(-1,2), S.Half, Rational(-1,2)],
84
+ [S.Half, I/2, Rational(-1,2), -I/2]])
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/tests/test_pring.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.physics.pring import wavefunction, energy
2
+ from sympy.core.numbers import (I, pi)
3
+ from sympy.functions.elementary.exponential import exp
4
+ from sympy.functions.elementary.miscellaneous import sqrt
5
+ from sympy.integrals.integrals import integrate
6
+ from sympy.simplify.simplify import simplify
7
+ from sympy.abc import m, x, r
8
+ from sympy.physics.quantum.constants import hbar
9
+
10
+
11
+ def test_wavefunction():
12
+ Psi = {
13
+ 0: (1/sqrt(2 * pi)),
14
+ 1: (1/sqrt(2 * pi)) * exp(I * x),
15
+ 2: (1/sqrt(2 * pi)) * exp(2 * I * x),
16
+ 3: (1/sqrt(2 * pi)) * exp(3 * I * x)
17
+ }
18
+ for n in Psi:
19
+ assert simplify(wavefunction(n, x) - Psi[n]) == 0
20
+
21
+
22
+ def test_norm(n=1):
23
+ # Maximum "n" which is tested:
24
+ for i in range(n + 1):
25
+ assert integrate(
26
+ wavefunction(i, x) * wavefunction(-i, x), (x, 0, 2 * pi)) == 1
27
+
28
+
29
+ def test_orthogonality(n=1):
30
+ # Maximum "n" which is tested:
31
+ for i in range(n + 1):
32
+ for j in range(i+1, n+1):
33
+ assert integrate(
34
+ wavefunction(i, x) * wavefunction(j, x), (x, 0, 2 * pi)) == 0
35
+
36
+
37
+ def test_energy(n=1):
38
+ # Maximum "n" which is tested:
39
+ for i in range(n+1):
40
+ assert simplify(
41
+ energy(i, m, r) - ((i**2 * hbar**2) / (2 * m * r**2))) == 0
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/tests/test_qho_1d.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.core.numbers import (Rational, oo, pi)
2
+ from sympy.core.singleton import S
3
+ from sympy.core.symbol import Symbol
4
+ from sympy.functions.elementary.exponential import exp
5
+ from sympy.functions.elementary.miscellaneous import sqrt
6
+ from sympy.integrals.integrals import integrate
7
+ from sympy.simplify.simplify import simplify
8
+ from sympy.abc import omega, m, x
9
+ from sympy.physics.qho_1d import psi_n, E_n, coherent_state
10
+ from sympy.physics.quantum.constants import hbar
11
+
12
+ nu = m * omega / hbar
13
+
14
+
15
+ def test_wavefunction():
16
+ Psi = {
17
+ 0: (nu/pi)**Rational(1, 4) * exp(-nu * x**2 /2),
18
+ 1: (nu/pi)**Rational(1, 4) * sqrt(2*nu) * x * exp(-nu * x**2 /2),
19
+ 2: (nu/pi)**Rational(1, 4) * (2 * nu * x**2 - 1)/sqrt(2) * exp(-nu * x**2 /2),
20
+ 3: (nu/pi)**Rational(1, 4) * sqrt(nu/3) * (2 * nu * x**3 - 3 * x) * exp(-nu * x**2 /2)
21
+ }
22
+ for n in Psi:
23
+ assert simplify(psi_n(n, x, m, omega) - Psi[n]) == 0
24
+
25
+
26
+ def test_norm(n=1):
27
+ # Maximum "n" which is tested:
28
+ for i in range(n + 1):
29
+ assert integrate(psi_n(i, x, 1, 1)**2, (x, -oo, oo)) == 1
30
+
31
+
32
+ def test_orthogonality(n=1):
33
+ # Maximum "n" which is tested:
34
+ for i in range(n + 1):
35
+ for j in range(i + 1, n + 1):
36
+ assert integrate(
37
+ psi_n(i, x, 1, 1)*psi_n(j, x, 1, 1), (x, -oo, oo)) == 0
38
+
39
+
40
+ def test_energies(n=1):
41
+ # Maximum "n" which is tested:
42
+ for i in range(n + 1):
43
+ assert E_n(i, omega) == hbar * omega * (i + S.Half)
44
+
45
+ def test_coherent_state(n=10):
46
+ # Maximum "n" which is tested:
47
+ # test whether coherent state is the eigenstate of annihilation operator
48
+ alpha = Symbol("alpha")
49
+ for i in range(n + 1):
50
+ assert simplify(sqrt(n + 1) * coherent_state(n + 1, alpha)) == simplify(alpha * coherent_state(n, alpha))
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/tests/test_secondquant.py ADDED
@@ -0,0 +1,1301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.functions.elementary.complexes import conjugate
2
+ from sympy.functions.elementary.exponential import exp
3
+ from sympy.physics.secondquant import (
4
+ Dagger, Bd, VarBosonicBasis, BBra, B, BKet, FixedBosonicBasis,
5
+ matrix_rep, apply_operators, InnerProduct, Commutator, KroneckerDelta,
6
+ AnnihilateBoson, CreateBoson, BosonicOperator,
7
+ F, Fd, FKet, BosonState, CreateFermion, AnnihilateFermion,
8
+ evaluate_deltas, AntiSymmetricTensor, contraction, NO, wicks,
9
+ PermutationOperator, simplify_index_permutations,
10
+ _sort_anticommuting_fermions, _get_ordered_dummies,
11
+ substitute_dummies, FockStateBosonKet,
12
+ ContractionAppliesOnlyToFermions
13
+ )
14
+
15
+ from sympy.concrete.summations import Sum
16
+ from sympy.core.function import (Function, expand)
17
+ from sympy.core.numbers import (I, Rational)
18
+ from sympy.core.singleton import S
19
+ from sympy.core.symbol import (Dummy, Symbol, symbols)
20
+ from sympy.functions.elementary.miscellaneous import sqrt
21
+ from sympy.printing.repr import srepr
22
+ from sympy.simplify.simplify import simplify
23
+
24
+ from sympy.testing.pytest import slow, raises
25
+ from sympy.printing.latex import latex
26
+
27
+
28
+ def test_PermutationOperator():
29
+ p, q, r, s = symbols('p,q,r,s')
30
+ f, g, h, i = map(Function, 'fghi')
31
+ P = PermutationOperator
32
+ assert P(p, q).get_permuted(f(p)*g(q)) == -f(q)*g(p)
33
+ assert P(p, q).get_permuted(f(p, q)) == -f(q, p)
34
+ assert P(p, q).get_permuted(f(p)) == f(p)
35
+ expr = (f(p)*g(q)*h(r)*i(s)
36
+ - f(q)*g(p)*h(r)*i(s)
37
+ - f(p)*g(q)*h(s)*i(r)
38
+ + f(q)*g(p)*h(s)*i(r))
39
+ perms = [P(p, q), P(r, s)]
40
+ assert (simplify_index_permutations(expr, perms) ==
41
+ P(p, q)*P(r, s)*f(p)*g(q)*h(r)*i(s))
42
+ assert latex(P(p, q)) == 'P(pq)'
43
+
44
+ p1, p2 = symbols('p1,p2')
45
+ assert latex(P(p1,p2) == 'P(p_{1}p_{2})')
46
+
47
+ def test_index_permutations_with_dummies():
48
+ a, b, c, d = symbols('a b c d')
49
+ p, q, r, s = symbols('p q r s', cls=Dummy)
50
+ f, g = map(Function, 'fg')
51
+ P = PermutationOperator
52
+
53
+ # No dummy substitution necessary
54
+ expr = f(a, b, p, q) - f(b, a, p, q)
55
+ assert simplify_index_permutations(
56
+ expr, [P(a, b)]) == P(a, b)*f(a, b, p, q)
57
+
58
+ # Cases where dummy substitution is needed
59
+ expected = P(a, b)*substitute_dummies(f(a, b, p, q))
60
+
61
+ expr = f(a, b, p, q) - f(b, a, q, p)
62
+ result = simplify_index_permutations(expr, [P(a, b)])
63
+ assert expected == substitute_dummies(result)
64
+
65
+ expr = f(a, b, q, p) - f(b, a, p, q)
66
+ result = simplify_index_permutations(expr, [P(a, b)])
67
+ assert expected == substitute_dummies(result)
68
+
69
+ # A case where nothing can be done
70
+ expr = f(a, b, q, p) - g(b, a, p, q)
71
+ result = simplify_index_permutations(expr, [P(a, b)])
72
+ assert expr == result
73
+
74
+
75
+ def test_dagger():
76
+ i, j, n, m = symbols('i,j,n,m')
77
+ assert Dagger(1) == 1
78
+ assert Dagger(1.0) == 1.0
79
+ assert Dagger(2*I) == -2*I
80
+ assert Dagger(S.Half*I/3.0) == I*Rational(-1, 2)/3.0
81
+ assert Dagger(BKet([n])) == BBra([n])
82
+ assert Dagger(B(0)) == Bd(0)
83
+ assert Dagger(Bd(0)) == B(0)
84
+ assert Dagger(B(n)) == Bd(n)
85
+ assert Dagger(Bd(n)) == B(n)
86
+ assert Dagger(B(0) + B(1)) == Bd(0) + Bd(1)
87
+ assert Dagger(n*m) == Dagger(n)*Dagger(m) # n, m commute
88
+ assert Dagger(B(n)*B(m)) == Bd(m)*Bd(n)
89
+ assert Dagger(B(n)**10) == Dagger(B(n))**10
90
+ assert Dagger('a') == Dagger(Symbol('a'))
91
+ assert Dagger(Dagger('a')) == Symbol('a')
92
+ assert Dagger(exp(2 * I)) == exp(-2 * I)
93
+ assert Dagger(i) == conjugate(i)
94
+
95
+
96
+ def test_operator():
97
+ i, j = symbols('i,j')
98
+ o = BosonicOperator(i)
99
+ assert o.state == i
100
+ assert o.is_symbolic
101
+ o = BosonicOperator(1)
102
+ assert o.state == 1
103
+ assert not o.is_symbolic
104
+
105
+
106
+ def test_create():
107
+ i, j, n, m, p1 = symbols('i,j,n,m,p1')
108
+ o = Bd(i)
109
+ assert latex(o) == "{b^\\dagger_{i}}"
110
+ assert latex(Bd(p1)) == "{b^\\dagger_{p_{1}}}"
111
+ assert isinstance(o, CreateBoson)
112
+ o = o.subs(i, j)
113
+ assert o.atoms(Symbol) == {j}
114
+ o = Bd(0)
115
+ assert o.apply_operator(BKet([n])) == sqrt(n + 1)*BKet([n + 1])
116
+ o = Bd(n)
117
+ assert o.apply_operator(BKet([n])) == o*BKet([n])
118
+
119
+
120
+ def test_annihilate():
121
+ i, j, n, m, p1 = symbols('i,j,n,m,p1')
122
+ o = B(i)
123
+ assert latex(o) == "b_{i}"
124
+ assert latex(B(p1)) == "b_{p_{1}}"
125
+ assert isinstance(o, AnnihilateBoson)
126
+ o = o.subs(i, j)
127
+ assert o.atoms(Symbol) == {j}
128
+ o = B(0)
129
+ assert o.apply_operator(BKet([n])) == sqrt(n)*BKet([n - 1])
130
+ o = B(n)
131
+ assert o.apply_operator(BKet([n])) == o*BKet([n])
132
+
133
+
134
+ def test_basic_state():
135
+ i, j, n, m = symbols('i,j,n,m')
136
+ s = BosonState([0, 1, 2, 3, 4])
137
+ assert len(s) == 5
138
+ assert s.args[0] == tuple(range(5))
139
+ assert s.up(0) == BosonState([1, 1, 2, 3, 4])
140
+ assert s.down(4) == BosonState([0, 1, 2, 3, 3])
141
+ for i in range(5):
142
+ assert s.up(i).down(i) == s
143
+ assert s.down(0) == 0
144
+ for i in range(5):
145
+ assert s[i] == i
146
+ s = BosonState([n, m])
147
+ assert s.down(0) == BosonState([n - 1, m])
148
+ assert s.up(0) == BosonState([n + 1, m])
149
+
150
+
151
+ def test_basic_apply():
152
+ n = symbols("n")
153
+ e = B(0)*BKet([n])
154
+ assert apply_operators(e) == sqrt(n)*BKet([n - 1])
155
+ e = Bd(0)*BKet([n])
156
+ assert apply_operators(e) == sqrt(n + 1)*BKet([n + 1])
157
+
158
+
159
+ def test_complex_apply():
160
+ n, m = symbols("n,m")
161
+ o = Bd(0)*B(0)*Bd(1)*B(0)
162
+ e = apply_operators(o*BKet([n, m]))
163
+ answer = sqrt(n)*sqrt(m + 1)*(-1 + n)*BKet([-1 + n, 1 + m])
164
+ assert expand(e) == expand(answer)
165
+
166
+
167
+ def test_number_operator():
168
+ n = symbols("n")
169
+ o = Bd(0)*B(0)
170
+ e = apply_operators(o*BKet([n]))
171
+ assert e == n*BKet([n])
172
+
173
+
174
+ def test_inner_product():
175
+ i, j, k, l = symbols('i,j,k,l')
176
+ s1 = BBra([0])
177
+ s2 = BKet([1])
178
+ assert InnerProduct(s1, Dagger(s1)) == 1
179
+ assert InnerProduct(s1, s2) == 0
180
+ s1 = BBra([i, j])
181
+ s2 = BKet([k, l])
182
+ r = InnerProduct(s1, s2)
183
+ assert r == KroneckerDelta(i, k)*KroneckerDelta(j, l)
184
+
185
+
186
+ def test_symbolic_matrix_elements():
187
+ n, m = symbols('n,m')
188
+ s1 = BBra([n])
189
+ s2 = BKet([m])
190
+ o = B(0)
191
+ e = apply_operators(s1*o*s2)
192
+ assert e == sqrt(m)*KroneckerDelta(n, m - 1)
193
+
194
+
195
+ def test_matrix_elements():
196
+ b = VarBosonicBasis(5)
197
+ o = B(0)
198
+ m = matrix_rep(o, b)
199
+ for i in range(4):
200
+ assert m[i, i + 1] == sqrt(i + 1)
201
+ o = Bd(0)
202
+ m = matrix_rep(o, b)
203
+ for i in range(4):
204
+ assert m[i + 1, i] == sqrt(i + 1)
205
+
206
+
207
+ def test_fixed_bosonic_basis():
208
+ b = FixedBosonicBasis(2, 2)
209
+ # assert b == [FockState((2, 0)), FockState((1, 1)), FockState((0, 2))]
210
+ state = b.state(1)
211
+ assert state == FockStateBosonKet((1, 1))
212
+ assert b.index(state) == 1
213
+ assert b.state(1) == b[1]
214
+ assert len(b) == 3
215
+ assert str(b) == '[FockState((2, 0)), FockState((1, 1)), FockState((0, 2))]'
216
+ assert repr(b) == '[FockState((2, 0)), FockState((1, 1)), FockState((0, 2))]'
217
+ assert srepr(b) == '[FockState((2, 0)), FockState((1, 1)), FockState((0, 2))]'
218
+
219
+
220
+ @slow
221
+ def test_sho():
222
+ n, m = symbols('n,m')
223
+ h_n = Bd(n)*B(n)*(n + S.Half)
224
+ H = Sum(h_n, (n, 0, 5))
225
+ o = H.doit(deep=False)
226
+ b = FixedBosonicBasis(2, 6)
227
+ m = matrix_rep(o, b)
228
+ # We need to double check these energy values to make sure that they
229
+ # are correct and have the proper degeneracies!
230
+ diag = [1, 2, 3, 3, 4, 5, 4, 5, 6, 7, 5, 6, 7, 8, 9, 6, 7, 8, 9, 10, 11]
231
+ for i in range(len(diag)):
232
+ assert diag[i] == m[i, i]
233
+
234
+
235
+ def test_commutation():
236
+ n, m = symbols("n,m", above_fermi=True)
237
+ c = Commutator(B(0), Bd(0))
238
+ assert c == 1
239
+ c = Commutator(Bd(0), B(0))
240
+ assert c == -1
241
+ c = Commutator(B(n), Bd(0))
242
+ assert c == KroneckerDelta(n, 0)
243
+ c = Commutator(B(0), B(0))
244
+ assert c == 0
245
+ c = Commutator(B(0), Bd(0))
246
+ e = simplify(apply_operators(c*BKet([n])))
247
+ assert e == BKet([n])
248
+ c = Commutator(B(0), B(1))
249
+ e = simplify(apply_operators(c*BKet([n, m])))
250
+ assert e == 0
251
+
252
+ c = Commutator(F(m), Fd(m))
253
+ assert c == +1 - 2*NO(Fd(m)*F(m))
254
+ c = Commutator(Fd(m), F(m))
255
+ assert c.expand() == -1 + 2*NO(Fd(m)*F(m))
256
+
257
+ C = Commutator
258
+ X, Y, Z = symbols('X,Y,Z', commutative=False)
259
+ assert C(C(X, Y), Z) != 0
260
+ assert C(C(X, Z), Y) != 0
261
+ assert C(Y, C(X, Z)) != 0
262
+
263
+ i, j, k, l = symbols('i,j,k,l', below_fermi=True)
264
+ a, b, c, d = symbols('a,b,c,d', above_fermi=True)
265
+ p, q, r, s = symbols('p,q,r,s')
266
+ D = KroneckerDelta
267
+
268
+ assert C(Fd(a), F(i)) == -2*NO(F(i)*Fd(a))
269
+ assert C(Fd(j), NO(Fd(a)*F(i))).doit(wicks=True) == -D(j, i)*Fd(a)
270
+ assert C(Fd(a)*F(i), Fd(b)*F(j)).doit(wicks=True) == 0
271
+
272
+ c1 = Commutator(F(a), Fd(a))
273
+ assert Commutator.eval(c1, c1) == 0
274
+ c = Commutator(Fd(a)*F(i),Fd(b)*F(j))
275
+ assert latex(c) == r'\left[{a^\dagger_{a}} a_{i},{a^\dagger_{b}} a_{j}\right]'
276
+ assert repr(c) == 'Commutator(CreateFermion(a)*AnnihilateFermion(i),CreateFermion(b)*AnnihilateFermion(j))'
277
+ assert str(c) == '[CreateFermion(a)*AnnihilateFermion(i),CreateFermion(b)*AnnihilateFermion(j)]'
278
+
279
+
280
+ def test_create_f():
281
+ i, j, n, m = symbols('i,j,n,m')
282
+ o = Fd(i)
283
+ assert isinstance(o, CreateFermion)
284
+ o = o.subs(i, j)
285
+ assert o.atoms(Symbol) == {j}
286
+ o = Fd(1)
287
+ assert o.apply_operator(FKet([n])) == FKet([1, n])
288
+ assert o.apply_operator(FKet([n])) == -FKet([n, 1])
289
+ o = Fd(n)
290
+ assert o.apply_operator(FKet([])) == FKet([n])
291
+
292
+ vacuum = FKet([], fermi_level=4)
293
+ assert vacuum == FKet([], fermi_level=4)
294
+
295
+ i, j, k, l = symbols('i,j,k,l', below_fermi=True)
296
+ a, b, c, d = symbols('a,b,c,d', above_fermi=True)
297
+ p, q, r, s = symbols('p,q,r,s')
298
+ p1 = symbols("p1")
299
+
300
+ assert Fd(i).apply_operator(FKet([i, j, k], 4)) == FKet([j, k], 4)
301
+ assert Fd(a).apply_operator(FKet([i, b, k], 4)) == FKet([a, i, b, k], 4)
302
+
303
+ assert Dagger(B(p)).apply_operator(q) == q*CreateBoson(p)
304
+ assert repr(Fd(p)) == 'CreateFermion(p)'
305
+ assert srepr(Fd(p)) == "CreateFermion(Symbol('p'))"
306
+ assert latex(Fd(p)) == r'{a^\dagger_{p}}'
307
+ assert latex(Fd(p1)) == r'{a^\dagger_{p_{1}}}'
308
+ assert latex(FKet([a,i], 1)) == r"\left|\left( a, \ i\right)\right\rangle"
309
+ assert latex(FKet([j,i,b,a], 2)) == r"\left|\left( a, \ b, \ i, \ j\right)\right\rangle"
310
+
311
+
312
+ def test_annihilate_f():
313
+ i, j, n, m = symbols('i,j,n,m')
314
+ o = F(i)
315
+ assert isinstance(o, AnnihilateFermion)
316
+ o = o.subs(i, j)
317
+ assert o.atoms(Symbol) == {j}
318
+ o = F(1)
319
+ assert o.apply_operator(FKet([1, n])) == FKet([n])
320
+ assert o.apply_operator(FKet([n, 1])) == -FKet([n])
321
+ o = F(n)
322
+ assert o.apply_operator(FKet([n])) == FKet([])
323
+
324
+ i, j, k, l = symbols('i,j,k,l', below_fermi=True)
325
+ a, b, c, d = symbols('a,b,c,d', above_fermi=True)
326
+ p, q, r, s = symbols('p,q,r,s')
327
+ p1 = symbols('p1')
328
+
329
+ assert F(i).apply_operator(FKet([i, j, k], 4)) == 0
330
+ assert F(a).apply_operator(FKet([i, b, k], 4)) == 0
331
+ assert F(l).apply_operator(FKet([i, j, k], 3)) == 0
332
+ assert F(l).apply_operator(FKet([i, j, k], 4)) == FKet([l, i, j, k], 4)
333
+ assert str(F(p)) == 'f(p)'
334
+ assert repr(F(p)) == 'AnnihilateFermion(p)'
335
+ assert srepr(F(p)) == "AnnihilateFermion(Symbol('p'))"
336
+ assert latex(F(p)) == 'a_{p}'
337
+ assert latex(F(p1)) == 'a_{p_{1}}'
338
+
339
+
340
+ def test_create_b():
341
+ i, j, n, m = symbols('i,j,n,m')
342
+ o = Bd(i)
343
+ assert isinstance(o, CreateBoson)
344
+ o = o.subs(i, j)
345
+ assert o.atoms(Symbol) == {j}
346
+ o = Bd(0)
347
+ assert o.apply_operator(BKet([n])) == sqrt(n + 1)*BKet([n + 1])
348
+ o = Bd(n)
349
+ assert o.apply_operator(BKet([n])) == o*BKet([n])
350
+
351
+
352
+ def test_annihilate_b():
353
+ i, j, n, m = symbols('i,j,n,m')
354
+ o = B(i)
355
+ assert isinstance(o, AnnihilateBoson)
356
+ o = o.subs(i, j)
357
+ assert o.atoms(Symbol) == {j}
358
+ o = B(0)
359
+
360
+
361
+ def test_wicks():
362
+ p, q, r, s = symbols('p,q,r,s', above_fermi=True)
363
+
364
+ # Testing for particles only
365
+
366
+ str = F(p)*Fd(q)
367
+ assert wicks(str) == NO(F(p)*Fd(q)) + KroneckerDelta(p, q)
368
+ str = Fd(p)*F(q)
369
+ assert wicks(str) == NO(Fd(p)*F(q))
370
+
371
+ str = F(p)*Fd(q)*F(r)*Fd(s)
372
+ nstr = wicks(str)
373
+ fasit = NO(
374
+ KroneckerDelta(p, q)*KroneckerDelta(r, s)
375
+ + KroneckerDelta(p, q)*AnnihilateFermion(r)*CreateFermion(s)
376
+ + KroneckerDelta(r, s)*AnnihilateFermion(p)*CreateFermion(q)
377
+ - KroneckerDelta(p, s)*AnnihilateFermion(r)*CreateFermion(q)
378
+ - AnnihilateFermion(p)*AnnihilateFermion(r)*CreateFermion(q)*CreateFermion(s))
379
+ assert nstr == fasit
380
+
381
+ assert (p*q*nstr).expand() == wicks(p*q*str)
382
+ assert (nstr*p*q*2).expand() == wicks(str*p*q*2)
383
+
384
+ # Testing CC equations particles and holes
385
+ i, j, k, l = symbols('i j k l', below_fermi=True, cls=Dummy)
386
+ a, b, c, d = symbols('a b c d', above_fermi=True, cls=Dummy)
387
+ p, q, r, s = symbols('p q r s', cls=Dummy)
388
+
389
+ assert (wicks(F(a)*NO(F(i)*F(j))*Fd(b)) ==
390
+ NO(F(a)*F(i)*F(j)*Fd(b)) +
391
+ KroneckerDelta(a, b)*NO(F(i)*F(j)))
392
+ assert (wicks(F(a)*NO(F(i)*F(j)*F(k))*Fd(b)) ==
393
+ NO(F(a)*F(i)*F(j)*F(k)*Fd(b)) -
394
+ KroneckerDelta(a, b)*NO(F(i)*F(j)*F(k)))
395
+
396
+ expr = wicks(Fd(i)*NO(Fd(j)*F(k))*F(l))
397
+ assert (expr ==
398
+ -KroneckerDelta(i, k)*NO(Fd(j)*F(l)) -
399
+ KroneckerDelta(j, l)*NO(Fd(i)*F(k)) -
400
+ KroneckerDelta(i, k)*KroneckerDelta(j, l) +
401
+ KroneckerDelta(i, l)*NO(Fd(j)*F(k)) +
402
+ NO(Fd(i)*Fd(j)*F(k)*F(l)))
403
+ expr = wicks(F(a)*NO(F(b)*Fd(c))*Fd(d))
404
+ assert (expr ==
405
+ -KroneckerDelta(a, c)*NO(F(b)*Fd(d)) -
406
+ KroneckerDelta(b, d)*NO(F(a)*Fd(c)) -
407
+ KroneckerDelta(a, c)*KroneckerDelta(b, d) +
408
+ KroneckerDelta(a, d)*NO(F(b)*Fd(c)) +
409
+ NO(F(a)*F(b)*Fd(c)*Fd(d)))
410
+
411
+
412
+ def test_NO():
413
+ i, j, k, l = symbols('i j k l', below_fermi=True)
414
+ a, b, c, d = symbols('a b c d', above_fermi=True)
415
+ p, q, r, s = symbols('p q r s', cls=Dummy)
416
+
417
+ assert (NO(Fd(p)*F(q) + Fd(a)*F(b)) ==
418
+ NO(Fd(p)*F(q)) + NO(Fd(a)*F(b)))
419
+ assert (NO(Fd(i)*NO(F(j)*Fd(a))) ==
420
+ NO(Fd(i)*F(j)*Fd(a)))
421
+ assert NO(1) == 1
422
+ assert NO(i) == i
423
+ assert (NO(Fd(a)*Fd(b)*(F(c) + F(d))) ==
424
+ NO(Fd(a)*Fd(b)*F(c)) +
425
+ NO(Fd(a)*Fd(b)*F(d)))
426
+
427
+ assert NO(Fd(a)*F(b))._remove_brackets() == Fd(a)*F(b)
428
+ assert NO(F(j)*Fd(i))._remove_brackets() == F(j)*Fd(i)
429
+
430
+ assert (NO(Fd(p)*F(q)).subs(Fd(p), Fd(a) + Fd(i)) ==
431
+ NO(Fd(a)*F(q)) + NO(Fd(i)*F(q)))
432
+ assert (NO(Fd(p)*F(q)).subs(F(q), F(a) + F(i)) ==
433
+ NO(Fd(p)*F(a)) + NO(Fd(p)*F(i)))
434
+
435
+ expr = NO(Fd(p)*F(q))._remove_brackets()
436
+ assert wicks(expr) == NO(expr)
437
+
438
+ assert NO(Fd(a)*F(b)) == - NO(F(b)*Fd(a))
439
+
440
+ no = NO(Fd(a)*F(i)*F(b)*Fd(j))
441
+ l1 = list(no.iter_q_creators())
442
+ assert l1 == [0, 1]
443
+ l2 = list(no.iter_q_annihilators())
444
+ assert l2 == [3, 2]
445
+ no = NO(Fd(a)*Fd(i))
446
+ assert no.has_q_creators == 1
447
+ assert no.has_q_annihilators == -1
448
+ assert str(no) == ':CreateFermion(a)*CreateFermion(i):'
449
+ assert repr(no) == 'NO(CreateFermion(a)*CreateFermion(i))'
450
+ assert latex(no) == r'\left\{{a^\dagger_{a}} {a^\dagger_{i}}\right\}'
451
+ raises(NotImplementedError, lambda: NO(Bd(p)*F(q)))
452
+
453
+
454
+ def test_sorting():
455
+ i, j = symbols('i,j', below_fermi=True)
456
+ a, b = symbols('a,b', above_fermi=True)
457
+ p, q = symbols('p,q')
458
+
459
+ # p, q
460
+ assert _sort_anticommuting_fermions([Fd(p), F(q)]) == ([Fd(p), F(q)], 0)
461
+ assert _sort_anticommuting_fermions([F(p), Fd(q)]) == ([Fd(q), F(p)], 1)
462
+
463
+ # i, p
464
+ assert _sort_anticommuting_fermions([F(p), Fd(i)]) == ([F(p), Fd(i)], 0)
465
+ assert _sort_anticommuting_fermions([Fd(i), F(p)]) == ([F(p), Fd(i)], 1)
466
+ assert _sort_anticommuting_fermions([Fd(p), Fd(i)]) == ([Fd(p), Fd(i)], 0)
467
+ assert _sort_anticommuting_fermions([Fd(i), Fd(p)]) == ([Fd(p), Fd(i)], 1)
468
+ assert _sort_anticommuting_fermions([F(p), F(i)]) == ([F(i), F(p)], 1)
469
+ assert _sort_anticommuting_fermions([F(i), F(p)]) == ([F(i), F(p)], 0)
470
+ assert _sort_anticommuting_fermions([Fd(p), F(i)]) == ([F(i), Fd(p)], 1)
471
+ assert _sort_anticommuting_fermions([F(i), Fd(p)]) == ([F(i), Fd(p)], 0)
472
+
473
+ # a, p
474
+ assert _sort_anticommuting_fermions([F(p), Fd(a)]) == ([Fd(a), F(p)], 1)
475
+ assert _sort_anticommuting_fermions([Fd(a), F(p)]) == ([Fd(a), F(p)], 0)
476
+ assert _sort_anticommuting_fermions([Fd(p), Fd(a)]) == ([Fd(a), Fd(p)], 1)
477
+ assert _sort_anticommuting_fermions([Fd(a), Fd(p)]) == ([Fd(a), Fd(p)], 0)
478
+ assert _sort_anticommuting_fermions([F(p), F(a)]) == ([F(p), F(a)], 0)
479
+ assert _sort_anticommuting_fermions([F(a), F(p)]) == ([F(p), F(a)], 1)
480
+ assert _sort_anticommuting_fermions([Fd(p), F(a)]) == ([Fd(p), F(a)], 0)
481
+ assert _sort_anticommuting_fermions([F(a), Fd(p)]) == ([Fd(p), F(a)], 1)
482
+
483
+ # i, a
484
+ assert _sort_anticommuting_fermions([F(i), Fd(j)]) == ([F(i), Fd(j)], 0)
485
+ assert _sort_anticommuting_fermions([Fd(j), F(i)]) == ([F(i), Fd(j)], 1)
486
+ assert _sort_anticommuting_fermions([Fd(a), Fd(i)]) == ([Fd(a), Fd(i)], 0)
487
+ assert _sort_anticommuting_fermions([Fd(i), Fd(a)]) == ([Fd(a), Fd(i)], 1)
488
+ assert _sort_anticommuting_fermions([F(a), F(i)]) == ([F(i), F(a)], 1)
489
+ assert _sort_anticommuting_fermions([F(i), F(a)]) == ([F(i), F(a)], 0)
490
+
491
+
492
+ def test_contraction():
493
+ i, j, k, l = symbols('i,j,k,l', below_fermi=True)
494
+ a, b, c, d = symbols('a,b,c,d', above_fermi=True)
495
+ p, q, r, s = symbols('p,q,r,s')
496
+ assert contraction(Fd(i), F(j)) == KroneckerDelta(i, j)
497
+ assert contraction(F(a), Fd(b)) == KroneckerDelta(a, b)
498
+ assert contraction(F(a), Fd(i)) == 0
499
+ assert contraction(Fd(a), F(i)) == 0
500
+ assert contraction(F(i), Fd(a)) == 0
501
+ assert contraction(Fd(i), F(a)) == 0
502
+ assert contraction(Fd(i), F(p)) == KroneckerDelta(i, p)
503
+ restr = evaluate_deltas(contraction(Fd(p), F(q)))
504
+ assert restr.is_only_below_fermi
505
+ restr = evaluate_deltas(contraction(F(p), Fd(q)))
506
+ assert restr.is_only_above_fermi
507
+ raises(ContractionAppliesOnlyToFermions, lambda: contraction(B(a), Fd(b)))
508
+
509
+
510
+ def test_evaluate_deltas():
511
+ i, j, k = symbols('i,j,k')
512
+
513
+ r = KroneckerDelta(i, j) * KroneckerDelta(j, k)
514
+ assert evaluate_deltas(r) == KroneckerDelta(i, k)
515
+
516
+ r = KroneckerDelta(i, 0) * KroneckerDelta(j, k)
517
+ assert evaluate_deltas(r) == KroneckerDelta(i, 0) * KroneckerDelta(j, k)
518
+
519
+ r = KroneckerDelta(1, j) * KroneckerDelta(j, k)
520
+ assert evaluate_deltas(r) == KroneckerDelta(1, k)
521
+
522
+ r = KroneckerDelta(j, 2) * KroneckerDelta(k, j)
523
+ assert evaluate_deltas(r) == KroneckerDelta(2, k)
524
+
525
+ r = KroneckerDelta(i, 0) * KroneckerDelta(i, j) * KroneckerDelta(j, 1)
526
+ assert evaluate_deltas(r) == 0
527
+
528
+ r = (KroneckerDelta(0, i) * KroneckerDelta(0, j)
529
+ * KroneckerDelta(1, j) * KroneckerDelta(1, j))
530
+ assert evaluate_deltas(r) == 0
531
+
532
+
533
+ def test_Tensors():
534
+ i, j, k, l = symbols('i j k l', below_fermi=True, cls=Dummy)
535
+ a, b, c, d = symbols('a b c d', above_fermi=True, cls=Dummy)
536
+ p, q, r, s = symbols('p q r s')
537
+
538
+ AT = AntiSymmetricTensor
539
+ assert AT('t', (a, b), (i, j)) == -AT('t', (b, a), (i, j))
540
+ assert AT('t', (a, b), (i, j)) == AT('t', (b, a), (j, i))
541
+ assert AT('t', (a, b), (i, j)) == -AT('t', (a, b), (j, i))
542
+ assert AT('t', (a, a), (i, j)) == 0
543
+ assert AT('t', (a, b), (i, i)) == 0
544
+ assert AT('t', (a, b, c), (i, j)) == -AT('t', (b, a, c), (i, j))
545
+ assert AT('t', (a, b, c), (i, j, k)) == AT('t', (b, a, c), (i, k, j))
546
+
547
+ tabij = AT('t', (a, b), (i, j))
548
+ assert tabij.has(a)
549
+ assert tabij.has(b)
550
+ assert tabij.has(i)
551
+ assert tabij.has(j)
552
+ assert tabij.subs(b, c) == AT('t', (a, c), (i, j))
553
+ assert (2*tabij).subs(i, c) == 2*AT('t', (a, b), (c, j))
554
+ assert tabij.symbol == Symbol('t')
555
+ assert latex(tabij) == '{t^{ab}_{ij}}'
556
+ assert str(tabij) == 't((_a, _b),(_i, _j))'
557
+
558
+ assert AT('t', (a, a), (i, j)).subs(a, b) == AT('t', (b, b), (i, j))
559
+ assert AT('t', (a, i), (a, j)).subs(a, b) == AT('t', (b, i), (b, j))
560
+
561
+ a1, a2, a3, a4 = symbols('alpha1:5')
562
+ u_alpha1234 = AntiSymmetricTensor("u", (a1, a2), (a3, a4))
563
+
564
+ assert latex(u_alpha1234) == r'{u^{\alpha_{1}\alpha_{2}}_{\alpha_{3}\alpha_{4}}}'
565
+ assert str(u_alpha1234) == 'u((alpha1, alpha2),(alpha3, alpha4))'
566
+
567
+
568
+ def test_fully_contracted():
569
+ i, j, k, l = symbols('i j k l', below_fermi=True)
570
+ a, b, c, d = symbols('a b c d', above_fermi=True)
571
+ p, q, r, s = symbols('p q r s', cls=Dummy)
572
+
573
+ Fock = (AntiSymmetricTensor('f', (p,), (q,))*
574
+ NO(Fd(p)*F(q)))
575
+ V = (AntiSymmetricTensor('v', (p, q), (r, s))*
576
+ NO(Fd(p)*Fd(q)*F(s)*F(r)))/4
577
+
578
+ Fai = wicks(NO(Fd(i)*F(a))*Fock,
579
+ keep_only_fully_contracted=True,
580
+ simplify_kronecker_deltas=True)
581
+ assert Fai == AntiSymmetricTensor('f', (a,), (i,))
582
+ Vabij = wicks(NO(Fd(i)*Fd(j)*F(b)*F(a))*V,
583
+ keep_only_fully_contracted=True,
584
+ simplify_kronecker_deltas=True)
585
+ assert Vabij == AntiSymmetricTensor('v', (a, b), (i, j))
586
+
587
+
588
+ def test_substitute_dummies_without_dummies():
589
+ i, j = symbols('i,j')
590
+ assert substitute_dummies(att(i, j) + 2) == att(i, j) + 2
591
+ assert substitute_dummies(att(i, j) + 1) == att(i, j) + 1
592
+
593
+
594
+ def test_substitute_dummies_NO_operator():
595
+ i, j = symbols('i j', cls=Dummy)
596
+ assert substitute_dummies(att(i, j)*NO(Fd(i)*F(j))
597
+ - att(j, i)*NO(Fd(j)*F(i))) == 0
598
+
599
+
600
+ def test_substitute_dummies_SQ_operator():
601
+ i, j = symbols('i j', cls=Dummy)
602
+ assert substitute_dummies(att(i, j)*Fd(i)*F(j)
603
+ - att(j, i)*Fd(j)*F(i)) == 0
604
+
605
+
606
+ def test_substitute_dummies_new_indices():
607
+ i, j = symbols('i j', below_fermi=True, cls=Dummy)
608
+ a, b = symbols('a b', above_fermi=True, cls=Dummy)
609
+ p, q = symbols('p q', cls=Dummy)
610
+ f = Function('f')
611
+ assert substitute_dummies(f(i, a, p) - f(j, b, q), new_indices=True) == 0
612
+
613
+
614
+ def test_substitute_dummies_substitution_order():
615
+ i, j, k, l = symbols('i j k l', below_fermi=True, cls=Dummy)
616
+ f = Function('f')
617
+ from sympy.utilities.iterables import variations
618
+ for permut in variations([i, j, k, l], 4):
619
+ assert substitute_dummies(f(*permut) - f(i, j, k, l)) == 0
620
+
621
+
622
+ def test_dummy_order_inner_outer_lines_VT1T1T1():
623
+ ii = symbols('i', below_fermi=True)
624
+ aa = symbols('a', above_fermi=True)
625
+ k, l = symbols('k l', below_fermi=True, cls=Dummy)
626
+ c, d = symbols('c d', above_fermi=True, cls=Dummy)
627
+
628
+ v = Function('v')
629
+ t = Function('t')
630
+ dums = _get_ordered_dummies
631
+
632
+ # Coupled-Cluster T1 terms with V*T1*T1*T1
633
+ # t^{a}_{k} t^{c}_{i} t^{d}_{l} v^{lk}_{dc}
634
+ exprs = [
635
+ # permut v and t <=> swapping internal lines, equivalent
636
+ # irrespective of symmetries in v
637
+ v(k, l, c, d)*t(c, ii)*t(d, l)*t(aa, k),
638
+ v(l, k, c, d)*t(c, ii)*t(d, k)*t(aa, l),
639
+ v(k, l, d, c)*t(d, ii)*t(c, l)*t(aa, k),
640
+ v(l, k, d, c)*t(d, ii)*t(c, k)*t(aa, l),
641
+ ]
642
+ for permut in exprs[1:]:
643
+ assert dums(exprs[0]) != dums(permut)
644
+ assert substitute_dummies(exprs[0]) == substitute_dummies(permut)
645
+
646
+
647
+ def test_dummy_order_inner_outer_lines_VT1T1T1T1():
648
+ ii, jj = symbols('i j', below_fermi=True)
649
+ aa, bb = symbols('a b', above_fermi=True)
650
+ k, l = symbols('k l', below_fermi=True, cls=Dummy)
651
+ c, d = symbols('c d', above_fermi=True, cls=Dummy)
652
+
653
+ v = Function('v')
654
+ t = Function('t')
655
+ dums = _get_ordered_dummies
656
+
657
+ # Coupled-Cluster T2 terms with V*T1*T1*T1*T1
658
+ exprs = [
659
+ # permut t <=> swapping external lines, not equivalent
660
+ # except if v has certain symmetries.
661
+ v(k, l, c, d)*t(c, ii)*t(d, jj)*t(aa, k)*t(bb, l),
662
+ v(k, l, c, d)*t(c, jj)*t(d, ii)*t(aa, k)*t(bb, l),
663
+ v(k, l, c, d)*t(c, ii)*t(d, jj)*t(bb, k)*t(aa, l),
664
+ v(k, l, c, d)*t(c, jj)*t(d, ii)*t(bb, k)*t(aa, l),
665
+ ]
666
+ for permut in exprs[1:]:
667
+ assert dums(exprs[0]) != dums(permut)
668
+ assert substitute_dummies(exprs[0]) != substitute_dummies(permut)
669
+ exprs = [
670
+ # permut v <=> swapping external lines, not equivalent
671
+ # except if v has certain symmetries.
672
+ #
673
+ # Note that in contrast to above, these permutations have identical
674
+ # dummy order. That is because the proximity to external indices
675
+ # has higher influence on the canonical dummy ordering than the
676
+ # position of a dummy on the factors. In fact, the terms here are
677
+ # similar in structure as the result of the dummy substitutions above.
678
+ v(k, l, c, d)*t(c, ii)*t(d, jj)*t(aa, k)*t(bb, l),
679
+ v(l, k, c, d)*t(c, ii)*t(d, jj)*t(aa, k)*t(bb, l),
680
+ v(k, l, d, c)*t(c, ii)*t(d, jj)*t(aa, k)*t(bb, l),
681
+ v(l, k, d, c)*t(c, ii)*t(d, jj)*t(aa, k)*t(bb, l),
682
+ ]
683
+ for permut in exprs[1:]:
684
+ assert dums(exprs[0]) == dums(permut)
685
+ assert substitute_dummies(exprs[0]) != substitute_dummies(permut)
686
+ exprs = [
687
+ # permut t and v <=> swapping internal lines, equivalent.
688
+ # Canonical dummy order is different, and a consistent
689
+ # substitution reveals the equivalence.
690
+ v(k, l, c, d)*t(c, ii)*t(d, jj)*t(aa, k)*t(bb, l),
691
+ v(k, l, d, c)*t(c, jj)*t(d, ii)*t(aa, k)*t(bb, l),
692
+ v(l, k, c, d)*t(c, ii)*t(d, jj)*t(bb, k)*t(aa, l),
693
+ v(l, k, d, c)*t(c, jj)*t(d, ii)*t(bb, k)*t(aa, l),
694
+ ]
695
+ for permut in exprs[1:]:
696
+ assert dums(exprs[0]) != dums(permut)
697
+ assert substitute_dummies(exprs[0]) == substitute_dummies(permut)
698
+
699
+
700
+ def test_get_subNO():
701
+ p, q, r = symbols('p,q,r')
702
+ assert NO(F(p)*F(q)*F(r)).get_subNO(1) == NO(F(p)*F(r))
703
+ assert NO(F(p)*F(q)*F(r)).get_subNO(0) == NO(F(q)*F(r))
704
+ assert NO(F(p)*F(q)*F(r)).get_subNO(2) == NO(F(p)*F(q))
705
+
706
+
707
+ def test_equivalent_internal_lines_VT1T1():
708
+ i, j, k, l = symbols('i j k l', below_fermi=True, cls=Dummy)
709
+ a, b, c, d = symbols('a b c d', above_fermi=True, cls=Dummy)
710
+
711
+ v = Function('v')
712
+ t = Function('t')
713
+ dums = _get_ordered_dummies
714
+
715
+ exprs = [ # permute v. Different dummy order. Not equivalent.
716
+ v(i, j, a, b)*t(a, i)*t(b, j),
717
+ v(j, i, a, b)*t(a, i)*t(b, j),
718
+ v(i, j, b, a)*t(a, i)*t(b, j),
719
+ ]
720
+ for permut in exprs[1:]:
721
+ assert dums(exprs[0]) != dums(permut)
722
+ assert substitute_dummies(exprs[0]) != substitute_dummies(permut)
723
+
724
+ exprs = [ # permute v. Different dummy order. Equivalent
725
+ v(i, j, a, b)*t(a, i)*t(b, j),
726
+ v(j, i, b, a)*t(a, i)*t(b, j),
727
+ ]
728
+ for permut in exprs[1:]:
729
+ assert dums(exprs[0]) != dums(permut)
730
+ assert substitute_dummies(exprs[0]) == substitute_dummies(permut)
731
+
732
+ exprs = [ # permute t. Same dummy order, not equivalent.
733
+ v(i, j, a, b)*t(a, i)*t(b, j),
734
+ v(i, j, a, b)*t(b, i)*t(a, j),
735
+ ]
736
+ for permut in exprs[1:]:
737
+ assert dums(exprs[0]) == dums(permut)
738
+ assert substitute_dummies(exprs[0]) != substitute_dummies(permut)
739
+
740
+ exprs = [ # permute v and t. Different dummy order, equivalent
741
+ v(i, j, a, b)*t(a, i)*t(b, j),
742
+ v(j, i, a, b)*t(a, j)*t(b, i),
743
+ v(i, j, b, a)*t(b, i)*t(a, j),
744
+ v(j, i, b, a)*t(b, j)*t(a, i),
745
+ ]
746
+ for permut in exprs[1:]:
747
+ assert dums(exprs[0]) != dums(permut)
748
+ assert substitute_dummies(exprs[0]) == substitute_dummies(permut)
749
+
750
+
751
+ def test_equivalent_internal_lines_VT2conjT2():
752
+ # this diagram requires special handling in TCE
753
+ i, j, k, l, m, n = symbols('i j k l m n', below_fermi=True, cls=Dummy)
754
+ a, b, c, d, e, f = symbols('a b c d e f', above_fermi=True, cls=Dummy)
755
+ p1, p2, p3, p4 = symbols('p1 p2 p3 p4', above_fermi=True, cls=Dummy)
756
+ h1, h2, h3, h4 = symbols('h1 h2 h3 h4', below_fermi=True, cls=Dummy)
757
+
758
+ from sympy.utilities.iterables import variations
759
+
760
+ v = Function('v')
761
+ t = Function('t')
762
+ dums = _get_ordered_dummies
763
+
764
+ # v(abcd)t(abij)t(ijcd)
765
+ template = v(p1, p2, p3, p4)*t(p1, p2, i, j)*t(i, j, p3, p4)
766
+ permutator = variations([a, b, c, d], 4)
767
+ base = template.subs(zip([p1, p2, p3, p4], next(permutator)))
768
+ for permut in permutator:
769
+ subslist = zip([p1, p2, p3, p4], permut)
770
+ expr = template.subs(subslist)
771
+ assert dums(base) != dums(expr)
772
+ assert substitute_dummies(expr) == substitute_dummies(base)
773
+ template = v(p1, p2, p3, p4)*t(p1, p2, j, i)*t(j, i, p3, p4)
774
+ permutator = variations([a, b, c, d], 4)
775
+ base = template.subs(zip([p1, p2, p3, p4], next(permutator)))
776
+ for permut in permutator:
777
+ subslist = zip([p1, p2, p3, p4], permut)
778
+ expr = template.subs(subslist)
779
+ assert dums(base) != dums(expr)
780
+ assert substitute_dummies(expr) == substitute_dummies(base)
781
+
782
+ # v(abcd)t(abij)t(jicd)
783
+ template = v(p1, p2, p3, p4)*t(p1, p2, i, j)*t(j, i, p3, p4)
784
+ permutator = variations([a, b, c, d], 4)
785
+ base = template.subs(zip([p1, p2, p3, p4], next(permutator)))
786
+ for permut in permutator:
787
+ subslist = zip([p1, p2, p3, p4], permut)
788
+ expr = template.subs(subslist)
789
+ assert dums(base) != dums(expr)
790
+ assert substitute_dummies(expr) == substitute_dummies(base)
791
+ template = v(p1, p2, p3, p4)*t(p1, p2, j, i)*t(i, j, p3, p4)
792
+ permutator = variations([a, b, c, d], 4)
793
+ base = template.subs(zip([p1, p2, p3, p4], next(permutator)))
794
+ for permut in permutator:
795
+ subslist = zip([p1, p2, p3, p4], permut)
796
+ expr = template.subs(subslist)
797
+ assert dums(base) != dums(expr)
798
+ assert substitute_dummies(expr) == substitute_dummies(base)
799
+
800
+
801
+ def test_equivalent_internal_lines_VT2conjT2_ambiguous_order():
802
+ # These diagrams invokes _determine_ambiguous() because the
803
+ # dummies can not be ordered unambiguously by the key alone
804
+ i, j, k, l, m, n = symbols('i j k l m n', below_fermi=True, cls=Dummy)
805
+ a, b, c, d, e, f = symbols('a b c d e f', above_fermi=True, cls=Dummy)
806
+ p1, p2, p3, p4 = symbols('p1 p2 p3 p4', above_fermi=True, cls=Dummy)
807
+ h1, h2, h3, h4 = symbols('h1 h2 h3 h4', below_fermi=True, cls=Dummy)
808
+
809
+ from sympy.utilities.iterables import variations
810
+
811
+ v = Function('v')
812
+ t = Function('t')
813
+ dums = _get_ordered_dummies
814
+
815
+ # v(abcd)t(abij)t(cdij)
816
+ template = v(p1, p2, p3, p4)*t(p1, p2, i, j)*t(p3, p4, i, j)
817
+ permutator = variations([a, b, c, d], 4)
818
+ base = template.subs(zip([p1, p2, p3, p4], next(permutator)))
819
+ for permut in permutator:
820
+ subslist = zip([p1, p2, p3, p4], permut)
821
+ expr = template.subs(subslist)
822
+ assert dums(base) != dums(expr)
823
+ assert substitute_dummies(expr) == substitute_dummies(base)
824
+ template = v(p1, p2, p3, p4)*t(p1, p2, j, i)*t(p3, p4, i, j)
825
+ permutator = variations([a, b, c, d], 4)
826
+ base = template.subs(zip([p1, p2, p3, p4], next(permutator)))
827
+ for permut in permutator:
828
+ subslist = zip([p1, p2, p3, p4], permut)
829
+ expr = template.subs(subslist)
830
+ assert dums(base) != dums(expr)
831
+ assert substitute_dummies(expr) == substitute_dummies(base)
832
+
833
+
834
+ def test_equivalent_internal_lines_VT2():
835
+ i, j, k, l = symbols('i j k l', below_fermi=True, cls=Dummy)
836
+ a, b, c, d = symbols('a b c d', above_fermi=True, cls=Dummy)
837
+
838
+ v = Function('v')
839
+ t = Function('t')
840
+ dums = _get_ordered_dummies
841
+ exprs = [
842
+ # permute v. Same dummy order, not equivalent.
843
+ #
844
+ # This test show that the dummy order may not be sensitive to all
845
+ # index permutations. The following expressions have identical
846
+ # structure as the resulting terms from of the dummy substitutions
847
+ # in the test above. Here, all expressions have the same dummy
848
+ # order, so they cannot be simplified by means of dummy
849
+ # substitution. In order to simplify further, it is necessary to
850
+ # exploit symmetries in the objects, for instance if t or v is
851
+ # antisymmetric.
852
+ v(i, j, a, b)*t(a, b, i, j),
853
+ v(j, i, a, b)*t(a, b, i, j),
854
+ v(i, j, b, a)*t(a, b, i, j),
855
+ v(j, i, b, a)*t(a, b, i, j),
856
+ ]
857
+ for permut in exprs[1:]:
858
+ assert dums(exprs[0]) == dums(permut)
859
+ assert substitute_dummies(exprs[0]) != substitute_dummies(permut)
860
+
861
+ exprs = [
862
+ # permute t.
863
+ v(i, j, a, b)*t(a, b, i, j),
864
+ v(i, j, a, b)*t(b, a, i, j),
865
+ v(i, j, a, b)*t(a, b, j, i),
866
+ v(i, j, a, b)*t(b, a, j, i),
867
+ ]
868
+ for permut in exprs[1:]:
869
+ assert dums(exprs[0]) != dums(permut)
870
+ assert substitute_dummies(exprs[0]) != substitute_dummies(permut)
871
+
872
+ exprs = [ # permute v and t. Relabelling of dummies should be equivalent.
873
+ v(i, j, a, b)*t(a, b, i, j),
874
+ v(j, i, a, b)*t(a, b, j, i),
875
+ v(i, j, b, a)*t(b, a, i, j),
876
+ v(j, i, b, a)*t(b, a, j, i),
877
+ ]
878
+ for permut in exprs[1:]:
879
+ assert dums(exprs[0]) != dums(permut)
880
+ assert substitute_dummies(exprs[0]) == substitute_dummies(permut)
881
+
882
+
883
+ def test_internal_external_VT2T2():
884
+ ii, jj = symbols('i j', below_fermi=True)
885
+ aa, bb = symbols('a b', above_fermi=True)
886
+ k, l = symbols('k l', below_fermi=True, cls=Dummy)
887
+ c, d = symbols('c d', above_fermi=True, cls=Dummy)
888
+
889
+ v = Function('v')
890
+ t = Function('t')
891
+ dums = _get_ordered_dummies
892
+
893
+ exprs = [
894
+ v(k, l, c, d)*t(aa, c, ii, k)*t(bb, d, jj, l),
895
+ v(l, k, c, d)*t(aa, c, ii, l)*t(bb, d, jj, k),
896
+ v(k, l, d, c)*t(aa, d, ii, k)*t(bb, c, jj, l),
897
+ v(l, k, d, c)*t(aa, d, ii, l)*t(bb, c, jj, k),
898
+ ]
899
+ for permut in exprs[1:]:
900
+ assert dums(exprs[0]) != dums(permut)
901
+ assert substitute_dummies(exprs[0]) == substitute_dummies(permut)
902
+ exprs = [
903
+ v(k, l, c, d)*t(aa, c, ii, k)*t(d, bb, jj, l),
904
+ v(l, k, c, d)*t(aa, c, ii, l)*t(d, bb, jj, k),
905
+ v(k, l, d, c)*t(aa, d, ii, k)*t(c, bb, jj, l),
906
+ v(l, k, d, c)*t(aa, d, ii, l)*t(c, bb, jj, k),
907
+ ]
908
+ for permut in exprs[1:]:
909
+ assert dums(exprs[0]) != dums(permut)
910
+ assert substitute_dummies(exprs[0]) == substitute_dummies(permut)
911
+ exprs = [
912
+ v(k, l, c, d)*t(c, aa, ii, k)*t(bb, d, jj, l),
913
+ v(l, k, c, d)*t(c, aa, ii, l)*t(bb, d, jj, k),
914
+ v(k, l, d, c)*t(d, aa, ii, k)*t(bb, c, jj, l),
915
+ v(l, k, d, c)*t(d, aa, ii, l)*t(bb, c, jj, k),
916
+ ]
917
+ for permut in exprs[1:]:
918
+ assert dums(exprs[0]) != dums(permut)
919
+ assert substitute_dummies(exprs[0]) == substitute_dummies(permut)
920
+
921
+
922
+ def test_internal_external_pqrs():
923
+ ii, jj = symbols('i j')
924
+ aa, bb = symbols('a b')
925
+ k, l = symbols('k l', cls=Dummy)
926
+ c, d = symbols('c d', cls=Dummy)
927
+
928
+ v = Function('v')
929
+ t = Function('t')
930
+ dums = _get_ordered_dummies
931
+
932
+ exprs = [
933
+ v(k, l, c, d)*t(aa, c, ii, k)*t(bb, d, jj, l),
934
+ v(l, k, c, d)*t(aa, c, ii, l)*t(bb, d, jj, k),
935
+ v(k, l, d, c)*t(aa, d, ii, k)*t(bb, c, jj, l),
936
+ v(l, k, d, c)*t(aa, d, ii, l)*t(bb, c, jj, k),
937
+ ]
938
+ for permut in exprs[1:]:
939
+ assert dums(exprs[0]) != dums(permut)
940
+ assert substitute_dummies(exprs[0]) == substitute_dummies(permut)
941
+
942
+
943
+ def test_dummy_order_well_defined():
944
+ aa, bb = symbols('a b', above_fermi=True)
945
+ k, l, m = symbols('k l m', below_fermi=True, cls=Dummy)
946
+ c, d = symbols('c d', above_fermi=True, cls=Dummy)
947
+ p, q = symbols('p q', cls=Dummy)
948
+
949
+ A = Function('A')
950
+ B = Function('B')
951
+ C = Function('C')
952
+ dums = _get_ordered_dummies
953
+
954
+ # We go through all key components in the order of increasing priority,
955
+ # and consider only fully orderable expressions. Non-orderable expressions
956
+ # are tested elsewhere.
957
+
958
+ # pos in first factor determines sort order
959
+ assert dums(A(k, l)*B(l, k)) == [k, l]
960
+ assert dums(A(l, k)*B(l, k)) == [l, k]
961
+ assert dums(A(k, l)*B(k, l)) == [k, l]
962
+ assert dums(A(l, k)*B(k, l)) == [l, k]
963
+
964
+ # factors involving the index
965
+ assert dums(A(k, l)*B(l, m)*C(k, m)) == [l, k, m]
966
+ assert dums(A(k, l)*B(l, m)*C(m, k)) == [l, k, m]
967
+ assert dums(A(l, k)*B(l, m)*C(k, m)) == [l, k, m]
968
+ assert dums(A(l, k)*B(l, m)*C(m, k)) == [l, k, m]
969
+ assert dums(A(k, l)*B(m, l)*C(k, m)) == [l, k, m]
970
+ assert dums(A(k, l)*B(m, l)*C(m, k)) == [l, k, m]
971
+ assert dums(A(l, k)*B(m, l)*C(k, m)) == [l, k, m]
972
+ assert dums(A(l, k)*B(m, l)*C(m, k)) == [l, k, m]
973
+
974
+ # same, but with factor order determined by non-dummies
975
+ assert dums(A(k, aa, l)*A(l, bb, m)*A(bb, k, m)) == [l, k, m]
976
+ assert dums(A(k, aa, l)*A(l, bb, m)*A(bb, m, k)) == [l, k, m]
977
+ assert dums(A(k, aa, l)*A(m, bb, l)*A(bb, k, m)) == [l, k, m]
978
+ assert dums(A(k, aa, l)*A(m, bb, l)*A(bb, m, k)) == [l, k, m]
979
+ assert dums(A(l, aa, k)*A(l, bb, m)*A(bb, k, m)) == [l, k, m]
980
+ assert dums(A(l, aa, k)*A(l, bb, m)*A(bb, m, k)) == [l, k, m]
981
+ assert dums(A(l, aa, k)*A(m, bb, l)*A(bb, k, m)) == [l, k, m]
982
+ assert dums(A(l, aa, k)*A(m, bb, l)*A(bb, m, k)) == [l, k, m]
983
+
984
+ # index range
985
+ assert dums(A(p, c, k)*B(p, c, k)) == [k, c, p]
986
+ assert dums(A(p, k, c)*B(p, c, k)) == [k, c, p]
987
+ assert dums(A(c, k, p)*B(p, c, k)) == [k, c, p]
988
+ assert dums(A(c, p, k)*B(p, c, k)) == [k, c, p]
989
+ assert dums(A(k, c, p)*B(p, c, k)) == [k, c, p]
990
+ assert dums(A(k, p, c)*B(p, c, k)) == [k, c, p]
991
+ assert dums(B(p, c, k)*A(p, c, k)) == [k, c, p]
992
+ assert dums(B(p, k, c)*A(p, c, k)) == [k, c, p]
993
+ assert dums(B(c, k, p)*A(p, c, k)) == [k, c, p]
994
+ assert dums(B(c, p, k)*A(p, c, k)) == [k, c, p]
995
+ assert dums(B(k, c, p)*A(p, c, k)) == [k, c, p]
996
+ assert dums(B(k, p, c)*A(p, c, k)) == [k, c, p]
997
+
998
+
999
+ def test_dummy_order_ambiguous():
1000
+ aa, bb = symbols('a b', above_fermi=True)
1001
+ i, j, k, l, m = symbols('i j k l m', below_fermi=True, cls=Dummy)
1002
+ a, b, c, d, e = symbols('a b c d e', above_fermi=True, cls=Dummy)
1003
+ p, q = symbols('p q', cls=Dummy)
1004
+ p1, p2, p3, p4 = symbols('p1 p2 p3 p4', above_fermi=True, cls=Dummy)
1005
+ p5, p6, p7, p8 = symbols('p5 p6 p7 p8', above_fermi=True, cls=Dummy)
1006
+ h1, h2, h3, h4 = symbols('h1 h2 h3 h4', below_fermi=True, cls=Dummy)
1007
+ h5, h6, h7, h8 = symbols('h5 h6 h7 h8', below_fermi=True, cls=Dummy)
1008
+
1009
+ A = Function('A')
1010
+ B = Function('B')
1011
+
1012
+ from sympy.utilities.iterables import variations
1013
+
1014
+ # A*A*A*A*B -- ordering of p5 and p4 is used to figure out the rest
1015
+ template = A(p1, p2)*A(p4, p1)*A(p2, p3)*A(p3, p5)*B(p5, p4)
1016
+ permutator = variations([a, b, c, d, e], 5)
1017
+ base = template.subs(zip([p1, p2, p3, p4, p5], next(permutator)))
1018
+ for permut in permutator:
1019
+ subslist = zip([p1, p2, p3, p4, p5], permut)
1020
+ expr = template.subs(subslist)
1021
+ assert substitute_dummies(expr) == substitute_dummies(base)
1022
+
1023
+ # A*A*A*A*A -- an arbitrary index is assigned and the rest are figured out
1024
+ template = A(p1, p2)*A(p4, p1)*A(p2, p3)*A(p3, p5)*A(p5, p4)
1025
+ permutator = variations([a, b, c, d, e], 5)
1026
+ base = template.subs(zip([p1, p2, p3, p4, p5], next(permutator)))
1027
+ for permut in permutator:
1028
+ subslist = zip([p1, p2, p3, p4, p5], permut)
1029
+ expr = template.subs(subslist)
1030
+ assert substitute_dummies(expr) == substitute_dummies(base)
1031
+
1032
+ # A*A*A -- ordering of p5 and p4 is used to figure out the rest
1033
+ template = A(p1, p2, p4, p1)*A(p2, p3, p3, p5)*A(p5, p4)
1034
+ permutator = variations([a, b, c, d, e], 5)
1035
+ base = template.subs(zip([p1, p2, p3, p4, p5], next(permutator)))
1036
+ for permut in permutator:
1037
+ subslist = zip([p1, p2, p3, p4, p5], permut)
1038
+ expr = template.subs(subslist)
1039
+ assert substitute_dummies(expr) == substitute_dummies(base)
1040
+
1041
+
1042
+ def atv(*args):
1043
+ return AntiSymmetricTensor('v', args[:2], args[2:] )
1044
+
1045
+
1046
+ def att(*args):
1047
+ if len(args) == 4:
1048
+ return AntiSymmetricTensor('t', args[:2], args[2:] )
1049
+ elif len(args) == 2:
1050
+ return AntiSymmetricTensor('t', (args[0],), (args[1],))
1051
+
1052
+
1053
+ def test_dummy_order_inner_outer_lines_VT1T1T1_AT():
1054
+ ii = symbols('i', below_fermi=True)
1055
+ aa = symbols('a', above_fermi=True)
1056
+ k, l = symbols('k l', below_fermi=True, cls=Dummy)
1057
+ c, d = symbols('c d', above_fermi=True, cls=Dummy)
1058
+
1059
+ # Coupled-Cluster T1 terms with V*T1*T1*T1
1060
+ # t^{a}_{k} t^{c}_{i} t^{d}_{l} v^{lk}_{dc}
1061
+ exprs = [
1062
+ # permut v and t <=> swapping internal lines, equivalent
1063
+ # irrespective of symmetries in v
1064
+ atv(k, l, c, d)*att(c, ii)*att(d, l)*att(aa, k),
1065
+ atv(l, k, c, d)*att(c, ii)*att(d, k)*att(aa, l),
1066
+ atv(k, l, d, c)*att(d, ii)*att(c, l)*att(aa, k),
1067
+ atv(l, k, d, c)*att(d, ii)*att(c, k)*att(aa, l),
1068
+ ]
1069
+ for permut in exprs[1:]:
1070
+ assert substitute_dummies(exprs[0]) == substitute_dummies(permut)
1071
+
1072
+
1073
+ def test_dummy_order_inner_outer_lines_VT1T1T1T1_AT():
1074
+ ii, jj = symbols('i j', below_fermi=True)
1075
+ aa, bb = symbols('a b', above_fermi=True)
1076
+ k, l = symbols('k l', below_fermi=True, cls=Dummy)
1077
+ c, d = symbols('c d', above_fermi=True, cls=Dummy)
1078
+
1079
+ # Coupled-Cluster T2 terms with V*T1*T1*T1*T1
1080
+ # non-equivalent substitutions (change of sign)
1081
+ exprs = [
1082
+ # permut t <=> swapping external lines
1083
+ atv(k, l, c, d)*att(c, ii)*att(d, jj)*att(aa, k)*att(bb, l),
1084
+ atv(k, l, c, d)*att(c, jj)*att(d, ii)*att(aa, k)*att(bb, l),
1085
+ atv(k, l, c, d)*att(c, ii)*att(d, jj)*att(bb, k)*att(aa, l),
1086
+ ]
1087
+ for permut in exprs[1:]:
1088
+ assert substitute_dummies(exprs[0]) == -substitute_dummies(permut)
1089
+
1090
+ # equivalent substitutions
1091
+ exprs = [
1092
+ atv(k, l, c, d)*att(c, ii)*att(d, jj)*att(aa, k)*att(bb, l),
1093
+ # permut t <=> swapping external lines
1094
+ atv(k, l, c, d)*att(c, jj)*att(d, ii)*att(bb, k)*att(aa, l),
1095
+ ]
1096
+ for permut in exprs[1:]:
1097
+ assert substitute_dummies(exprs[0]) == substitute_dummies(permut)
1098
+
1099
+
1100
+ def test_equivalent_internal_lines_VT1T1_AT():
1101
+ i, j, k, l = symbols('i j k l', below_fermi=True, cls=Dummy)
1102
+ a, b, c, d = symbols('a b c d', above_fermi=True, cls=Dummy)
1103
+
1104
+ exprs = [ # permute v. Different dummy order. Not equivalent.
1105
+ atv(i, j, a, b)*att(a, i)*att(b, j),
1106
+ atv(j, i, a, b)*att(a, i)*att(b, j),
1107
+ atv(i, j, b, a)*att(a, i)*att(b, j),
1108
+ ]
1109
+ for permut in exprs[1:]:
1110
+ assert substitute_dummies(exprs[0]) != substitute_dummies(permut)
1111
+
1112
+ exprs = [ # permute v. Different dummy order. Equivalent
1113
+ atv(i, j, a, b)*att(a, i)*att(b, j),
1114
+ atv(j, i, b, a)*att(a, i)*att(b, j),
1115
+ ]
1116
+ for permut in exprs[1:]:
1117
+ assert substitute_dummies(exprs[0]) == substitute_dummies(permut)
1118
+
1119
+ exprs = [ # permute t. Same dummy order, not equivalent.
1120
+ atv(i, j, a, b)*att(a, i)*att(b, j),
1121
+ atv(i, j, a, b)*att(b, i)*att(a, j),
1122
+ ]
1123
+ for permut in exprs[1:]:
1124
+ assert substitute_dummies(exprs[0]) != substitute_dummies(permut)
1125
+
1126
+ exprs = [ # permute v and t. Different dummy order, equivalent
1127
+ atv(i, j, a, b)*att(a, i)*att(b, j),
1128
+ atv(j, i, a, b)*att(a, j)*att(b, i),
1129
+ atv(i, j, b, a)*att(b, i)*att(a, j),
1130
+ atv(j, i, b, a)*att(b, j)*att(a, i),
1131
+ ]
1132
+ for permut in exprs[1:]:
1133
+ assert substitute_dummies(exprs[0]) == substitute_dummies(permut)
1134
+
1135
+
1136
+ def test_equivalent_internal_lines_VT2conjT2_AT():
1137
+ # this diagram requires special handling in TCE
1138
+ i, j, k, l, m, n = symbols('i j k l m n', below_fermi=True, cls=Dummy)
1139
+ a, b, c, d, e, f = symbols('a b c d e f', above_fermi=True, cls=Dummy)
1140
+ p1, p2, p3, p4 = symbols('p1 p2 p3 p4', above_fermi=True, cls=Dummy)
1141
+ h1, h2, h3, h4 = symbols('h1 h2 h3 h4', below_fermi=True, cls=Dummy)
1142
+
1143
+ from sympy.utilities.iterables import variations
1144
+
1145
+ # atv(abcd)att(abij)att(ijcd)
1146
+ template = atv(p1, p2, p3, p4)*att(p1, p2, i, j)*att(i, j, p3, p4)
1147
+ permutator = variations([a, b, c, d], 4)
1148
+ base = template.subs(zip([p1, p2, p3, p4], next(permutator)))
1149
+ for permut in permutator:
1150
+ subslist = zip([p1, p2, p3, p4], permut)
1151
+ expr = template.subs(subslist)
1152
+ assert substitute_dummies(expr) == substitute_dummies(base)
1153
+ template = atv(p1, p2, p3, p4)*att(p1, p2, j, i)*att(j, i, p3, p4)
1154
+ permutator = variations([a, b, c, d], 4)
1155
+ base = template.subs(zip([p1, p2, p3, p4], next(permutator)))
1156
+ for permut in permutator:
1157
+ subslist = zip([p1, p2, p3, p4], permut)
1158
+ expr = template.subs(subslist)
1159
+ assert substitute_dummies(expr) == substitute_dummies(base)
1160
+
1161
+ # atv(abcd)att(abij)att(jicd)
1162
+ template = atv(p1, p2, p3, p4)*att(p1, p2, i, j)*att(j, i, p3, p4)
1163
+ permutator = variations([a, b, c, d], 4)
1164
+ base = template.subs(zip([p1, p2, p3, p4], next(permutator)))
1165
+ for permut in permutator:
1166
+ subslist = zip([p1, p2, p3, p4], permut)
1167
+ expr = template.subs(subslist)
1168
+ assert substitute_dummies(expr) == substitute_dummies(base)
1169
+ template = atv(p1, p2, p3, p4)*att(p1, p2, j, i)*att(i, j, p3, p4)
1170
+ permutator = variations([a, b, c, d], 4)
1171
+ base = template.subs(zip([p1, p2, p3, p4], next(permutator)))
1172
+ for permut in permutator:
1173
+ subslist = zip([p1, p2, p3, p4], permut)
1174
+ expr = template.subs(subslist)
1175
+ assert substitute_dummies(expr) == substitute_dummies(base)
1176
+
1177
+
1178
+ def test_equivalent_internal_lines_VT2conjT2_ambiguous_order_AT():
1179
+ # These diagrams invokes _determine_ambiguous() because the
1180
+ # dummies can not be ordered unambiguously by the key alone
1181
+ i, j, k, l, m, n = symbols('i j k l m n', below_fermi=True, cls=Dummy)
1182
+ a, b, c, d, e, f = symbols('a b c d e f', above_fermi=True, cls=Dummy)
1183
+ p1, p2, p3, p4 = symbols('p1 p2 p3 p4', above_fermi=True, cls=Dummy)
1184
+ h1, h2, h3, h4 = symbols('h1 h2 h3 h4', below_fermi=True, cls=Dummy)
1185
+
1186
+ from sympy.utilities.iterables import variations
1187
+
1188
+ # atv(abcd)att(abij)att(cdij)
1189
+ template = atv(p1, p2, p3, p4)*att(p1, p2, i, j)*att(p3, p4, i, j)
1190
+ permutator = variations([a, b, c, d], 4)
1191
+ base = template.subs(zip([p1, p2, p3, p4], next(permutator)))
1192
+ for permut in permutator:
1193
+ subslist = zip([p1, p2, p3, p4], permut)
1194
+ expr = template.subs(subslist)
1195
+ assert substitute_dummies(expr) == substitute_dummies(base)
1196
+ template = atv(p1, p2, p3, p4)*att(p1, p2, j, i)*att(p3, p4, i, j)
1197
+ permutator = variations([a, b, c, d], 4)
1198
+ base = template.subs(zip([p1, p2, p3, p4], next(permutator)))
1199
+ for permut in permutator:
1200
+ subslist = zip([p1, p2, p3, p4], permut)
1201
+ expr = template.subs(subslist)
1202
+ assert substitute_dummies(expr) == substitute_dummies(base)
1203
+
1204
+
1205
+ def test_equivalent_internal_lines_VT2_AT():
1206
+ i, j, k, l = symbols('i j k l', below_fermi=True, cls=Dummy)
1207
+ a, b, c, d = symbols('a b c d', above_fermi=True, cls=Dummy)
1208
+
1209
+ exprs = [
1210
+ # permute v. Same dummy order, not equivalent.
1211
+ atv(i, j, a, b)*att(a, b, i, j),
1212
+ atv(j, i, a, b)*att(a, b, i, j),
1213
+ atv(i, j, b, a)*att(a, b, i, j),
1214
+ ]
1215
+ for permut in exprs[1:]:
1216
+ assert substitute_dummies(exprs[0]) != substitute_dummies(permut)
1217
+
1218
+ exprs = [
1219
+ # permute t.
1220
+ atv(i, j, a, b)*att(a, b, i, j),
1221
+ atv(i, j, a, b)*att(b, a, i, j),
1222
+ atv(i, j, a, b)*att(a, b, j, i),
1223
+ ]
1224
+ for permut in exprs[1:]:
1225
+ assert substitute_dummies(exprs[0]) != substitute_dummies(permut)
1226
+
1227
+ exprs = [ # permute v and t. Relabelling of dummies should be equivalent.
1228
+ atv(i, j, a, b)*att(a, b, i, j),
1229
+ atv(j, i, a, b)*att(a, b, j, i),
1230
+ atv(i, j, b, a)*att(b, a, i, j),
1231
+ atv(j, i, b, a)*att(b, a, j, i),
1232
+ ]
1233
+ for permut in exprs[1:]:
1234
+ assert substitute_dummies(exprs[0]) == substitute_dummies(permut)
1235
+
1236
+
1237
+ def test_internal_external_VT2T2_AT():
1238
+ ii, jj = symbols('i j', below_fermi=True)
1239
+ aa, bb = symbols('a b', above_fermi=True)
1240
+ k, l = symbols('k l', below_fermi=True, cls=Dummy)
1241
+ c, d = symbols('c d', above_fermi=True, cls=Dummy)
1242
+
1243
+ exprs = [
1244
+ atv(k, l, c, d)*att(aa, c, ii, k)*att(bb, d, jj, l),
1245
+ atv(l, k, c, d)*att(aa, c, ii, l)*att(bb, d, jj, k),
1246
+ atv(k, l, d, c)*att(aa, d, ii, k)*att(bb, c, jj, l),
1247
+ atv(l, k, d, c)*att(aa, d, ii, l)*att(bb, c, jj, k),
1248
+ ]
1249
+ for permut in exprs[1:]:
1250
+ assert substitute_dummies(exprs[0]) == substitute_dummies(permut)
1251
+ exprs = [
1252
+ atv(k, l, c, d)*att(aa, c, ii, k)*att(d, bb, jj, l),
1253
+ atv(l, k, c, d)*att(aa, c, ii, l)*att(d, bb, jj, k),
1254
+ atv(k, l, d, c)*att(aa, d, ii, k)*att(c, bb, jj, l),
1255
+ atv(l, k, d, c)*att(aa, d, ii, l)*att(c, bb, jj, k),
1256
+ ]
1257
+ for permut in exprs[1:]:
1258
+ assert substitute_dummies(exprs[0]) == substitute_dummies(permut)
1259
+ exprs = [
1260
+ atv(k, l, c, d)*att(c, aa, ii, k)*att(bb, d, jj, l),
1261
+ atv(l, k, c, d)*att(c, aa, ii, l)*att(bb, d, jj, k),
1262
+ atv(k, l, d, c)*att(d, aa, ii, k)*att(bb, c, jj, l),
1263
+ atv(l, k, d, c)*att(d, aa, ii, l)*att(bb, c, jj, k),
1264
+ ]
1265
+ for permut in exprs[1:]:
1266
+ assert substitute_dummies(exprs[0]) == substitute_dummies(permut)
1267
+
1268
+
1269
+ def test_internal_external_pqrs_AT():
1270
+ ii, jj = symbols('i j')
1271
+ aa, bb = symbols('a b')
1272
+ k, l = symbols('k l', cls=Dummy)
1273
+ c, d = symbols('c d', cls=Dummy)
1274
+
1275
+ exprs = [
1276
+ atv(k, l, c, d)*att(aa, c, ii, k)*att(bb, d, jj, l),
1277
+ atv(l, k, c, d)*att(aa, c, ii, l)*att(bb, d, jj, k),
1278
+ atv(k, l, d, c)*att(aa, d, ii, k)*att(bb, c, jj, l),
1279
+ atv(l, k, d, c)*att(aa, d, ii, l)*att(bb, c, jj, k),
1280
+ ]
1281
+ for permut in exprs[1:]:
1282
+ assert substitute_dummies(exprs[0]) == substitute_dummies(permut)
1283
+
1284
+
1285
+ def test_issue_19661():
1286
+ a = Symbol('0')
1287
+ assert latex(Commutator(Bd(a)**2, B(a))
1288
+ ) == '- \\left[b_{0},{b^\\dagger_{0}}^{2}\\right]'
1289
+
1290
+
1291
+ def test_canonical_ordering_AntiSymmetricTensor():
1292
+ v = symbols("v")
1293
+
1294
+ c, d = symbols(('c','d'), above_fermi=True,
1295
+ cls=Dummy)
1296
+ k, l = symbols(('k','l'), below_fermi=True,
1297
+ cls=Dummy)
1298
+
1299
+ # formerly, the left gave either the left or the right
1300
+ assert AntiSymmetricTensor(v, (k, l), (d, c)
1301
+ ) == -AntiSymmetricTensor(v, (l, k), (d, c))
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/tests/test_sho.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.core import symbols, Rational, Function, diff
2
+ from sympy.physics.sho import R_nl, E_nl
3
+ from sympy.simplify.simplify import simplify
4
+
5
+
6
+ def test_sho_R_nl():
7
+ omega, r = symbols('omega r')
8
+ l = symbols('l', integer=True)
9
+ u = Function('u')
10
+
11
+ # check that it obeys the Schrodinger equation
12
+ for n in range(5):
13
+ schreq = ( -diff(u(r), r, 2)/2 + ((l*(l + 1))/(2*r**2)
14
+ + omega**2*r**2/2 - E_nl(n, l, omega))*u(r) )
15
+ result = schreq.subs(u(r), r*R_nl(n, l, omega/2, r))
16
+ assert simplify(result.doit()) == 0
17
+
18
+
19
+ def test_energy():
20
+ n, l, hw = symbols('n l hw')
21
+ assert simplify(E_nl(n, l, hw) - (2*n + l + Rational(3, 2))*hw) == 0
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/__init__.py ADDED
@@ -0,0 +1,453 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # isort:skip_file
2
+ """
3
+ Dimensional analysis and unit systems.
4
+
5
+ This module defines dimension/unit systems and physical quantities. It is
6
+ based on a group-theoretical construction where dimensions are represented as
7
+ vectors (coefficients being the exponents), and units are defined as a dimension
8
+ to which we added a scale.
9
+
10
+ Quantities are built from a factor and a unit, and are the basic objects that
11
+ one will use when doing computations.
12
+
13
+ All objects except systems and prefixes can be used in SymPy expressions.
14
+ Note that as part of a CAS, various objects do not combine automatically
15
+ under operations.
16
+
17
+ Details about the implementation can be found in the documentation, and we
18
+ will not repeat all the explanations we gave there concerning our approach.
19
+ Ideas about future developments can be found on the `Github wiki
20
+ <https://github.com/sympy/sympy/wiki/Unit-systems>`_, and you should consult
21
+ this page if you are willing to help.
22
+
23
+ Useful functions:
24
+
25
+ - ``find_unit``: easily lookup pre-defined units.
26
+ - ``convert_to(expr, newunit)``: converts an expression into the same
27
+ expression expressed in another unit.
28
+
29
+ """
30
+
31
+ from .dimensions import Dimension, DimensionSystem
32
+ from .unitsystem import UnitSystem
33
+ from .util import convert_to
34
+ from .quantities import Quantity
35
+
36
+ from .definitions.dimension_definitions import (
37
+ amount_of_substance, acceleration, action, area,
38
+ capacitance, charge, conductance, current, energy,
39
+ force, frequency, impedance, inductance, length,
40
+ luminous_intensity, magnetic_density,
41
+ magnetic_flux, mass, momentum, power, pressure, temperature, time,
42
+ velocity, voltage, volume
43
+ )
44
+
45
+ Unit = Quantity
46
+
47
+ speed = velocity
48
+ luminosity = luminous_intensity
49
+ magnetic_flux_density = magnetic_density
50
+ amount = amount_of_substance
51
+
52
+ from .prefixes import (
53
+ # 10-power based:
54
+ yotta,
55
+ zetta,
56
+ exa,
57
+ peta,
58
+ tera,
59
+ giga,
60
+ mega,
61
+ kilo,
62
+ hecto,
63
+ deca,
64
+ deci,
65
+ centi,
66
+ milli,
67
+ micro,
68
+ nano,
69
+ pico,
70
+ femto,
71
+ atto,
72
+ zepto,
73
+ yocto,
74
+ # 2-power based:
75
+ kibi,
76
+ mebi,
77
+ gibi,
78
+ tebi,
79
+ pebi,
80
+ exbi,
81
+ )
82
+
83
+ from .definitions import (
84
+ percent, percents,
85
+ permille,
86
+ rad, radian, radians,
87
+ deg, degree, degrees,
88
+ sr, steradian, steradians,
89
+ mil, angular_mil, angular_mils,
90
+ m, meter, meters,
91
+ kg, kilogram, kilograms,
92
+ s, second, seconds,
93
+ A, ampere, amperes,
94
+ K, kelvin, kelvins,
95
+ mol, mole, moles,
96
+ cd, candela, candelas,
97
+ g, gram, grams,
98
+ mg, milligram, milligrams,
99
+ ug, microgram, micrograms,
100
+ t, tonne, metric_ton,
101
+ newton, newtons, N,
102
+ joule, joules, J,
103
+ watt, watts, W,
104
+ pascal, pascals, Pa, pa,
105
+ hertz, hz, Hz,
106
+ coulomb, coulombs, C,
107
+ volt, volts, v, V,
108
+ ohm, ohms,
109
+ siemens, S, mho, mhos,
110
+ farad, farads, F,
111
+ henry, henrys, H,
112
+ tesla, teslas, T,
113
+ weber, webers, Wb, wb,
114
+ optical_power, dioptre, D,
115
+ lux, lx,
116
+ katal, kat,
117
+ gray, Gy,
118
+ becquerel, Bq,
119
+ km, kilometer, kilometers,
120
+ dm, decimeter, decimeters,
121
+ cm, centimeter, centimeters,
122
+ mm, millimeter, millimeters,
123
+ um, micrometer, micrometers, micron, microns,
124
+ nm, nanometer, nanometers,
125
+ pm, picometer, picometers,
126
+ ft, foot, feet,
127
+ inch, inches,
128
+ yd, yard, yards,
129
+ mi, mile, miles,
130
+ nmi, nautical_mile, nautical_miles,
131
+ angstrom, angstroms,
132
+ ha, hectare,
133
+ l, L, liter, liters,
134
+ dl, dL, deciliter, deciliters,
135
+ cl, cL, centiliter, centiliters,
136
+ ml, mL, milliliter, milliliters,
137
+ ms, millisecond, milliseconds,
138
+ us, microsecond, microseconds,
139
+ ns, nanosecond, nanoseconds,
140
+ ps, picosecond, picoseconds,
141
+ minute, minutes,
142
+ h, hour, hours,
143
+ day, days,
144
+ anomalistic_year, anomalistic_years,
145
+ sidereal_year, sidereal_years,
146
+ tropical_year, tropical_years,
147
+ common_year, common_years,
148
+ julian_year, julian_years,
149
+ draconic_year, draconic_years,
150
+ gaussian_year, gaussian_years,
151
+ full_moon_cycle, full_moon_cycles,
152
+ year, years,
153
+ G, gravitational_constant,
154
+ c, speed_of_light,
155
+ elementary_charge,
156
+ hbar,
157
+ planck,
158
+ eV, electronvolt, electronvolts,
159
+ avogadro_number,
160
+ avogadro, avogadro_constant,
161
+ boltzmann, boltzmann_constant,
162
+ stefan, stefan_boltzmann_constant,
163
+ R, molar_gas_constant,
164
+ faraday_constant,
165
+ josephson_constant,
166
+ von_klitzing_constant,
167
+ Da, dalton, amu, amus, atomic_mass_unit, atomic_mass_constant,
168
+ me, electron_rest_mass,
169
+ gee, gees, acceleration_due_to_gravity,
170
+ u0, magnetic_constant, vacuum_permeability,
171
+ e0, electric_constant, vacuum_permittivity,
172
+ Z0, vacuum_impedance,
173
+ coulomb_constant, electric_force_constant,
174
+ atmosphere, atmospheres, atm,
175
+ kPa,
176
+ bar, bars,
177
+ pound, pounds,
178
+ psi,
179
+ dHg0,
180
+ mmHg, torr,
181
+ mmu, mmus, milli_mass_unit,
182
+ quart, quarts,
183
+ ly, lightyear, lightyears,
184
+ au, astronomical_unit, astronomical_units,
185
+ planck_mass,
186
+ planck_time,
187
+ planck_temperature,
188
+ planck_length,
189
+ planck_charge,
190
+ planck_area,
191
+ planck_volume,
192
+ planck_momentum,
193
+ planck_energy,
194
+ planck_force,
195
+ planck_power,
196
+ planck_density,
197
+ planck_energy_density,
198
+ planck_intensity,
199
+ planck_angular_frequency,
200
+ planck_pressure,
201
+ planck_current,
202
+ planck_voltage,
203
+ planck_impedance,
204
+ planck_acceleration,
205
+ bit, bits,
206
+ byte,
207
+ kibibyte, kibibytes,
208
+ mebibyte, mebibytes,
209
+ gibibyte, gibibytes,
210
+ tebibyte, tebibytes,
211
+ pebibyte, pebibytes,
212
+ exbibyte, exbibytes,
213
+ )
214
+
215
+ from .systems import (
216
+ mks, mksa, si
217
+ )
218
+
219
+
220
+ def find_unit(quantity, unit_system="SI"):
221
+ """
222
+ Return a list of matching units or dimension names.
223
+
224
+ - If ``quantity`` is a string -- units/dimensions containing the string
225
+ `quantity`.
226
+ - If ``quantity`` is a unit or dimension -- units having matching base
227
+ units or dimensions.
228
+
229
+ Examples
230
+ ========
231
+
232
+ >>> from sympy.physics import units as u
233
+ >>> u.find_unit('charge')
234
+ ['C', 'coulomb', 'coulombs', 'planck_charge', 'elementary_charge']
235
+ >>> u.find_unit(u.charge)
236
+ ['C', 'coulomb', 'coulombs', 'planck_charge', 'elementary_charge']
237
+ >>> u.find_unit("ampere")
238
+ ['ampere', 'amperes']
239
+ >>> u.find_unit('angstrom')
240
+ ['angstrom', 'angstroms']
241
+ >>> u.find_unit('volt')
242
+ ['volt', 'volts', 'electronvolt', 'electronvolts', 'planck_voltage']
243
+ >>> u.find_unit(u.inch**3)[:9]
244
+ ['L', 'l', 'cL', 'cl', 'dL', 'dl', 'mL', 'ml', 'liter']
245
+ """
246
+ unit_system = UnitSystem.get_unit_system(unit_system)
247
+
248
+ import sympy.physics.units as u
249
+ rv = []
250
+ if isinstance(quantity, str):
251
+ rv = [i for i in dir(u) if quantity in i and isinstance(getattr(u, i), Quantity)]
252
+ dim = getattr(u, quantity)
253
+ if isinstance(dim, Dimension):
254
+ rv.extend(find_unit(dim))
255
+ else:
256
+ for i in sorted(dir(u)):
257
+ other = getattr(u, i)
258
+ if not isinstance(other, Quantity):
259
+ continue
260
+ if isinstance(quantity, Quantity):
261
+ if quantity.dimension == other.dimension:
262
+ rv.append(str(i))
263
+ elif isinstance(quantity, Dimension):
264
+ if other.dimension == quantity:
265
+ rv.append(str(i))
266
+ elif other.dimension == Dimension(unit_system.get_dimensional_expr(quantity)):
267
+ rv.append(str(i))
268
+ return sorted(set(rv), key=lambda x: (len(x), x))
269
+
270
+ # NOTE: the old units module had additional variables:
271
+ # 'density', 'illuminance', 'resistance'.
272
+ # They were not dimensions, but units (old Unit class).
273
+
274
+ __all__ = [
275
+ 'Dimension', 'DimensionSystem',
276
+ 'UnitSystem',
277
+ 'convert_to',
278
+ 'Quantity',
279
+
280
+ 'amount_of_substance', 'acceleration', 'action', 'area',
281
+ 'capacitance', 'charge', 'conductance', 'current', 'energy',
282
+ 'force', 'frequency', 'impedance', 'inductance', 'length',
283
+ 'luminous_intensity', 'magnetic_density',
284
+ 'magnetic_flux', 'mass', 'momentum', 'power', 'pressure', 'temperature', 'time',
285
+ 'velocity', 'voltage', 'volume',
286
+
287
+ 'Unit',
288
+
289
+ 'speed',
290
+ 'luminosity',
291
+ 'magnetic_flux_density',
292
+ 'amount',
293
+
294
+ 'yotta',
295
+ 'zetta',
296
+ 'exa',
297
+ 'peta',
298
+ 'tera',
299
+ 'giga',
300
+ 'mega',
301
+ 'kilo',
302
+ 'hecto',
303
+ 'deca',
304
+ 'deci',
305
+ 'centi',
306
+ 'milli',
307
+ 'micro',
308
+ 'nano',
309
+ 'pico',
310
+ 'femto',
311
+ 'atto',
312
+ 'zepto',
313
+ 'yocto',
314
+
315
+ 'kibi',
316
+ 'mebi',
317
+ 'gibi',
318
+ 'tebi',
319
+ 'pebi',
320
+ 'exbi',
321
+
322
+ 'percent', 'percents',
323
+ 'permille',
324
+ 'rad', 'radian', 'radians',
325
+ 'deg', 'degree', 'degrees',
326
+ 'sr', 'steradian', 'steradians',
327
+ 'mil', 'angular_mil', 'angular_mils',
328
+ 'm', 'meter', 'meters',
329
+ 'kg', 'kilogram', 'kilograms',
330
+ 's', 'second', 'seconds',
331
+ 'A', 'ampere', 'amperes',
332
+ 'K', 'kelvin', 'kelvins',
333
+ 'mol', 'mole', 'moles',
334
+ 'cd', 'candela', 'candelas',
335
+ 'g', 'gram', 'grams',
336
+ 'mg', 'milligram', 'milligrams',
337
+ 'ug', 'microgram', 'micrograms',
338
+ 't', 'tonne', 'metric_ton',
339
+ 'newton', 'newtons', 'N',
340
+ 'joule', 'joules', 'J',
341
+ 'watt', 'watts', 'W',
342
+ 'pascal', 'pascals', 'Pa', 'pa',
343
+ 'hertz', 'hz', 'Hz',
344
+ 'coulomb', 'coulombs', 'C',
345
+ 'volt', 'volts', 'v', 'V',
346
+ 'ohm', 'ohms',
347
+ 'siemens', 'S', 'mho', 'mhos',
348
+ 'farad', 'farads', 'F',
349
+ 'henry', 'henrys', 'H',
350
+ 'tesla', 'teslas', 'T',
351
+ 'weber', 'webers', 'Wb', 'wb',
352
+ 'optical_power', 'dioptre', 'D',
353
+ 'lux', 'lx',
354
+ 'katal', 'kat',
355
+ 'gray', 'Gy',
356
+ 'becquerel', 'Bq',
357
+ 'km', 'kilometer', 'kilometers',
358
+ 'dm', 'decimeter', 'decimeters',
359
+ 'cm', 'centimeter', 'centimeters',
360
+ 'mm', 'millimeter', 'millimeters',
361
+ 'um', 'micrometer', 'micrometers', 'micron', 'microns',
362
+ 'nm', 'nanometer', 'nanometers',
363
+ 'pm', 'picometer', 'picometers',
364
+ 'ft', 'foot', 'feet',
365
+ 'inch', 'inches',
366
+ 'yd', 'yard', 'yards',
367
+ 'mi', 'mile', 'miles',
368
+ 'nmi', 'nautical_mile', 'nautical_miles',
369
+ 'angstrom', 'angstroms',
370
+ 'ha', 'hectare',
371
+ 'l', 'L', 'liter', 'liters',
372
+ 'dl', 'dL', 'deciliter', 'deciliters',
373
+ 'cl', 'cL', 'centiliter', 'centiliters',
374
+ 'ml', 'mL', 'milliliter', 'milliliters',
375
+ 'ms', 'millisecond', 'milliseconds',
376
+ 'us', 'microsecond', 'microseconds',
377
+ 'ns', 'nanosecond', 'nanoseconds',
378
+ 'ps', 'picosecond', 'picoseconds',
379
+ 'minute', 'minutes',
380
+ 'h', 'hour', 'hours',
381
+ 'day', 'days',
382
+ 'anomalistic_year', 'anomalistic_years',
383
+ 'sidereal_year', 'sidereal_years',
384
+ 'tropical_year', 'tropical_years',
385
+ 'common_year', 'common_years',
386
+ 'julian_year', 'julian_years',
387
+ 'draconic_year', 'draconic_years',
388
+ 'gaussian_year', 'gaussian_years',
389
+ 'full_moon_cycle', 'full_moon_cycles',
390
+ 'year', 'years',
391
+ 'G', 'gravitational_constant',
392
+ 'c', 'speed_of_light',
393
+ 'elementary_charge',
394
+ 'hbar',
395
+ 'planck',
396
+ 'eV', 'electronvolt', 'electronvolts',
397
+ 'avogadro_number',
398
+ 'avogadro', 'avogadro_constant',
399
+ 'boltzmann', 'boltzmann_constant',
400
+ 'stefan', 'stefan_boltzmann_constant',
401
+ 'R', 'molar_gas_constant',
402
+ 'faraday_constant',
403
+ 'josephson_constant',
404
+ 'von_klitzing_constant',
405
+ 'Da', 'dalton', 'amu', 'amus', 'atomic_mass_unit', 'atomic_mass_constant',
406
+ 'me', 'electron_rest_mass',
407
+ 'gee', 'gees', 'acceleration_due_to_gravity',
408
+ 'u0', 'magnetic_constant', 'vacuum_permeability',
409
+ 'e0', 'electric_constant', 'vacuum_permittivity',
410
+ 'Z0', 'vacuum_impedance',
411
+ 'coulomb_constant', 'electric_force_constant',
412
+ 'atmosphere', 'atmospheres', 'atm',
413
+ 'kPa',
414
+ 'bar', 'bars',
415
+ 'pound', 'pounds',
416
+ 'psi',
417
+ 'dHg0',
418
+ 'mmHg', 'torr',
419
+ 'mmu', 'mmus', 'milli_mass_unit',
420
+ 'quart', 'quarts',
421
+ 'ly', 'lightyear', 'lightyears',
422
+ 'au', 'astronomical_unit', 'astronomical_units',
423
+ 'planck_mass',
424
+ 'planck_time',
425
+ 'planck_temperature',
426
+ 'planck_length',
427
+ 'planck_charge',
428
+ 'planck_area',
429
+ 'planck_volume',
430
+ 'planck_momentum',
431
+ 'planck_energy',
432
+ 'planck_force',
433
+ 'planck_power',
434
+ 'planck_density',
435
+ 'planck_energy_density',
436
+ 'planck_intensity',
437
+ 'planck_angular_frequency',
438
+ 'planck_pressure',
439
+ 'planck_current',
440
+ 'planck_voltage',
441
+ 'planck_impedance',
442
+ 'planck_acceleration',
443
+ 'bit', 'bits',
444
+ 'byte',
445
+ 'kibibyte', 'kibibytes',
446
+ 'mebibyte', 'mebibytes',
447
+ 'gibibyte', 'gibibytes',
448
+ 'tebibyte', 'tebibytes',
449
+ 'pebibyte', 'pebibytes',
450
+ 'exbibyte', 'exbibytes',
451
+
452
+ 'mks', 'mksa', 'si',
453
+ ]
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/definitions/__init__.py ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from .unit_definitions import (
2
+ percent, percents,
3
+ permille,
4
+ rad, radian, radians,
5
+ deg, degree, degrees,
6
+ sr, steradian, steradians,
7
+ mil, angular_mil, angular_mils,
8
+ m, meter, meters,
9
+ kg, kilogram, kilograms,
10
+ s, second, seconds,
11
+ A, ampere, amperes,
12
+ K, kelvin, kelvins,
13
+ mol, mole, moles,
14
+ cd, candela, candelas,
15
+ g, gram, grams,
16
+ mg, milligram, milligrams,
17
+ ug, microgram, micrograms,
18
+ t, tonne, metric_ton,
19
+ newton, newtons, N,
20
+ joule, joules, J,
21
+ watt, watts, W,
22
+ pascal, pascals, Pa, pa,
23
+ hertz, hz, Hz,
24
+ coulomb, coulombs, C,
25
+ volt, volts, v, V,
26
+ ohm, ohms,
27
+ siemens, S, mho, mhos,
28
+ farad, farads, F,
29
+ henry, henrys, H,
30
+ tesla, teslas, T,
31
+ weber, webers, Wb, wb,
32
+ optical_power, dioptre, D,
33
+ lux, lx,
34
+ katal, kat,
35
+ gray, Gy,
36
+ becquerel, Bq,
37
+ km, kilometer, kilometers,
38
+ dm, decimeter, decimeters,
39
+ cm, centimeter, centimeters,
40
+ mm, millimeter, millimeters,
41
+ um, micrometer, micrometers, micron, microns,
42
+ nm, nanometer, nanometers,
43
+ pm, picometer, picometers,
44
+ ft, foot, feet,
45
+ inch, inches,
46
+ yd, yard, yards,
47
+ mi, mile, miles,
48
+ nmi, nautical_mile, nautical_miles,
49
+ ha, hectare,
50
+ l, L, liter, liters,
51
+ dl, dL, deciliter, deciliters,
52
+ cl, cL, centiliter, centiliters,
53
+ ml, mL, milliliter, milliliters,
54
+ ms, millisecond, milliseconds,
55
+ us, microsecond, microseconds,
56
+ ns, nanosecond, nanoseconds,
57
+ ps, picosecond, picoseconds,
58
+ minute, minutes,
59
+ h, hour, hours,
60
+ day, days,
61
+ anomalistic_year, anomalistic_years,
62
+ sidereal_year, sidereal_years,
63
+ tropical_year, tropical_years,
64
+ common_year, common_years,
65
+ julian_year, julian_years,
66
+ draconic_year, draconic_years,
67
+ gaussian_year, gaussian_years,
68
+ full_moon_cycle, full_moon_cycles,
69
+ year, years,
70
+ G, gravitational_constant,
71
+ c, speed_of_light,
72
+ elementary_charge,
73
+ hbar,
74
+ planck,
75
+ eV, electronvolt, electronvolts,
76
+ avogadro_number,
77
+ avogadro, avogadro_constant,
78
+ boltzmann, boltzmann_constant,
79
+ stefan, stefan_boltzmann_constant,
80
+ R, molar_gas_constant,
81
+ faraday_constant,
82
+ josephson_constant,
83
+ von_klitzing_constant,
84
+ Da, dalton, amu, amus, atomic_mass_unit, atomic_mass_constant,
85
+ me, electron_rest_mass,
86
+ gee, gees, acceleration_due_to_gravity,
87
+ u0, magnetic_constant, vacuum_permeability,
88
+ e0, electric_constant, vacuum_permittivity,
89
+ Z0, vacuum_impedance,
90
+ coulomb_constant, coulombs_constant, electric_force_constant,
91
+ atmosphere, atmospheres, atm,
92
+ kPa, kilopascal,
93
+ bar, bars,
94
+ pound, pounds,
95
+ psi,
96
+ dHg0,
97
+ mmHg, torr,
98
+ mmu, mmus, milli_mass_unit,
99
+ quart, quarts,
100
+ angstrom, angstroms,
101
+ ly, lightyear, lightyears,
102
+ au, astronomical_unit, astronomical_units,
103
+ planck_mass,
104
+ planck_time,
105
+ planck_temperature,
106
+ planck_length,
107
+ planck_charge,
108
+ planck_area,
109
+ planck_volume,
110
+ planck_momentum,
111
+ planck_energy,
112
+ planck_force,
113
+ planck_power,
114
+ planck_density,
115
+ planck_energy_density,
116
+ planck_intensity,
117
+ planck_angular_frequency,
118
+ planck_pressure,
119
+ planck_current,
120
+ planck_voltage,
121
+ planck_impedance,
122
+ planck_acceleration,
123
+ bit, bits,
124
+ byte,
125
+ kibibyte, kibibytes,
126
+ mebibyte, mebibytes,
127
+ gibibyte, gibibytes,
128
+ tebibyte, tebibytes,
129
+ pebibyte, pebibytes,
130
+ exbibyte, exbibytes,
131
+ curie, rutherford
132
+ )
133
+
134
+ __all__ = [
135
+ 'percent', 'percents',
136
+ 'permille',
137
+ 'rad', 'radian', 'radians',
138
+ 'deg', 'degree', 'degrees',
139
+ 'sr', 'steradian', 'steradians',
140
+ 'mil', 'angular_mil', 'angular_mils',
141
+ 'm', 'meter', 'meters',
142
+ 'kg', 'kilogram', 'kilograms',
143
+ 's', 'second', 'seconds',
144
+ 'A', 'ampere', 'amperes',
145
+ 'K', 'kelvin', 'kelvins',
146
+ 'mol', 'mole', 'moles',
147
+ 'cd', 'candela', 'candelas',
148
+ 'g', 'gram', 'grams',
149
+ 'mg', 'milligram', 'milligrams',
150
+ 'ug', 'microgram', 'micrograms',
151
+ 't', 'tonne', 'metric_ton',
152
+ 'newton', 'newtons', 'N',
153
+ 'joule', 'joules', 'J',
154
+ 'watt', 'watts', 'W',
155
+ 'pascal', 'pascals', 'Pa', 'pa',
156
+ 'hertz', 'hz', 'Hz',
157
+ 'coulomb', 'coulombs', 'C',
158
+ 'volt', 'volts', 'v', 'V',
159
+ 'ohm', 'ohms',
160
+ 'siemens', 'S', 'mho', 'mhos',
161
+ 'farad', 'farads', 'F',
162
+ 'henry', 'henrys', 'H',
163
+ 'tesla', 'teslas', 'T',
164
+ 'weber', 'webers', 'Wb', 'wb',
165
+ 'optical_power', 'dioptre', 'D',
166
+ 'lux', 'lx',
167
+ 'katal', 'kat',
168
+ 'gray', 'Gy',
169
+ 'becquerel', 'Bq',
170
+ 'km', 'kilometer', 'kilometers',
171
+ 'dm', 'decimeter', 'decimeters',
172
+ 'cm', 'centimeter', 'centimeters',
173
+ 'mm', 'millimeter', 'millimeters',
174
+ 'um', 'micrometer', 'micrometers', 'micron', 'microns',
175
+ 'nm', 'nanometer', 'nanometers',
176
+ 'pm', 'picometer', 'picometers',
177
+ 'ft', 'foot', 'feet',
178
+ 'inch', 'inches',
179
+ 'yd', 'yard', 'yards',
180
+ 'mi', 'mile', 'miles',
181
+ 'nmi', 'nautical_mile', 'nautical_miles',
182
+ 'ha', 'hectare',
183
+ 'l', 'L', 'liter', 'liters',
184
+ 'dl', 'dL', 'deciliter', 'deciliters',
185
+ 'cl', 'cL', 'centiliter', 'centiliters',
186
+ 'ml', 'mL', 'milliliter', 'milliliters',
187
+ 'ms', 'millisecond', 'milliseconds',
188
+ 'us', 'microsecond', 'microseconds',
189
+ 'ns', 'nanosecond', 'nanoseconds',
190
+ 'ps', 'picosecond', 'picoseconds',
191
+ 'minute', 'minutes',
192
+ 'h', 'hour', 'hours',
193
+ 'day', 'days',
194
+ 'anomalistic_year', 'anomalistic_years',
195
+ 'sidereal_year', 'sidereal_years',
196
+ 'tropical_year', 'tropical_years',
197
+ 'common_year', 'common_years',
198
+ 'julian_year', 'julian_years',
199
+ 'draconic_year', 'draconic_years',
200
+ 'gaussian_year', 'gaussian_years',
201
+ 'full_moon_cycle', 'full_moon_cycles',
202
+ 'year', 'years',
203
+ 'G', 'gravitational_constant',
204
+ 'c', 'speed_of_light',
205
+ 'elementary_charge',
206
+ 'hbar',
207
+ 'planck',
208
+ 'eV', 'electronvolt', 'electronvolts',
209
+ 'avogadro_number',
210
+ 'avogadro', 'avogadro_constant',
211
+ 'boltzmann', 'boltzmann_constant',
212
+ 'stefan', 'stefan_boltzmann_constant',
213
+ 'R', 'molar_gas_constant',
214
+ 'faraday_constant',
215
+ 'josephson_constant',
216
+ 'von_klitzing_constant',
217
+ 'Da', 'dalton', 'amu', 'amus', 'atomic_mass_unit', 'atomic_mass_constant',
218
+ 'me', 'electron_rest_mass',
219
+ 'gee', 'gees', 'acceleration_due_to_gravity',
220
+ 'u0', 'magnetic_constant', 'vacuum_permeability',
221
+ 'e0', 'electric_constant', 'vacuum_permittivity',
222
+ 'Z0', 'vacuum_impedance',
223
+ 'coulomb_constant', 'coulombs_constant', 'electric_force_constant',
224
+ 'atmosphere', 'atmospheres', 'atm',
225
+ 'kPa', 'kilopascal',
226
+ 'bar', 'bars',
227
+ 'pound', 'pounds',
228
+ 'psi',
229
+ 'dHg0',
230
+ 'mmHg', 'torr',
231
+ 'mmu', 'mmus', 'milli_mass_unit',
232
+ 'quart', 'quarts',
233
+ 'angstrom', 'angstroms',
234
+ 'ly', 'lightyear', 'lightyears',
235
+ 'au', 'astronomical_unit', 'astronomical_units',
236
+ 'planck_mass',
237
+ 'planck_time',
238
+ 'planck_temperature',
239
+ 'planck_length',
240
+ 'planck_charge',
241
+ 'planck_area',
242
+ 'planck_volume',
243
+ 'planck_momentum',
244
+ 'planck_energy',
245
+ 'planck_force',
246
+ 'planck_power',
247
+ 'planck_density',
248
+ 'planck_energy_density',
249
+ 'planck_intensity',
250
+ 'planck_angular_frequency',
251
+ 'planck_pressure',
252
+ 'planck_current',
253
+ 'planck_voltage',
254
+ 'planck_impedance',
255
+ 'planck_acceleration',
256
+ 'bit', 'bits',
257
+ 'byte',
258
+ 'kibibyte', 'kibibytes',
259
+ 'mebibyte', 'mebibytes',
260
+ 'gibibyte', 'gibibytes',
261
+ 'tebibyte', 'tebibytes',
262
+ 'pebibyte', 'pebibytes',
263
+ 'exbibyte', 'exbibytes',
264
+ 'curie', 'rutherford',
265
+ ]
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/definitions/dimension_definitions.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.physics.units import Dimension
2
+
3
+
4
+ angle: Dimension = Dimension(name="angle")
5
+
6
+ # base dimensions (MKS)
7
+ length = Dimension(name="length", symbol="L")
8
+ mass = Dimension(name="mass", symbol="M")
9
+ time = Dimension(name="time", symbol="T")
10
+
11
+ # base dimensions (MKSA not in MKS)
12
+ current: Dimension = Dimension(name='current', symbol='I')
13
+
14
+ # other base dimensions:
15
+ temperature: Dimension = Dimension("temperature", "T")
16
+ amount_of_substance: Dimension = Dimension("amount_of_substance")
17
+ luminous_intensity: Dimension = Dimension("luminous_intensity")
18
+
19
+ # derived dimensions (MKS)
20
+ velocity = Dimension(name="velocity")
21
+ acceleration = Dimension(name="acceleration")
22
+ momentum = Dimension(name="momentum")
23
+ force = Dimension(name="force", symbol="F")
24
+ energy = Dimension(name="energy", symbol="E")
25
+ power = Dimension(name="power")
26
+ pressure = Dimension(name="pressure")
27
+ frequency = Dimension(name="frequency", symbol="f")
28
+ action = Dimension(name="action", symbol="A")
29
+ area = Dimension("area")
30
+ volume = Dimension("volume")
31
+
32
+ # derived dimensions (MKSA not in MKS)
33
+ voltage: Dimension = Dimension(name='voltage', symbol='U')
34
+ impedance: Dimension = Dimension(name='impedance', symbol='Z')
35
+ conductance: Dimension = Dimension(name='conductance', symbol='G')
36
+ capacitance: Dimension = Dimension(name='capacitance')
37
+ inductance: Dimension = Dimension(name='inductance')
38
+ charge: Dimension = Dimension(name='charge', symbol='Q')
39
+ magnetic_density: Dimension = Dimension(name='magnetic_density', symbol='B')
40
+ magnetic_flux: Dimension = Dimension(name='magnetic_flux')
41
+
42
+ # Dimensions in information theory:
43
+ information: Dimension = Dimension(name='information')
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/definitions/unit_definitions.py ADDED
@@ -0,0 +1,407 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.physics.units.definitions.dimension_definitions import current, temperature, amount_of_substance, \
2
+ luminous_intensity, angle, charge, voltage, impedance, conductance, capacitance, inductance, magnetic_density, \
3
+ magnetic_flux, information
4
+
5
+ from sympy.core.numbers import (Rational, pi)
6
+ from sympy.core.singleton import S as S_singleton
7
+ from sympy.physics.units.prefixes import kilo, mega, milli, micro, deci, centi, nano, pico, kibi, mebi, gibi, tebi, pebi, exbi
8
+ from sympy.physics.units.quantities import PhysicalConstant, Quantity
9
+
10
+ One = S_singleton.One
11
+
12
+ #### UNITS ####
13
+
14
+ # Dimensionless:
15
+ percent = percents = Quantity("percent", latex_repr=r"\%")
16
+ percent.set_global_relative_scale_factor(Rational(1, 100), One)
17
+
18
+ permille = Quantity("permille")
19
+ permille.set_global_relative_scale_factor(Rational(1, 1000), One)
20
+
21
+
22
+ # Angular units (dimensionless)
23
+ rad = radian = radians = Quantity("radian", abbrev="rad")
24
+ radian.set_global_dimension(angle)
25
+ deg = degree = degrees = Quantity("degree", abbrev="deg", latex_repr=r"^\circ")
26
+ degree.set_global_relative_scale_factor(pi/180, radian)
27
+ sr = steradian = steradians = Quantity("steradian", abbrev="sr")
28
+ mil = angular_mil = angular_mils = Quantity("angular_mil", abbrev="mil")
29
+
30
+ # Base units:
31
+ m = meter = meters = Quantity("meter", abbrev="m")
32
+
33
+ # gram; used to define its prefixed units
34
+ g = gram = grams = Quantity("gram", abbrev="g")
35
+
36
+ # NOTE: the `kilogram` has scale factor 1000. In SI, kg is a base unit, but
37
+ # nonetheless we are trying to be compatible with the `kilo` prefix. In a
38
+ # similar manner, people using CGS or gaussian units could argue that the
39
+ # `centimeter` rather than `meter` is the fundamental unit for length, but the
40
+ # scale factor of `centimeter` will be kept as 1/100 to be compatible with the
41
+ # `centi` prefix. The current state of the code assumes SI unit dimensions, in
42
+ # the future this module will be modified in order to be unit system-neutral
43
+ # (that is, support all kinds of unit systems).
44
+ kg = kilogram = kilograms = Quantity("kilogram", abbrev="kg")
45
+ kg.set_global_relative_scale_factor(kilo, gram)
46
+
47
+ s = second = seconds = Quantity("second", abbrev="s")
48
+ A = ampere = amperes = Quantity("ampere", abbrev='A')
49
+ ampere.set_global_dimension(current)
50
+ K = kelvin = kelvins = Quantity("kelvin", abbrev='K')
51
+ kelvin.set_global_dimension(temperature)
52
+ mol = mole = moles = Quantity("mole", abbrev="mol")
53
+ mole.set_global_dimension(amount_of_substance)
54
+ cd = candela = candelas = Quantity("candela", abbrev="cd")
55
+ candela.set_global_dimension(luminous_intensity)
56
+
57
+ # derived units
58
+ newton = newtons = N = Quantity("newton", abbrev="N")
59
+
60
+ kilonewton = kilonewtons = kN = Quantity("kilonewton", abbrev="kN")
61
+ kilonewton.set_global_relative_scale_factor(kilo, newton)
62
+
63
+ meganewton = meganewtons = MN = Quantity("meganewton", abbrev="MN")
64
+ meganewton.set_global_relative_scale_factor(mega, newton)
65
+
66
+ joule = joules = J = Quantity("joule", abbrev="J")
67
+ watt = watts = W = Quantity("watt", abbrev="W")
68
+ pascal = pascals = Pa = pa = Quantity("pascal", abbrev="Pa")
69
+ hertz = hz = Hz = Quantity("hertz", abbrev="Hz")
70
+
71
+ # CGS derived units:
72
+ dyne = Quantity("dyne")
73
+ dyne.set_global_relative_scale_factor(One/10**5, newton)
74
+ erg = Quantity("erg")
75
+ erg.set_global_relative_scale_factor(One/10**7, joule)
76
+
77
+ # MKSA extension to MKS: derived units
78
+ coulomb = coulombs = C = Quantity("coulomb", abbrev='C')
79
+ coulomb.set_global_dimension(charge)
80
+ volt = volts = v = V = Quantity("volt", abbrev='V')
81
+ volt.set_global_dimension(voltage)
82
+ ohm = ohms = Quantity("ohm", abbrev='ohm', latex_repr=r"\Omega")
83
+ ohm.set_global_dimension(impedance)
84
+ siemens = S = mho = mhos = Quantity("siemens", abbrev='S')
85
+ siemens.set_global_dimension(conductance)
86
+ farad = farads = F = Quantity("farad", abbrev='F')
87
+ farad.set_global_dimension(capacitance)
88
+ henry = henrys = H = Quantity("henry", abbrev='H')
89
+ henry.set_global_dimension(inductance)
90
+ tesla = teslas = T = Quantity("tesla", abbrev='T')
91
+ tesla.set_global_dimension(magnetic_density)
92
+ weber = webers = Wb = wb = Quantity("weber", abbrev='Wb')
93
+ weber.set_global_dimension(magnetic_flux)
94
+
95
+ # CGS units for electromagnetic quantities:
96
+ statampere = Quantity("statampere")
97
+ statcoulomb = statC = franklin = Quantity("statcoulomb", abbrev="statC")
98
+ statvolt = Quantity("statvolt")
99
+ gauss = Quantity("gauss")
100
+ maxwell = Quantity("maxwell")
101
+ debye = Quantity("debye")
102
+ oersted = Quantity("oersted")
103
+
104
+ # Other derived units:
105
+ optical_power = dioptre = diopter = D = Quantity("dioptre")
106
+ lux = lx = Quantity("lux", abbrev="lx")
107
+
108
+ # katal is the SI unit of catalytic activity
109
+ katal = kat = Quantity("katal", abbrev="kat")
110
+
111
+ # gray is the SI unit of absorbed dose
112
+ gray = Gy = Quantity("gray")
113
+
114
+ # becquerel is the SI unit of radioactivity
115
+ becquerel = Bq = Quantity("becquerel", abbrev="Bq")
116
+
117
+
118
+ # Common mass units
119
+
120
+ mg = milligram = milligrams = Quantity("milligram", abbrev="mg")
121
+ mg.set_global_relative_scale_factor(milli, gram)
122
+
123
+ ug = microgram = micrograms = Quantity("microgram", abbrev="ug", latex_repr=r"\mu\text{g}")
124
+ ug.set_global_relative_scale_factor(micro, gram)
125
+
126
+ # Atomic mass constant
127
+ Da = dalton = amu = amus = atomic_mass_unit = atomic_mass_constant = PhysicalConstant("atomic_mass_constant")
128
+
129
+ t = metric_ton = tonne = Quantity("tonne", abbrev="t")
130
+ tonne.set_global_relative_scale_factor(mega, gram)
131
+
132
+ # Electron rest mass
133
+ me = electron_rest_mass = Quantity("electron_rest_mass", abbrev="me")
134
+
135
+
136
+ # Common length units
137
+
138
+ km = kilometer = kilometers = Quantity("kilometer", abbrev="km")
139
+ km.set_global_relative_scale_factor(kilo, meter)
140
+
141
+ dm = decimeter = decimeters = Quantity("decimeter", abbrev="dm")
142
+ dm.set_global_relative_scale_factor(deci, meter)
143
+
144
+ cm = centimeter = centimeters = Quantity("centimeter", abbrev="cm")
145
+ cm.set_global_relative_scale_factor(centi, meter)
146
+
147
+ mm = millimeter = millimeters = Quantity("millimeter", abbrev="mm")
148
+ mm.set_global_relative_scale_factor(milli, meter)
149
+
150
+ um = micrometer = micrometers = micron = microns = \
151
+ Quantity("micrometer", abbrev="um", latex_repr=r'\mu\text{m}')
152
+ um.set_global_relative_scale_factor(micro, meter)
153
+
154
+ nm = nanometer = nanometers = Quantity("nanometer", abbrev="nm")
155
+ nm.set_global_relative_scale_factor(nano, meter)
156
+
157
+ pm = picometer = picometers = Quantity("picometer", abbrev="pm")
158
+ pm.set_global_relative_scale_factor(pico, meter)
159
+
160
+ ft = foot = feet = Quantity("foot", abbrev="ft")
161
+ ft.set_global_relative_scale_factor(Rational(3048, 10000), meter)
162
+
163
+ inch = inches = Quantity("inch")
164
+ inch.set_global_relative_scale_factor(Rational(1, 12), foot)
165
+
166
+ yd = yard = yards = Quantity("yard", abbrev="yd")
167
+ yd.set_global_relative_scale_factor(3, feet)
168
+
169
+ mi = mile = miles = Quantity("mile")
170
+ mi.set_global_relative_scale_factor(5280, feet)
171
+
172
+ nmi = nautical_mile = nautical_miles = Quantity("nautical_mile")
173
+ nmi.set_global_relative_scale_factor(6076, feet)
174
+
175
+ angstrom = angstroms = Quantity("angstrom", latex_repr=r'\r{A}')
176
+ angstrom.set_global_relative_scale_factor(Rational(1, 10**10), meter)
177
+
178
+
179
+ # Common volume and area units
180
+
181
+ ha = hectare = Quantity("hectare", abbrev="ha")
182
+
183
+ l = L = liter = liters = Quantity("liter", abbrev="l")
184
+
185
+ dl = dL = deciliter = deciliters = Quantity("deciliter", abbrev="dl")
186
+ dl.set_global_relative_scale_factor(Rational(1, 10), liter)
187
+
188
+ cl = cL = centiliter = centiliters = Quantity("centiliter", abbrev="cl")
189
+ cl.set_global_relative_scale_factor(Rational(1, 100), liter)
190
+
191
+ ml = mL = milliliter = milliliters = Quantity("milliliter", abbrev="ml")
192
+ ml.set_global_relative_scale_factor(Rational(1, 1000), liter)
193
+
194
+
195
+ # Common time units
196
+
197
+ ms = millisecond = milliseconds = Quantity("millisecond", abbrev="ms")
198
+ millisecond.set_global_relative_scale_factor(milli, second)
199
+
200
+ us = microsecond = microseconds = Quantity("microsecond", abbrev="us", latex_repr=r'\mu\text{s}')
201
+ microsecond.set_global_relative_scale_factor(micro, second)
202
+
203
+ ns = nanosecond = nanoseconds = Quantity("nanosecond", abbrev="ns")
204
+ nanosecond.set_global_relative_scale_factor(nano, second)
205
+
206
+ ps = picosecond = picoseconds = Quantity("picosecond", abbrev="ps")
207
+ picosecond.set_global_relative_scale_factor(pico, second)
208
+
209
+ minute = minutes = Quantity("minute")
210
+ minute.set_global_relative_scale_factor(60, second)
211
+
212
+ h = hour = hours = Quantity("hour")
213
+ hour.set_global_relative_scale_factor(60, minute)
214
+
215
+ day = days = Quantity("day")
216
+ day.set_global_relative_scale_factor(24, hour)
217
+
218
+ anomalistic_year = anomalistic_years = Quantity("anomalistic_year")
219
+ anomalistic_year.set_global_relative_scale_factor(365.259636, day)
220
+
221
+ sidereal_year = sidereal_years = Quantity("sidereal_year")
222
+ sidereal_year.set_global_relative_scale_factor(31558149.540, seconds)
223
+
224
+ tropical_year = tropical_years = Quantity("tropical_year")
225
+ tropical_year.set_global_relative_scale_factor(365.24219, day)
226
+
227
+ common_year = common_years = Quantity("common_year")
228
+ common_year.set_global_relative_scale_factor(365, day)
229
+
230
+ julian_year = julian_years = Quantity("julian_year")
231
+ julian_year.set_global_relative_scale_factor((365 + One/4), day)
232
+
233
+ draconic_year = draconic_years = Quantity("draconic_year")
234
+ draconic_year.set_global_relative_scale_factor(346.62, day)
235
+
236
+ gaussian_year = gaussian_years = Quantity("gaussian_year")
237
+ gaussian_year.set_global_relative_scale_factor(365.2568983, day)
238
+
239
+ full_moon_cycle = full_moon_cycles = Quantity("full_moon_cycle")
240
+ full_moon_cycle.set_global_relative_scale_factor(411.78443029, day)
241
+
242
+ year = years = tropical_year
243
+
244
+
245
+ #### CONSTANTS ####
246
+
247
+ # Newton constant
248
+ G = gravitational_constant = PhysicalConstant("gravitational_constant", abbrev="G")
249
+
250
+ # speed of light
251
+ c = speed_of_light = PhysicalConstant("speed_of_light", abbrev="c")
252
+
253
+ # elementary charge
254
+ elementary_charge = PhysicalConstant("elementary_charge", abbrev="e")
255
+
256
+ # Planck constant
257
+ planck = PhysicalConstant("planck", abbrev="h")
258
+
259
+ # Reduced Planck constant
260
+ hbar = PhysicalConstant("hbar", abbrev="hbar")
261
+
262
+ # Electronvolt
263
+ eV = electronvolt = electronvolts = PhysicalConstant("electronvolt", abbrev="eV")
264
+
265
+ # Avogadro number
266
+ avogadro_number = PhysicalConstant("avogadro_number")
267
+
268
+ # Avogadro constant
269
+ avogadro = avogadro_constant = PhysicalConstant("avogadro_constant")
270
+
271
+ # Boltzmann constant
272
+ boltzmann = boltzmann_constant = PhysicalConstant("boltzmann_constant")
273
+
274
+ # Stefan-Boltzmann constant
275
+ stefan = stefan_boltzmann_constant = PhysicalConstant("stefan_boltzmann_constant")
276
+
277
+ # Molar gas constant
278
+ R = molar_gas_constant = PhysicalConstant("molar_gas_constant", abbrev="R")
279
+
280
+ # Faraday constant
281
+ faraday_constant = PhysicalConstant("faraday_constant")
282
+
283
+ # Josephson constant
284
+ josephson_constant = PhysicalConstant("josephson_constant", abbrev="K_j")
285
+
286
+ # Von Klitzing constant
287
+ von_klitzing_constant = PhysicalConstant("von_klitzing_constant", abbrev="R_k")
288
+
289
+ # Acceleration due to gravity (on the Earth surface)
290
+ gee = gees = acceleration_due_to_gravity = PhysicalConstant("acceleration_due_to_gravity", abbrev="g")
291
+
292
+ # magnetic constant:
293
+ u0 = magnetic_constant = vacuum_permeability = PhysicalConstant("magnetic_constant")
294
+
295
+ # electric constat:
296
+ e0 = electric_constant = vacuum_permittivity = PhysicalConstant("vacuum_permittivity")
297
+
298
+ # vacuum impedance:
299
+ Z0 = vacuum_impedance = PhysicalConstant("vacuum_impedance", abbrev='Z_0', latex_repr=r'Z_{0}')
300
+
301
+ # Coulomb's constant:
302
+ coulomb_constant = coulombs_constant = electric_force_constant = \
303
+ PhysicalConstant("coulomb_constant", abbrev="k_e")
304
+
305
+
306
+ atmosphere = atmospheres = atm = Quantity("atmosphere", abbrev="atm")
307
+
308
+ kPa = kilopascal = Quantity("kilopascal", abbrev="kPa")
309
+ kilopascal.set_global_relative_scale_factor(kilo, Pa)
310
+
311
+ bar = bars = Quantity("bar", abbrev="bar")
312
+
313
+ pound = pounds = Quantity("pound") # exact
314
+
315
+ psi = Quantity("psi")
316
+
317
+ dHg0 = 13.5951 # approx value at 0 C
318
+ mmHg = torr = Quantity("mmHg")
319
+
320
+ atmosphere.set_global_relative_scale_factor(101325, pascal)
321
+ bar.set_global_relative_scale_factor(100, kPa)
322
+ pound.set_global_relative_scale_factor(Rational(45359237, 100000000), kg)
323
+
324
+ mmu = mmus = milli_mass_unit = Quantity("milli_mass_unit")
325
+
326
+ quart = quarts = Quantity("quart")
327
+
328
+
329
+ # Other convenient units and magnitudes
330
+
331
+ ly = lightyear = lightyears = Quantity("lightyear", abbrev="ly")
332
+
333
+ au = astronomical_unit = astronomical_units = Quantity("astronomical_unit", abbrev="AU")
334
+
335
+
336
+ # Fundamental Planck units:
337
+ planck_mass = Quantity("planck_mass", abbrev="m_P", latex_repr=r'm_\text{P}')
338
+
339
+ planck_time = Quantity("planck_time", abbrev="t_P", latex_repr=r't_\text{P}')
340
+
341
+ planck_temperature = Quantity("planck_temperature", abbrev="T_P",
342
+ latex_repr=r'T_\text{P}')
343
+
344
+ planck_length = Quantity("planck_length", abbrev="l_P", latex_repr=r'l_\text{P}')
345
+
346
+ planck_charge = Quantity("planck_charge", abbrev="q_P", latex_repr=r'q_\text{P}')
347
+
348
+
349
+ # Derived Planck units:
350
+ planck_area = Quantity("planck_area")
351
+
352
+ planck_volume = Quantity("planck_volume")
353
+
354
+ planck_momentum = Quantity("planck_momentum")
355
+
356
+ planck_energy = Quantity("planck_energy", abbrev="E_P", latex_repr=r'E_\text{P}')
357
+
358
+ planck_force = Quantity("planck_force", abbrev="F_P", latex_repr=r'F_\text{P}')
359
+
360
+ planck_power = Quantity("planck_power", abbrev="P_P", latex_repr=r'P_\text{P}')
361
+
362
+ planck_density = Quantity("planck_density", abbrev="rho_P", latex_repr=r'\rho_\text{P}')
363
+
364
+ planck_energy_density = Quantity("planck_energy_density", abbrev="rho^E_P")
365
+
366
+ planck_intensity = Quantity("planck_intensity", abbrev="I_P", latex_repr=r'I_\text{P}')
367
+
368
+ planck_angular_frequency = Quantity("planck_angular_frequency", abbrev="omega_P",
369
+ latex_repr=r'\omega_\text{P}')
370
+
371
+ planck_pressure = Quantity("planck_pressure", abbrev="p_P", latex_repr=r'p_\text{P}')
372
+
373
+ planck_current = Quantity("planck_current", abbrev="I_P", latex_repr=r'I_\text{P}')
374
+
375
+ planck_voltage = Quantity("planck_voltage", abbrev="V_P", latex_repr=r'V_\text{P}')
376
+
377
+ planck_impedance = Quantity("planck_impedance", abbrev="Z_P", latex_repr=r'Z_\text{P}')
378
+
379
+ planck_acceleration = Quantity("planck_acceleration", abbrev="a_P",
380
+ latex_repr=r'a_\text{P}')
381
+
382
+
383
+ # Information theory units:
384
+ bit = bits = Quantity("bit")
385
+ bit.set_global_dimension(information)
386
+
387
+ byte = bytes = Quantity("byte")
388
+
389
+ kibibyte = kibibytes = Quantity("kibibyte")
390
+ mebibyte = mebibytes = Quantity("mebibyte")
391
+ gibibyte = gibibytes = Quantity("gibibyte")
392
+ tebibyte = tebibytes = Quantity("tebibyte")
393
+ pebibyte = pebibytes = Quantity("pebibyte")
394
+ exbibyte = exbibytes = Quantity("exbibyte")
395
+
396
+ byte.set_global_relative_scale_factor(8, bit)
397
+ kibibyte.set_global_relative_scale_factor(kibi, byte)
398
+ mebibyte.set_global_relative_scale_factor(mebi, byte)
399
+ gibibyte.set_global_relative_scale_factor(gibi, byte)
400
+ tebibyte.set_global_relative_scale_factor(tebi, byte)
401
+ pebibyte.set_global_relative_scale_factor(pebi, byte)
402
+ exbibyte.set_global_relative_scale_factor(exbi, byte)
403
+
404
+ # Older units for radioactivity
405
+ curie = Ci = Quantity("curie", abbrev="Ci")
406
+
407
+ rutherford = Rd = Quantity("rutherford", abbrev="Rd")
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/dimensions.py ADDED
@@ -0,0 +1,590 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Definition of physical dimensions.
3
+
4
+ Unit systems will be constructed on top of these dimensions.
5
+
6
+ Most of the examples in the doc use MKS system and are presented from the
7
+ computer point of view: from a human point, adding length to time is not legal
8
+ in MKS but it is in natural system; for a computer in natural system there is
9
+ no time dimension (but a velocity dimension instead) - in the basis - so the
10
+ question of adding time to length has no meaning.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import collections
16
+ from functools import reduce
17
+
18
+ from sympy.core.basic import Basic
19
+ from sympy.core.containers import (Dict, Tuple)
20
+ from sympy.core.singleton import S
21
+ from sympy.core.sorting import default_sort_key
22
+ from sympy.core.symbol import Symbol
23
+ from sympy.core.sympify import sympify
24
+ from sympy.matrices.dense import Matrix
25
+ from sympy.functions.elementary.trigonometric import TrigonometricFunction
26
+ from sympy.core.expr import Expr
27
+ from sympy.core.power import Pow
28
+
29
+
30
+ class _QuantityMapper:
31
+
32
+ _quantity_scale_factors_global: dict[Expr, Expr] = {}
33
+ _quantity_dimensional_equivalence_map_global: dict[Expr, Expr] = {}
34
+ _quantity_dimension_global: dict[Expr, Expr] = {}
35
+
36
+ def __init__(self, *args, **kwargs):
37
+ self._quantity_dimension_map = {}
38
+ self._quantity_scale_factors = {}
39
+
40
+ def set_quantity_dimension(self, quantity, dimension):
41
+ """
42
+ Set the dimension for the quantity in a unit system.
43
+
44
+ If this relation is valid in every unit system, use
45
+ ``quantity.set_global_dimension(dimension)`` instead.
46
+ """
47
+ from sympy.physics.units import Quantity
48
+ dimension = sympify(dimension)
49
+ if not isinstance(dimension, Dimension):
50
+ if dimension == 1:
51
+ dimension = Dimension(1)
52
+ else:
53
+ raise ValueError("expected dimension or 1")
54
+ elif isinstance(dimension, Quantity):
55
+ dimension = self.get_quantity_dimension(dimension)
56
+ self._quantity_dimension_map[quantity] = dimension
57
+
58
+ def set_quantity_scale_factor(self, quantity, scale_factor):
59
+ """
60
+ Set the scale factor of a quantity relative to another quantity.
61
+
62
+ It should be used only once per quantity to just one other quantity,
63
+ the algorithm will then be able to compute the scale factors to all
64
+ other quantities.
65
+
66
+ In case the scale factor is valid in every unit system, please use
67
+ ``quantity.set_global_relative_scale_factor(scale_factor)`` instead.
68
+ """
69
+ from sympy.physics.units import Quantity
70
+ from sympy.physics.units.prefixes import Prefix
71
+ scale_factor = sympify(scale_factor)
72
+ # replace all prefixes by their ratio to canonical units:
73
+ scale_factor = scale_factor.replace(
74
+ lambda x: isinstance(x, Prefix),
75
+ lambda x: x.scale_factor
76
+ )
77
+ # replace all quantities by their ratio to canonical units:
78
+ scale_factor = scale_factor.replace(
79
+ lambda x: isinstance(x, Quantity),
80
+ lambda x: self.get_quantity_scale_factor(x)
81
+ )
82
+ self._quantity_scale_factors[quantity] = scale_factor
83
+
84
+ def get_quantity_dimension(self, unit):
85
+ from sympy.physics.units import Quantity
86
+ # First look-up the local dimension map, then the global one:
87
+ if unit in self._quantity_dimension_map:
88
+ return self._quantity_dimension_map[unit]
89
+ if unit in self._quantity_dimension_global:
90
+ return self._quantity_dimension_global[unit]
91
+ if unit in self._quantity_dimensional_equivalence_map_global:
92
+ dep_unit = self._quantity_dimensional_equivalence_map_global[unit]
93
+ if isinstance(dep_unit, Quantity):
94
+ return self.get_quantity_dimension(dep_unit)
95
+ else:
96
+ return Dimension(self.get_dimensional_expr(dep_unit))
97
+ if isinstance(unit, Quantity):
98
+ return Dimension(unit.name)
99
+ else:
100
+ return Dimension(1)
101
+
102
+ def get_quantity_scale_factor(self, unit):
103
+ if unit in self._quantity_scale_factors:
104
+ return self._quantity_scale_factors[unit]
105
+ if unit in self._quantity_scale_factors_global:
106
+ mul_factor, other_unit = self._quantity_scale_factors_global[unit]
107
+ return mul_factor*self.get_quantity_scale_factor(other_unit)
108
+ return S.One
109
+
110
+
111
+ class Dimension(Expr):
112
+ """
113
+ This class represent the dimension of a physical quantities.
114
+
115
+ The ``Dimension`` constructor takes as parameters a name and an optional
116
+ symbol.
117
+
118
+ For example, in classical mechanics we know that time is different from
119
+ temperature and dimensions make this difference (but they do not provide
120
+ any measure of these quantities.
121
+
122
+ >>> from sympy.physics.units import Dimension
123
+ >>> length = Dimension('length')
124
+ >>> length
125
+ Dimension(length)
126
+ >>> time = Dimension('time')
127
+ >>> time
128
+ Dimension(time)
129
+
130
+ Dimensions can be composed using multiplication, division and
131
+ exponentiation (by a number) to give new dimensions. Addition and
132
+ subtraction is defined only when the two objects are the same dimension.
133
+
134
+ >>> velocity = length / time
135
+ >>> velocity
136
+ Dimension(length/time)
137
+
138
+ It is possible to use a dimension system object to get the dimensionsal
139
+ dependencies of a dimension, for example the dimension system used by the
140
+ SI units convention can be used:
141
+
142
+ >>> from sympy.physics.units.systems.si import dimsys_SI
143
+ >>> dimsys_SI.get_dimensional_dependencies(velocity)
144
+ {Dimension(length, L): 1, Dimension(time, T): -1}
145
+ >>> length + length
146
+ Dimension(length)
147
+ >>> l2 = length**2
148
+ >>> l2
149
+ Dimension(length**2)
150
+ >>> dimsys_SI.get_dimensional_dependencies(l2)
151
+ {Dimension(length, L): 2}
152
+
153
+ """
154
+
155
+ _op_priority = 13.0
156
+
157
+ # XXX: This doesn't seem to be used anywhere...
158
+ _dimensional_dependencies = {} # type: ignore
159
+
160
+ is_commutative = True
161
+ is_number = False
162
+ # make sqrt(M**2) --> M
163
+ is_positive = True
164
+ is_real = True
165
+
166
+ def __new__(cls, name, symbol=None):
167
+
168
+ if isinstance(name, str):
169
+ name = Symbol(name)
170
+ else:
171
+ name = sympify(name)
172
+
173
+ if not isinstance(name, Expr):
174
+ raise TypeError("Dimension name needs to be a valid math expression")
175
+
176
+ if isinstance(symbol, str):
177
+ symbol = Symbol(symbol)
178
+ elif symbol is not None:
179
+ assert isinstance(symbol, Symbol)
180
+
181
+ obj = Expr.__new__(cls, name)
182
+
183
+ obj._name = name
184
+ obj._symbol = symbol
185
+ return obj
186
+
187
+ @property
188
+ def name(self):
189
+ return self._name
190
+
191
+ @property
192
+ def symbol(self):
193
+ return self._symbol
194
+
195
+ def __str__(self):
196
+ """
197
+ Display the string representation of the dimension.
198
+ """
199
+ if self.symbol is None:
200
+ return "Dimension(%s)" % (self.name)
201
+ else:
202
+ return "Dimension(%s, %s)" % (self.name, self.symbol)
203
+
204
+ def __repr__(self):
205
+ return self.__str__()
206
+
207
+ def __neg__(self):
208
+ return self
209
+
210
+ def __add__(self, other):
211
+ from sympy.physics.units.quantities import Quantity
212
+ other = sympify(other)
213
+ if isinstance(other, Basic):
214
+ if other.has(Quantity):
215
+ raise TypeError("cannot sum dimension and quantity")
216
+ if isinstance(other, Dimension) and self == other:
217
+ return self
218
+ return super().__add__(other)
219
+ return self
220
+
221
+ def __radd__(self, other):
222
+ return self.__add__(other)
223
+
224
+ def __sub__(self, other):
225
+ # there is no notion of ordering (or magnitude) among dimension,
226
+ # subtraction is equivalent to addition when the operation is legal
227
+ return self + other
228
+
229
+ def __rsub__(self, other):
230
+ # there is no notion of ordering (or magnitude) among dimension,
231
+ # subtraction is equivalent to addition when the operation is legal
232
+ return self + other
233
+
234
+ def __pow__(self, other):
235
+ return self._eval_power(other)
236
+
237
+ def _eval_power(self, other):
238
+ other = sympify(other)
239
+ return Dimension(self.name**other)
240
+
241
+ def __mul__(self, other):
242
+ from sympy.physics.units.quantities import Quantity
243
+ if isinstance(other, Basic):
244
+ if other.has(Quantity):
245
+ raise TypeError("cannot sum dimension and quantity")
246
+ if isinstance(other, Dimension):
247
+ return Dimension(self.name*other.name)
248
+ if not other.free_symbols: # other.is_number cannot be used
249
+ return self
250
+ return super().__mul__(other)
251
+ return self
252
+
253
+ def __rmul__(self, other):
254
+ return self.__mul__(other)
255
+
256
+ def __truediv__(self, other):
257
+ return self*Pow(other, -1)
258
+
259
+ def __rtruediv__(self, other):
260
+ return other * pow(self, -1)
261
+
262
+ @classmethod
263
+ def _from_dimensional_dependencies(cls, dependencies):
264
+ return reduce(lambda x, y: x * y, (
265
+ d**e for d, e in dependencies.items()
266
+ ), 1)
267
+
268
+ def has_integer_powers(self, dim_sys):
269
+ """
270
+ Check if the dimension object has only integer powers.
271
+
272
+ All the dimension powers should be integers, but rational powers may
273
+ appear in intermediate steps. This method may be used to check that the
274
+ final result is well-defined.
275
+ """
276
+
277
+ return all(dpow.is_Integer for dpow in dim_sys.get_dimensional_dependencies(self).values())
278
+
279
+
280
+ # Create dimensions according to the base units in MKSA.
281
+ # For other unit systems, they can be derived by transforming the base
282
+ # dimensional dependency dictionary.
283
+
284
+
285
+ class DimensionSystem(Basic, _QuantityMapper):
286
+ r"""
287
+ DimensionSystem represents a coherent set of dimensions.
288
+
289
+ The constructor takes three parameters:
290
+
291
+ - base dimensions;
292
+ - derived dimensions: these are defined in terms of the base dimensions
293
+ (for example velocity is defined from the division of length by time);
294
+ - dependency of dimensions: how the derived dimensions depend
295
+ on the base dimensions.
296
+
297
+ Optionally either the ``derived_dims`` or the ``dimensional_dependencies``
298
+ may be omitted.
299
+ """
300
+
301
+ def __new__(cls, base_dims, derived_dims=(), dimensional_dependencies={}):
302
+ dimensional_dependencies = dict(dimensional_dependencies)
303
+
304
+ def parse_dim(dim):
305
+ if isinstance(dim, str):
306
+ dim = Dimension(Symbol(dim))
307
+ elif isinstance(dim, Dimension):
308
+ pass
309
+ elif isinstance(dim, Symbol):
310
+ dim = Dimension(dim)
311
+ else:
312
+ raise TypeError("%s wrong type" % dim)
313
+ return dim
314
+
315
+ base_dims = [parse_dim(i) for i in base_dims]
316
+ derived_dims = [parse_dim(i) for i in derived_dims]
317
+
318
+ for dim in base_dims:
319
+ if (dim in dimensional_dependencies
320
+ and (len(dimensional_dependencies[dim]) != 1 or
321
+ dimensional_dependencies[dim].get(dim, None) != 1)):
322
+ raise IndexError("Repeated value in base dimensions")
323
+ dimensional_dependencies[dim] = Dict({dim: 1})
324
+
325
+ def parse_dim_name(dim):
326
+ if isinstance(dim, Dimension):
327
+ return dim
328
+ elif isinstance(dim, str):
329
+ return Dimension(Symbol(dim))
330
+ elif isinstance(dim, Symbol):
331
+ return Dimension(dim)
332
+ else:
333
+ raise TypeError("unrecognized type %s for %s" % (type(dim), dim))
334
+
335
+ for dim in dimensional_dependencies.keys():
336
+ dim = parse_dim(dim)
337
+ if (dim not in derived_dims) and (dim not in base_dims):
338
+ derived_dims.append(dim)
339
+
340
+ def parse_dict(d):
341
+ return Dict({parse_dim_name(i): j for i, j in d.items()})
342
+
343
+ # Make sure everything is a SymPy type:
344
+ dimensional_dependencies = {parse_dim_name(i): parse_dict(j) for i, j in
345
+ dimensional_dependencies.items()}
346
+
347
+ for dim in derived_dims:
348
+ if dim in base_dims:
349
+ raise ValueError("Dimension %s both in base and derived" % dim)
350
+ if dim not in dimensional_dependencies:
351
+ # TODO: should this raise a warning?
352
+ dimensional_dependencies[dim] = Dict({dim: 1})
353
+
354
+ base_dims.sort(key=default_sort_key)
355
+ derived_dims.sort(key=default_sort_key)
356
+
357
+ base_dims = Tuple(*base_dims)
358
+ derived_dims = Tuple(*derived_dims)
359
+ dimensional_dependencies = Dict({i: Dict(j) for i, j in dimensional_dependencies.items()})
360
+ obj = Basic.__new__(cls, base_dims, derived_dims, dimensional_dependencies)
361
+ return obj
362
+
363
+ @property
364
+ def base_dims(self):
365
+ return self.args[0]
366
+
367
+ @property
368
+ def derived_dims(self):
369
+ return self.args[1]
370
+
371
+ @property
372
+ def dimensional_dependencies(self):
373
+ return self.args[2]
374
+
375
+ def _get_dimensional_dependencies_for_name(self, dimension):
376
+ if isinstance(dimension, str):
377
+ dimension = Dimension(Symbol(dimension))
378
+ elif not isinstance(dimension, Dimension):
379
+ dimension = Dimension(dimension)
380
+
381
+ if dimension.name.is_Symbol:
382
+ # Dimensions not included in the dependencies are considered
383
+ # as base dimensions:
384
+ return dict(self.dimensional_dependencies.get(dimension, {dimension: 1}))
385
+
386
+ if dimension.name.is_number or dimension.name.is_NumberSymbol:
387
+ return {}
388
+
389
+ get_for_name = self._get_dimensional_dependencies_for_name
390
+
391
+ if dimension.name.is_Mul:
392
+ ret = collections.defaultdict(int)
393
+ dicts = [get_for_name(i) for i in dimension.name.args]
394
+ for d in dicts:
395
+ for k, v in d.items():
396
+ ret[k] += v
397
+ return {k: v for (k, v) in ret.items() if v != 0}
398
+
399
+ if dimension.name.is_Add:
400
+ dicts = [get_for_name(i) for i in dimension.name.args]
401
+ if all(d == dicts[0] for d in dicts[1:]):
402
+ return dicts[0]
403
+ raise TypeError("Only equivalent dimensions can be added or subtracted.")
404
+
405
+ if dimension.name.is_Pow:
406
+ dim_base = get_for_name(dimension.name.base)
407
+ dim_exp = get_for_name(dimension.name.exp)
408
+ if dim_exp == {} or dimension.name.exp.is_Symbol:
409
+ return {k: v * dimension.name.exp for (k, v) in dim_base.items()}
410
+ else:
411
+ raise TypeError("The exponent for the power operator must be a Symbol or dimensionless.")
412
+
413
+ if dimension.name.is_Function:
414
+ args = (Dimension._from_dimensional_dependencies(
415
+ get_for_name(arg)) for arg in dimension.name.args)
416
+ result = dimension.name.func(*args)
417
+
418
+ dicts = [get_for_name(i) for i in dimension.name.args]
419
+
420
+ if isinstance(result, Dimension):
421
+ return self.get_dimensional_dependencies(result)
422
+ elif result.func == dimension.name.func:
423
+ if isinstance(dimension.name, TrigonometricFunction):
424
+ if dicts[0] in ({}, {Dimension('angle'): 1}):
425
+ return {}
426
+ else:
427
+ raise TypeError("The input argument for the function {} must be dimensionless or have dimensions of angle.".format(dimension.func))
428
+ else:
429
+ if all(item == {} for item in dicts):
430
+ return {}
431
+ else:
432
+ raise TypeError("The input arguments for the function {} must be dimensionless.".format(dimension.func))
433
+ else:
434
+ return get_for_name(result)
435
+
436
+ raise TypeError("Type {} not implemented for get_dimensional_dependencies".format(type(dimension.name)))
437
+
438
+ def get_dimensional_dependencies(self, name, mark_dimensionless=False):
439
+ dimdep = self._get_dimensional_dependencies_for_name(name)
440
+ if mark_dimensionless and dimdep == {}:
441
+ return {Dimension(1): 1}
442
+ return dict(dimdep.items())
443
+
444
+ def equivalent_dims(self, dim1, dim2):
445
+ deps1 = self.get_dimensional_dependencies(dim1)
446
+ deps2 = self.get_dimensional_dependencies(dim2)
447
+ return deps1 == deps2
448
+
449
+ def extend(self, new_base_dims, new_derived_dims=(), new_dim_deps=None):
450
+ deps = dict(self.dimensional_dependencies)
451
+ if new_dim_deps:
452
+ deps.update(new_dim_deps)
453
+
454
+ new_dim_sys = DimensionSystem(
455
+ tuple(self.base_dims) + tuple(new_base_dims),
456
+ tuple(self.derived_dims) + tuple(new_derived_dims),
457
+ deps
458
+ )
459
+ new_dim_sys._quantity_dimension_map.update(self._quantity_dimension_map)
460
+ new_dim_sys._quantity_scale_factors.update(self._quantity_scale_factors)
461
+ return new_dim_sys
462
+
463
+ def is_dimensionless(self, dimension):
464
+ """
465
+ Check if the dimension object really has a dimension.
466
+
467
+ A dimension should have at least one component with non-zero power.
468
+ """
469
+ if dimension.name == 1:
470
+ return True
471
+ return self.get_dimensional_dependencies(dimension) == {}
472
+
473
+ @property
474
+ def list_can_dims(self):
475
+ """
476
+ Useless method, kept for compatibility with previous versions.
477
+
478
+ DO NOT USE.
479
+
480
+ List all canonical dimension names.
481
+ """
482
+ dimset = set()
483
+ for i in self.base_dims:
484
+ dimset.update(set(self.get_dimensional_dependencies(i).keys()))
485
+ return tuple(sorted(dimset, key=str))
486
+
487
+ @property
488
+ def inv_can_transf_matrix(self):
489
+ """
490
+ Useless method, kept for compatibility with previous versions.
491
+
492
+ DO NOT USE.
493
+
494
+ Compute the inverse transformation matrix from the base to the
495
+ canonical dimension basis.
496
+
497
+ It corresponds to the matrix where columns are the vector of base
498
+ dimensions in canonical basis.
499
+
500
+ This matrix will almost never be used because dimensions are always
501
+ defined with respect to the canonical basis, so no work has to be done
502
+ to get them in this basis. Nonetheless if this matrix is not square
503
+ (or not invertible) it means that we have chosen a bad basis.
504
+ """
505
+ matrix = reduce(lambda x, y: x.row_join(y),
506
+ [self.dim_can_vector(d) for d in self.base_dims])
507
+ return matrix
508
+
509
+ @property
510
+ def can_transf_matrix(self):
511
+ """
512
+ Useless method, kept for compatibility with previous versions.
513
+
514
+ DO NOT USE.
515
+
516
+ Return the canonical transformation matrix from the canonical to the
517
+ base dimension basis.
518
+
519
+ It is the inverse of the matrix computed with inv_can_transf_matrix().
520
+ """
521
+
522
+ #TODO: the inversion will fail if the system is inconsistent, for
523
+ # example if the matrix is not a square
524
+ return reduce(lambda x, y: x.row_join(y),
525
+ [self.dim_can_vector(d) for d in sorted(self.base_dims, key=str)]
526
+ ).inv()
527
+
528
+ def dim_can_vector(self, dim):
529
+ """
530
+ Useless method, kept for compatibility with previous versions.
531
+
532
+ DO NOT USE.
533
+
534
+ Dimensional representation in terms of the canonical base dimensions.
535
+ """
536
+
537
+ vec = []
538
+ for d in self.list_can_dims:
539
+ vec.append(self.get_dimensional_dependencies(dim).get(d, 0))
540
+ return Matrix(vec)
541
+
542
+ def dim_vector(self, dim):
543
+ """
544
+ Useless method, kept for compatibility with previous versions.
545
+
546
+ DO NOT USE.
547
+
548
+
549
+ Vector representation in terms of the base dimensions.
550
+ """
551
+ return self.can_transf_matrix * Matrix(self.dim_can_vector(dim))
552
+
553
+ def print_dim_base(self, dim):
554
+ """
555
+ Give the string expression of a dimension in term of the basis symbols.
556
+ """
557
+ dims = self.dim_vector(dim)
558
+ symbols = [i.symbol if i.symbol is not None else i.name for i in self.base_dims]
559
+ res = S.One
560
+ for (s, p) in zip(symbols, dims):
561
+ res *= s**p
562
+ return res
563
+
564
+ @property
565
+ def dim(self):
566
+ """
567
+ Useless method, kept for compatibility with previous versions.
568
+
569
+ DO NOT USE.
570
+
571
+ Give the dimension of the system.
572
+
573
+ That is return the number of dimensions forming the basis.
574
+ """
575
+ return len(self.base_dims)
576
+
577
+ @property
578
+ def is_consistent(self):
579
+ """
580
+ Useless method, kept for compatibility with previous versions.
581
+
582
+ DO NOT USE.
583
+
584
+ Check if the system is well defined.
585
+ """
586
+
587
+ # not enough or too many base dimensions compared to independent
588
+ # dimensions
589
+ # in vector language: the set of vectors do not form a basis
590
+ return self.inv_can_transf_matrix.is_square
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/prefixes.py ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Module defining unit prefixe class and some constants.
3
+
4
+ Constant dict for SI and binary prefixes are defined as PREFIXES and
5
+ BIN_PREFIXES.
6
+ """
7
+ from sympy.core.expr import Expr
8
+ from sympy.core.sympify import sympify
9
+ from sympy.core.singleton import S
10
+
11
+ class Prefix(Expr):
12
+ """
13
+ This class represent prefixes, with their name, symbol and factor.
14
+
15
+ Prefixes are used to create derived units from a given unit. They should
16
+ always be encapsulated into units.
17
+
18
+ The factor is constructed from a base (default is 10) to some power, and
19
+ it gives the total multiple or fraction. For example the kilometer km
20
+ is constructed from the meter (factor 1) and the kilo (10 to the power 3,
21
+ i.e. 1000). The base can be changed to allow e.g. binary prefixes.
22
+
23
+ A prefix multiplied by something will always return the product of this
24
+ other object times the factor, except if the other object:
25
+
26
+ - is a prefix and they can be combined into a new prefix;
27
+ - defines multiplication with prefixes (which is the case for the Unit
28
+ class).
29
+ """
30
+ _op_priority = 13.0
31
+ is_commutative = True
32
+
33
+ def __new__(cls, name, abbrev, exponent, base=sympify(10), latex_repr=None):
34
+
35
+ name = sympify(name)
36
+ abbrev = sympify(abbrev)
37
+ exponent = sympify(exponent)
38
+ base = sympify(base)
39
+
40
+ obj = Expr.__new__(cls, name, abbrev, exponent, base)
41
+ obj._name = name
42
+ obj._abbrev = abbrev
43
+ obj._scale_factor = base**exponent
44
+ obj._exponent = exponent
45
+ obj._base = base
46
+ obj._latex_repr = latex_repr
47
+ return obj
48
+
49
+ @property
50
+ def name(self):
51
+ return self._name
52
+
53
+ @property
54
+ def abbrev(self):
55
+ return self._abbrev
56
+
57
+ @property
58
+ def scale_factor(self):
59
+ return self._scale_factor
60
+
61
+ def _latex(self, printer):
62
+ if self._latex_repr is None:
63
+ return r'\text{%s}' % self._abbrev
64
+ return self._latex_repr
65
+
66
+ @property
67
+ def base(self):
68
+ return self._base
69
+
70
+ def __str__(self):
71
+ return str(self._abbrev)
72
+
73
+ def __repr__(self):
74
+ if self.base == 10:
75
+ return "Prefix(%r, %r, %r)" % (
76
+ str(self.name), str(self.abbrev), self._exponent)
77
+ else:
78
+ return "Prefix(%r, %r, %r, %r)" % (
79
+ str(self.name), str(self.abbrev), self._exponent, self.base)
80
+
81
+ def __mul__(self, other):
82
+ from sympy.physics.units import Quantity
83
+ if not isinstance(other, (Quantity, Prefix)):
84
+ return super().__mul__(other)
85
+
86
+ fact = self.scale_factor * other.scale_factor
87
+
88
+ if isinstance(other, Prefix):
89
+ if fact == 1:
90
+ return S.One
91
+ # simplify prefix
92
+ for p in PREFIXES:
93
+ if PREFIXES[p].scale_factor == fact:
94
+ return PREFIXES[p]
95
+ return fact
96
+
97
+ return self.scale_factor * other
98
+
99
+ def __truediv__(self, other):
100
+ if not hasattr(other, "scale_factor"):
101
+ return super().__truediv__(other)
102
+
103
+ fact = self.scale_factor / other.scale_factor
104
+
105
+ if fact == 1:
106
+ return S.One
107
+ elif isinstance(other, Prefix):
108
+ for p in PREFIXES:
109
+ if PREFIXES[p].scale_factor == fact:
110
+ return PREFIXES[p]
111
+ return fact
112
+
113
+ return self.scale_factor / other
114
+
115
+ def __rtruediv__(self, other):
116
+ if other == 1:
117
+ for p in PREFIXES:
118
+ if PREFIXES[p].scale_factor == 1 / self.scale_factor:
119
+ return PREFIXES[p]
120
+ return other / self.scale_factor
121
+
122
+
123
+ def prefix_unit(unit, prefixes):
124
+ """
125
+ Return a list of all units formed by unit and the given prefixes.
126
+
127
+ You can use the predefined PREFIXES or BIN_PREFIXES, but you can also
128
+ pass as argument a subdict of them if you do not want all prefixed units.
129
+
130
+ >>> from sympy.physics.units.prefixes import (PREFIXES,
131
+ ... prefix_unit)
132
+ >>> from sympy.physics.units import m
133
+ >>> pref = {"m": PREFIXES["m"], "c": PREFIXES["c"], "d": PREFIXES["d"]}
134
+ >>> prefix_unit(m, pref) # doctest: +SKIP
135
+ [millimeter, centimeter, decimeter]
136
+ """
137
+
138
+ from sympy.physics.units.quantities import Quantity
139
+ from sympy.physics.units import UnitSystem
140
+
141
+ prefixed_units = []
142
+
143
+ for prefix in prefixes.values():
144
+ quantity = Quantity(
145
+ "%s%s" % (prefix.name, unit.name),
146
+ abbrev=("%s%s" % (prefix.abbrev, unit.abbrev)),
147
+ is_prefixed=True,
148
+ )
149
+ UnitSystem._quantity_dimensional_equivalence_map_global[quantity] = unit
150
+ UnitSystem._quantity_scale_factors_global[quantity] = (prefix.scale_factor, unit)
151
+ prefixed_units.append(quantity)
152
+
153
+ return prefixed_units
154
+
155
+
156
+ yotta = Prefix('yotta', 'Y', 24)
157
+ zetta = Prefix('zetta', 'Z', 21)
158
+ exa = Prefix('exa', 'E', 18)
159
+ peta = Prefix('peta', 'P', 15)
160
+ tera = Prefix('tera', 'T', 12)
161
+ giga = Prefix('giga', 'G', 9)
162
+ mega = Prefix('mega', 'M', 6)
163
+ kilo = Prefix('kilo', 'k', 3)
164
+ hecto = Prefix('hecto', 'h', 2)
165
+ deca = Prefix('deca', 'da', 1)
166
+ deci = Prefix('deci', 'd', -1)
167
+ centi = Prefix('centi', 'c', -2)
168
+ milli = Prefix('milli', 'm', -3)
169
+ micro = Prefix('micro', 'mu', -6, latex_repr=r"\mu")
170
+ nano = Prefix('nano', 'n', -9)
171
+ pico = Prefix('pico', 'p', -12)
172
+ femto = Prefix('femto', 'f', -15)
173
+ atto = Prefix('atto', 'a', -18)
174
+ zepto = Prefix('zepto', 'z', -21)
175
+ yocto = Prefix('yocto', 'y', -24)
176
+
177
+
178
+ # https://physics.nist.gov/cuu/Units/prefixes.html
179
+ PREFIXES = {
180
+ 'Y': yotta,
181
+ 'Z': zetta,
182
+ 'E': exa,
183
+ 'P': peta,
184
+ 'T': tera,
185
+ 'G': giga,
186
+ 'M': mega,
187
+ 'k': kilo,
188
+ 'h': hecto,
189
+ 'da': deca,
190
+ 'd': deci,
191
+ 'c': centi,
192
+ 'm': milli,
193
+ 'mu': micro,
194
+ 'n': nano,
195
+ 'p': pico,
196
+ 'f': femto,
197
+ 'a': atto,
198
+ 'z': zepto,
199
+ 'y': yocto,
200
+ }
201
+
202
+
203
+ kibi = Prefix('kibi', 'Y', 10, 2)
204
+ mebi = Prefix('mebi', 'Y', 20, 2)
205
+ gibi = Prefix('gibi', 'Y', 30, 2)
206
+ tebi = Prefix('tebi', 'Y', 40, 2)
207
+ pebi = Prefix('pebi', 'Y', 50, 2)
208
+ exbi = Prefix('exbi', 'Y', 60, 2)
209
+
210
+
211
+ # https://physics.nist.gov/cuu/Units/binary.html
212
+ BIN_PREFIXES = {
213
+ 'Ki': kibi,
214
+ 'Mi': mebi,
215
+ 'Gi': gibi,
216
+ 'Ti': tebi,
217
+ 'Pi': pebi,
218
+ 'Ei': exbi,
219
+ }
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/quantities.py ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Physical quantities.
3
+ """
4
+
5
+ from sympy.core.expr import AtomicExpr
6
+ from sympy.core.symbol import Symbol
7
+ from sympy.core.sympify import sympify
8
+ from sympy.physics.units.dimensions import _QuantityMapper
9
+ from sympy.physics.units.prefixes import Prefix
10
+
11
+
12
+ class Quantity(AtomicExpr):
13
+ """
14
+ Physical quantity: can be a unit of measure, a constant or a generic quantity.
15
+ """
16
+
17
+ is_commutative = True
18
+ is_real = True
19
+ is_number = False
20
+ is_nonzero = True
21
+ is_physical_constant = False
22
+ _diff_wrt = True
23
+
24
+ def __new__(cls, name, abbrev=None,
25
+ latex_repr=None, pretty_unicode_repr=None,
26
+ pretty_ascii_repr=None, mathml_presentation_repr=None,
27
+ is_prefixed=False,
28
+ **assumptions):
29
+
30
+ if not isinstance(name, Symbol):
31
+ name = Symbol(name)
32
+
33
+ if abbrev is None:
34
+ abbrev = name
35
+ elif isinstance(abbrev, str):
36
+ abbrev = Symbol(abbrev)
37
+
38
+ # HACK: These are here purely for type checking. They actually get assigned below.
39
+ cls._is_prefixed = is_prefixed
40
+
41
+ obj = AtomicExpr.__new__(cls, name, abbrev)
42
+ obj._name = name
43
+ obj._abbrev = abbrev
44
+ obj._latex_repr = latex_repr
45
+ obj._unicode_repr = pretty_unicode_repr
46
+ obj._ascii_repr = pretty_ascii_repr
47
+ obj._mathml_repr = mathml_presentation_repr
48
+ obj._is_prefixed = is_prefixed
49
+ return obj
50
+
51
+ def set_global_dimension(self, dimension):
52
+ _QuantityMapper._quantity_dimension_global[self] = dimension
53
+
54
+ def set_global_relative_scale_factor(self, scale_factor, reference_quantity):
55
+ """
56
+ Setting a scale factor that is valid across all unit system.
57
+ """
58
+ from sympy.physics.units import UnitSystem
59
+ scale_factor = sympify(scale_factor)
60
+ if isinstance(scale_factor, Prefix):
61
+ self._is_prefixed = True
62
+ # replace all prefixes by their ratio to canonical units:
63
+ scale_factor = scale_factor.replace(
64
+ lambda x: isinstance(x, Prefix),
65
+ lambda x: x.scale_factor
66
+ )
67
+ scale_factor = sympify(scale_factor)
68
+ UnitSystem._quantity_scale_factors_global[self] = (scale_factor, reference_quantity)
69
+ UnitSystem._quantity_dimensional_equivalence_map_global[self] = reference_quantity
70
+
71
+ @property
72
+ def name(self):
73
+ return self._name
74
+
75
+ @property
76
+ def dimension(self):
77
+ from sympy.physics.units import UnitSystem
78
+ unit_system = UnitSystem.get_default_unit_system()
79
+ return unit_system.get_quantity_dimension(self)
80
+
81
+ @property
82
+ def abbrev(self):
83
+ """
84
+ Symbol representing the unit name.
85
+
86
+ Prepend the abbreviation with the prefix symbol if it is defines.
87
+ """
88
+ return self._abbrev
89
+
90
+ @property
91
+ def scale_factor(self):
92
+ """
93
+ Overall magnitude of the quantity as compared to the canonical units.
94
+ """
95
+ from sympy.physics.units import UnitSystem
96
+ unit_system = UnitSystem.get_default_unit_system()
97
+ return unit_system.get_quantity_scale_factor(self)
98
+
99
+ def _eval_is_positive(self):
100
+ return True
101
+
102
+ def _eval_is_constant(self):
103
+ return True
104
+
105
+ def _eval_Abs(self):
106
+ return self
107
+
108
+ def _eval_subs(self, old, new):
109
+ if isinstance(new, Quantity) and self != old:
110
+ return self
111
+
112
+ def _latex(self, printer):
113
+ if self._latex_repr:
114
+ return self._latex_repr
115
+ else:
116
+ return r'\text{{{}}}'.format(self.args[1] \
117
+ if len(self.args) >= 2 else self.args[0])
118
+
119
+ def convert_to(self, other, unit_system="SI"):
120
+ """
121
+ Convert the quantity to another quantity of same dimensions.
122
+
123
+ Examples
124
+ ========
125
+
126
+ >>> from sympy.physics.units import speed_of_light, meter, second
127
+ >>> speed_of_light
128
+ speed_of_light
129
+ >>> speed_of_light.convert_to(meter/second)
130
+ 299792458*meter/second
131
+
132
+ >>> from sympy.physics.units import liter
133
+ >>> liter.convert_to(meter**3)
134
+ meter**3/1000
135
+ """
136
+ from .util import convert_to
137
+ return convert_to(self, other, unit_system)
138
+
139
+ @property
140
+ def free_symbols(self):
141
+ """Return free symbols from quantity."""
142
+ return set()
143
+
144
+ @property
145
+ def is_prefixed(self):
146
+ """Whether or not the quantity is prefixed. Eg. `kilogram` is prefixed, but `gram` is not."""
147
+ return self._is_prefixed
148
+
149
+ class PhysicalConstant(Quantity):
150
+ """Represents a physical constant, eg. `speed_of_light` or `avogadro_constant`."""
151
+
152
+ is_physical_constant = True
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/systems/__init__.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ from sympy.physics.units.systems.mks import MKS
2
+ from sympy.physics.units.systems.mksa import MKSA
3
+ from sympy.physics.units.systems.natural import natural
4
+ from sympy.physics.units.systems.si import SI
5
+
6
+ __all__ = ['MKS', 'MKSA', 'natural', 'SI']
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/systems/cgs.py ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.core.singleton import S
2
+ from sympy.functions.elementary.miscellaneous import sqrt
3
+ from sympy.physics.units import UnitSystem, centimeter, gram, second, coulomb, charge, speed_of_light, current, mass, \
4
+ length, voltage, magnetic_density, magnetic_flux
5
+ from sympy.physics.units.definitions import coulombs_constant
6
+ from sympy.physics.units.definitions.unit_definitions import statcoulomb, statampere, statvolt, volt, tesla, gauss, \
7
+ weber, maxwell, debye, oersted, ohm, farad, henry, erg, ampere, coulomb_constant
8
+ from sympy.physics.units.systems.mks import dimsys_length_weight_time
9
+
10
+ One = S.One
11
+
12
+ dimsys_cgs = dimsys_length_weight_time.extend(
13
+ [],
14
+ new_dim_deps={
15
+ # Dimensional dependencies for derived dimensions
16
+ "impedance": {"time": 1, "length": -1},
17
+ "conductance": {"time": -1, "length": 1},
18
+ "capacitance": {"length": 1},
19
+ "inductance": {"time": 2, "length": -1},
20
+ "charge": {"mass": S.Half, "length": S(3)/2, "time": -1},
21
+ "current": {"mass": One/2, "length": 3*One/2, "time": -2},
22
+ "voltage": {"length": -One/2, "mass": One/2, "time": -1},
23
+ "magnetic_density": {"length": -One/2, "mass": One/2, "time": -1},
24
+ "magnetic_flux": {"length": 3*One/2, "mass": One/2, "time": -1},
25
+ }
26
+ )
27
+
28
+ cgs_gauss = UnitSystem(
29
+ base_units=[centimeter, gram, second],
30
+ units=[],
31
+ name="cgs_gauss",
32
+ dimension_system=dimsys_cgs)
33
+
34
+
35
+ cgs_gauss.set_quantity_scale_factor(coulombs_constant, 1)
36
+
37
+ cgs_gauss.set_quantity_dimension(statcoulomb, charge)
38
+ cgs_gauss.set_quantity_scale_factor(statcoulomb, centimeter**(S(3)/2)*gram**(S.Half)/second)
39
+
40
+ cgs_gauss.set_quantity_dimension(coulomb, charge)
41
+
42
+ cgs_gauss.set_quantity_dimension(statampere, current)
43
+ cgs_gauss.set_quantity_scale_factor(statampere, statcoulomb/second)
44
+
45
+ cgs_gauss.set_quantity_dimension(statvolt, voltage)
46
+ cgs_gauss.set_quantity_scale_factor(statvolt, erg/statcoulomb)
47
+
48
+ cgs_gauss.set_quantity_dimension(volt, voltage)
49
+
50
+ cgs_gauss.set_quantity_dimension(gauss, magnetic_density)
51
+ cgs_gauss.set_quantity_scale_factor(gauss, sqrt(gram/centimeter)/second)
52
+
53
+ cgs_gauss.set_quantity_dimension(tesla, magnetic_density)
54
+
55
+ cgs_gauss.set_quantity_dimension(maxwell, magnetic_flux)
56
+ cgs_gauss.set_quantity_scale_factor(maxwell, sqrt(centimeter**3*gram)/second)
57
+
58
+ # SI units expressed in CGS-gaussian units:
59
+ cgs_gauss.set_quantity_scale_factor(coulomb, 10*speed_of_light*statcoulomb)
60
+ cgs_gauss.set_quantity_scale_factor(ampere, 10*speed_of_light*statcoulomb/second)
61
+ cgs_gauss.set_quantity_scale_factor(volt, 10**6/speed_of_light*statvolt)
62
+ cgs_gauss.set_quantity_scale_factor(weber, 10**8*maxwell)
63
+ cgs_gauss.set_quantity_scale_factor(tesla, 10**4*gauss)
64
+ cgs_gauss.set_quantity_scale_factor(debye, One/10**18*statcoulomb*centimeter)
65
+ cgs_gauss.set_quantity_scale_factor(oersted, sqrt(gram/centimeter)/second)
66
+ cgs_gauss.set_quantity_scale_factor(ohm, 10**5/speed_of_light**2*second/centimeter)
67
+ cgs_gauss.set_quantity_scale_factor(farad, One/10**5*speed_of_light**2*centimeter)
68
+ cgs_gauss.set_quantity_scale_factor(henry, 10**5/speed_of_light**2/centimeter*second**2)
69
+
70
+ # Coulomb's constant:
71
+ cgs_gauss.set_quantity_dimension(coulomb_constant, 1)
72
+ cgs_gauss.set_quantity_scale_factor(coulomb_constant, 1)
73
+
74
+ __all__ = [
75
+ 'ohm', 'tesla', 'maxwell', 'speed_of_light', 'volt', 'second', 'voltage',
76
+ 'debye', 'dimsys_length_weight_time', 'centimeter', 'coulomb_constant',
77
+ 'farad', 'sqrt', 'UnitSystem', 'current', 'charge', 'weber', 'gram',
78
+ 'statcoulomb', 'gauss', 'S', 'statvolt', 'oersted', 'statampere',
79
+ 'dimsys_cgs', 'coulomb', 'magnetic_density', 'magnetic_flux', 'One',
80
+ 'length', 'erg', 'mass', 'coulombs_constant', 'henry', 'ampere',
81
+ 'cgs_gauss',
82
+ ]
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/systems/length_weight_time.py ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.core.singleton import S
2
+
3
+ from sympy.core.numbers import pi
4
+
5
+ from sympy.physics.units import DimensionSystem, hertz, kilogram
6
+ from sympy.physics.units.definitions import (
7
+ G, Hz, J, N, Pa, W, c, g, kg, m, s, meter, gram, second, newton,
8
+ joule, watt, pascal)
9
+ from sympy.physics.units.definitions.dimension_definitions import (
10
+ acceleration, action, energy, force, frequency, momentum,
11
+ power, pressure, velocity, length, mass, time)
12
+ from sympy.physics.units.prefixes import PREFIXES, prefix_unit
13
+ from sympy.physics.units.prefixes import (
14
+ kibi, mebi, gibi, tebi, pebi, exbi
15
+ )
16
+ from sympy.physics.units.definitions import (
17
+ cd, K, coulomb, volt, ohm, siemens, farad, henry, tesla, weber, dioptre,
18
+ lux, katal, gray, becquerel, inch, hectare, liter, julian_year,
19
+ gravitational_constant, speed_of_light, elementary_charge, planck, hbar,
20
+ electronvolt, avogadro_number, avogadro_constant, boltzmann_constant,
21
+ stefan_boltzmann_constant, atomic_mass_constant, molar_gas_constant,
22
+ faraday_constant, josephson_constant, von_klitzing_constant,
23
+ acceleration_due_to_gravity, magnetic_constant, vacuum_permittivity,
24
+ vacuum_impedance, coulomb_constant, atmosphere, bar, pound, psi, mmHg,
25
+ milli_mass_unit, quart, lightyear, astronomical_unit, planck_mass,
26
+ planck_time, planck_temperature, planck_length, planck_charge,
27
+ planck_area, planck_volume, planck_momentum, planck_energy, planck_force,
28
+ planck_power, planck_density, planck_energy_density, planck_intensity,
29
+ planck_angular_frequency, planck_pressure, planck_current, planck_voltage,
30
+ planck_impedance, planck_acceleration, bit, byte, kibibyte, mebibyte,
31
+ gibibyte, tebibyte, pebibyte, exbibyte, curie, rutherford, radian, degree,
32
+ steradian, angular_mil, atomic_mass_unit, gee, kPa, ampere, u0, kelvin,
33
+ mol, mole, candela, electric_constant, boltzmann, angstrom
34
+ )
35
+
36
+
37
+ dimsys_length_weight_time = DimensionSystem([
38
+ # Dimensional dependencies for MKS base dimensions
39
+ length,
40
+ mass,
41
+ time,
42
+ ], dimensional_dependencies={
43
+ # Dimensional dependencies for derived dimensions
44
+ "velocity": {"length": 1, "time": -1},
45
+ "acceleration": {"length": 1, "time": -2},
46
+ "momentum": {"mass": 1, "length": 1, "time": -1},
47
+ "force": {"mass": 1, "length": 1, "time": -2},
48
+ "energy": {"mass": 1, "length": 2, "time": -2},
49
+ "power": {"length": 2, "mass": 1, "time": -3},
50
+ "pressure": {"mass": 1, "length": -1, "time": -2},
51
+ "frequency": {"time": -1},
52
+ "action": {"length": 2, "mass": 1, "time": -1},
53
+ "area": {"length": 2},
54
+ "volume": {"length": 3},
55
+ })
56
+
57
+
58
+ One = S.One
59
+
60
+
61
+ # Base units:
62
+ dimsys_length_weight_time.set_quantity_dimension(meter, length)
63
+ dimsys_length_weight_time.set_quantity_scale_factor(meter, One)
64
+
65
+ # gram; used to define its prefixed units
66
+ dimsys_length_weight_time.set_quantity_dimension(gram, mass)
67
+ dimsys_length_weight_time.set_quantity_scale_factor(gram, One)
68
+
69
+ dimsys_length_weight_time.set_quantity_dimension(second, time)
70
+ dimsys_length_weight_time.set_quantity_scale_factor(second, One)
71
+
72
+ # derived units
73
+
74
+ dimsys_length_weight_time.set_quantity_dimension(newton, force)
75
+ dimsys_length_weight_time.set_quantity_scale_factor(newton, kilogram*meter/second**2)
76
+
77
+ dimsys_length_weight_time.set_quantity_dimension(joule, energy)
78
+ dimsys_length_weight_time.set_quantity_scale_factor(joule, newton*meter)
79
+
80
+ dimsys_length_weight_time.set_quantity_dimension(watt, power)
81
+ dimsys_length_weight_time.set_quantity_scale_factor(watt, joule/second)
82
+
83
+ dimsys_length_weight_time.set_quantity_dimension(pascal, pressure)
84
+ dimsys_length_weight_time.set_quantity_scale_factor(pascal, newton/meter**2)
85
+
86
+ dimsys_length_weight_time.set_quantity_dimension(hertz, frequency)
87
+ dimsys_length_weight_time.set_quantity_scale_factor(hertz, One)
88
+
89
+ # Other derived units:
90
+
91
+ dimsys_length_weight_time.set_quantity_dimension(dioptre, 1 / length)
92
+ dimsys_length_weight_time.set_quantity_scale_factor(dioptre, 1/meter)
93
+
94
+ # Common volume and area units
95
+
96
+ dimsys_length_weight_time.set_quantity_dimension(hectare, length**2)
97
+ dimsys_length_weight_time.set_quantity_scale_factor(hectare, (meter**2)*(10000))
98
+
99
+ dimsys_length_weight_time.set_quantity_dimension(liter, length**3)
100
+ dimsys_length_weight_time.set_quantity_scale_factor(liter, meter**3/1000)
101
+
102
+
103
+ # Newton constant
104
+ # REF: NIST SP 959 (June 2019)
105
+
106
+ dimsys_length_weight_time.set_quantity_dimension(gravitational_constant, length ** 3 * mass ** -1 * time ** -2)
107
+ dimsys_length_weight_time.set_quantity_scale_factor(gravitational_constant, 6.67430e-11*m**3/(kg*s**2))
108
+
109
+ # speed of light
110
+
111
+ dimsys_length_weight_time.set_quantity_dimension(speed_of_light, velocity)
112
+ dimsys_length_weight_time.set_quantity_scale_factor(speed_of_light, 299792458*meter/second)
113
+
114
+
115
+ # Planck constant
116
+ # REF: NIST SP 959 (June 2019)
117
+
118
+ dimsys_length_weight_time.set_quantity_dimension(planck, action)
119
+ dimsys_length_weight_time.set_quantity_scale_factor(planck, 6.62607015e-34*joule*second)
120
+
121
+ # Reduced Planck constant
122
+ # REF: NIST SP 959 (June 2019)
123
+
124
+ dimsys_length_weight_time.set_quantity_dimension(hbar, action)
125
+ dimsys_length_weight_time.set_quantity_scale_factor(hbar, planck / (2 * pi))
126
+
127
+
128
+ __all__ = [
129
+ 'mmHg', 'atmosphere', 'newton', 'meter', 'vacuum_permittivity', 'pascal',
130
+ 'magnetic_constant', 'angular_mil', 'julian_year', 'weber', 'exbibyte',
131
+ 'liter', 'molar_gas_constant', 'faraday_constant', 'avogadro_constant',
132
+ 'planck_momentum', 'planck_density', 'gee', 'mol', 'bit', 'gray', 'kibi',
133
+ 'bar', 'curie', 'prefix_unit', 'PREFIXES', 'planck_time', 'gram',
134
+ 'candela', 'force', 'planck_intensity', 'energy', 'becquerel',
135
+ 'planck_acceleration', 'speed_of_light', 'dioptre', 'second', 'frequency',
136
+ 'Hz', 'power', 'lux', 'planck_current', 'momentum', 'tebibyte',
137
+ 'planck_power', 'degree', 'mebi', 'K', 'planck_volume',
138
+ 'quart', 'pressure', 'W', 'joule', 'boltzmann_constant', 'c', 'g',
139
+ 'planck_force', 'exbi', 's', 'watt', 'action', 'hbar', 'gibibyte',
140
+ 'DimensionSystem', 'cd', 'volt', 'planck_charge', 'angstrom',
141
+ 'dimsys_length_weight_time', 'pebi', 'vacuum_impedance', 'planck',
142
+ 'farad', 'gravitational_constant', 'u0', 'hertz', 'tesla', 'steradian',
143
+ 'josephson_constant', 'planck_area', 'stefan_boltzmann_constant',
144
+ 'astronomical_unit', 'J', 'N', 'planck_voltage', 'planck_energy',
145
+ 'atomic_mass_constant', 'rutherford', 'elementary_charge', 'Pa',
146
+ 'planck_mass', 'henry', 'planck_angular_frequency', 'ohm', 'pound',
147
+ 'planck_pressure', 'G', 'avogadro_number', 'psi', 'von_klitzing_constant',
148
+ 'planck_length', 'radian', 'mole', 'acceleration',
149
+ 'planck_energy_density', 'mebibyte', 'length',
150
+ 'acceleration_due_to_gravity', 'planck_temperature', 'tebi', 'inch',
151
+ 'electronvolt', 'coulomb_constant', 'kelvin', 'kPa', 'boltzmann',
152
+ 'milli_mass_unit', 'gibi', 'planck_impedance', 'electric_constant', 'kg',
153
+ 'coulomb', 'siemens', 'byte', 'atomic_mass_unit', 'm', 'kibibyte',
154
+ 'kilogram', 'lightyear', 'mass', 'time', 'pebibyte', 'velocity',
155
+ 'ampere', 'katal',
156
+ ]
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/systems/mks.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ MKS unit system.
3
+
4
+ MKS stands for "meter, kilogram, second".
5
+ """
6
+
7
+ from sympy.physics.units import UnitSystem
8
+ from sympy.physics.units.definitions import gravitational_constant, hertz, joule, newton, pascal, watt, speed_of_light, gram, kilogram, meter, second
9
+ from sympy.physics.units.definitions.dimension_definitions import (
10
+ acceleration, action, energy, force, frequency, momentum,
11
+ power, pressure, velocity, length, mass, time)
12
+ from sympy.physics.units.prefixes import PREFIXES, prefix_unit
13
+ from sympy.physics.units.systems.length_weight_time import dimsys_length_weight_time
14
+
15
+ dims = (velocity, acceleration, momentum, force, energy, power, pressure,
16
+ frequency, action)
17
+
18
+ units = [meter, gram, second, joule, newton, watt, pascal, hertz]
19
+ all_units = []
20
+
21
+ # Prefixes of units like gram, joule, newton etc get added using `prefix_unit`
22
+ # in the for loop, but the actual units have to be added manually.
23
+ all_units.extend([gram, joule, newton, watt, pascal, hertz])
24
+
25
+ for u in units:
26
+ all_units.extend(prefix_unit(u, PREFIXES))
27
+ all_units.extend([gravitational_constant, speed_of_light])
28
+
29
+ # unit system
30
+ MKS = UnitSystem(base_units=(meter, kilogram, second), units=all_units, name="MKS", dimension_system=dimsys_length_weight_time, derived_units={
31
+ power: watt,
32
+ time: second,
33
+ pressure: pascal,
34
+ length: meter,
35
+ frequency: hertz,
36
+ mass: kilogram,
37
+ force: newton,
38
+ energy: joule,
39
+ velocity: meter/second,
40
+ acceleration: meter/(second**2),
41
+ })
42
+
43
+
44
+ __all__ = [
45
+ 'MKS', 'units', 'all_units', 'dims',
46
+ ]
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/systems/mksa.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ MKS unit system.
3
+
4
+ MKS stands for "meter, kilogram, second, ampere".
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from sympy.physics.units.definitions import Z0, ampere, coulomb, farad, henry, siemens, tesla, volt, weber, ohm
10
+ from sympy.physics.units.definitions.dimension_definitions import (
11
+ capacitance, charge, conductance, current, impedance, inductance,
12
+ magnetic_density, magnetic_flux, voltage)
13
+ from sympy.physics.units.prefixes import PREFIXES, prefix_unit
14
+ from sympy.physics.units.systems.mks import MKS, dimsys_length_weight_time
15
+ from sympy.physics.units.quantities import Quantity
16
+
17
+ dims = (voltage, impedance, conductance, current, capacitance, inductance, charge,
18
+ magnetic_density, magnetic_flux)
19
+
20
+ units = [ampere, volt, ohm, siemens, farad, henry, coulomb, tesla, weber]
21
+
22
+ all_units: list[Quantity] = []
23
+ for u in units:
24
+ all_units.extend(prefix_unit(u, PREFIXES))
25
+ all_units.extend(units)
26
+
27
+ all_units.append(Z0)
28
+
29
+ dimsys_MKSA = dimsys_length_weight_time.extend([
30
+ # Dimensional dependencies for base dimensions (MKSA not in MKS)
31
+ current,
32
+ ], new_dim_deps={
33
+ # Dimensional dependencies for derived dimensions
34
+ "voltage": {"mass": 1, "length": 2, "current": -1, "time": -3},
35
+ "impedance": {"mass": 1, "length": 2, "current": -2, "time": -3},
36
+ "conductance": {"mass": -1, "length": -2, "current": 2, "time": 3},
37
+ "capacitance": {"mass": -1, "length": -2, "current": 2, "time": 4},
38
+ "inductance": {"mass": 1, "length": 2, "current": -2, "time": -2},
39
+ "charge": {"current": 1, "time": 1},
40
+ "magnetic_density": {"mass": 1, "current": -1, "time": -2},
41
+ "magnetic_flux": {"length": 2, "mass": 1, "current": -1, "time": -2},
42
+ })
43
+
44
+ MKSA = MKS.extend(base=(ampere,), units=all_units, name='MKSA', dimension_system=dimsys_MKSA, derived_units={
45
+ magnetic_flux: weber,
46
+ impedance: ohm,
47
+ current: ampere,
48
+ voltage: volt,
49
+ inductance: henry,
50
+ conductance: siemens,
51
+ magnetic_density: tesla,
52
+ charge: coulomb,
53
+ capacitance: farad,
54
+ })
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/systems/natural.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Naturalunit system.
3
+
4
+ The natural system comes from "setting c = 1, hbar = 1". From the computer
5
+ point of view it means that we use velocity and action instead of length and
6
+ time. Moreover instead of mass we use energy.
7
+ """
8
+
9
+ from sympy.physics.units import DimensionSystem
10
+ from sympy.physics.units.definitions import c, eV, hbar
11
+ from sympy.physics.units.definitions.dimension_definitions import (
12
+ action, energy, force, frequency, length, mass, momentum,
13
+ power, time, velocity)
14
+ from sympy.physics.units.prefixes import PREFIXES, prefix_unit
15
+ from sympy.physics.units.unitsystem import UnitSystem
16
+
17
+
18
+ # dimension system
19
+ _natural_dim = DimensionSystem(
20
+ base_dims=(action, energy, velocity),
21
+ derived_dims=(length, mass, time, momentum, force, power, frequency)
22
+ )
23
+
24
+ units = prefix_unit(eV, PREFIXES)
25
+
26
+ # unit system
27
+ natural = UnitSystem(base_units=(hbar, eV, c), units=units, name="Natural system")
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/systems/si.py ADDED
@@ -0,0 +1,377 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ SI unit system.
3
+ Based on MKSA, which stands for "meter, kilogram, second, ampere".
4
+ Added kelvin, candela and mole.
5
+
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from sympy.physics.units import DimensionSystem, Dimension, dHg0
11
+
12
+ from sympy.physics.units.quantities import Quantity
13
+
14
+ from sympy.core.numbers import (Rational, pi)
15
+ from sympy.core.singleton import S
16
+ from sympy.functions.elementary.miscellaneous import sqrt
17
+ from sympy.physics.units.definitions.dimension_definitions import (
18
+ acceleration, action, current, impedance, length, mass, time, velocity,
19
+ amount_of_substance, temperature, information, frequency, force, pressure,
20
+ energy, power, charge, voltage, capacitance, conductance, magnetic_flux,
21
+ magnetic_density, inductance, luminous_intensity
22
+ )
23
+ from sympy.physics.units.definitions import (
24
+ kilogram, newton, second, meter, gram, cd, K, joule, watt, pascal, hertz,
25
+ coulomb, volt, ohm, siemens, farad, henry, tesla, weber, dioptre, lux,
26
+ katal, gray, becquerel, inch, liter, julian_year, gravitational_constant,
27
+ speed_of_light, elementary_charge, planck, hbar, electronvolt,
28
+ avogadro_number, avogadro_constant, boltzmann_constant, electron_rest_mass,
29
+ stefan_boltzmann_constant, Da, atomic_mass_constant, molar_gas_constant,
30
+ faraday_constant, josephson_constant, von_klitzing_constant,
31
+ acceleration_due_to_gravity, magnetic_constant, vacuum_permittivity,
32
+ vacuum_impedance, coulomb_constant, atmosphere, bar, pound, psi, mmHg,
33
+ milli_mass_unit, quart, lightyear, astronomical_unit, planck_mass,
34
+ planck_time, planck_temperature, planck_length, planck_charge, planck_area,
35
+ planck_volume, planck_momentum, planck_energy, planck_force, planck_power,
36
+ planck_density, planck_energy_density, planck_intensity,
37
+ planck_angular_frequency, planck_pressure, planck_current, planck_voltage,
38
+ planck_impedance, planck_acceleration, bit, byte, kibibyte, mebibyte,
39
+ gibibyte, tebibyte, pebibyte, exbibyte, curie, rutherford, radian, degree,
40
+ steradian, angular_mil, atomic_mass_unit, gee, kPa, ampere, u0, c, kelvin,
41
+ mol, mole, candela, m, kg, s, electric_constant, G, boltzmann
42
+ )
43
+ from sympy.physics.units.prefixes import PREFIXES, prefix_unit
44
+ from sympy.physics.units.systems.mksa import MKSA, dimsys_MKSA
45
+
46
+ derived_dims = (frequency, force, pressure, energy, power, charge, voltage,
47
+ capacitance, conductance, magnetic_flux,
48
+ magnetic_density, inductance, luminous_intensity)
49
+ base_dims = (amount_of_substance, luminous_intensity, temperature)
50
+
51
+ units = [mol, cd, K, lux, hertz, newton, pascal, joule, watt, coulomb, volt,
52
+ farad, ohm, siemens, weber, tesla, henry, candela, lux, becquerel,
53
+ gray, katal]
54
+
55
+ all_units: list[Quantity] = []
56
+ for u in units:
57
+ all_units.extend(prefix_unit(u, PREFIXES))
58
+
59
+ all_units.extend(units)
60
+ all_units.extend([mol, cd, K, lux])
61
+
62
+
63
+ dimsys_SI = dimsys_MKSA.extend(
64
+ [
65
+ # Dimensional dependencies for other base dimensions:
66
+ temperature,
67
+ amount_of_substance,
68
+ luminous_intensity,
69
+ ])
70
+
71
+ dimsys_default = dimsys_SI.extend(
72
+ [information],
73
+ )
74
+
75
+ SI = MKSA.extend(base=(mol, cd, K), units=all_units, name='SI', dimension_system=dimsys_SI, derived_units={
76
+ power: watt,
77
+ magnetic_flux: weber,
78
+ time: second,
79
+ impedance: ohm,
80
+ pressure: pascal,
81
+ current: ampere,
82
+ voltage: volt,
83
+ length: meter,
84
+ frequency: hertz,
85
+ inductance: henry,
86
+ temperature: kelvin,
87
+ amount_of_substance: mole,
88
+ luminous_intensity: candela,
89
+ conductance: siemens,
90
+ mass: kilogram,
91
+ magnetic_density: tesla,
92
+ charge: coulomb,
93
+ force: newton,
94
+ capacitance: farad,
95
+ energy: joule,
96
+ velocity: meter/second,
97
+ })
98
+
99
+ One = S.One
100
+
101
+ SI.set_quantity_dimension(radian, One)
102
+
103
+ SI.set_quantity_scale_factor(ampere, One)
104
+
105
+ SI.set_quantity_scale_factor(kelvin, One)
106
+
107
+ SI.set_quantity_scale_factor(mole, One)
108
+
109
+ SI.set_quantity_scale_factor(candela, One)
110
+
111
+ # MKSA extension to MKS: derived units
112
+
113
+ SI.set_quantity_scale_factor(coulomb, One)
114
+
115
+ SI.set_quantity_scale_factor(volt, joule/coulomb)
116
+
117
+ SI.set_quantity_scale_factor(ohm, volt/ampere)
118
+
119
+ SI.set_quantity_scale_factor(siemens, ampere/volt)
120
+
121
+ SI.set_quantity_scale_factor(farad, coulomb/volt)
122
+
123
+ SI.set_quantity_scale_factor(henry, volt*second/ampere)
124
+
125
+ SI.set_quantity_scale_factor(tesla, volt*second/meter**2)
126
+
127
+ SI.set_quantity_scale_factor(weber, joule/ampere)
128
+
129
+
130
+ SI.set_quantity_dimension(lux, luminous_intensity / length ** 2)
131
+ SI.set_quantity_scale_factor(lux, steradian*candela/meter**2)
132
+
133
+ # katal is the SI unit of catalytic activity
134
+
135
+ SI.set_quantity_dimension(katal, amount_of_substance / time)
136
+ SI.set_quantity_scale_factor(katal, mol/second)
137
+
138
+ # gray is the SI unit of absorbed dose
139
+
140
+ SI.set_quantity_dimension(gray, energy / mass)
141
+ SI.set_quantity_scale_factor(gray, meter**2/second**2)
142
+
143
+ # becquerel is the SI unit of radioactivity
144
+
145
+ SI.set_quantity_dimension(becquerel, 1 / time)
146
+ SI.set_quantity_scale_factor(becquerel, 1/second)
147
+
148
+ #### CONSTANTS ####
149
+
150
+ # elementary charge
151
+ # REF: NIST SP 959 (June 2019)
152
+
153
+ SI.set_quantity_dimension(elementary_charge, charge)
154
+ SI.set_quantity_scale_factor(elementary_charge, 1.602176634e-19*coulomb)
155
+
156
+ # Electronvolt
157
+ # REF: NIST SP 959 (June 2019)
158
+
159
+ SI.set_quantity_dimension(electronvolt, energy)
160
+ SI.set_quantity_scale_factor(electronvolt, 1.602176634e-19*joule)
161
+
162
+ # Avogadro number
163
+ # REF: NIST SP 959 (June 2019)
164
+
165
+ SI.set_quantity_dimension(avogadro_number, One)
166
+ SI.set_quantity_scale_factor(avogadro_number, 6.02214076e23)
167
+
168
+ # Avogadro constant
169
+
170
+ SI.set_quantity_dimension(avogadro_constant, amount_of_substance ** -1)
171
+ SI.set_quantity_scale_factor(avogadro_constant, avogadro_number / mol)
172
+
173
+ # Boltzmann constant
174
+ # REF: NIST SP 959 (June 2019)
175
+
176
+ SI.set_quantity_dimension(boltzmann_constant, energy / temperature)
177
+ SI.set_quantity_scale_factor(boltzmann_constant, 1.380649e-23*joule/kelvin)
178
+
179
+ # Stefan-Boltzmann constant
180
+ # REF: NIST SP 959 (June 2019)
181
+
182
+ SI.set_quantity_dimension(stefan_boltzmann_constant, energy * time ** -1 * length ** -2 * temperature ** -4)
183
+ SI.set_quantity_scale_factor(stefan_boltzmann_constant, pi**2 * boltzmann_constant**4 / (60 * hbar**3 * speed_of_light ** 2))
184
+
185
+ # Atomic mass
186
+ # REF: NIST SP 959 (June 2019)
187
+
188
+ SI.set_quantity_dimension(atomic_mass_constant, mass)
189
+ SI.set_quantity_scale_factor(atomic_mass_constant, 1.66053906660e-24*gram)
190
+
191
+ # Molar gas constant
192
+ # REF: NIST SP 959 (June 2019)
193
+
194
+ SI.set_quantity_dimension(molar_gas_constant, energy / (temperature * amount_of_substance))
195
+ SI.set_quantity_scale_factor(molar_gas_constant, boltzmann_constant * avogadro_constant)
196
+
197
+ # Faraday constant
198
+
199
+ SI.set_quantity_dimension(faraday_constant, charge / amount_of_substance)
200
+ SI.set_quantity_scale_factor(faraday_constant, elementary_charge * avogadro_constant)
201
+
202
+ # Josephson constant
203
+
204
+ SI.set_quantity_dimension(josephson_constant, frequency / voltage)
205
+ SI.set_quantity_scale_factor(josephson_constant, 0.5 * planck / elementary_charge)
206
+
207
+ # Von Klitzing constant
208
+
209
+ SI.set_quantity_dimension(von_klitzing_constant, voltage / current)
210
+ SI.set_quantity_scale_factor(von_klitzing_constant, hbar / elementary_charge ** 2)
211
+
212
+ # Acceleration due to gravity (on the Earth surface)
213
+
214
+ SI.set_quantity_dimension(acceleration_due_to_gravity, acceleration)
215
+ SI.set_quantity_scale_factor(acceleration_due_to_gravity, 9.80665*meter/second**2)
216
+
217
+ # magnetic constant:
218
+
219
+ SI.set_quantity_dimension(magnetic_constant, force / current ** 2)
220
+ SI.set_quantity_scale_factor(magnetic_constant, 4*pi/10**7 * newton/ampere**2)
221
+
222
+ # electric constant:
223
+
224
+ SI.set_quantity_dimension(vacuum_permittivity, capacitance / length)
225
+ SI.set_quantity_scale_factor(vacuum_permittivity, 1/(u0 * c**2))
226
+
227
+ # vacuum impedance:
228
+
229
+ SI.set_quantity_dimension(vacuum_impedance, impedance)
230
+ SI.set_quantity_scale_factor(vacuum_impedance, u0 * c)
231
+
232
+ # Electron rest mass
233
+ SI.set_quantity_dimension(electron_rest_mass, mass)
234
+ SI.set_quantity_scale_factor(electron_rest_mass, 9.1093837015e-31*kilogram)
235
+
236
+ # Coulomb's constant:
237
+ SI.set_quantity_dimension(coulomb_constant, force * length ** 2 / charge ** 2)
238
+ SI.set_quantity_scale_factor(coulomb_constant, 1/(4*pi*vacuum_permittivity))
239
+
240
+ SI.set_quantity_dimension(psi, pressure)
241
+ SI.set_quantity_scale_factor(psi, pound * gee / inch ** 2)
242
+
243
+ SI.set_quantity_dimension(mmHg, pressure)
244
+ SI.set_quantity_scale_factor(mmHg, dHg0 * acceleration_due_to_gravity * kilogram / meter**2)
245
+
246
+ SI.set_quantity_dimension(milli_mass_unit, mass)
247
+ SI.set_quantity_scale_factor(milli_mass_unit, atomic_mass_unit/1000)
248
+
249
+ SI.set_quantity_dimension(quart, length ** 3)
250
+ SI.set_quantity_scale_factor(quart, Rational(231, 4) * inch**3)
251
+
252
+ # Other convenient units and magnitudes
253
+
254
+ SI.set_quantity_dimension(lightyear, length)
255
+ SI.set_quantity_scale_factor(lightyear, speed_of_light*julian_year)
256
+
257
+ SI.set_quantity_dimension(astronomical_unit, length)
258
+ SI.set_quantity_scale_factor(astronomical_unit, 149597870691*meter)
259
+
260
+ # Fundamental Planck units:
261
+
262
+ SI.set_quantity_dimension(planck_mass, mass)
263
+ SI.set_quantity_scale_factor(planck_mass, sqrt(hbar*speed_of_light/G))
264
+
265
+ SI.set_quantity_dimension(planck_time, time)
266
+ SI.set_quantity_scale_factor(planck_time, sqrt(hbar*G/speed_of_light**5))
267
+
268
+ SI.set_quantity_dimension(planck_temperature, temperature)
269
+ SI.set_quantity_scale_factor(planck_temperature, sqrt(hbar*speed_of_light**5/G/boltzmann**2))
270
+
271
+ SI.set_quantity_dimension(planck_length, length)
272
+ SI.set_quantity_scale_factor(planck_length, sqrt(hbar*G/speed_of_light**3))
273
+
274
+ SI.set_quantity_dimension(planck_charge, charge)
275
+ SI.set_quantity_scale_factor(planck_charge, sqrt(4*pi*electric_constant*hbar*speed_of_light))
276
+
277
+ # Derived Planck units:
278
+
279
+ SI.set_quantity_dimension(planck_area, length ** 2)
280
+ SI.set_quantity_scale_factor(planck_area, planck_length**2)
281
+
282
+ SI.set_quantity_dimension(planck_volume, length ** 3)
283
+ SI.set_quantity_scale_factor(planck_volume, planck_length**3)
284
+
285
+ SI.set_quantity_dimension(planck_momentum, mass * velocity)
286
+ SI.set_quantity_scale_factor(planck_momentum, planck_mass * speed_of_light)
287
+
288
+ SI.set_quantity_dimension(planck_energy, energy)
289
+ SI.set_quantity_scale_factor(planck_energy, planck_mass * speed_of_light**2)
290
+
291
+ SI.set_quantity_dimension(planck_force, force)
292
+ SI.set_quantity_scale_factor(planck_force, planck_energy / planck_length)
293
+
294
+ SI.set_quantity_dimension(planck_power, power)
295
+ SI.set_quantity_scale_factor(planck_power, planck_energy / planck_time)
296
+
297
+ SI.set_quantity_dimension(planck_density, mass / length ** 3)
298
+ SI.set_quantity_scale_factor(planck_density, planck_mass / planck_length**3)
299
+
300
+ SI.set_quantity_dimension(planck_energy_density, energy / length ** 3)
301
+ SI.set_quantity_scale_factor(planck_energy_density, planck_energy / planck_length**3)
302
+
303
+ SI.set_quantity_dimension(planck_intensity, mass * time ** (-3))
304
+ SI.set_quantity_scale_factor(planck_intensity, planck_energy_density * speed_of_light)
305
+
306
+ SI.set_quantity_dimension(planck_angular_frequency, 1 / time)
307
+ SI.set_quantity_scale_factor(planck_angular_frequency, 1 / planck_time)
308
+
309
+ SI.set_quantity_dimension(planck_pressure, pressure)
310
+ SI.set_quantity_scale_factor(planck_pressure, planck_force / planck_length**2)
311
+
312
+ SI.set_quantity_dimension(planck_current, current)
313
+ SI.set_quantity_scale_factor(planck_current, planck_charge / planck_time)
314
+
315
+ SI.set_quantity_dimension(planck_voltage, voltage)
316
+ SI.set_quantity_scale_factor(planck_voltage, planck_energy / planck_charge)
317
+
318
+ SI.set_quantity_dimension(planck_impedance, impedance)
319
+ SI.set_quantity_scale_factor(planck_impedance, planck_voltage / planck_current)
320
+
321
+ SI.set_quantity_dimension(planck_acceleration, acceleration)
322
+ SI.set_quantity_scale_factor(planck_acceleration, speed_of_light / planck_time)
323
+
324
+ # Older units for radioactivity
325
+
326
+ SI.set_quantity_dimension(curie, 1 / time)
327
+ SI.set_quantity_scale_factor(curie, 37000000000*becquerel)
328
+
329
+ SI.set_quantity_dimension(rutherford, 1 / time)
330
+ SI.set_quantity_scale_factor(rutherford, 1000000*becquerel)
331
+
332
+
333
+ # check that scale factors are the right SI dimensions:
334
+ for _scale_factor, _dimension in zip(
335
+ SI._quantity_scale_factors.values(),
336
+ SI._quantity_dimension_map.values()
337
+ ):
338
+ dimex = SI.get_dimensional_expr(_scale_factor)
339
+ if dimex != 1:
340
+ # XXX: equivalent_dims is an instance method taking two arguments in
341
+ # addition to self so this can not work:
342
+ if not DimensionSystem.equivalent_dims(_dimension, Dimension(dimex)): # type: ignore
343
+ raise ValueError("quantity value and dimension mismatch")
344
+ del _scale_factor, _dimension
345
+
346
+ __all__ = [
347
+ 'mmHg', 'atmosphere', 'inductance', 'newton', 'meter',
348
+ 'vacuum_permittivity', 'pascal', 'magnetic_constant', 'voltage',
349
+ 'angular_mil', 'luminous_intensity', 'all_units',
350
+ 'julian_year', 'weber', 'exbibyte', 'liter',
351
+ 'molar_gas_constant', 'faraday_constant', 'avogadro_constant',
352
+ 'lightyear', 'planck_density', 'gee', 'mol', 'bit', 'gray',
353
+ 'planck_momentum', 'bar', 'magnetic_density', 'prefix_unit', 'PREFIXES',
354
+ 'planck_time', 'dimex', 'gram', 'candela', 'force', 'planck_intensity',
355
+ 'energy', 'becquerel', 'planck_acceleration', 'speed_of_light',
356
+ 'conductance', 'frequency', 'coulomb_constant', 'degree', 'lux', 'planck',
357
+ 'current', 'planck_current', 'tebibyte', 'planck_power', 'MKSA', 'power',
358
+ 'K', 'planck_volume', 'quart', 'pressure', 'amount_of_substance',
359
+ 'joule', 'boltzmann_constant', 'Dimension', 'c', 'planck_force', 'length',
360
+ 'watt', 'action', 'hbar', 'gibibyte', 'DimensionSystem', 'cd', 'volt',
361
+ 'planck_charge', 'dioptre', 'vacuum_impedance', 'dimsys_default', 'farad',
362
+ 'charge', 'gravitational_constant', 'temperature', 'u0', 'hertz',
363
+ 'capacitance', 'tesla', 'steradian', 'planck_mass', 'josephson_constant',
364
+ 'planck_area', 'stefan_boltzmann_constant', 'base_dims',
365
+ 'astronomical_unit', 'radian', 'planck_voltage', 'impedance',
366
+ 'planck_energy', 'Da', 'atomic_mass_constant', 'rutherford', 'second', 'inch',
367
+ 'elementary_charge', 'SI', 'electronvolt', 'dimsys_SI', 'henry',
368
+ 'planck_angular_frequency', 'ohm', 'pound', 'planck_pressure', 'G', 'psi',
369
+ 'dHg0', 'von_klitzing_constant', 'planck_length', 'avogadro_number',
370
+ 'mole', 'acceleration', 'information', 'planck_energy_density',
371
+ 'mebibyte', 's', 'acceleration_due_to_gravity', 'electron_rest_mass',
372
+ 'planck_temperature', 'units', 'mass', 'dimsys_MKSA', 'kelvin', 'kPa',
373
+ 'boltzmann', 'milli_mass_unit', 'planck_impedance', 'electric_constant',
374
+ 'derived_dims', 'kg', 'coulomb', 'siemens', 'byte', 'magnetic_flux',
375
+ 'atomic_mass_unit', 'm', 'kibibyte', 'kilogram', 'One', 'curie', 'u',
376
+ 'time', 'pebibyte', 'velocity', 'ampere', 'katal',
377
+ ]
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/tests/__init__.py ADDED
File without changes
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/tests/test_dimensions.py ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.physics.units.systems.si import dimsys_SI
2
+
3
+ from sympy.core.numbers import pi
4
+ from sympy.core.singleton import S
5
+ from sympy.core.symbol import Symbol
6
+ from sympy.functions.elementary.complexes import Abs
7
+ from sympy.functions.elementary.exponential import log
8
+ from sympy.functions.elementary.miscellaneous import sqrt
9
+ from sympy.functions.elementary.trigonometric import (acos, atan2, cos)
10
+ from sympy.physics.units.dimensions import Dimension
11
+ from sympy.physics.units.definitions.dimension_definitions import (
12
+ length, time, mass, force, pressure, angle
13
+ )
14
+ from sympy.physics.units import foot
15
+ from sympy.testing.pytest import raises
16
+
17
+
18
+ def test_Dimension_definition():
19
+ assert dimsys_SI.get_dimensional_dependencies(length) == {length: 1}
20
+ assert length.name == Symbol("length")
21
+ assert length.symbol == Symbol("L")
22
+
23
+ halflength = sqrt(length)
24
+ assert dimsys_SI.get_dimensional_dependencies(halflength) == {length: S.Half}
25
+
26
+
27
+ def test_Dimension_error_definition():
28
+ # tuple with more or less than two entries
29
+ raises(TypeError, lambda: Dimension(("length", 1, 2)))
30
+ raises(TypeError, lambda: Dimension(["length"]))
31
+
32
+ # non-number power
33
+ raises(TypeError, lambda: Dimension({"length": "a"}))
34
+
35
+ # non-number with named argument
36
+ raises(TypeError, lambda: Dimension({"length": (1, 2)}))
37
+
38
+ # symbol should by Symbol or str
39
+ raises(AssertionError, lambda: Dimension("length", symbol=1))
40
+
41
+
42
+ def test_str():
43
+ assert str(Dimension("length")) == "Dimension(length)"
44
+ assert str(Dimension("length", "L")) == "Dimension(length, L)"
45
+
46
+
47
+ def test_Dimension_properties():
48
+ assert dimsys_SI.is_dimensionless(length) is False
49
+ assert dimsys_SI.is_dimensionless(length/length) is True
50
+ assert dimsys_SI.is_dimensionless(Dimension("undefined")) is False
51
+
52
+ assert length.has_integer_powers(dimsys_SI) is True
53
+ assert (length**(-1)).has_integer_powers(dimsys_SI) is True
54
+ assert (length**1.5).has_integer_powers(dimsys_SI) is False
55
+
56
+
57
+ def test_Dimension_add_sub():
58
+ assert length + length == length
59
+ assert length - length == length
60
+ assert -length == length
61
+
62
+ raises(TypeError, lambda: length + foot)
63
+ raises(TypeError, lambda: foot + length)
64
+ raises(TypeError, lambda: length - foot)
65
+ raises(TypeError, lambda: foot - length)
66
+
67
+ # issue 14547 - only raise error for dimensional args; allow
68
+ # others to pass
69
+ x = Symbol('x')
70
+ e = length + x
71
+ assert e == x + length and e.is_Add and set(e.args) == {length, x}
72
+ e = length + 1
73
+ assert e == 1 + length == 1 - length and e.is_Add and set(e.args) == {length, 1}
74
+
75
+ assert dimsys_SI.get_dimensional_dependencies(mass * length / time**2 + force) == \
76
+ {length: 1, mass: 1, time: -2}
77
+ assert dimsys_SI.get_dimensional_dependencies(mass * length / time**2 + force -
78
+ pressure * length**2) == \
79
+ {length: 1, mass: 1, time: -2}
80
+
81
+ raises(TypeError, lambda: dimsys_SI.get_dimensional_dependencies(mass * length / time**2 + pressure))
82
+
83
+ def test_Dimension_mul_div_exp():
84
+ assert 2*length == length*2 == length/2 == length
85
+ assert 2/length == 1/length
86
+ x = Symbol('x')
87
+ m = x*length
88
+ assert m == length*x and m.is_Mul and set(m.args) == {x, length}
89
+ d = x/length
90
+ assert d == x*length**-1 and d.is_Mul and set(d.args) == {x, 1/length}
91
+ d = length/x
92
+ assert d == length*x**-1 and d.is_Mul and set(d.args) == {1/x, length}
93
+
94
+ velo = length / time
95
+
96
+ assert (length * length) == length ** 2
97
+
98
+ assert dimsys_SI.get_dimensional_dependencies(length * length) == {length: 2}
99
+ assert dimsys_SI.get_dimensional_dependencies(length ** 2) == {length: 2}
100
+ assert dimsys_SI.get_dimensional_dependencies(length * time) == {length: 1, time: 1}
101
+ assert dimsys_SI.get_dimensional_dependencies(velo) == {length: 1, time: -1}
102
+ assert dimsys_SI.get_dimensional_dependencies(velo ** 2) == {length: 2, time: -2}
103
+
104
+ assert dimsys_SI.get_dimensional_dependencies(length / length) == {}
105
+ assert dimsys_SI.get_dimensional_dependencies(velo / length * time) == {}
106
+ assert dimsys_SI.get_dimensional_dependencies(length ** -1) == {length: -1}
107
+ assert dimsys_SI.get_dimensional_dependencies(velo ** -1.5) == {length: -1.5, time: 1.5}
108
+
109
+ length_a = length**"a"
110
+ assert dimsys_SI.get_dimensional_dependencies(length_a) == {length: Symbol("a")}
111
+
112
+ assert dimsys_SI.get_dimensional_dependencies(length**pi) == {length: pi}
113
+ assert dimsys_SI.get_dimensional_dependencies(length**(length/length)) == {length: Dimension(1)}
114
+
115
+ raises(TypeError, lambda: dimsys_SI.get_dimensional_dependencies(length**length))
116
+
117
+ assert length != 1
118
+ assert length / length != 1
119
+
120
+ length_0 = length ** 0
121
+ assert dimsys_SI.get_dimensional_dependencies(length_0) == {}
122
+
123
+ # issue 18738
124
+ a = Symbol('a')
125
+ b = Symbol('b')
126
+ c = sqrt(a**2 + b**2)
127
+ c_dim = c.subs({a: length, b: length})
128
+ assert dimsys_SI.equivalent_dims(c_dim, length)
129
+
130
+ def test_Dimension_functions():
131
+ raises(TypeError, lambda: dimsys_SI.get_dimensional_dependencies(cos(length)))
132
+ raises(TypeError, lambda: dimsys_SI.get_dimensional_dependencies(acos(angle)))
133
+ raises(TypeError, lambda: dimsys_SI.get_dimensional_dependencies(atan2(length, time)))
134
+ raises(TypeError, lambda: dimsys_SI.get_dimensional_dependencies(log(length)))
135
+ raises(TypeError, lambda: dimsys_SI.get_dimensional_dependencies(log(100, length)))
136
+ raises(TypeError, lambda: dimsys_SI.get_dimensional_dependencies(log(length, 10)))
137
+
138
+ assert dimsys_SI.get_dimensional_dependencies(pi) == {}
139
+
140
+ assert dimsys_SI.get_dimensional_dependencies(cos(1)) == {}
141
+ assert dimsys_SI.get_dimensional_dependencies(cos(angle)) == {}
142
+
143
+ assert dimsys_SI.get_dimensional_dependencies(atan2(length, length)) == {}
144
+
145
+ assert dimsys_SI.get_dimensional_dependencies(log(length / length, length / length)) == {}
146
+
147
+ assert dimsys_SI.get_dimensional_dependencies(Abs(length)) == {length: 1}
148
+ assert dimsys_SI.get_dimensional_dependencies(Abs(length / length)) == {}
149
+
150
+ assert dimsys_SI.get_dimensional_dependencies(sqrt(-1)) == {}
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/tests/test_dimensionsystem.py ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.core.symbol import symbols
2
+ from sympy.matrices.dense import (Matrix, eye)
3
+ from sympy.physics.units.definitions.dimension_definitions import (
4
+ action, current, length, mass, time,
5
+ velocity)
6
+ from sympy.physics.units.dimensions import DimensionSystem
7
+
8
+
9
+ def test_extend():
10
+ ms = DimensionSystem((length, time), (velocity,))
11
+
12
+ mks = ms.extend((mass,), (action,))
13
+
14
+ res = DimensionSystem((length, time, mass), (velocity, action))
15
+ assert mks.base_dims == res.base_dims
16
+ assert mks.derived_dims == res.derived_dims
17
+
18
+
19
+ def test_list_dims():
20
+ dimsys = DimensionSystem((length, time, mass))
21
+
22
+ assert dimsys.list_can_dims == (length, mass, time)
23
+
24
+
25
+ def test_dim_can_vector():
26
+ dimsys = DimensionSystem(
27
+ [length, mass, time],
28
+ [velocity, action],
29
+ {
30
+ velocity: {length: 1, time: -1}
31
+ }
32
+ )
33
+
34
+ assert dimsys.dim_can_vector(length) == Matrix([1, 0, 0])
35
+ assert dimsys.dim_can_vector(velocity) == Matrix([1, 0, -1])
36
+
37
+ dimsys = DimensionSystem(
38
+ (length, velocity, action),
39
+ (mass, time),
40
+ {
41
+ time: {length: 1, velocity: -1}
42
+ }
43
+ )
44
+
45
+ assert dimsys.dim_can_vector(length) == Matrix([0, 1, 0])
46
+ assert dimsys.dim_can_vector(velocity) == Matrix([0, 0, 1])
47
+ assert dimsys.dim_can_vector(time) == Matrix([0, 1, -1])
48
+
49
+ dimsys = DimensionSystem(
50
+ (length, mass, time),
51
+ (velocity, action),
52
+ {velocity: {length: 1, time: -1},
53
+ action: {mass: 1, length: 2, time: -1}})
54
+
55
+ assert dimsys.dim_vector(length) == Matrix([1, 0, 0])
56
+ assert dimsys.dim_vector(velocity) == Matrix([1, 0, -1])
57
+
58
+
59
+ def test_inv_can_transf_matrix():
60
+ dimsys = DimensionSystem((length, mass, time))
61
+ assert dimsys.inv_can_transf_matrix == eye(3)
62
+
63
+
64
+ def test_can_transf_matrix():
65
+ dimsys = DimensionSystem((length, mass, time))
66
+ assert dimsys.can_transf_matrix == eye(3)
67
+
68
+ dimsys = DimensionSystem((length, velocity, action))
69
+ assert dimsys.can_transf_matrix == eye(3)
70
+
71
+ dimsys = DimensionSystem((length, time), (velocity,), {velocity: {length: 1, time: -1}})
72
+ assert dimsys.can_transf_matrix == eye(2)
73
+
74
+
75
+ def test_is_consistent():
76
+ assert DimensionSystem((length, time)).is_consistent is True
77
+
78
+
79
+ def test_print_dim_base():
80
+ mksa = DimensionSystem(
81
+ (length, time, mass, current),
82
+ (action,),
83
+ {action: {mass: 1, length: 2, time: -1}})
84
+ L, M, T = symbols("L M T")
85
+ assert mksa.print_dim_base(action) == L**2*M/T
86
+
87
+
88
+ def test_dim():
89
+ dimsys = DimensionSystem(
90
+ (length, mass, time),
91
+ (velocity, action),
92
+ {velocity: {length: 1, time: -1},
93
+ action: {mass: 1, length: 2, time: -1}}
94
+ )
95
+ assert dimsys.dim == 3
code/LaDi-RL-old-qwen-cod/LaDi-RL-old-qwen-cod/venv/lib64/python3.10/site-packages/sympy/physics/units/tests/test_prefixes.py ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.core.mul import Mul
2
+ from sympy.core.numbers import Rational
3
+ from sympy.core.singleton import S
4
+ from sympy.core.symbol import (Symbol, symbols)
5
+ from sympy.physics.units import Quantity, length, meter, W
6
+ from sympy.physics.units.prefixes import PREFIXES, Prefix, prefix_unit, kilo, \
7
+ kibi
8
+ from sympy.physics.units.systems import SI
9
+
10
+ x = Symbol('x')
11
+
12
+
13
+ def test_prefix_operations():
14
+ m = PREFIXES['m']
15
+ k = PREFIXES['k']
16
+ M = PREFIXES['M']
17
+
18
+ dodeca = Prefix('dodeca', 'dd', 1, base=12)
19
+
20
+ assert m * k is S.One
21
+ assert m * W == W / 1000
22
+ assert k * k == M
23
+ assert 1 / m == k
24
+ assert k / m == M
25
+
26
+ assert dodeca * dodeca == 144
27
+ assert 1 / dodeca == S.One / 12
28
+ assert k / dodeca == S(1000) / 12
29
+ assert dodeca / dodeca is S.One
30
+
31
+ m = Quantity("fake_meter")
32
+ SI.set_quantity_dimension(m, S.One)
33
+ SI.set_quantity_scale_factor(m, S.One)
34
+
35
+ assert dodeca * m == 12 * m
36
+ assert dodeca / m == 12 / m
37
+
38
+ expr1 = kilo * 3
39
+ assert isinstance(expr1, Mul)
40
+ assert expr1.args == (3, kilo)
41
+
42
+ expr2 = kilo * x
43
+ assert isinstance(expr2, Mul)
44
+ assert expr2.args == (x, kilo)
45
+
46
+ expr3 = kilo / 3
47
+ assert isinstance(expr3, Mul)
48
+ assert expr3.args == (Rational(1, 3), kilo)
49
+ assert expr3.args == (S.One/3, kilo)
50
+
51
+ expr4 = kilo / x
52
+ assert isinstance(expr4, Mul)
53
+ assert expr4.args == (1/x, kilo)
54
+
55
+
56
+ def test_prefix_unit():
57
+ m = Quantity("fake_meter", abbrev="m")
58
+ m.set_global_relative_scale_factor(1, meter)
59
+
60
+ pref = {"m": PREFIXES["m"], "c": PREFIXES["c"], "d": PREFIXES["d"]}
61
+
62
+ q1 = Quantity("millifake_meter", abbrev="mm")
63
+ q2 = Quantity("centifake_meter", abbrev="cm")
64
+ q3 = Quantity("decifake_meter", abbrev="dm")
65
+
66
+ SI.set_quantity_dimension(q1, length)
67
+
68
+ SI.set_quantity_scale_factor(q1, PREFIXES["m"])
69
+ SI.set_quantity_scale_factor(q1, PREFIXES["c"])
70
+ SI.set_quantity_scale_factor(q1, PREFIXES["d"])
71
+
72
+ res = [q1, q2, q3]
73
+
74
+ prefs = prefix_unit(m, pref)
75
+ assert set(prefs) == set(res)
76
+ assert {v.abbrev for v in prefs} == set(symbols("mm,cm,dm"))
77
+
78
+
79
+ def test_bases():
80
+ assert kilo.base == 10
81
+ assert kibi.base == 2
82
+
83
+
84
+ def test_repr():
85
+ assert eval(repr(kilo)) == kilo
86
+ assert eval(repr(kibi)) == kibi