This is valid:
M = [1,2,3]
for M[0] in range(0,10):
print M[0]
2013-05-14
The star operator opens tuples and other sequences:
# Solution to https://twitter.com/iwontoffendyou/status/1704935240907518367 | |
# Tobin Fricke 2023-09-22 | |
import numpy as np | |
import scipy.optimize | |
def dist_from_circle_center_to_curve(R): | |
# Center of circle of radius R that is tangent to the y axis and the unit circle. | |
x0 = R | |
# Solution to the following puzzle: | |
# Invert three boolean signals Using only two NOT gates, | |
# and as many AND or OR gates as needed, | |
# | |
# Tobin Fricke 2020-09-03 | |
for x in [True, False]: | |
for y in [True, False]: | |
for z in [True, False]: | |
# If we assume that there is only one solution, then, when searching for the input |
#include <stdio.h> | |
#include <stdlib.h> | |
int main(int argc, char **argv) { | |
const int baz = rand(); // ok! | |
baz = 99; // compile-time error. | |
static int goo = rand(); // compile-time error. | |
goo = 99; // ok. |
def exact_sqrt(x): | |
"""Calculate the square root of an arbitrarily large integer. | |
The result of exact_sqrt(x) is a tuple (a, r) such that a**2 + r = x, where | |
a is the largest integer such that a**2 <= x, and r is the "remainder". If | |
x is a perfect square, then r will be zero. | |
The algorithm used is the "long-hand square root" algorithm, as described at | |
http://mathforum.org/library/drmath/view/52656.html |
% Plot the frequency response of an ideal active twin-T notch, versus | |
% bootstrap feedback gain \alpha. | |
% | |
% Tobin Fricke <[email protected]> | |
% 2013-11-21 | |
% Pick the color map (to make the plot pretty) | |
cm = jet(); | |
% Choose the frequency axis |
A PDH error signal can be calibrated (into Hz per volt) simply by | |
observing the peak-to-peak amplitude of the PDH signal as the | |
cavity is swept through resonance. Here's the math: | |
An impedance-matched, lossless cavity has amplitude reflectivity of | |
r_c(f) = i f / (i f + pcav) | |
where pcav is the cavity pole, and f is the detuning frequency (i.e. | |
the difference between the frequency of the light and the resonant |
This is valid:
M = [1,2,3]
for M[0] in range(0,10):
print M[0]
2013-05-14
The star operator opens tuples and other sequences:
% Program to solve a sort of magic square, where only the rows and columns | |
% must sum to the magic constant, and not the diagonals. Some elements of | |
% the square are given in advance while others (indicated with 0) are | |
% unknown. | |
% | |
% TF Time-Wasting Project 04-2013 | |
function result = fu_puzzle | |
puzzle = ... | |
[ 1 0 0 0 22 |
f_mod = 35.5e6 | |
pcav = 300e3 | |
i = {0, 1} | |
conj(z) = real(z) - i*imag(z) | |
r_c(f) = i*f / (i*f + pcav) | |
pdh(f) = imag(r_c(f)*conj(r_c(f+f_mod))-conj(r_c(f))*r_c(f-f_mod)) | |
set samples 501 |