Compare commits

...

6 Commits

Author SHA1 Message Date
nikhitha79
186f0498cb
Merge 8368803dac into f3f32ae3ca 2024-11-21 21:35:12 +05:30
pre-commit-ci[bot]
f3f32ae3ca
[pre-commit.ci] pre-commit autoupdate (#12385)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.7.3 → v0.7.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.7.3...v0.7.4)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-11-18 22:07:12 +01:00
Christian Clauss
e3bd7721c8
validate_filenames.py Shebang python for Windows (#12371) 2024-11-15 14:59:14 +01:00
pre-commit-ci[bot]
e3f3d668be
[pre-commit.ci] pre-commit autoupdate (#12370)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.7.2 → v0.7.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.7.2...v0.7.3)
- [github.com/abravalheri/validate-pyproject: v0.22 → v0.23](https://github.com/abravalheri/validate-pyproject/compare/v0.22...v0.23)

* Update sudoku_solver.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2024-11-11 21:05:50 +01:00
pre-commit-ci[bot]
8368803dac [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-10-30 16:47:29 +00:00
nikhitha79
6f127c6b8d
Create rotational_partition 2024-10-30 22:15:39 +05:30
4 changed files with 37 additions and 4 deletions

View File

@ -16,7 +16,7 @@ repos:
- id: auto-walrus
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.2
rev: v0.7.4
hooks:
- id: ruff
- id: ruff-format
@ -42,7 +42,7 @@ repos:
pass_filenames: false
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.22
rev: v0.23
hooks:
- id: validate-pyproject

View File

@ -172,7 +172,7 @@ def solved(values):
def from_file(filename, sep="\n"):
"Parse a file into a list of strings, separated by sep."
return open(filename).read().strip().split(sep) # noqa: SIM115
return open(filename).read().strip().split(sep)
def random_puzzle(assignments=17):

View File

@ -0,0 +1,33 @@
def rotation_partition_function(moment_of_inertia: float,
temperature: float) -> float:
"""
Calculates the rotational partition
function for linear molecules.
>>> round(rotation_partition_function(1e-46, 300), 4)
5.9275
>>> round(rotation_partition_function(2e-46, 300), 4)
11.855
>>> round(rotation_partition_function(-2e-46, 300), 4)
Traceback (most recent call last):
...
ValueError: Moment of inertia must be positive
>>> round(rotation_partition_function(1e-46, -300), 4)
Traceback (most recent call last):
...
ValueError: Temperature must be positive
"""
if moment_of_inertia <= 0:
raise ValueError("Moment of inertia must be positive")
if temperature <= 0:
raise ValueError("Temperature must be positive")
k_B = 1.380649e-23 # Boltzmann constant
h = 6.62607015e-34 # Planck's constant
return (2 * math.pi * moment_of_inertia * k_B * temperature) / (h ** 2)
if __name__ == "__main__":
import doctest
doctest.testmod(name="rotation_partition_function")

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!python
import os
try: