Thursday, October 31, 2019

Texas Instruments’ Speak and Spell

Texas Instruments’ Speak & Spell
Photo: SSPL/Getty Images
Proto-Digital Signal Processor: Texas Instruments’ Speak & Spell prompted its user to spell a word by synthesizing the sound of the word. The user would then try to spell the word using the small keyboard. The original model, released in 1978, had a jazzy blue vacuum fluorescent display and ran on four “C” cells.

Before the Speak & Spell was introduced, hardly anybody other than the four engineers who developed it thought it should be introduced. Texas Instruments management saw little value in the project. When the four described it to one of the nation’s top experts in spelling education, he essentially advised them to kill it. When they test-marketed it, parents were dismissive.

But Paul Breedlove, Gene Frantz, Larry Brantingham, and Richard Wiggins were having fun building it, and didn’t want to stop. They somehow forgot to mention to TI management that they had encountered surprising antipathy to the idea, even where one might have expected warm endorsement. Fortunately for them, though, it just so happened the Speak & Spell was the only consumer-targeted project at TI at that particular moment that was within its budget (two of the others were a CB radio and a home computer).

Well, almost within budget. In an interview, Frantz recalls that it’s just possible the team may have neglected to properly expense a few things to keep the official cost tally low. But these things happen, don’t they?

The basic idea for an educational spelling toy was Breedlove’s. Breedlove just happened to have been in several right places, all at the right times.

Breedlove and Frantz had participated in the development of Little Professor, a calculator-with-a-twist that TI introduced in 1976. Educators at the time considered the use of calculators in the classroom to be cheating. TI, then and now one of the world’s biggest makers of calculators, tried to get over that objection and crack the education market by creating a calculator that presented equations lacking their solutions; students had three chances to type in the correct answer.

Breedlove also had a daughter who was learning to spell, and it occurred to him that there was a basic similarity between teaching math and teaching spelling. With math, you present an equation and the student has to solve it; with spelling, you enunciate a word and the student has to spell it. A spelling toy would differ in that the words would have to be spoken aloud. That would obviously require technology that converted stored words to audible speech. Such technology did exist then, but it was costly and would have made any product in which it was used far too expensive for the consumer market.

But Breedlove, who had recently done a stint in TI’s speech-research lab, knew that workers in that lab, and probably elsewhere, were on the verge of creating affordable speech-synthesis tech. Even so, there was yet another hurdle, which was that the speech-synthesis capabilities for this spelling toy would require an amount of memory then considered ridiculous.

He didn’t let it deter him. Instead, he started assembling a team by recruiting Frantz to be the system designer. Breedlove knew Wiggins from the speech-processing lab; conveniently, Wiggins was between projects. Wiggins was good friends with Brantingham, an IC architect, and suggested him for the team. Breedlove then went to TI management to get funding.

They were never going to get funding from the regular R&D budget, Frantz explains, because the risk for the proposed product was too high and the potential return was too low. But TI had a second source of funding for “wild hair” ideas. Alas, the spelling device was too risky for even that. The last-resort option was something called the idea program. All you had to do was convince a senior TI technologist to back it. Breedlove found such a person to sign off on his proposal, and the team got US $25,000 to work with (roughly $100,000 in 2019 dollars).

The Speak & Spell designers: [from left] Gene Frantz, Richard Wiggins, Paul Breedlove, and Larry Brantingham.
Photo: Gene Frantz/Texas Instruments
Toy Story: The Speak & Spell was designed by [from left] Gene Frantz, Richard Wiggins, Paul Breedlove, and Larry Brantingham.

They started work in early 1977. Their design called for three new chips: a controller, “huge” ROMs, and a single-chip speech synthesizer, which did not then exist. Initially designated TMC0281, the synthesizer chip would be the world’s first.

The Speak & Spell would ultimately incorporate a pair of 128-kilobit ROM chips. The state of the art at the time was 16 kb.

The synthesizer was based on a technique for coding speech called linear predictive coding (LPC). LPC let the device generate the speech signal for an entire word from a relatively small amount of data, much smaller than what would have been required to simply store digitized recordings of the words themselves. The idea to use LPC, which was cutting edge at the time, came from Wiggins, whose specialty was voice-processing algorithms, and who held a doctorate in applied math from Harvard and had previously worked at the Mitre Corp. Wiggins was acquainted with some of the pioneers of LPC, which was then starting to find commercial applications after being developed in the 1960s at Bell Labs in New Jersey, and at Nagoya University and NTT in Japan.

The synthesizer chip ran digital signal processing logic, although it was not itself a DSP. Wiggins and Brantingham specified and designed the chip entirely by themselves and without any approvals from anyone, according to Frantz. TI management had neglected to fit the project into any particular reporting structure, and that suited the four team members just fine. In Frantz’s estimation, the lack of “help” from management gave Wiggins and Brantingham the freedom they needed to figure out a successful design. “They made the appropriate compromises to get that puppy to work,” Frantz says.

The team also had a choice of process technologies. In addition to complementary metal-oxide-semiconductor (CMOS) technology, its predecessors were available. Negative-channel metal-oxide semiconductor (NMOS) was still widely used in those days. Much less common, and much less fast, was positive-channel metal-oxide semiconductor (PMOS).

“NMOS was high-performance at the time,” Frantz explains. “We did it in PMOS, which was…not high-performance. So we not only designed the first speech-synthesis device, we did it in the worst technology you could pick. And the reason for that was if you were doing a consumer product, you couldn’t afford NMOS.” The ROMs were done in PMOS as well.

When the Speak & Spell hit the market in 1978, it was instantly popular with the only constituency that really mattered—kids. And it appeared to be an effective means of helping youngsters learn to spell. Most important, the Speak & Spell was instrumental in overcoming the resistance to using electronic devices in education.

Texas Instruments wouldn’t produce its first digital signal processor chip for another five years, in 1983. But the implementation of DSP logic in the Speak & Spell was such an important breakthrough that the toy was designated an IEEE Milestone in 2009. It also helped launch TI toward a leadership position in DSP that the company continues to hold more than four decades later.



from Hacker News https://ift.tt/2WvDulF

Million Short


At Million Short, we are committed to designing innovative technology to redefine internet search. In creating a differentiated search, we aim to provide alternative methods for organizing, accessing, and discovering the vast web of information on the Internet.

Million Short started out as an experimental web search engine that allows you to filter and refine your search results set. The thinking was that web searches yield the same popular sites. Million Short makes it easy to discover sites that just don't make it to the top of the search engine results for whatever reason – whether it be poor SEO, new site, small marketing budget, or competitive keywords. The Million Short technology gives users access to the wealth of untapped information on the web.

Fast forward to today, Million Short has made numerous updates to the engine, including international support, mobile and tablet optimization, browser search extensions and design updates. Our team is comprised of individuals who are dedicated to growing and powering the discovery of information for the world. Million Short is designed in Canada - our dedicated team works out of our head office in the heart of Toronto and continues to improve the way in which we search for information.



from Hacker News https://ift.tt/1TDyyAK

Lack of cdnjs activity


Join GitHub today

GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

Sign up
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lack of cdnjs activity #13524

Comments

This was referenced Oct 23, 2019

This was referenced Oct 28, 2019

kevin-brown

added a commit to select2/select2 that referenced this issue

Oct 31, 2019
This is needed until cdnjs figures out their future in cdnjs/cdnjs#13524. Until then, we will just reference their existence and promote jsDelivr to the primary source.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.


from Hacker News https://ift.tt/2C3cK2e

Woof, Woof


The journalism with which he made his name took essentially the same approach. Standing head on to a subject and giving it ‘a good wiggle’, regardless of the consequences, became his stock in trade. Many journalists are fearless in the pursuit of truth, but Waugh was not, for the most part, a campaigning or a political writer. He thought there was ‘nothing so ridiculous’ as the posturing of journalists who saw themselves as part of a ‘sane and pragmatic’ political process. His attitude to truth is best described as dynamic. In the aftermath of the shooting, he recounted, his corporal of horse, Chudleigh, ‘a tough Bristolian’, had looked at him so solemnly ‘that I could not resist the temptation to say: “Kiss me, Chudleigh.”’ Having failed to get the historical reference, Chudleigh treated him ‘with some caution’ thereafter. Chudleigh himself denied the exchange had ever taken place and Waugh concludes: ‘I have told the story so often now that I honestly can’t remember whether it started life as a lie.’ The ability to blend truth with invention on a sliding scale from the plausible to the surreal was the key to Auberon Waugh’s Diary, a column that ran in Private Eye from 1972 until 1985, which he regarded as his greatest achievement, and in which he claimed, with justice, to have invented a new form, ‘a work of pure fantasy, except that the characters in it were real’.

Affecting the persona of a grand country landowner with friends at court and exaggeratedly Edwardian views, Waugh responded to topical events. At one moment, he was in anxious consultation with the queen about the difficulty of finding a second husband for Princess Margaret and at another accompanying Idi Amin on the viola, enjoying his ‘light tenor’ in a selection of parlour ballads. The atmosphere of the Diary cast an aura of wild improbability over even such presumably real events as a press reception for the English Country Cheese Council. Learning that George Best is for sale for £200,000, he toys with the idea of using a recent legacy to buy him as ‘a companion on my occasional visits to the night club scene of our metropolis’, but reflecting that Best has a reputation for being ‘rather off-hand’ with his employers and speaking with an impenetrable accent, he decides to buy ‘a little Filipino servant instead’. There was no cage Waugh would not rattle. Sometimes it was just for fun. He could be, as his former colleague Max Hastings put it, ‘manically mischievous’. At others he would make a point with Swiftian savagery, as in July 1977 when the Gay News trial came to court. Mary Whitehouse, the campaigner against the ‘permissive society’, had brought a private prosecution against the magazine on a charge of blasphemous libel because of a poem by James Kirkup it had published which described Jesus having sex with a variety of men, including Pontius Pilate. John Mortimer and Geoffrey Robertson appeared for the defence, but lost. Gay News was fined and its publisher given a suspended prison sentence. ‘I have an open mind about queer-bashing,’ Waugh’s diary reflected, ‘from one point of view it seems rather cruel … I simply don’t know.’ ‘But,’ he concluded, ‘if it has to be done, it should be done properly on Wimbledon Common and not in an underhand way at the Old Bailey.’

The diary was a theatre of the absurd which Waugh occasionally took on tour in a kind of performance journalism, most notably during the 1979 general election. This was part of his ‘oblique, crablike’ pursuit of Jeremy Thorpe, the former leader of the Liberal Party. Allegations that Thorpe had hired a hit man to dispose of his former lover Norman Scott had been cropping up since 1975, nowhere more persistently than in Private Eye. Thorpe had used his influence and the libel laws to avoid prosecution, and Waugh felt the press had been craven. In 1977 Andrew Newton, the comically incompetent hit man who had missed Scott but killed his dog, Rinka, was released from prison and started hawking his story round the papers. Thorpe, as anxious to deny his homosexuality as the charge of attempted murder, set out to square the press. The diary reported:

To New Scotland Yard where Jeremy Thorpe has called a press conference to discuss various allegations that have been made about his sex life. I have many interesting new allegations to make, but they throw me out at the door.

When all the weeping toadies are assembled, only one of them dares to ask him whether he has ever done it. Mr Keith Graves, of BBC TV, who is hereby given the Gnome Award for News Reporter of the Year, has been vilified by every prig and pharisee in Fleet Street for asking the only worthwhile question.

Poor Jeremy. He is his own worst enemy, but with friends like these he really has no need of himself. The only remaining mystery is why the Liberal Party policy committee decided to murder Scott rather than Jeremy.

The next year Thorpe was charged with conspiracy to murder and was awaiting trial at the time of the 1979 election. Waugh was infuriated by the way the ‘savage’ British libel laws, a minefield through which he was obliged to tiptoe, could be manipulated ‘as a convenience for the rich and powerful to save themselves from criticism’. Richard Ingrams, then editor of Private Eye, suggested that, since he felt so strongly, Waugh might stand for Parliament himself. It’s possible Ingrams was joking, but Waugh took up the suggestion and ran in Thorpe’s North Devon constituency for the Dog Lovers’ Party, campaign slogan: ‘Rinka is not forgotten. Rinka lives. Woof, woof.’ Before Thorpe’s lawyers could get an injunction, the Dog Lovers’ manifesto was printed in the Spectator and the Guardian. It argued that while Thorpe should be considered innocent unless proved guilty, for a man ‘publicly accused of crimes which would bring him the cordial dislike of all right-minded citizens and dog lovers’ to be hailed as ‘a hero’ and applauded by the Liberal Party at its Conference was ‘disgusting’. The manifesto was duly banned and Thorpe’s barrister, George Carman QC, an old antagonist of the Eye, brought a charge of attempting to pervert the course of justice against Waugh, which was upheld on appeal by Lord Denning.

This prevented Waugh from campaigning, but he still won 79 votes. He noted that allegations of attempted murder were not enough to cause more than five thousand Liberal voters to abandon their loyalty to the party. He found this shocking. There was something in Waugh of Molière’s misanthrope, Alceste, a savagery of disillusionment that came from having once believed better of humanity. Waugh had stood for Parliament before, in 1969, in a bid to draw attention to the Biafran famine. He had been to Biafra and seen for himself the effects of the blockade by the Nigerian federal government (Biafra had declared independence from Nigeria), supported by the British. With the South African activist Suzanne Cronjé, he published Biafra, Britain’s Shame, made a speaking tour of universities and attended rallies in Trafalgar Square. It was a role that ‘did not come easily’, as he admitted, but he thought that if people knew the truth they would change their minds. His election meetings were thinly attended, then Biafra collapsed and the cause was dead. It was Waugh’s only attempt to take up a public cause, ‘with all the pomposity and self-importance’ required, and it convinced him of ‘the fatuity of politics’ and the ‘wickedness of politicians’, who were prepared to commit any atrocity in the pursuit of power ‘if they think they can get away with it’. With the Thorpe campaign he repeated historic tragedy as satirical farce. It’s unclear to what extent his scepticism was the cause or the consequence of his decision in later life to abandon the Catholic faith in which he had been brought up. Musing in the Literary Review in July 1998 about the rodomontade of book festivals, he wrote: ‘It would be absurd to describe such pleasant occasions as a waste of time. Is anything a waste of time, in the perspective of a godless eternity?’

It is these editorials, written ‘From the Pulpit’ during his editorship of the Literary Review from 1986 until his death, which form the most useful part of Naim Attallah’s ‘celebration’. As a survey of Waugh’s career this collection is less balanced than William Cook’s anthology of 2010, Kiss Me, Chudleigh, the World According to Auberon Waugh. Attallah, who is chairman of Quartet Books and who bankrolled the Review and Ingrams’s magazine the Oldie for many years, is not unreasonably concerned to focus on his own relationship with Waugh and through him on the last days of the Soho world of Grub Street scribblers. Attallah’s own standing as an author has been somewhat ambiguous since 2004, when Jennie Erdal’s memoir, Ghosting, explained that she had written many of Attallah’s books and much of his journalism. Neither she nor Attallah seems to have been resentful about the relationship, and it seems, reading this book, that he is now so used to having his writing done for him he is unperturbed by the fact that his own supposed ‘commentary’ often refers to him in the third person. It is almost as if he has not only not written it, he hasn’t read it either. This, and the absence of any notes to clarify contemporary references, make the book somewhat baffling at first, but it comes in time to seem the sort of absurdist format that Waugh would probably have enjoyed.

*

In his time as a columnist he wrote for many papers, from the Catholic Herald to the Daily Mail, by way of the Spectator, the New Statesman and the Daily and Sunday Telegraphs. The Private Eye diary, however, saw him at his best. Nobody but Ingrams, as Waugh acknowledged, would have published it and taken the attendant crossfire, certainly not for 14 years. The end came in 1986. Waugh was the victim of a practical joke after his friend Henry Porter, who was working on the Sunday Times, sent him a letter apparently from Claire Tomalin, the paper’s literary editor, asking him to review Mae West Is Dead, Adam Mars-Jones’s selection of lesbian and gay fiction, adding that she would ‘expect a generous piece’. Waugh duly relayed this breach of professional etiquette to readers of the diary, whereupon Tomalin had no alternative but to sue. To Waugh’s disappointment, Ingrams was minded to accept an out of court settlement. Waugh made vigorous attempts to inflame the situation, giving it ‘a good wiggle’ with a number of articles in the Spectator which he hoped would lead to a charge of contempt of court, but to no avail. The anti-climax left him depressed. ‘If all libels were to be settled by large sums of money out of court, what joy was there in writing them?’ Two months later he resigned. At his farewell lunch he was upstaged by Ingrams, who announced his own retirement to cries of dismay all round, except from the ‘small young man called Ian Hislop’ who sat ‘tight-lipped’ as Waugh begged Ingrams to stay. After lunch Waugh walked round the corner to the offices of the Literary Review and took up his last job.

The Literary Review began life forty years ago, along with the LRB and Quarto, with which the Literary Review later merged, during the Times lockout, which meant that the TLS was not published for a year. This created a vacuum into which hopeful new magazines flooded. My first job was on Quarto where I worked for the editor, Craig Raine, on the Alice principle, that he was one and I was all the rest. I remember the literary scene Attallah recalls, a world of long lunches, overflowing ashtrays and the regular run to Gaston’s, the depot where pristine review copies were somewhat furtively exchanged for hard cash to be spent later at L’Escargot. By 1986 that world was dying, indeed its death had been pronounced repeatedly for at least twenty years by Soho habitués from Quentin Crisp to Jeffrey Bernard. At the root of the perhaps unlikely friendship between Waugh and Attallah was a commitment to keeping up the old ways. The offices were cramped and editorial work was done amid chain-smoking, bridge playing and heavy drinking, which was not confined to the men. These fledgling papers employed young people, notably young women, in proper, if badly paid jobs. From the Literary Review Waugh helped to launch the careers of arts journalists including Laura Cumming and Kate Kellaway, and the poet Carol Rumens. Members of staff at a particularly low financial ebb might be put up rent free in his flat.

The Academy Club, which Attallah founded at Waugh’s request in the tiny basement of the Literary Review’s offices, was a place for more drinking and talking. There was an erratically enforced ‘no poets’ rule, because Waugh claimed that poets talked about nothing but themselves and never paid for their drinks. It was the poetry itself, however, that he really couldn’t stand. ‘Free verse’ was one of his bêtes noires. It was in the spirit of the Review that while Waugh complained in his column about the unsolicited poems that arrived by every post, he acknowledged that the poetry editor, Rumens, ‘on whom the task of reading all this drivel falls’, took a different view. Thus, while she selected poems to go in the magazine, Waugh attempted to encourage the sort of verse he preferred with a regular competition. Entries were to be in a traditional form, such as haikus or terze rime. His conception of the role of editor extended to the active discouragement of certain kinds of writing, hence his invention of the Bad Sex Prize, which still flourishes, and was meant for the ‘admonishment and guidance’ of novelists. The actual prize went to the reader who sent in ‘the most remarkable example of bad sexual description taken from any novel published this year’, while the award was presented at an elaborate ceremony featuring readings from the unlucky winner’s efforts. Recipients have included Rachel Johnson and Melvyn Bragg.

At the Literary Review Waugh held up a distorting mirror to the literary world. Some of his scepticism must have been a product of his relationship with his father. Geoffrey Wheatcroft noted that as he grew older Waugh ‘became more candid about his father, until in his memoir Will This Do? (1991) he admitted that he had been starved of affection as a child’. Wheatcroft suggests that this may have informed his ‘savage public personality, by contrast with a private man who … was genial and generous’. Perhaps. Waugh exhibited that mixture of pride and resentment towards ‘Evelyn Waugh’, as he referred to him, that the sons of overpowering fathers often feel. At the same time, he may simply have inherited his father’s vituperative streak. He was relentless in pursuit of vendettas, one of the most successful of which was the campaign against Anthony Powell, which offered scope for every element of Waugh’s mixed feelings about literary life. He objected to Powell’s ‘abominable’ prose, to his pretentiousness in insisting that his name be pronounced ‘Pole’ because of his supposed descent from a 12th-century Welsh king, and to the fact that Powell thought the 12-volume Dance to the Music of Time was on a par with the novels of Evelyn Waugh. After years of mutual antagonism, the feud came to a spectacular climax in 1990 when Powell published a collection of his reviews, many of them from the Telegraph, where he was lead reviewer. Exactly how and why that paper’s literary editor, Nicholas Shakespeare, came to send Powell’s Miscellaneous Verdicts: Writings on Writers to Waugh remains obscure. As recently as January last year Shakespeare was still trying to explain the course of events in the Spectator. Waugh’s review, which he insisted was a ‘good-natured’ bit of fun, was precisely calibrated to hit all of Powell’s many tender spots, from his snobbery – ‘the fortnightly lead review by Anthony Powell has become an institution for which I can think of practically no equivalent in the whole field of British publishing, unless perhaps the excellent Jennifer’s Diary in … Harper’s & Queen’ – to ‘the wonderfully recycled source of his literary style’ and his lack of humour. Hell broke loose on a scale beyond Waugh’s wildest hopes. Powell resigned from the Telegraph, Shakespeare was ‘allowed to leave’, and, to make up for the offence it had caused, the newspaper took the extraordinary step of commissioning a bust of Powell to go in its offices. Waugh wondered if that was entirely wise: ‘people are often sensitive about these things.’

Not all of his campaigns were so funny or so fair. Powell was himself a great bearer of grudges and should have been able to take it on the chin, but Waugh was capable of turning on anyone, including his friends. Choosing Will This Do? as his Sunday Telegraph Christmas book choice, Kingsley Amis wrote: ‘Despite the known dangers of mentioning this person, even favourably, I nominate Auberon Waugh’s volume of autobiography … It is not the most agreeable nor certainly the most edifying of reads, and now and then it portrays the author in an even worse light than he perceives, but it is unusually entertaining.’ That Waugh lacked insight, an ability to calibrate his behaviour even approximately on a conventional moral scale, was a shrewd observation. In his ODNB essay on him, Wheatcroft refers to Waugh’s ‘fatal facility’. Early in his career he dashed off five unremarkable novels before giving up fiction. He later wished he had spent more time on them, but writers are like runners, and for Waugh it was the 100 yard dash of the column, not the marathon of the novel, that brought out his peculiar talent. His journalism was written too fast to be filtered and it was accordingly contradictory, impulsive, sometimes regrettable, seldom regretted.

Despite his fragile health, his death when it came in January 2001 was unexpected. His friends and colleagues were devastated, his enemies rejoiced. Two days later the Guardian published a piece by Polly Toynbee denouncing Waugh as one of the ‘reactionary fogeys’ whose icon was Evelyn Waugh. ‘Effete, drunken, snobbish, sneering, racist and sexist’, he was a writer of ‘limited vocabulary’ whose work was ‘empty and destructive’. Eighteen years later the article is remarkable for its prescience on some points and its obtuseness on others. Toynbee was wrong about Waugh’s writing, his personal style and his view of his father. He had long since described the Brideshead fantasy of ‘some sort of norm or state of grace from which a bad world had fallen’ as ‘dangerous nonsense’. She had no ear for his irony and seems to have mistaken the persona of Auberon Waugh’s Diary for the man. As two of the best-known journalists of the day, Toynbee and Waugh epitomised everything the other most disliked. Toynbee’s was the political journalism of an intellectual aristocracy Waugh thought pompous and pointless. His was the sceptical black comedy of the columnist, which she considered reckless and damaging. She exempted him, however, from her principal objection to his set:

This coterie has led the spirit of anti-Europeanism that pervades Tory Party and country. Christopher Booker, Richard Ingrams and the rest posit a brave little England of crusty country-living upper-class eccentrics versus the dread (another of their words) bureaucracy of Brussels … Don’t imagine that the breed is dying out. Boris Johnson, editor of the Spectator, is only 36, a writer of just this humorous stamp, with mannerisms to match. The fact that the obits proclaim Waugh ‘the most courteous and loveable of friends’, or that Boris Johnson is also a charming and affable fellow, is neither here nor there.

As their political careers demonstrate, Waugh and Johnson were opposites. Johnson wanted power, Waugh distrusted power, wanted to subvert it, and believed that the best form of subversion was flippancy. By the time he wrote Will This Do? flippancy was under increasing pressure from political correctness, the libel laws and an increased social anxiety about causing offence. ‘I am mildly surprised,’ he wrote, ‘that I am still allowed to exist.’ For an indication of what his diary might have said today here is the entry for 2 July 1982:

Nearly 2000 readers have written to ask my advice on whether or not Prince William of Wales should be circumcised. It is not an easy question … It all depends on what sort of a monarchy people want … I feel it should be made the subject of a national plebiscite, like the Common Market referendum. We have to think of something to keep us amused now the Falklands are over.



from Hacker News https://ift.tt/2Pug5PW

Sunset Geometry (2016)

12 Dec 2016

Robert Vanderbei has written a beautiful series of articles and talks about a method for finding the radius of the earth based on a single photograph of a sunset over a large, calm lake.

Vanderbei’s analysis is an elegant and subtle exercise in classical trigonometry. In this post, I would like to present an alternative analysis in a different language: Geometric Algebra. I believe that geometric algebra is a more powerful system for formulating and solving trigonometry problems than the classical “lengths and angles” approach, and it deserves to be better known. Vanderbei’s sunset problem is simple to understand and challenging to solve, so it makes a nice benchmark.

Here’s Vanderbei’s sunset problem. If the earth was flat, photographs of the sun setting over water would look like this:

Notice that the reflection dips just as far below the horizon as the sun peaks above it.

Actual photographs of the sun setting over calm water (like Vanderbei’sUpdate: I should have been more careful to note that most photographs of sunsets over water actually don’t look like Vanderbei’s photograph (or my diagram) because of waves and atmospheric effects, and that sensor saturation artifacts make it hard to interpret images like this. Reproducing Vanderbei’s image may be somewhere between hard and impossible. More Below.) look more like this:

Round earth sunset diagram

Notice the shortened reflection. This happens because of the curvature of the earth, and by measuring the size of this effect, it is possible to infer the ratio of the earth’s radius to the camera’s height above the waterThe main virtue of Vanderbei’s method is that the evidence is so directly visual (and that you can collect it with a smart phone on vacation). If you want to make a simpler and better measurement with a similar flavor, climb a mountain and use an astrolabe; the math is simpler and the measurement will be more accurate..

Vanderbei calls the angle of the sun above the horizon \alpha, and the angle of the sun’s reflection below the horizon \beta. With geometric algebra at our disposal, it’s often algebraically simpler to work with unit directions than angles, so I will also label unit directions from the camera to the top of the sun, s, the horizon, t, and the bottom of the sun’s reflection from the water, w.

To analyze this problem, it’s helpful to consider a side view:

There are two important triangles in this diagram: the triangle formed by the center of the earth, the camera, and the horizon (drawn in red), and the triangle formed by the center of the earth, the camera, and the reflection point where the top of the sun reflects off the water (drawn in green).

The triangle equations

Triangles have a very simple algebraic representation in terms of vectorsIn this post, I am following the common geometric algebra convention of writing vectors as plain, lower-case letters, and using Greek letters for scalars. This takes a little getting used to if you are accustomed to bold face or over-arrows for vectors, but skipping all the decorations makes it simpler to work with lots of vectors.:

\begin{aligned} r_1 - d_1 = p \\ r_2 - d_2 = p \end{aligned}

These simple sums of vectors subsume all the information about the relationships of lengths and angles that is expressed in classical trigonometry through “soh-cah-toa”, the triangle postulate (sum of interior angles is 180 degrees), the Pythagorean theorem, and the laws of cosines and sines. Quite an improvement.

It will be useful to re-express d_1 and d_2 in terms of the unit directions defined previously in order to relate other vectors to known directions:

(1a)

r_1 - |d_1|t = p

(1b)

r_2 - |d_2|w = p

In other words, d_1 is directed toward the horizon, and d_2 is directed toward the bottom of the reflection from the water.

Besides these triangles, there are a few salient geometric facts:

The horizon condition

The line of sight to the horizon is tangent to the earth at the horizon, and is therefore perpendicular to the radius of the earth through the horizon.

(2)

r_1 \cdot d_1 = r_1 \cdot t = 0

The reflection condition

In terms of angles, this is expressed as “angle of incidence equals angle of reflection”. In terms of vectors, it can be restated as

r_2 \cdot s = - r_2 \cdot w

or

(3)

r_2 \cdot (s + w) = 0

Known lengths

We know the lengths of some of these vectors in terms of the earth’s radius, \rho, and the height of the camera above the shoreline, \delta,

(4a)

r_1^2 = r_2^2 = \rho^2

(4b)

p^2 = (\rho + \delta)^2

(4c)

s^2 = w^2 = t^2 = 1

Squaring both sides of the first triangle equation (1a), and using the horizon condition (2) (or equivalently, using the Pythagorean theorem) also allows finding the length of d_1:

(4d)

d_1^2 = p^2 - r_1^2 = (\rho + \delta)^2 - \rho^2

Equations (1-4) contain all of the geometrical informationI assumed one other important piece of geometrical information by writting “s” in two places on the side-view diagram. This corresponds to the (excellent) approximation that the sun is very far away compared to other lengths. needed to solve algebraically for the Earth’s radius, \rho, in terms of the given angles/directions (\alpha and \beta, or s, w, and t) and the height of the camera above the shoreline, \delta.

Introducing Geometric Algebra

So far, I have formulated everything in terms of vector algebra that should look familiar to students of physics or engineering (Gibbs vector algebra). To actually solve the equations, I will use a few additional notions from geometric algebra.

Geometric algebra is the answer to the question “what if I could multiply and divide by vectors?” It introduces a new associative (but non-commutative) invertible product between vectors: the geometric product. The geometric product between vectors a and b is simply written ab. The geometric product of a vector with itself equals a scalar (the square of the length of the vector),

aa = a^2 = |a|^2

This fact, combined with associativity and the other familiar rules for multiplication, is enough to define the geometric product uniquely.

The symmetric and anti-symmetric parts of the geometric product have important geometric meaning, and are traditionally given their own special symbolsPhysicists may be mystified to realize that, based on this definition of the geometric product, parallel vectors commute, and perpendicular vectors anti-commute. What else does that remind you of?:

\begin{aligned} (ab + ba)/2 & = a \cdot b = b \cdot a \\ (ab - ba)/2 & = a \wedge b = - b \wedge a \end{aligned}

I will assume that the dot product, a \cdot b, is familiar: it is related to the projection of one vector onto another, and proportional to the cosine of the angle between them.

The wedge product, a \wedge b, is probably only familiar if you have studied differential forms (or geometric algebra, of course), but it is very similar to the more familiar cross product, a \times b. It represents the directed area of the parallelogram spanned by two vectors, and is proportional to the sine of the angle between themAnti-symmetry and bi-linearity are exactly what is needed to represent area: a vector spans no area with itself (anti-symmetry), and the area of a parallelogram scales linearly with the lengths of each of its legs (bi-linearity).

The wedge product is extremely useful in linear algebra because it represents linear subspaces spanned by any number of vectors in a way that can be manipulated algebraically.
. Whereas the cross product represents directed area by a vector orthogonal to the area (a trick that works only in 3 dimensions), the wedge product represents a directed area by a different kind of object called a "bivector." The wedge product is associative (like the geometric product, but unlike the cross or dot products), and the wedge product of more than two vectors builds objects of higher "grades." The wedge product between 3 vectors is a trivector representing a directed volume (of the parallelepiped spanned by them), and the wedge product between k different vectors is a k-vector representing a directed k-dimensional volume (which is always zero in spaces of dimension less than k).

We can turn these definitions around to write the geometric product in terms of the dot and wedge products,

ab = a \cdot b + a \wedge b = \left\langle a b \right\rangle_0 + \left\langle a b \right\rangle_2

where \left\langle a b \right\rangle_0 and \left\langle a b \right\rangle_2 are notations for “the scalar part” and “the bivector part”.

There is a strange thing about this object: it represents the sum of two different “kinds of things,” a scalar and a bivector. But this should be no more troubling than the fact that a complex number represents the sum of a “real number” and an “imaginary number,” (in fact, there is an extremely close relationship between complex numbers and the geometric product of two vectors). With experience, it becomes clear that a sum of a scalar and a bivector is exactly what is needed to represent the product of two vectors in an associative, invertible way.

The geometric product gives us two new super powers when working with vector equations:

Solving equations involving products of vectors.

Given an equation for two different products of vectors

ab = cd

if b is known, we can solve for a by right-multiplying by b^{-1} (i.e. dividing by b).

a = cdb^{-1}

b^{-1} is well-defined by demanding

bb^{-1} = 1

left-multiplying by b

b^2 b^{-1} = b

and dividing through by the scalar b^2

b^{-1} = \frac{b}{b^2}

Contrast this to the dot product and the cross/wedge product. In general, even when b is known, it is not possible to uniquely solve any one of the following equations for a.

\begin{aligned} a \cdot b & = c \cdot d \\ a \wedge b & = c \wedge d \\ a \times b & = c \times d \end{aligned}

The first equation only determines the part of a that is parallel to b, and the second two equations only determine the part of a that is perpendicular to b. You need both of these to solve for all of a, and that’s what the single geometric product gives you.

Transitive relationships between vectors

It frequently occurs that we know the relationships of two vectors a and b to a third vector c, and we would like to use this information to determine the relationship between a and b. Algebraically, we can take the unknown product

ab

and insert the identity

cc^{-1} = \frac{cc}{|c|^2} = 1

between the factors and re-associate

ab = a \left(cc^{-1}\right) b = \left(a c\right) \left(c^{-1} b\right) = \frac{1}{|c|^2}(ac)(cb)

thus re-expressing the unknown product ab in terms of the known products products ac and cb.

Because cc^{-1} = 1, we can insert it anywhere that it’s convenient in any product of vectors. This has the same practical effect as resolving vectors into parts parallel and perpendicular to c. This is an example of a very general technique that shows up in many forms throughout mathematics: inserting an identity to resolve a product into simpler pieces.

We will use this trick twice below at a critical moment in solving the sunset problem.

Reformulating the horizon and reflection conditions

In order to make efficient use of geometric algebra’s tools, it is useful to reformulate equations (2) and (3) (the horizon and reflection conditions) in terms of the geometric product instead of the dot product.

Horizon condition

Consider the geometric product

r_1 t = r_1 \cdot t + r_1 \wedge t = r_1 \wedge t

where the first equality is an expression of the general vector identity ab = a \cdot b + a \wedge b, and the second equality follows from r_1 \cdot t = 0, our previous form of the horizon condition (2).

In two dimensions, there is only one unit bivector, called I, spanned by any two orthogonal unit vectors e_1 and e_2:

e_1 \wedge e_2 = e_1 e_2 = I

Therefore r_1 \wedge t is proportional to I, and since r_1 and t are orthogonal, we can write

(2’)

r_1 t = r_1 \wedge t = |r_1||t|I = |r_1|I = \rho I

Reflection Condition

Our previous version of the reflection condition (3) also has the form of an orthogonality condition:

r_2 \cdot (s + w) = 0

so, similarly to the way we rewrote the horizon condition, we can rewrite this in terms of the geometric product as There’s another way to write reflections in geometric algebra that shows up more commonly: r_2 s = - w r_2 or s = - r_2^{-1} w r_2 = - r_2 w r_2^{-1} .

This other form is very useful for composing reflections into rotations, or factoring rotations into reflections, but the form we use here involving forming an orthogonal vector will be more convenient when it comes time to solve for r_2.

r_2 (s + w) = |r_2| |s + w| I

It will simplify later algebra to define a new unit vector based on this equation:

g \equiv \frac{ s + w }{|s + w|}

g^2 = 1

so that the reflection condition becomes

(3’)

r_2 g = |r_2| |g| I = |r_2| I = \rho I

Solving for the Earth’s radius

Now that we have rewritten our main geometric conditions in terms of the geometric product instead of the dot product, we are ready to solve the triangle equations.

First, eliminate p and set the left hand sides of (1a) and (1b) equal to one anotherThis equation involving a sum of four vectors is a “quadrilateral equation” in exactly the same sense as our earlier triangle equations: it expresses the fact that the red vectors and green vectors in our diagram form a quadrilateral.:

r_1 - |d_1| t = r_2 - |d_2| w

The magnitude |d_2| is unknown, so we could proceed by solving for it, but it is more efficient to simply eliminate it in the following way. First, multiply both sides of the equation on the right by w:

r_1 w - |d_1| t w = r_2 w - |d_2| w^2

Now we can use “grade separation” to separately consider the scalar and bivector parts of this equation. Since w^2 is a scalar, the |d_2| dependence drops out of the bivector part:

\left\langle r_1 w - |d_1| t w \right\rangle_2 = \left\langle r_2 w \right\rangle_2

Rearranging to isolate the |d_1| term gives

|d_1| \left\langle t w \right\rangle_2 = \left\langle r_1 w - r_2 w \right\rangle_2

We can now take advantage of the horizon and reflection conditions to rewrite the unknown products r_1 w and r_2 w in terms of known products by inserting factors of t t = 1 and g g = 1 and re-associating (this is the second “super power” from the introduction above):

|d_1|\left\langle t w \right\rangle_2 = \left\langle r_1 t t w - r_2 g g w \right\rangle_2

We can simplify both r_1 t and r_2 g to \rho I using the horizon (2’) and reflection (3’) conditions:

|d_1| \left\langle t w \right\rangle_2 = \rho \left\langle I t w - I g w \right\rangle_2

Now expanding the geometric products of vectors into dot and wedge product gives

|d_1| t \wedge w = \rho I (g \cdot w - t \cdot w)

where I have dropped terms like \left\langle t \cdot w\right\rangle_2 = 0 and \left\langle I (t \wedge w - g \wedge w)\right\rangle_2 = 0 because they contain no part with grade 2.

We can take advantage of the known length |d_1|^2 derived as (4d) by taking the magnitude squared of both sides:

\begin{aligned} |d_1|^2 |t \wedge w|^2 & = \rho^2 \left(g \cdot w - t \cdot w\right)^2 \\ |d_1|^2 & = \rho^2 \left[ \frac{\left(g \cdot w - t \cdot w\right)^2}{|t \wedge w|^2}\right] \end{aligned}

To simplify further algebra, for the term in brackets, introduce

\epsilon^2 \equiv \frac{(g \cdot w - t \cdot w)^2}{|t \wedge w|^2}

which is written entirely in terms of known products of directions. This gives

|d_1|^2 = \rho^2 \epsilon^2

Now substituting from (4d) for |d_1|^2 gives

(\rho + \delta)^2 - \rho^2 = \rho^2 \epsilon^2

and dividing through by \rho^2 gives

\left(1 + \frac{\delta}{\rho}\right)^2 - 1 = \epsilon^2

and finally, we are able to solve for \rho, the radius of the earthI (and Vanderbei) have chosen a positive square root here. What, if anything, does the negative square root represent?

(5)

\rho = \frac{\delta}{\sqrt{1 + \epsilon^2} - 1}

We can recover Vanderbei’s final answer by rewriting \epsilon^2 in terms of angles using the following relationships:

\begin{aligned} t \cdot w & = \cos(\beta) \\ t \wedge w & = \sin(\beta) I \\ g \cdot w & = \cos(\gamma) = \cos\left(\frac{\alpha + \beta}{2}\right) \end{aligned}

so

\epsilon^2 = \frac{\left(\cos(\gamma) - \cos(\beta)\right)^2}{\sin(\beta)^2}

From this and (5), it is a simple exercise in trigonometric identities to recover the form given on slide 28 in Vanderbei’s talk, but there are two better forms that I will show instead.

First, a small angle form.

Using the general approximations

\begin{aligned} \sqrt{1+x^2} &\approx 1 + x^2/2 &\mathrm{for}\quad x \ll 1 \\ \sin{\theta} &\approx \theta &\mathrm{for}\quad \theta \ll 1 \\ \cos{\theta} &\approx 1 - \theta^2/2 &\mathrm{for}\quad \theta \ll 1 \\ \end{aligned}

we can simplify (5) to

(5’)

\rho \approx \frac{2}{\epsilon^2}\delta \approx \frac{8\beta^2}{\left(\beta^2 - \gamma^2\right)^2} \delta

The angles in Vanderbei’s photo are quite small, so this approximation is accurate to better than one part in a millionIt’s also simpler than other small angle approximations previously given by Vanderbei.. Since the uncertainty in the angles and camera height are about 10% each, this small angle approximation is certainly sufficient.

In fact, when calculating with rounded (floating point) arithmetic, the small angle form (5’) is actually more accurate than the exact form given by Vanderbei. This counterintuitive fact occurs because the exact form suffers from “catastrophic cancellation,” the result of subtracting approximately equal values that have been computed with rounding error.

We can get rid of one place such cancellation occurs by multiplying the numerator and denominator of our exact expression (5) by 1 + \sqrt{1 + \epsilon^2} to get

(5’’)

\rho = \frac{ \sqrt{ 1 + \epsilon^2 } + 1 }{\epsilon^2}\delta

and we can get rid of another source of cancelation by replacing the difference of cosines in our expression for \epsilon^2 with a difference of sines using the general trigonometric identityThis identity is related to the classical Haversine Formula from spherical trigonometry. Evelyn Lamb has written a wonderful blog post on this and other creatures in the zoo of forgotten trigonometry functions.

\cos(\theta) = 1-2\sin ^2\left(\frac{\theta}{2}\right)

so that:

\epsilon^2 = 4 \frac{\left(\sin^2\left(\frac{\gamma}{2}\right) - \sin^2\left(\frac{\beta}{2}\right)\right)^2}{\sin(\beta)^2}

This is helpful because we’re now subtracting two numbers that are very close to 0 instead of very close to 1, and intermediate rounding to a fixed number of digits throws away less information for numbers that are close to 0 than for numbers that are close to 1.

Plugging this expression for \epsilon^2 into the non-cancelling form for \rho (5’’) now allows computing \rho without undue rounding issues.

To evaluate \rho in terms of measured parameters, insert the following values into either (5’) or (5’’)

\begin{aligned} \alpha &= 69\ \mathrm{px} \cdot 0.5^{\circ}/317\ \mathrm{px} &=& 0.001899\ \mathrm{rad}\\ \beta &= 29\ \mathrm{px} \cdot 0.5^{\circ}/317\ \mathrm{px} &=& 0.0007983\ \mathrm{rad}\\ \gamma &= \frac{\alpha + \beta}{2} &=& 0.001349\ \mathrm{rad}\\ \epsilon^2 &= 5.482 \times 10^{-7} \\ \delta &= 7\ \mathrm{ft} \\ \rho &= 2.55 \times 10^{7}\ \mathrm{ft} &=& 4836\ \mathrm{mi} \end{aligned}

This is 20% larger than the true value, 3960 miIt’s also different in the second digit from the answer given by Vanderbei (slide 28). I think this is attributable to the “catastrophic cancellation” discussed above, combined with low precision calculation.. Not too bad.

Comparison to other systems

Classical trigonometry

At this point, perhaps you are thinking that I’m crazy to believe that the analysis above is simpler than doing classical trigonometry. We learned trigonometry in high school, and it wasn’t all that hard, right? And the geometric algebra analysis involves a bunch of unfamiliar notations, keeping track of non-commuting multiplications, and the new geometric notion of “bivectorOn the other hand, it does give you algebraic super powers..”

But the classical trigonometry analysis of this problem is hard. Harder than the trigonometry problems that you solved in high school. If you don’t believe me, take a crack at solving it without referring to Vanderbei’s analysis. Or even just follow along with the talk and fill in all the algebra.

The subtlest part of Vanderbei’s formulation of the problem involves noticing a non-trivial relationship between 4 angles:

\phi + \beta = \theta + \gamma

and the subtlest part of solving the problem involves solving the trigonometric equationThis equation is transcendental in the angles, but turns out to be algebraic (quadratic) in \cos(\phi).

\cos(\phi + \beta) = \cos(\phi)\cos(\gamma)

for \cos(\phi).

Solving difficult trigonometry problems in the classical language tends to involve constantly moving back and forth between algebraic expressions and the diagrams. This is because the full relationships between lengths and angles as separate entities are much more complicated than the relationships between vectors, which keep information about magnitude and direction conveniently integrated together. For this reason, in classical analyses, much of the information about lengths and angles is typically left implicit in diagrams, rather than being written down in an explicitly algebraic form.

In contrast, in the geometric algebra formulation, once the (fairly simple) equations (1-4) were written down, the rest of the solution was entirely algebraic. It also did not involve invoking any laws for relationships between transcendental functions (\sin and \cos).

Besides classical trigonometry, there are a few other competing (and partially overlapping) algebraic systems for solving geometrical problems, and all of them are capable of solving this problem.

Gibbs Vector Algebra

You could stick to Gibbs’ vector analysis (dot products and cross products), and use a cross product with w to annihilate |d_2| in a similar way that we used “grade separation”. There is no explicitly algebraic analogue to our trick of inserting factors of gg = 1 and tt = 1 to relate unknown products of two vectors to known products with a third. Even so, you could split r_1 and r_2 into parts parallel and perpendicular to g and t and achieve essentially similar results, with a little bit more of the reasoning left in prose instead of algebra. The major deficiency of Gibbs’ vector analysis is that the cross product is funny in 2D (because it returns an object that lives outside the plane), forces you to think about things like “pseudo-vectorspseudo-vectors are vectors that want to be bivectors.” in 3D if you consider the behavior of the cross product under transformations, and doesn’t work at all in more than 3 dimensions. But none of those problems is fatal here, and Gibbs’ vector algebra is a good and efficient way to solve plane trigonometry problems. If you know it, use it.

Complex Numbers

Alternatively, you could use complex numbers, and this works very well for problems in the plane. Like geometric algebra, complex numbers provide an associative and invertible product between directed magnitudes in the plane, and there are analogues to all the algebraic tricks we used here. The following mapping is useful for understanding the relationship between systems:

\begin{aligned} a \cdot b &\longleftrightarrow \mathrm{Re}\left(a b^{\dagger}\right) \\ a \wedge b &\longleftrightarrow \mathrm{Im}\left(a b^{\dagger}\right) \\ a b &\longleftrightarrow a b^{\dagger} \end{aligned}

The main deficiencies of complex numbers are that they don’t extend well to three or more dimensions, and that they single out the real axis as a special direction in the plane in a way that isn’t appropriate to problems with rotational symmetry. I also think there isn’t as much of a culture of viewing and understanding complex numbers geometrically as there is for Gibbs vector analysis or geometric algebra. For example, did you know that if two complex numbers are oriented along orthogonal directions, then

\mathrm{Re}\left(a b^{\dagger}\right) = 0

This is an important geometric idea, but I only know it because it falls out of the mapping to geometric algebra.

Rational Trigonometry

NJ Wildberger has recently advocated a system of doing trigonometry called Rational Trigonometry that avoids all use of transcendental functions and many uses of the square root function. It’s a pretty system with some definite merits, and I’d be interested to see someone analyze this problem with it.

Nevertheless, with geometric algebra, we were able to avoid all the same transcendental functions and square roots that Wildberger’s system avoids, and geometric algebra extends more easily to more than two dimensions and is more thoroughly coordinate free. Rational trigonometry also has the same problem as classical trigonometry in that directions and magnitudes are represented and manipulated separately instead of integrated together as vectors.

I wonder what a Rational Trigonometer would do at the step where we use grade separation to annihilate |d_2|, or at the steps where we insert factors of gg = 1 and tt = 1 to decompose unknown vectors against known vectors.

Pauli Matrices

Physicists use Pauli matrices to model 3D geometry in quantum mechanics problems. That system is completely isomorphic to the geometric algebra of 3D vectors, and can (and should) be used completely algebraically without ever introducing explicit matrix representations. But physicists rarely contemplate using Pauli matrices to solve non-quantum mechanical geometry problems because they believe that Pauli matrices are fundamentally quantum objects, somehow related to spin-1/2 particles like the electron. I have never seen someone try to use Pauli matrices to solve a trigonometry problem, but it can certainly be done.

Conclusion

Through years of experience solving physics and computer graphics problems, I have slowly learned to be skeptical of angles. In many problems where your input data is given in terms of coordinates or lengths, it is possible to solve the problem completely without ever introducing angles, and in these cases, introducing angles adds algebraic complications and computational inefficiencies. In 3D, introducing angles also invites gimbal lock.

This is not to say that angles are never useful; quite the contraryLest I give the wrong impression, geometric algebra is perfectly capable of handling angles, and in fact smoothly extends the way that complex numbers handle angles to more dimensions. It’s just that it also allows you to avoid angles where they aren’t fundamental.

For example, geometric algebra’s version of the Euler formula is

\exp(I\theta) = \cos(\theta) + \sin(\theta)I

where I is any unit bivector, and in more than two dimensions, this formula is valid for each separate plane.
. They are exactly what you need for problems explicitly involving arc lengths on a circle (so especially problems involving rolling discs, cylinders, or spheres), or rotation at a uniform rate, or for interpolating continuously between known discrete rotations. They’re also handy for making small angle approximations. However, for most problems involving areas, projections, reflections, and other simple relationships between vectors (in other words, most problems of trigonometry), angles are a distraction from more direct solutions.

To say it another way, Wildberger (author of Rational Trigonometry) emphasizes that you don’t need to think about arc lengths on a circle to understand triangles, and on this point I agree with him completely. Of course, you do need to think about arc lengths on a circle to understand problems involving… arc lengths on a circle. For these problems, we should of course know and use angles.

Given this point of view, when I came across Vanderbei’s sunset problem, I thought “there must be a simpler way with fewer angles.” So this is my best attempt, using the most efficient tool I know.

If you didn’t know any geometric algebra before, and you have made it here, thank you and congratulations. I hope I have at least made you more intrigued about its possibilities. It is impossible to teach someone geometric algebra in one blog post (just as it is impossible to teach someone classical trigonometry, complex numbers, or vector analysis in one blog post). The best places I know to learn more are:

  • Hestenes’ Oersted Medal lecture: (PDF). This is a compact introduction by the founder of modern Geometric Algebra.
  • Dorst, Fontijne, and Mann, Geometric Algebra for Computer Science. This book is by far the best pedagogical introduction I have seen if you want to actually learn how to calculate things. Unlike most other books on the subject, you don’t need to know any physics (or even care about physics) to appreciate it.

Additionally, Hestenes’ website has many wonderful papers, and I also especially recommend two of his other books for more advanced readers:

  • Space-Time Algebra. Hestenes’ original book on the subject, a very compact, energetic, and wide-ranging presentation with some deep physical applications. Recently re-issued by Birkhäuser.
  • Clifford Algebra to Geometric Calculus. This is a challenging, advanced, and sometimes frustrating reference book, but it presents the subject in far more depth than it has been presented anywhere else. It used to be hard to find, and I suspect that few people have truly read it carefully. But it contains results that will probably continue to be rediscovered for decades. Chapter 7 on directed integration theory is especially notable: it contains extensions of most of the magical integral formulas of complex analysis (like Cauchy’s integral formula) to any number of dimensions (and even to curved manifolds!).

Finally, thank you to Steven Strogatz for first pointing me to this problem (and a related, fiendishly difficult pure trigonometric functions problem). And of course, thank you to Robert Vanderbei for dreaming up this wonderful problem, and presenting it so beautifully.

Updates

Bret Victor notes on Twitter that many more of the equations in this post could be accompanied by diagrams. Interactive diagrams. His example:

Side view sunset diagram annotated with bivectors.

I’ll list a few relevant resources along these lines:

  • Daniel Fontijne wrote a program called GAViewer to accompany Geometric Algebra for Computer Science (recommended above) that allows visualizing and visually manipulating GA expressions. I wish you could embed it on the web.
  • Apparatus is a very cool environment for drawing interactive diagrams, and I hear you can embed apparatus creations into other web pages now. Maybe someone can teach it how to speak GA!
  • weshoke ported the Versor GA library to Javascript (Versor.js) and there are stubs of an expression parser and a canvas renderer written by a few other contributors (including me). Maybe you could be the one to flesh this out!
  • Finally, I’ll mention that Desmos (my employer) is a great way to interact with equations, functions, and graphs (but GA isn’t on our current roadmap).

Jacob Rus writes to suggest a few more resources for learning about GA:

I was a bit surprised you didn’t mention Hestenes’s NFCM book, as that seems closest to the type of problem solving you were doing:

David Hestenes, New Foundations for Classical Mechanics

A couple other sources you might mention:

At a closer to high school geometry level, perhaps also:

New Foundations for Classical Mechanics is the first book I read about GA. It has tons of great diagrams, and gives some interesting new perspectives on well known mechanics problems. This book got me excited about GA, but I personally found Geometric Algebra for Computer Science (recommended above) did a better job teaching me how to calculate things and solve problems on my own.


A few readers have written in with skepticism about whether Vanderbei’s photograph shows what he (and I) said it shows. A quick search on Google Images shows that ripples and waves in water generally play a dominant role in the appearance of the sun’s reflection. Vanderbei addresses waves, atmospheric effects, and CCD saturation in his article and concludes that the reflection in his image does display the geometric effect under discussion, but that he was lucky to obtain such an image.

Randall Munroe writes:

There are some cool and somewhat similar tricks for estimating the size of the Earth by carefully observing the sunset. My favorite is to go to a beach at sunrise and stand atop some steps or a lifeguard stand. When the sun first appears, start a stopwatch. Then run/drop quickly to the ground, and time how long it takes the sun to appear a second time. I think you can use that to work out the Earth’s radius.

Here’s a page spelling out the relevant calculations. If you live on the West Coast, like me, you don’t even have to wake up early to try this.



from Hacker News https://ift.tt/32ZHT2x

Here Dragons Abound: Exploring procedural generation and display of fantasy maps

In a

previous posting

I reviewed

Azgaar's Fantasy Map Generator

 and as I noted, one of the things I really liked was his method for defining terrain generation by composing basic terrain generation actions in a template:

In 

Dragons Abound

, the equivalent terrain generation control is handled by turning actions on and off with parameters, and the sequence of actions is hard-coded into terrain generation code.  This is much less flexible and much more fragile than Azgaar's approach.  Well, never let it be said that I'm too proud to recognize a great idea and steal it!  So I did.

Dragons Abound

 has a bunch of different terrain generation primitives, so the basic notion of creating a template that could point to these primitives and execute them was pretty straightforward to implement.  In some sense, 

Dragons Abound

 has templates already; they're just not encoded in a declarative fashion.  And they are missing some features.  Two of Azgaar's nice features are (1) a repetition count, and (2) that any parameter to the primitive can be expressed as a range of numbers to be randomly generated when the primitive is executed.  I added both of these features.

I also added a percentage chance to each primitive; this is the chance the primitive will execute.  Azgaar has something like this.  If you express the number of repetitions for an action in Azgaar's templates as a fraction, it has a fractional chance of executing the last repetition.  So an action with “n: 3.5" would produce 3 repetitions half the time and 4 repetitions half the time.  But I actually wanted something a little different from this.  I want to be able to say “On 25% of the maps, add 3-6 little islands."  That requires separating the chance to execute from the number of repetitions. 

Converting 

Dragons Abound

's primitives to work well in a template was a little more difficult.  Most of 

Dragons Abound

's terrain generation primitives are written as standalone functions that pull their parameters from the global parameter structure.  So these needed to rewritten so that they received their parameters from the template.  And for ease of writing the templates, I wanted each parameter to fall back to a value in the global parameter structure if it wasn't in the template.  This provided a lot of flexibility; for the common cases the template specification is very succinct, but I can override anything by adding it to the template.

A different kind of challenge arose with regards to 

Dragons Abound

's “additional map features."  These are minor map features such as cluster islands (like Hawaii) or barrier islands, etc.  They don't really contribute to the overall land shapes, but provide some areas of additional interest.  In my original approach to generation, these all have some percentage chance of appearing on any map.  One drawback to this approach is that I can sometimes get all the options at once, which is problematic.  For instance, 

Dragons Abound

 has four different methods for generating small islands, so on some maps I would end up with a lot of small islands!  What I really want to do is decide whether I want to have islands, and then pick one of those methods.  To accomplish this, I added a “choice" action to templates that chooses one action from a list of alternatives.  Using this I can say something like “Add some small islands to 75% of the maps, and do that by randomly selecting one of these four alternative methods for creating small islands."

In the course of converting the primitives to templates, I found and cleaned up a number of bugs.

One bug had to do with rivers.  Occasionally 

Dragons Abound

 generates maps like this:

which have rivers that end abruptly in the middle of the land rather than continuing to the ocean.

For various reasons, I thought this happened because of a breakdown in 

Dragons Abound

's sink fill algorithm.  As a bit of background, if you draw rivers by following the contour of the land down to the ocean, spots in the interior of the land that are local minima (that is, all of the neighboring land is higher) create problems, because if a river flows into that spot it cannot flow out.  Which would create rivers ending in the middle of nowhere, as above.

(In “real life" a spot like that would fill up with water creating a lake, until it overflowed and the water could continue on downhill.  If you want to know why 

Dragons Abound

 doesn't do that, you'll have to find that discussion in the archives :-)

The sink filling algorithm 

Dragons Abound

 uses is called the Planchon-Darboux algorithm.  It's elegant and efficient (you can read the original paper

here

) but for whatever reason I find it difficult to wrap my head around.  And that's made more complicated because 

Dragons Abound

 changes the resolution of the underlying map after drawing the coasts, and other factors.

At any rate, after many hours of debugging I finally figured out that the problem wasn't in the sink filling algorithm at all.  Instead, there was an invisible river on the map that the two orphaned rivers were flowing into.  Why the river was invisible became the next debugging mystery.

After some more painful pounding of head against wall, I traced the problem to the river drawing code.  In that code, there's a test that says to stop drawing the river once it reaches the ocean (actually a bit after it reaches the ocean).  (Rivers actually keep flowing under the ocean.  This is useful if, for example, the sea level changes.)  This makes the river broaden out properly at the coast, and prevents a situation where a river can come out of the ocean to cross land again.

This test was creating a problem in the infrequent case where a river starts on the edge of the map.  Technically the edge of the map is not part of the land and counts as being in the ocean.  (This lets rivers drain to the edge of the map.)  So if a river started on the edge of the map, the river drawing routine would immediately exit without drawing any river.

The solution was to make the ocean test a little smarter by looking backwards from the end of the river rather than forward from the start of the river.  With this fix in place the mystery rivers find an outlet:

They now flow into the Ox-Eye River and eventually to the sea.

That was rather a longer interruption than I would have liked, but that problem has been annoying me for a while, so I'm glad to have it fixed.

I encountered another problem while converting “Add Peninsulas."  This is a chunk of code that tries to

add islands to the ends of peninsulas

.  After the conversion, I had difficulty finding a test case where an island range was successfully added to the map.  This isn't entirely unlikely; this routine looks for a specific coast configuration that isn't always present.  Still, I should have been able to find something.

Inspecting the code, I discovered that when I

modified the coast creation to generate more detailed coasts

, I had broken some of the internal dependencies that Add Peninsulas used.  Fixing this required largely rewriting the code, but fortunately it is not long and is

fairly easy to understand

.  Ran into a few problems along the way, like this peninsula:

That's actually sort of interesting looking, but definitely not what it's supposed to be.  

Dragons Abound

 uses perturbation when painting the peninsula.  With that turned off here's what the peninsula looks like:

So this looks like a case where the perturbation is too wild.  I don't want this to (always) be perfectly straight but not quite such a wild curve!

That's a little better.  I spent a while tweaking the parameters of this code to get better looking peninsulas, but I'm still not entirely happy with the way it works.

Working on converting the previously mentioned island-creating routines to templates, I discovered that they failed if there wasn't any existing land.  (This is not normally a problem because 

Dragons Abound

 adds islands as late step in land generation, but came up when I tried to create a template for an all islands map.)  The reason island creation failed was that island placement needs to know how far away a potential island location is from existing land, and this was impossible to calculate if there was no land!

I fixed the routine that calculates the distance to land to work when there was no land, and while I was at it, I rewrote the entire routine for better efficiency.  Along the way I learned a lesson about accidentally using depth-first search when you mean to use bread-first search on a map with a few hundred thousand locations.  (Spoiler Alert:  It's a lot slower.)  At any rate, eventually I could create islands in an empty sea:

Another (funny) problem popped up as I started working on another template:

Square landmasses are probably not very realistic.  This was an odd problem that took a while to understand.

As mentioned above, 

Dragons Abound

 has a sink filling algorithm which makes sure that every location can flow downhill to the edge of the map.  When you run this on a completely flat map, it essentially turns the map into a pyramid, with the highest point in the center running down on four sides to the edges of the map.  If you then partially flood the map, the top of the pyramid sticks out of the water and forms the square landmass seen in the map above.  My solution was to add a little noise to the map before creating terrain, so that there aren't any large completely flat areas to form pyramids.

With the basic templating mechanism working, I started on some templates to recreate the different terrain generation types I had previously.  The first is the standard large island in the middle of the map.  The template for this puts a large island in the middle of the map, adds 3 smaller overlapping islands, and then adds smaller islands and other decorations.  That gives us landforms that look like this:

That was a pretty straightforward conversion.

A second map type is a peninsula shape, something like Florida in the United States.  To create this type of shape, I can create a long elliptical island, offset it into a corner, and then angle it to go across the map on the diagonal.

I like to add another ellipse at a cross-angle to the peninsula at the edge of the map to suggest a larger landmass “off-screen."

One problem with this template (and it was a problem with my corresponding formula pre-template) is that I have to specify the corner where I'm offsetting the peninsula, and the angle to the other corner.  If I want a peninsula coming from (say) the upper-right hand corner instead, I need a new template.  What I'd really like is a template that would just randomly select a corner and adjust accordingly.

One way to do this is to introduce a new operator for templates that can mirror (flip) the map along either the X or the Y dimension.  Using this operator in various combinations gives three more variants of the above map.  However, flipping the map isn't as easy as you might expect.  The map is based upon a Voronoi graph, not a 2D array of locations.  Each location knows its center, its edges, its neighbors and so on.  So I cannot simply swap indices in an array; I need to go through every location on the map, look up the corresponding flipped location and swap heights.  And this is slow, because finding a location by its coordinates is not fast.  (Even though I do use a quadtree to speed things up.)  That aside, it works well:

If I add a step to the template to flip on the X axis and a step to flip on the Y axis and give them both a 50% chance of executing, then I get all four possibilities.

(On a square map like the ones I normally use, it's also possible to do a 90 degree rotation, but I don't want to have an operation that only works on a square map.)

Another type of map I'd like to produce is a coastline: something like looking at a chunk of the east or west coasts of the United States.  

Dragons Abound

 has a routine for adding a slope across the map which can be used to create landmasses of this sort:

The terrain this produces is somewhat unsatisfactory, being essentially just a long ramp into the ocean.  This is can be somewhat addressed by other land creation routines that do things like add mountains in appropriate places, but it's still not very convincing.

Another way to create this sort of map is to create a very big island centered on one edge of the map, so that one long coast of the island shows up on the map -- somewhat like the peninsula, but running the other direction.  The angle can vary 180 degrees and then we can use the map flip trick from the peninsula template to effectively get all the possible angles.

Azgaar has a template called Atoll that produces a circular ring of islands like this:

I don't particularly want to generate island rings like this, but I do want to do something somewhat similar, which is to take a bite out of a landmass to create a large bay, as in this map:

The bay is created by dropping a smaller, negative island on top of the main landmass.  A negative island has a negative height, so it pushes down all the land where it is placed.  The challenge is placing the negative island.  If it is entirely inland it will create an interior sea; if it is too far out to sea it will not create an obvious bay.  My solution is to try random locations and then count the number of land and ocean locations within the rough circle of the bay. If there are at least 50% land locations and at least one ocean location, it gets used.  Here's an example of the placement of a large and a small bay:

This seems to work reasonably well.

The last (?) template from Azgaar I want to look at is “Mediterranean," which as the name suggests, is a land mass around a large central sea.  I don't totally understand Azgaar's template for this type of map but a reasonable approach would seem to be placing (overlapping) islands around the edge of the map.  That produces maps like this:

In this template the best number of islands along each side is enough to cover the edge but occasionally to leave gaps.  However, the appropriate number varies with the size of the islands and the length of the sides.  Luckily, most of my template actions already are sized as a percentage of the map size (e.g., “place an island that is 35% of the width of the map") so I can pick a number and size of islands that will work pretty well regardless of the size and proportions of the sides.

A nice option on this type of map is a chance for a small central island.

The last capability I want to add is to choose a template randomly, so that when I generate a random map, it might use any of the terrain templates.  I can use the same mechanism to randomly select a map style.  (This has a toggle so I can easily turn it off when I'm developing.)

My thanks again to Azgaar for all his good work and inspiration!



from Hacker News https://ift.tt/2dJGYv4

The California haters are back. And once again, they get us all wrong


If you live in California, here’s a news bulletin:

We are done. We are history. Pack up and leave now, while you still can.

For the record:

9:15 PM, Oct. 31, 2019 A previous version of this article said that a Wall Street Journal editorial was referring to Los Angeles’ ban on plastic straws. The editorial was referring to San Francisco’s ban.

I’m not just talking about the fact that half the state is on fire, which is tragic and frightening enough all on its own.

I’m parroting what a pack of gleeful doomsayers are saying about us in publications across the country. We are off the rails and off our rockers and it’s no wonder our great western experiment in modern living is going up in smoke.

The political right, of course, has long specialized in the sport of California mockery. But we’re now getting it from the left, as well. People are running for their lives and losing their homes, and the haters can’t wait to do a grave dance.

“It’s the End of California As We Know It,” warned a New York Times headline on an op-ed piece declaring that “at the heart of our state’s rot” is “a failure to live sustainably.”

Yeah, we‘ve got problems and a long way to go, but is there a state in the union that has done more in the interest of sustainability?

“California Is Becoming Unlivable,” screamed the Atlantic.

Speaking of which, do we sit around in California wondering if the Southeast — where many states are governed by Republicans, not wifty liberals — is unlivable because decades of construction on fragile coastal land has put millions of people in the direct path of killer hurricanes?

“Climate change,” the Atlantic said of our state, “is turning it into a tinderbox; the soaring cost of living is forcing even wealthy families into financial precarity. And, in some ways, the two crises are one: The housing crunch in urban centers has pushed construction to cheaper, more peripheral areas, where wildfire risk is greater.”

Some fair points can be found in this article. But even when you have to clear your throat to draw attention to yourself, there is no good reason to use the word “precarity.” Second of all, are some wealthy families, God forbid, selling their Range Rovers and laying off half the domestic staff? Are those among the horrors of financial precarity?

Even before fire season, California was under attack.

“California’s Hobo Paradise” was the title of a September editorial in the Wall Street Journal. The piece parroted President Trump’s bashing of California, particularly San Francisco and Los Angeles, for its tent cities and public health problems.

By the way, please advise Trump he doesn’t need to fuel up Air Force One and fly to California if homelessness is a genuine concern, because there’s a sizable population within walking distance of the White House.

“The city council has banned plastic straws,” the Journal editorial said, referring to the San Francisco Board of Supervisors, “but the good liberals don’t seem bothered by streets strewn with human feces and needles that fall into storm sewers.”

First of all, we may be morons, but we have discovered that it’s possible to drink beverages without plastic straws. Second, I don’t know of anyone, liberal or conservative, who is not bothered by homelessness and the condition of our streets. And the rest of the country should be, too, since a lot of the people sleeping on our streets tell me they’ve come here from somewhere else, like the Midwest, the East and the South.

“California is a failed state,” said Breitbart News, which, as I recall, was founded by a man who lived rather comfortably here in one of the many affluent areas of our failed state.

“As climate change ravages the Golden State, earthquakes could become the least of residents’ concerns,” said the New Republic, which also questioned whether California is still livable.

Among her mother’s frequent warnings, the writer said, were these:

Don’t walk alone at night. Don’t eat processed food. And don’t ever move to California, because, among its myriad other problems, “California’s going to fall off the face of the country and sink into the ocean.”

I doubt that, even as sea levels rise, but I don’t doubt that Trump will keep calling climate change a hoax even after he has to snorkel through the front door of Mar-a-Lago.

It’s not that I disagree with all of the criticisms we’re hearing about California, and even a lot of Californians have issues with the state, because more people are now leaving than moving in. It wasn’t long ago that I fretted in a column about our inability to keep the lights on and the twin demons of flat wages and high housing costs and the growing epidemic of homelessness.

But as a native, I’ve got a license to swing that club. And as I pointed out, our fair state is also home to the world’s fifth-largest economy and is a world capital of innovation and creativity. California has a hell of a lot more going for it than you’ll ever hear from our jealous critics and gasbag pundits. We have our share of problems for sure. But on issues such as climate change, immigration, criminal justice reform and investments in children, we are actively trying to make things better.

“Why would anyone live in California?” the Washington Times asked in September in an op-ed that said “eggs cost 50% more” in Los Angeles than in D.C. because of our cage-free hen law.

Why would anyone live here?

Gee, I don’t know. The 40 million or so people who call California home might have an answer or two, but let me offer a few of my own.

The beaches, the mountains, the deserts, the sunsets, the rural, the urban, the red, the blue, the people, the wildlife, the languages, the history, the diversity, the endless curiosities, the energy, the universities, the music, the art, the food, the culture, the climate, the risks that worked, the experiments that failed, the long tradition of break-away politics and the collective agreement that you can say or think of us what you will — we don’t really care one way or another— just shelter in place (unless you’re a firefighter) and please don’t move here.

It is unmanageable and unlivable, I’m telling you.

Designed and guaranteed to fail.

steve.lopez@latimes.com



from Hacker News https://ift.tt/325mx2u

What Is a Nation? (2015)


This is a reply to Brandon’s latest post. I offer similar thoughts to the below post in my post about ethnicity.

I agree with Brandon that in discussing things we should not limit ourselves to thinking in terms of states. We must consider, as Brandon puts it, both supra and sub states. We must also recall that states are much more fluid than we usually consider them.

When discussing international relations I attempt to get my conversation partners to agree that:

(1) National borders are not stable and,

(2) National identity is more fiction than reality.

The first is easily confirmed by looking at historical maps. Here is a map of the Levant/Greater Middle East in 14th century BC, in 830 BC, in 634 AD, in 1135 AD, and in 1900 AD.

Egypt and Persia are the only two entities that are present in some form or another throughout this time span, and even then their respective borders have fluctuated with only a few core regions being stable. I have yet to find someone who disagrees with the first point.

The second point is harder to get people to concede. We often think of ourselves as a given national identity and find it difficult to imagine that our nation did not exist since the beginning, or at least as far back as imaginable. Most nations have a foundation epic that makes little sense when seriously scrutinized.

Take for example American national identity. Three hundred million plus souls imagine themselves as ‘American’, but what exactly does that mean?

American identity cannot be equated with a specific phenotype; i.e. Americans are not all blue eyed blond people of English descent. In colonial days blacks outnumbered whites in several regions. Today whites in the Mid-Atlantic states are bronze skinned due to the dominance of Mediterranean descent there. The southwest is filled with “Hispanics” who overwhelming self-identify as white but are not considered really white, hence the curious demographic term “non-Hispanic white.” Even in the cradle of the American revolution, Massachusetts, the largest ancestry group is the Irish not English. The only state that is predominantly of English descent is Utah.

Among whites there is constant tension over who was really white and who is a “white negro.” Germans, who are today the largest ancestry group in the US, were the first ‘white’ subgroup to have to fight to prove that they were really white. The Irish, Italians, and others of European descent all had to fight for inclusion into the ‘white’ group. Today Hispanics and Asians are both vying for inclusion.

The revolutionary war serves as the US’ de facto national epic and the leaders of the rebellion are treated (and on occasion sculpted) as demi-gods. Yet the popular image of the revolution is more fiction than reality. Americans paid very little in tax relative to residents of the British isles. George Washington was a horrible military strategist. The founding fathers were not fighting to ensure liberty for the common man – they were fighting to shift control of government from elites in London to elites in Philadelphia. To be sure there were a few true revolutionaries, such as Thomas Paine, who were involved in the hope of genuinely reforming government. For every Paine, though, there were a dozen Hamiltons who wanted to preserve the British Empire, just without the British.

‘American’, in so far as it is an ethnic label, is non-stationary and continually evolving. I would not be amazed if the American label went extinct and was replaced with other labels in the future. Perhaps the Pacific Northwest will become inhabited by Cascadians in the future?

None of this is unique to the American moniker. It is easy to pick on the United States since it is a young nation, but most nations are just as fluid and nonsensical.

What does it mean to be British? Turkish? Austrian? Spanish?

Were the inhabitants of the British isles prior to the Norman invasion British?

The Byzantine Empire was only recently destroyed and many of its inhabitants inter married with Turkic migrants. The Ottomans gave themselves the title of Roman Emperor, “Kayser-i Rum.” A friend of mine jokingly calls Turks “Anatolian Greeks.”

‘Austrian’ as a national identity is arguably younger than the American moniker. Prior to the disestablishment of the Hapsburg Empire in WW1 there was no independent Austrian geopolitical entity. Austria was a constituent member of the Holy Roman Empire, the Hapsburg crown lands, the Austrian Empire, and Austria-Hungary before finally becoming simply Austria following WW1. Austrians are as culturally distinct from other Germans as Bavarians or Swabians are. Why then are Austrians a national group, but the latter two aren’t?

The Iberian peninsula has been under Muslim control (700s~1600s) longer than it has been under a united Spain. Spaniards continue to have significant traces of Arab/Berber genetic material. Despite the actions of Franco, Spanish (or “Castilian”) is not the sole language used in the country. Several million in the country’s northeast wish to cease being Spanish altogether in order to form an independent Catalan.

What is a nation? I argue that it is a group label that is invented and sustained in so far as it serves to further the goals of elites. Within an individual’s lifetime they appear unchanging, but from a historical perspective they are fluid and are frequently created, killed, or reborn as needed. When conversing about geopolitics we cannot ignore national identity, but we must keep in mind that in the long run nationality can be, and is, molded to suit political goals.



from Hacker News https://ift.tt/3359f7f