Being the oddball that I am, I decided to think about whether you could do it with magnets. What you want it something like a regular motor/generator, except you have fixed magnets in the rotor and stator. Also in a motor you usually only have three phases, because it gets complicated to do more. Here you don't have that problem. So I designed something with 31 poles acting against 32 teeth so you actually get 992 flux events per rotation. The plates looked something like:
And then when you stack two plates with magnets in between (north up in the rotor, south up on stator), you get something like,Of course after drawing this, I think I'd change it to have 3x31 and 3x32 teeth so the forces would be balanced, and I'd probably make the ends of the teeth 40% or 30% of the spacing instead of 50% like I did initially.
The article goes on to spend a couple pages drawing the conclusion that this is an indication of vaccine hesitancy, and that the country could be in big trouble. Unfortunately they're wrong.
Good journalism should provide its readers/listeners/watchers with perspective. Unfortunately it seems these authors don't have enough themselves.
If I got infected with Covid-19 it could kill me. I'm not really old, and my job is not on the front line, so I wasn't in the first groups eligible. But I'm neither young, nor trim; so I am at risk. Am I spending 20+ hours a day scouring every government waiting list and health organization site trying to get an appointment? No. And understanding why should be what journalists are doing, but they don't seem to be doing it.
People get upset at government when it is not effective. Joe Biden realizes his problems are just beginning with the passage of the relief bill. He now has to mobilize the government to deliver relief effectively. Vaccinating the bulk of the population is also going to require programs that deliver the vaccine effectively, and right now we are not there. Were there people for who infection would have practically been a death sentence? Certainly, and those people were properly motivated to clear herculean barriers to get the cure. For a great many of us though, we're managing the risks, and we'll get vaccinated when processes get sorted out and it becomes accessible to us.
Getting my flu shot last year was a matter of walking into a grocery store one day, wandering by the pharmacy, asking if I could get a flu shot, and then waiting two minutes to get one. That's what effective health care looks like; and so far in this pandemic, we are not there. Unfortunately when it comes to informing the public about the government's efforts on vaccinations, the mainstream media is not there either.
However beautiful the strategy, you should occasionally look at the results.
Americans can always be trusted to do the right thing, once all other possibilities have been exhausted.
Both of these are attributed to Churchill, but as with everything on the internet, YMMV.
sqrt(mean(A .^ 2.)) sqrt(sum(x->x^2, A)/length(A)) norm(A)/sqrt(length(A))The first version is kind of slow (3.5 times slower than the baseline). The second one saves having to generate a temporary copy of the entire array, instead squaring each term one by one as its consumed by sum(), it comes in only four percent slower than the baseline. The third one I expected great things from, as the norm() operation is basically the root of the sum of the squares, but it was actually slower than the other version at thirteen percent over the baseline. So what was the baseline? Well, I wrote it out:
function rms(A) s= 0 @simd for e in A s += e * e end sqrt( s / length(A) ) endThat little bit of magic dust before the for is required, probably to specify that none of the iterations have any dependency on any other, and let the compiler go crazy. I actually wrote this in C as well, using two different styles (tranditional and performant), and while there was a small variation in the timings (one was a smidge faster, and the other a sliver slower), the julia version and the C versions were practically identical for the clang version. The gcc version didn't do as well. But the whole ordeal with compile flags and such is a story for another time. Reference: benchmark_rms.jl Pluto notebook.
Labels: benchmark, julia, performance
using BenchmarkTools using Random using Statistics using LinearAlgebra using Plots A = 2 * rand(10^7) T_bench= @benchmark sqrt(mean(A .^ 2.)) T_bench2= @benchmark sqrt(sum(x->x*x, A)/ length( A )) T_bench3= @benchmark norm(A) / sqrt(length(A)) histogram( T_bench.times )Inlining C code, though the video cut the right edge off and I had to guess at what was missing,
using Libdl C_code = """ #include <stddef.h> #include <math.h> double c_rms(size_t n, double * X) { double s= 0.0 ; for ( size_t i= n ; ( i -- ) ; X ++ ) { s += ( *X * *X ) ; } return sqrt( s / n ) ; } double c_rmse(size_t n, double * X) { double s= 0.0 ; for ( size_t i= 0 ; ( i < n ) ; i ++ ) { s += X[i] * X[i] ; } return sqrt( s / n ) ; } """ const Clib = tempname() open( `gcc -fPIC -O3 -msse3 -xc -shared -ffast-math -o $(Clib * "." * Libdl.dlext) -`, "w" ) do f print(f, C_code) end c_rms( X::Array{Float64}) = ccall((:c_rms, C_lib), Float64, (Csize_t, Ptr{Float64},), length(X), X ) c_rmse( X::Array{Float64}) = ccall((:c_rmse, C_lib), Float64, (Csize_t, Ptr{Float64},), length(X), X ) c_rms( A )And finally, some parallel coding in Julia,
function rms(A) s = zero(eltype(A)) # generic versiion @simd for e in A s += e * e end sqrt( s / length(A) ) endTo try these pluto notebooks out without having to have Julia running locally, there's a Binder transform here, but I think I may eventually setup a pluto instance on my server.
Labels: julia
But beyond that, I had a lot of fun with the explanations of Laplace transforms by Steve Brunton at the University of Washington:
After digging through all his published videos, I found he tought a series of graduate classes in Engineering Mathematics which for some reason is a Mechanical Engineering course, but I didn't let that stop me. I queued up the beginning of the series and got started.
The first two lectures were just review (even for me), and I breezed right through them. The third one was on Taylor series. Now I did Taylor series in college, and never gave them another thought, so it still felt a bit of a review; but then the professor jumped in to Matlab to do some calculations and graphing. I've seen Matlab before, heck I know people that use it, but its never looked fun, and more importantly its a commercial piece of software. Not that there's anything wrong with commercial software, heck that's what I do for a living, but I'm not going to go out and buy Matlab just because I'm watching some videos on the internet. The last time I bumped into this problem, I found there was an open-source version called scilab, but that was more than ten years ago which is forever in computer years. Time to brush up on what's available out there.
Asking the keeper of all knowledge for "matlab alternative free" (the free is both implied and auto-suggested), and it turns out the scilab is still kicking, but that GNU is trying to run it over with Octave. (You would think that open source people would get along better than commercial people, but you would be wrong. Apparently when you're no longer in it for the money, all that's left is honor and glory, and history has taught us that that never ends well.) There are also a couple of python based options, like NumPy and Sage which are wedded to Python grammer. And there's Julia, something nebulous thrown together by MIT.
The path of least resistance probably would have been the clones, as I could copy and paste the examples from the lectures and run them with minimal rework. But when I have bumped into Matlab before, its grammer has always seemed about as close to an actual programming language as PHP; and I just couldn't bring myself to do that. Something Python based would have been practical, since its a very popular dynamic language at work, and used by the ML groups; but I made the mistake of learning Perl earlier in my career, and if you ever read transition guides for perl to python, its a lot of putting the training wheels back on; plus the whitespace sensitive syntax can go wrong in horrible opaque ways (holds up hands to show the scars). So of course I chose Julia.
The example from the ME564 Lecture 3 video was to plot sin(x)
and then plot the partial Taylor expansions of it to the 1st, 2nd, 3rd ... terms.
begin using Plots using TaylorSeries using Random x= -5π/4:.01:5π/4 sin_ish2= Taylor1([0,1,0,-1//(3*2)]) sin_ish3= Taylor1([0,1,0,-1//(3*2),0,1//(5*4*3*2)]) sin_ish4= Taylor1([0,1,0,-1//(3*2),0,1//(5*4*3*2),0,-1//(7*6*5*4*3*2)]) taylors= [ x-> x ## taylor of sin 𝒪(t) x-> sin_ish2( x ) ## taylor of sin 𝒪(t^3) x-> sin_ish3( x ) ## taylor of sin 𝒪(t^5) x-> sin_ish4( x ) ## taylor of sin 𝒪(t^7) ] labels = [ "taylor1" "taylor2" "taylor3" "taylor4" ] pl_= plot( x, x-> sin(x), title= "approximations", label="sine", linewidth= 4) plot!( x, taylors, label= labels ) plot!( x, x-> rand()/2-1/4, label= "noise" ) savefig( pl_, "/tmp/julia_sin.pdf" ) pl_ endThis is run in Pluto, which is a HTML notebook system, kind of like Jupyter; which makes pretty pictures as you go. There's some things I like so far, and things I don't. There's no compact operator for factorial, and since
7*6*5*4*3*2
is shorter than factorial(7)
, I just used that. I used rational representations for the fractions just on a whim, no good reason. And the ability to dump out a PDF as you go is kind of cool.
I threw in the noise there, just because I was cribbing off some examples of scatter plots of random values, and was trying to get an understanding of its use through osmosis. (random(3)
is not a random value between 0 and 3, like it would be in other languages, but is a vector of three random numbers.)
There still seems to be overlap with Matlab syntax, so I'm partially doomed there. My biggest gripe is that I have to call the Taylor1
generator first, and then create a function out of its result (x -> sin_ish2(x))
in taylors as putting the generator call in the function, even if I could figure out how to dereference it, would have it be called for every plot point. There's probably a way, but I didn't get anywhere close to finding it groping through the various getting started examples. I'm probably doing a dis-service to Taylor1
as well, as I really can't tell the difference between that and Poly()
.
I was reading yet another article about the depressing future of open plan offices: Even the Pandemic Can’t Kill the Open-Plan Office (disclaimer citylab is owned by my employer).
And part way down, there was a picture of an open plan office spaced out more, at the Oakland offices of Gensler, an architectural and design firm. What was interesting to me was not the spacing, but chairs pictured.
I am kind of a chair junkie. I owned five or six different kind of Herman Miller chairs I picked up on ebay over the years. Mirra is actually my favorite, and I just can't stand the Envoy though it could be I don't have it adjusted right. Now that all my co-workers are working from home, I've recommended the chairs to them, but like cheap web-cams, they're a little hard to come by at the moment. So I'm always on the lookout for other interesting options.
These chairs in the Gensler office, looked interesting. But what were they?
Several searches on common office supply sites (and the borg of e-commerce, amazon) were useless. They kept circling back to cheap hundred dollar chairs I wouldn't be caught dead in. There's no good way to search for "high end office chair where the arm rests attach to the seat back". I started looking for the most expensive chair I could find, and then search the entire inventory of that online catalog for something that matched. I searched for mesh chairs, task chairs, white chairs, executive chairs, all sorts of combinations of the above and others.
Useless. Hours wasted.
Finally, in frustration I searched for anything that mentioned chairs in regards to that office:
"Gensler Oakland chair"And I got back a breadcrumb:
located in Oakland, California. Gensler's Oakland office is characterized by. ... Haworth Collection by Forest Side Chair · Forest Side ChairNow what I did not realize was that officesnapshots.com where this link came back, had the picture of the chair I was looking at, and was annotated with its name. Instead I focused on the brand mentioned in the quoted text, hoping that the humans at that office were as predictable as most humans were, and if a site carried the Haworth collection, then it might also carry the other chair.
That landed me on modernplanet.com. Under office::task chairs, I started getting pretty close. There were a bunch of chairs from Knoll called regeneration that had what looked like the right back, but the arm rests were wrong. Then near the end of page two (who ever goes past page one on search results?), there it was "Knoll Generation Chair". At a modest price of $635, though when you add all the bells and whistles, its more like $930.
They even have a few on ebay, though the selection of colors is a little limited, and the most interesting one is local pickup in Dallas. Now who do I know that I could bug in Dallas ...
So once again, it comes as no surprise (at least to me) that the internet is terrible at helping you discover things that you didn't know were there. Discovery is a second class citizen. Even tools we had, we've lost. My college library back in the day was modernizing to add the ability to search for books on the mainframe (ya, I'm that old), and one of the features it had was the ability to see what books were next to the one you looked up on the bookshelf. I've never seen that feature since. Part of the wonder of the human brain is its ability to make connections between things, and through sharing those connections, create discovery. We have not even scratched the surface of how technology could support and strengthen that process.
Feb '04
Oops I dropped by satellite.
New Jets create excitement in the air.
The audience is not listening.
Mar '04
Neat chemicals you don't want to mess with.
The Lack of Practise Effect
Apr '04
Scramjets take to the air
Doing dangerous things in the fire.
The Real Way to get a job
May '04
Checking out cool tools (with the kids)
A master geek (Ink Tank flashback)
How to play with your kids