Usage examples: >>> astable_frequency(resistance_1=45, resistance_2=45, capacitance=7) 1523.8095238095239 >>> astable_frequency(resistance_1=356, resistance_2=234, capacitance=976) 1.7905459175553078 >>> astable_frequency(resistance_1=2, resistance_2=-1, capacitance=2) T
(
resistance_1: float, resistance_2: float, capacitance: float
)
| 24 | |
| 25 | |
| 26 | def astable_frequency( |
| 27 | resistance_1: float, resistance_2: float, capacitance: float |
| 28 | ) -> float: |
| 29 | """ |
| 30 | Usage examples: |
| 31 | >>> astable_frequency(resistance_1=45, resistance_2=45, capacitance=7) |
| 32 | 1523.8095238095239 |
| 33 | >>> astable_frequency(resistance_1=356, resistance_2=234, capacitance=976) |
| 34 | 1.7905459175553078 |
| 35 | >>> astable_frequency(resistance_1=2, resistance_2=-1, capacitance=2) |
| 36 | Traceback (most recent call last): |
| 37 | ... |
| 38 | ValueError: All values must be positive |
| 39 | >>> astable_frequency(resistance_1=45, resistance_2=45, capacitance=0) |
| 40 | Traceback (most recent call last): |
| 41 | ... |
| 42 | ValueError: All values must be positive |
| 43 | """ |
| 44 | |
| 45 | if resistance_1 <= 0 or resistance_2 <= 0 or capacitance <= 0: |
| 46 | raise ValueError("All values must be positive") |
| 47 | return (1.44 / ((resistance_1 + 2 * resistance_2) * capacitance)) * 10**6 |
| 48 | |
| 49 | |
| 50 | def astable_duty_cycle(resistance_1: float, resistance_2: float) -> float: |
nothing calls this directly
no outgoing calls
no test coverage detected