Quick Basic Python Tutorial

I have just posted a Quick Basic Python Tutorial on github.

Quick Python tutorial

View it here  Quick Introduction to Basic Python.

Short and simple for those who cannot wait to get started.  

Thank You, Errors



These are some of margin notes and snippets from the book Antifragile: Things That Gain From Disorder by Nassim Nicholas Taleb

This is the book I have spent the maximum time in year 2014.

  • Wind extinguishes a candle and energizes fire.
  • The antifragile loves randomness and uncertainty, which also means—crucially—a love of errors, a certain class of errors. Antifragility has a singular property of allowing us to deal with the unknown, to do things without understanding them—and do them well.
  • Let me be more aggressive: we are largely better at doing than we are at thinking, thanks to antifragility.
  • And we can almost always detect antifragility (and fragility) using a simple test of asymmetry: anything that has more upside than downside from random events (or certain shocks) is antifragile; the reverse is fragile.
  • I want to live happily in a world I don’t understand.
  • The antifragile gains from prediction errors, in the long run.
  • Technology is the result of antifragility, exploited by risk-takers in the form of tinkering and trial and error, with nerd-driven design confined to the backstage. Engineers and tinkerers develop things while history books are written by academics; we will have to refine historical interpretations of growth, innovation, and many such things.
  • Steve Jobs figured out that “you have to work hard to get your thinking clean to make it simple.” The Arabs have an expression for trenchant prose: no skill to understand it, mastery to write it.
  • I suddenly realized one day that fragility—which had been lacking a technical definition—could be expressed as what does not like volatility, and that what does not like volatility does not like randomness, uncertainty, disorder, errors, stressors, etc.
  • If you see fraud and do not say fraud, you are a fraud.
  • The only modern dictum I follow is one by George Santayana: A man is morally free when … he judges the world, and judges other men, with uncompromising sincerity. This is not just an aim but an obligation.
  • But academics (particularly in social science) seem to distrust each other; they live in petty obsessions, envy, and icy-cold hatreds, with small snubs developing into grudges, fossilized over time in the loneliness of the transaction with a computer screen and the immutability of their environment. Not to mention a level of envy I have almost never seen in business.… My experience is that money and transactions purify relations; ideas and abstract matters like “recognition” and “credit” warp them, creating an atmosphere of perpetual rivalry.
  • So a certain system of tinkering and trial and error would have the attributes of antifragility. If you want to become antifragile, put yourself in the situation “loves mistakes”—to the right of “hates mistakes”—by making these numerous and small in harm.
  • Layers of redundancy are the central risk management property of natural systems.
  • He wrote: “Repeated punishment, while it crushes the hatred of a few, stirs the hatred of all … just as trees that have been trimmed throw out again countless branches.”
  • The higher you build your barricades, the stronger we become.
  • We all learn early on in life that books and ideas are antifragile and get nourishment from attacks—to borrow from the Roman emperor Marcus Aurelius (one of the doer-Stoic authors), “fire feeds on obstacles.”
  • So here is a simple rule of thumb (a heuristic): to estimate the quality of research, take the caliber of the highest detractor, or the caliber of the lowest detractor whom the author answers in print—whichever is lower.
  • “My son, I am very disappointed in you,” he said. “I never hear anything wrong said about you. You have proven yourself incapable of generating envy.”
  • Take this easy-to-use heuristic (which is, to repeat the definition, a simple compressed rule of thumb) to detect the independence and robustness of someone’s reputation. With few exceptions, those who dress outrageously are robust or even antifragile in reputation; those clean-shaven types who dress in suits and ties are fragile to information about them.
  • When you don’t have debt you don’t care about your reputation in economics circles—and somehow it is only when you don’t care about your reputation that you tend to have a good one.
  • It is quite perplexing that those from whom we have benefited the most aren’t those who have tried to help us (say with “advice”) but rather those who have actively tried—but eventually failed—to harm us.
  • Finally, a thought. He who has never sinned is less reliable than he who has only sinned once. And someone who has made plenty of errors—though never the same error more than once—is more reliable than someone who has never made any.
  • Thank You, Errors
  • And someone who has made plenty of errors—though never the same error more than once—is more reliable than someone who has never made any.
  • As in Baudelaire’s sad poem about the albatross, what is made to fly will not do well trapped on the ground, where it is forced to traipse.
  • When we look at risks in Extremistan, we don’t look at evidence (evidence comes too late), we look at potential damage: never has the world been more prone to more damage; never.6 It is hard to explain to naive data-driven people that risk is in the future, not in the past.
  • There is a Latin expression festina lente, “make haste slowly.” The Romans were not the only ancients to respect the act of voluntary omission.
  • The difference between the two fellows will show us the difference between noise and signal. Noise is what you are supposed to ignore, signal what you need to heed.
  • This may be the only possible way to murder someone while staying squarely within the law. We can see from the tonsillectomy story that access to data increases intervention, causing us to behave like the neurotic fellow.
  • In business and economic decision making, reliance on data causes severe side effects—data is now plentiful thanks to connectivity, and the proportion of spuriousness in the data increases as one gets more immersed in it.
  • Now let’s add the psychological to this: we are not made to understand the point, so we overreact emotionally to noise. The best solution is to only look at very large changes in data or conditions, never at small ones.
  • To conclude, the best way to mitigate interventionism is to ration the supply of information, as naturalistically as possible.
  • And, as he discovered, the worst thing one can do to feel one knows things a bit deeper is to try to go into them a bit deeper. The sea gets deeper as you go further into it, according to a Venetian proverb.
  • People are cruel and unfair in the way they confer recognition, so it is best to stay out of that game. Stay robust to how others treat you.
  • As to the funds, to avoid the charity trap, Nero followed Fat Tony’s rule of systematically making donations, but not to those who directly asked for gifts.
  • And Stoics look down on luxury: about a fellow who led a lavish life, Seneca wrote: “He is in debt, whether he borrowed from another person or from fortune.
  • Success brings an asymmetry: you now have a lot more to lose than to gain.
  • This asymmetry between the effects of good and bad, benefit and harm, had to be familiar to the ancients—I found an earlier exposition in Livy: “Men feel the good less intensely than the bad” (segnius homines bona quam mala sentiunt), he wrote half a generation before Seneca.
  • Likewise, when I was a trader, a profession rife with a high dose of randomness, with continuous psychological harm that drills deep into one’s soul, I would go through the mental exercise of assuming every morning that the worst possible thing had actually happened—the rest of the day would be a bonus. Actually the method of mentally adjusting “to the worst” had advantages way beyond the therapeutic, as it made me take a certain class of risks for which the worst case is clear and unambiguous, with limited and known downside.
  • Actually the method of mentally adjusting “to the worst” had advantages way beyond the therapeutic, as it made me take a certain class of risks for which the worst case is clear and unambiguous, with limited and known downside. It is hard to stick to a good discipline of mental write-off when things are going well, yet that’s when one needs the discipline the most. Moreover, once in a while, I travel, Seneca-style, in uncomfortable circumstances (though unlike him I am not accompanied by “one or two” slaves).
  • An intelligent life is all about such emotional positioning to eliminate the sting of harm, which as we saw is done by mentally writing off belongings so one does not feel any pain from losses. The volatility of the world no longer affects you negatively.
  • Likewise, when I was a trader, a profession rife with a high dose of randomness, with continuous psychological harm that drills deep into one’s soul, I would go through the mental exercise of assuming every morning that the worst possible thing had actually happened—the rest of the day would be a bonus.
  • It is not about turning humans into vegetables. My idea of the modern Stoic sage is someone who transforms fear into prudence, pain into information, mistakes into initiation, and desire into undertaking.
  • One trick, for instance, that a Roman Stoic would use to separate anger from rightful action and avoid committing harm he would regret later would be to wait at least a day before beating up a servant who committed a violation.
  • Seneca also provides us a catalogue of social deeds: invest in good actions. Things can be taken away from us—not good deeds and acts of virtue.
  • He said that wealth is the slave of the wise man and master of the fool. Thus he broke a bit with the purported Stoic habit: he kept the upside.
  • The antifragile package has more to gain than to lose from being shaken. Simple test: if I have “nothing to lose” then it is all gain and I am antifragile.
  • 1 For those readers who wonder about the difference between Buddhism and Stoicism, I have a simple answer. A Stoic is a Buddhist with attitude, one who says “f*** you” to fate.
  • In other words, if something is fragile, its risk of breaking makes anything you do to improve it or make it “efficient” inconsequential unless you first reduce that risk of breaking. As Publilius Syrus wrote, nothing can be done both hastily and safely—almost nothing.
  • For antifragility is the combination aggressiveness plus paranoia—clip your downside, protect yourself from extreme harm, and let the upside, the positive Black Swans, take care of itself.
  • Activities “in the middle” are like such mashing. Recall Nero in Chapter 9 hanging around with janitors and scholars, rarely with middlebrows.
  • Also recall from Chapter 2 that overcompensation, to work, requires some harm and stressors as tools of discovery.
  • It also means letting people experience some, not too much, stress, to wake them up a bit. But, at the same time, they need to be protected from high danger—ignore small dangers, invest your energy in protecting them from consequential harm.
  • One finds similar ideas in ancestral lore: it is explained in a Yiddish proverb that says “Provide for the worst; the best can take care of itself.” This may sound like a platitude, but it is not: just observe how people tend to provide for the best and hope that the worst will take care of itself.
  • There are so many fields in which the middle is no “golden middle” and where the bimodal strategy (maximally safe plus maximally speculative) applies.
  • Many of the “doers” turned “thinkers” like Montaigne have done a serial barbell: pure action, then pure reflection.
  • Or, if I have to work, I find it preferable (and less painful) to work intensely for very short hours, then do nothing for the rest of the time (assuming doing nothing is really doing nothing), until I recover completely and look forward to a repetition, rather than being subjected to the tedium of Japanese style low-intensity interminable office hours with sleep deprivation. Main course and dessert are separate.
  • Main course and dessert are separate.
  • This ability to switch from a course of action is an option to change. Options—and optionality, the character of the option—are the topic of Book IV.
  • Further, you will never get to know yourself—your real preferences—unless you face options and choices. Recall that the volatility of life helps provide information to us about others, but also about ourselves.
  • And, it is worth repeating, options, any options, by allowing you more upside than downside, are vectors of antifragility.1
  • Beyond books, consider this simple heuristic: your work and ideas, whether in politics, the arts, or other domains, are antifragile if, instead of having one hundred percent of the people finding your mission acceptable or mildly commendable, you are better off having a high percentage of people disliking you and your message (even intensely), combined with a low percentage of extremely loyal and enthusiastic supporters. Options like dispersion of outcomes and don’t care about the average too much.
  • For Summers, this explained why men were overrepresented in the scientific and intellectual community (and also why men were overrepresented in jails or failures). The number of successful scientists depends on the “tails,” the extremes, rather than the average. Just as an option does not care about the adverse outcomes, or an author does not care about the haters.
  • Just as an option does not care about the adverse outcomes, or an author does not care about the haters.
  • No one at present dares to state the obvious: growth in society may not come from raising the average the Asian way, but from increasing the number of people in the “tails,” that small, very small number of risk takers crazy enough to have ideas of their own, those endowed with that very rare ability called imagination, that rarer quality called courage, and who make things happen.
  • This chapter refined the point and presented a manifestation of such asymmetry in the form of an option, by which one can take the upside if one likes, but without the downside. An option is the weapon of antifragility.
  • Let us call trial and error tinkering when it presents small errors and large gains.
  • The graph in Figure 7 best illustrates the idea present in California, and voiced by Steve Jobs at a famous speech: “Stay hungry, stay foolish.” He probably meant “Be crazy but retain the rationality of choosing the upper bound when you see it.” Any trial and error can be seen as the expression of an option, so long as one is capable of identifying a favorable result and exploiting it, as we see next.
  • Domain dependence: he missed it in places where the textbook did not point to the asymmetry—he understood optionality mathematically, but not really outside the equation. He did not think of trial and error as options.
  • (To repeat, in the jargon, “long” means “benefits from” and “short” “hurt by,” and “gamma” is a name for the nonlinearity of options, so “long gamma” means “benefits from volatility and variability.” Anthony even had as his mail address “@longgamma.com.”)
  • But the technology is only trivial retrospectively—not prospectively.
  • As per the Yiddish saying: “If the student is smart, the teacher takes the credit.” These illusions of contribution result largely from confirmation fallacies: in addition to the sad fact that history belongs to those who can write about it (whether winners or losers), a second bias appears, as those who write the accounts can deliver confirmatory facts (what has worked) but not a complete picture of what has worked and what has failed.
  • The important difference between theory and practice lies precisely in the detection of the sequence of events and retaining the sequence in memory.
  • And statistical research tends to be marred with this one-sidedness. Another reason one should trust the disconfirmatory more than the confirmatory.
  • Their wealth came from oil, not from some vocational know-how, so I am certain that their spending on education is completely sterile and a great transfer of resources (rather than milking antifragility by forcing their citizens to make money naturally, through circumstances).
  • The best is, as usual, from the master aphorist Publilius Syrus: “poverty makes experiences” (hominem experiri multa paupertas iubet).
  • My father, showing me the multiplication of villas in the countryside while bemoaning these nouveaux riches, calmly told me, “You, too, had you stayed here, would have become a beach bum. People from Amioun only do well when shaken.”
  • You make forays into the future by opportunism and optionality.
  • No, we don’t put theories into practice. We create theories out of practice.
  • For instance, a triangle was visualized as the head of a horse. Experimentation can make people much more careful than theories.
  • As we will see in the next section, it is precisely this type of uninhibited doer who made the Industrial Revolution happen.
  • Now, worse: Nokia, who used to be the top mobile phone maker, began as a paper mill (at some stage they were into rubber shoes). DuPont, now famous for Teflon nonstick cooking pans, Corian countertops, and the durable fabric Kevlar, actually started out as an explosives company.
  • But we find it hard to apply this lesson to technical skills acquired in schools, that is, to accept the crucial fact that what is picked up in the classroom stays largely in the classroom.
  • But the problem is more general; soccer moms try to eliminate the trial and error, the antifragility, from children’s lives, move them away from the ecological and transform them into nerds working on preexisting (soccer-mom-compatible) maps of reality.
  • As a child of civil war, I disbelieve in structured learning—actually I believe that one can be an intellectual without being a nerd, provided one has a private library instead of a classroom, and spends time as an aimless (but rational) flâneur benefiting from what randomness can give us inside and outside the library. Provided we have the right type of rigor, we need randomness, mess, adventures, uncertainty, self-discovery, near-traumatic episodes, all these things that make life worth living, compared to the structured, fake, and ineffective life of an empty-suit CEO with a preset schedule and an alarm clock.
  • As usual, an ancient, here Seneca, detected the problem (and the difference) with his saying “We do not study for life, but only for the lecture room,” non vitae, sed scolae discimus, which to my great horror has been corrupted and self-servingly changed to fit the motto of many colleges in the United States, with non scolae, sed vitae discimus as their motto, meaning that “We study [here] for life, not for the lecture hall.”
  • Avoidance of boredom is the only worthy mode of action. Life otherwise is not worth living.
  • One day in the 1980s I had dinner with a famous speculator, a hugely successful man. He muttered the hyperbole that hit home: “much of what other people know isn’t worth knowing.” To this day I still have the instinct that the treasure, what one needs to know for a profession, is necessarily what lies outside the corpus, as far away from the center as possible.
  • He taught Nero that an answer is planted in every question; never respond with a straight answer to a question that makes no sense to you.
  • Things are always simpler with him. In real life, as we saw with the ideas of Seneca and the bets of Thales, exposure is more important than knowledge; decision effects supersede logic. Textbook “knowledge” misses a dimension, the hidden asymmetry of benefits—just like the notion of average.
  • Textbook “knowledge” misses a dimension, the hidden asymmetry of benefits—just like the notion of average. The need to focus on the payoff from your actions instead of studying the structure of the world (or understanding the “True” and the “False”) has been largely missed in intellectual history.
  • The need to focus on the payoff from your actions instead of studying the structure of the world (or understanding the “True” and the “False”) has been largely missed in intellectual history. Horribly missed. The payoff, what happens to you (the benefits or harm from it), is always the most important thing, not the event itself.
  • The payoff, what happens to you (the benefits or harm from it), is always the most important thing, not the event itself.
  • Or to rephrase, You decide principally based on fragility, not so much on True/False. Let us discuss the idea of the insufficiency of True/False in decision making in the real world, particularly when probabilities are involved.
  • To conclude this section, note that doing is wiser than you are prone to believe—and more rational.
  • Recall in Chapter 2 my advocacy of redundancies as an aggressive stance.
  • Another intuitive way to look at convexity effects: consider the scaling property. If you double the exposure to something, do you more than double the harm it will cause? If so, then this is a situation of fragility. Otherwise, you are robust.
  • Always keep in mind the difference between a stone and its weight in pebbles. The Kerviel story is illustrative, so we can generalize and look at evidence across domains.
  • Bottlenecks are the mothers of all squeezes.
  • As in the scene from The Godfather (III), “Just when I thought I was out, they pull me back in.”
  • It all boils down to the following: figuring out if our miscalculations or misforecasts are on balance more harmful than they are beneficial, and how accelerating the damage is.
  • Once I figured out that fragility was directly from nonlinearity and convexity effects, and that convexity was measurable, I got all excited. The technique—detecting acceleration of harm—applies to anything that entails decision making under uncertainty, and risk management.
  • The technique—detecting acceleration of harm—applies to anything that entails decision making under uncertainty, and risk management.
  • Let’s say you want to check whether a town is overoptimized. Say you measure that when traffic increases by ten thousand cars, travel time grows by ten minutes. But if traffic increases by ten thousand more cars, travel time now extends by an extra thirty minutes.
  • But if traffic increases by ten thousand more cars, travel time now extends by an extra thirty minutes. Such acceleration of traffic time shows that traffic is fragile and you have too many cars and need to reduce traffic until the acceleration becomes mild (acceleration, I repeat, is acute concavity, or negative convexity effect).
  • Let me summarize the argument: if you have favorable asymmetries, or positive convexity, options being a special case, then in the long run you will do reasonably well, outperforming the average in the presence of uncertainty. The more uncertainty, the more role for optionality to kick in, and the more you will outperform.
  • The more uncertainty, the more role for optionality to kick in, and the more you will outperform. This property is very central to life.
  • In fact the error you get about the rate of growth of the child is much, much smaller than the error you would get measuring his height. The same with a scale: no matter how defective, it will almost always be able to tell you if you are gaining weight, so stop blaming it.
  • The reader might thus recognize the logic behind the barbell. Remember from the logic of the barbell that it is necessary to first remove fragilities.
  • Yet in practice it is the negative that’s used by the pros, those selected by evolution: chess grandmasters usually win by not losing; people become rich by not going bust (particularly when others do); religions are mostly about interdicts; the learning of life is about what to avoid. You reduce most of your personal risks of accident thanks to a small number of measures.
  • In life, antifragility is reached by not being a sucker.
  • So the central tenet of the epistemology I advocate is as follows: we know a lot more what is wrong than what is right, or, phrased according to the fragile/robust classification, negative knowledge (what is wrong, what does not work) is more robust to error than positive knowledge (what is right, what works). So knowledge grows by subtraction much more than by addition—given that what we know today might turn out to be wrong but what we know to be wrong cannot turn out to be right, at least not easily.
  • Rephrasing it again: since one small observation can disprove a statement, while millions can hardly confirm it, disconfirmation is more rigorous than confirmation.
  • Finally, consider this modernized version in a saying from Steve Jobs: “People think focus means saying yes to the thing you’ve got to focus on. But that’s not what it means at all. It means saying no to the hundred other good ideas that there are. You have to pick carefully.
  • Subtractive knowledge is a form of barbell.
  • I have often followed what I call Bergson’s razor: “A philosopher should be known for one single idea, not more” (I can’t source it to Bergson, but the rule is good enough).
  • As they say in the mafia, just work on removing the pebble in your shoe.
  • What is fragile will eventually break; and, luckily, we can easily tell what is fragile. Positive Black Swans are more unpredictable than negative ones.
  • “Time has sharp teeth that destroy everything,” declaimed the sixth-century (B.C.) poet Simonides of Ceos, perhaps starting a tradition in Western literature about the inexorable effect of time.
  • “Time has sharp teeth that destroy everything,” declaimed the sixth-century (B.C.) poet Simonides of Ceos, perhaps starting a tradition in Western literature about the inexorable effect of time.
  • So, the prime error is as follows. When asked to imagine the future, we have the tendency to take the present as a baseline, then produce a speculative destiny by adding new technologies and products to it and what sort of makes sense, given an interpolation of past developments. We also represent society according to our utopia of the moment, largely driven by our wishes—except for a few people called doomsayers, the future will be largely inhabited by our desires.
  • While they don’t usually wear ties, these types tend, of course, to exhibit all the textbook characteristics of nerdiness—mostly lack of charm, interest in objects instead of persons, causing them to neglect their looks. They love precision at the expense of applicability.
  • They love precision at the expense of applicability. And they typically share an absence of literary culture.
  • To understand the future, you do not need technoautistic jargon, obsession with “killer apps,” these sort of things. You just need the following: some respect for the past, some curiosity about the historical record, a hunger for the wisdom of the elders, and a grasp of the notion of “heuristics,” these often unwritten rules of thumb that are so determining of survival.
  • You just need the following: some respect for the past, some curiosity about the historical record, a hunger for the wisdom of the elders, and a grasp of the notion of “heuristics,” these often unwritten rules of thumb that are so determining of survival.
  • So the longer a technology lives, the longer it can be expected to live.
  • I received an interesting letter from Paul Doolan from Zurich, who was wondering how we could teach children skills for the twenty-first century since we do not know which skills will be needed in the twenty-first century—he figured out an elegant application of the large problem that Karl Popper called the error of historicism. Effectively my answer would be to make them read the classics. The future is in the past. 
  • Actually there is an Arabic proverb to that effect: he who does not have a past has no future.
  • Supposedly, if those who don’t watch prepackaged 18-minute hyped-up lectures on the Web paid attention to people in their teens and twenties, who do, and in whom supposedly the key to the future lies, they would be thinking differently. Much progress comes from the young because of their relative freedom from the system and courage to take action that older people lose as they become trapped in life.
  • Another mental bias causing the overhyping of technology comes from the fact that we notice change, not statics.
  • If you announce to someone “you lost $10,000,” he will be much more upset than if you tell him “your portfolio value, which was $785,000, is now $775,000.”
  • My best conversations in philosophy have been with French lycée teachers who love the topic but are not interested in pursuing a career writing papers in it (in France they teach philosophy in the last year of high school). Amateurs in any discipline are the best, if you can connect with them. Unlike dilettantes, career professionals are to knowledge what prostitutes are to love.
  • Every time I hear someone trying to make a comparison between a book and an e-reader, or something ancient and a new technology, “opinions” pop up, as if reality cared about opinions and narratives. There are secrets to our world that only practice can reveal, and no opinion or analysis will ever capture in full.
  • Simple, quite simple decision rules and heuristics emerge from this chapter. Via negativa, of course (by removal of the unnatural): only resort to medical techniques when the health payoff is very large (say, saving a life) and visibly exceeds its potential harm, such as incontrovertibly needed surgery or lifesaving medicine (penicillin).
  • Via negativa, of course (by removal of the unnatural): only resort to medical techniques when the health payoff is very large (say, saving a life) and visibly exceeds its potential harm, such as incontrovertibly needed surgery or lifesaving medicine (penicillin).
  • As usual, the solution is simple, an extension of via negativa and Fat Tony’s don’t-be-a-sucker rule: the non-natural needs to prove its benefits, not the natural—according to the statistical principle outlined earlier that nature is to be considered much less of a sucker than humans.
  • This is the same error as mistaking absence of evidence for evidence of absence, the one that tends to affect smart and educated people, as if education made people more confirmatory in their responses and more liable to fall into simple logical errors.
  • It was pure sucker-rationalism in the mind of doctors, following what made sense to boundedly intelligent humans, coupled with interventionism, this need to do something, this defect of thinking that we knew better, and denigration of the unobserved.
  • It was pure sucker-rationalism in the mind of doctors, following what made sense to boundedly intelligent humans, coupled with interventionism, this need to do something, this defect of thinking that we knew better, and denigration of the unobserved.
  • But it may not be just medicine—what we call diseases of civilization result from the attempt by humans to make life comfortable for ourselves against our own interest, since the comfortable is what fragilizes.
  • Another way to view it: the iatrogenics is in the patient, not in the treatment. If the patient is close to death, all speculative treatments should be encouraged—no holds barred. Conversely, if the patient is near healthy, then Mother Nature should be the doctor.
  • And, talking about radiation, few wonder why, after hundreds of million of years of having our skins exposed to sun rays, we suddenly need so much protection from them—is it that our exposure is more harmful than before because of changes in the atmosphere, or populations living in an environment mismatching the pigmentation of their skin—or rather, that makers of sun protection products need to make some profits?
  • Further, it is not certain whether these indicators people try to lower are causes or manifestations that correlate to a condition—just as muzzling a baby would certainly prevent him from crying but would not remove the cause of his emotions.
  • The ingestion of food combined with one’s activity brings about hormonal cascades (or something similar that conveys information), causing cravings (hence consumption of other foods) or changes in the way your body burns the energy, whether it needs to conserve fat and burn muscle, or vice versa. Complex systems have feedback loops, so what you “burn” depends on what you consume, and how you consume it.
  • Let me repeat the argument here in one block to make it clearer. Evolution proceeds by undirected, convex bricolage or tinkering, inherently robust, i.e., with the achievement of potential stochastic gains thanks to continuous, repetitive, small, localized mistakes. What men have done with top-down, command-and-control science has been exactly the reverse: interventions with negative convexity effects, i.e., the achievement of small certain gains through exposure to massive potential mistakes.
  • As Ennius wrote, “The good is mostly in the absence of bad”; Nimium boni est, cui nihil est mali.
  • “Sometimes scantiness of nourishment restores the system,” wrote Plotinus—and the ancients believed in purges (one manifestation of which was the oft-harmful, though often beneficial, routine of bloodletting).
  • (Aside from the point that the citrus our ancestors ingested was not sweet, they never ingested carbohydrates without large, very large quantities of fiber. Eating an orange or an apple is not biologically equivalent to drinking orange or apple juice.)
  • To understand the outright denial of antifragility in the way we seek wealth, consider that construction laborers seem happier with a ham and cheese baguette than businessmen with a Michelin three-star meal. Food tastes so much better after exertion. The Romans had a strange relation to wealth: anything that “softens” or “mollifies” was seen negatively.
  • So take the following principles derived from the random structure of the environment: when we are herbivores, we eat steadily; but when we are predators we eat more randomly. Hence our proteins need to be consumed randomly for statistical reasons.
  • Hence our proteins need to be consumed randomly for statistical reasons.
  • And there is this antifragility to the stressor of the fast, as it makes the wanted food taste better and can produce euphoria in one’s system. Breaking a fast feels like the exact opposite of a hangover.6
  • And it is not a new theory by empirically blind modern-day nutritionists—for instance I was struck by a dialogue in Stendhal’s monumental novel Le rouge et le noir in which the protagonist, Julien Sorel, is told “the work for the day will be long and rough, so let us fortify ourselves with a breakfast” (which in the French of the period was called “the first lunch”).
  • There is no word for it in Romance languages; in Arabic it is called Shhm—best translated as nonsmall. If you take risks and face your fate with dignity, there is nothing you can do that makes you small; if you don’t take risks, there is nothing you can do that makes you grand, nothing.
  • If you take risks and face your fate with dignity, there is nothing you can do that makes you small; if you don’t take risks, there is nothing you can do that makes you grand, nothing.
  • There is another central element of ancient Mediterranean ethics: Factum tacendo, crimen facias acrius: For Publilius Syrus, he who does not stop a crime is an accomplice.
  • But evidence of whether one has been a sucker or a nonsucker is easy to ferret out by looking at actual records, actions. Actions are symmetric, do not allow cherry-picking, remove the free option. When you look at the actual history of someone’s activities, instead of what thoughts he will deliver after the facts, things become crystal clear.
  • Never ask anyone for their opinion, forecast, or recommendation. Just ask them what they have—or don’t have—in their portfolio.
  • Suckers try to win arguments, nonsuckers try to win.
  • Never listen to a leftist who does not give away his fortune or does not live the exact lifestyle he wants others to follow. What the French call “the caviar left,” la gauche caviar, or what Anglo-Saxons call champagne socialists, are people who advocate socialism, sometimes even communism, or some political system with sumptuary limitations, while overtly leading a lavish lifestyle, often financed by inheritance—not realizing the contradiction that they want others to avoid just such a lifestyle.
  • Prophecy is a pledge of belief, little else. A prophet is not someone who first had an idea; he is the one to first believe in it—and take it to its conclusion.
  • A rule then hit me: with the exception of, say, drug dealers, small companies and artisans tend to sell us healthy products, ones that seem naturally and spontaneously needed; larger ones—including pharmaceutical giants—are likely to be in the business of producing wholesale iatrogenics, taking our money, and then, to add insult to injury, hijacking the state thanks to their army of lobbyists.
  • I turned around and recognized him, and the character suddenly deflated. As the saying goes, it is hardest to be a great man to one’s chambermaid.
  • But he left us with a good lesson: never trust the words of a man who is not free.
  • There exists an inverse Alan Blinder problem, called “evidence against one’s interest.” One should give more weight to witnesses and opinions when they present the opposite of a conflict of interest.
  • Modernity provides too many variables (but too little data per variable), and the spurious relationships grow much, much faster than real information, as noise is convex and information is concave.
  • But the good news is that I am convinced that a single person with courage can bring down a collective composed of wimps.
  • Everything in religious law comes down to the refinements, applications, and interpretations of the Golden Rule, “Don’t do unto others what you don’t want them to do to you.” This we saw was the logic behind Hammurabi’s rule.

Just Like Last Year…….

happyBirthday

Just like last year, google didn’t forget to wish.. Nice….

Displaying Truss

Truss_in_VTK.png

The truss program that was posted two weeks back, looked incomplete without a proper visualisations, so here’s a small VTK function written to display the truss with any quantity like stress/reactions or displacement.

Continue reading

Python Over Other Languages

Found this interesting Infographics on Python over other languages. There is no mention of fortran, but everything said for c++ applies to fortran

python over other languages

via Intellipaat

Only a fool learns from his own mistakes…

Risk_savvy_book
Here are some of the notes from the book Risk Savvy: How to Make Good Decisions by Gigerenzer, Gerd.

Loved the book. Many useful rules of thumbs!!

  • If reason conflicts with a strong emotion, don’t try to argue. Enlist a conflicting and stronger emotion.
  • Always ask: What is the absolute risk increase?
  • Always ask for the reference class: Percent of what?
  • When making decisions, so the argument continues, rules of thumb are always second best. Yet that is only true in a world of known risk, not in an uncertain world. To make good decisions in an uncertain world, one has to ignore part of the information, which is exactly what rules of thumb do. Doing so can save time and effort and lead to better decisions.
  • Such a climate is not a good one for innovation, because originality requires taking risks and making errors along the way. No risks, no errors, no innovation.
  • An old clattery auto is to drive a stretch of 2 miles, up and down a hill, /\. Because it is so old, it cannot drive the first mile—the ascent—faster than with an average speed of 15 miles per hour. Question: How fast does it have to drive the second mile—on going down, it can, of course, go faster—in order to obtain an average speed (for the whole distance) of 30 miles an hour?
  • Good errors help us to learn and to discover. A system that makes no errors will learn little and discover even less.
  • Let us compare two professions with opposing error cultures: commercial aviation and medicine. The error culture of Lufthansa’s and other international air companies’ pilots tends to be a positive one and the reason why flying has become so safe.
  • Ask whether checklists are used; if the answer is no or not forthcoming, choose a different hospital.
  • Don’t ask your doctors what they recommend to you, ask them what they would do if it were their mother, brother, or child.
  • Only a fool learns from his own mistakes. The wise man learns from the mistakes of others. – Otto von Bismarck
  • We may have no control about whether people find our clothes or skills or appearance attractive. But we do have control over internal goals such as acquiring languages, mastering a musical instrument, or taking responsibility for small children or our grandparents. The shift toward external goals is not a biological fact engraved in stone; it is possible for all of us to refocus on internal goals and shed excessive anxiety about everyday risks and uncertainties.
  • Solving a problem simply means representing it so as to make the solution transparent. -Herbert A. Simon
  • I believe in the power of simple rules in the real, messy world. They may not always help, but the first question should nevertheless be: Can we find a simple solution for a complex problem? This question is rarely asked. The reflex is to look for complex solutions first and, if they don’t work, to make them even more complex. The same is true in investment. In the wake of financial turmoil that even specialists were not able to predict, simple rules of thumb provide an alternative. Let’s take one complex problem that many of us face. Assume you have a chunk of money and want to invest it. You do not want to put all your eggs into one basket and are considering a number of stocks. You want to diversify. But how? Allocate your money equally to each of N funds.
  • Make everything as simple as possible, but not simpler.
  • Don’t buy financial products you don’t understand.
  • When someone offers her an investment option, she responds: “You have fifteen minutes’ time to explain how it works. If I still don’t understand it, I won’t buy it.” A simple rule like that can reduce global spread of damage.
  • Save 20 percent, spend 80 percent. Saving does not mean hiding money under your pillow, but rather investing it in the future.
  • The intuitive mind is a sacred gift and the rational mind is a faithful servant. We have created a society that honors the servant and has forgotten the gift. -Albert Einstein
  • Not every rule works all the time, just as a hammer does not work for all home repairs. This is why every CEO needs to have a wide range of “tools.”
  • First listen, then speak. If a person is not honest and trustworthy, the rest doesn’t matter. Encourage people to take risks and empower them to make decisions and take ownership.
  • Innovation drives success. You can’t play it safe and win. Analysis will not reduce uncertainty. When judging a plan, put as much stock in the people as in the plan.
  • Many industries, businesses, and restaurants use simple rules for pricing (“Take the cost of raw food and multiply by three”) and for decision making in general (“Don’t build a building without a tenant”).
  • If everything on earth were rational, nothing would happen. -Fyodor Dostoevsky
  • If you are highly proficient at a sport, don’t think too long about the next move. If you are a beginner, take your time in deciding what to do.
  • Make your expert opponents think rather than follow their gut.
  • Ask the waiter: What would you eat here this evening?
  • Keep your eyes wide open before marriage, half shut afterward. -Benjamin Franklin
  • Find the most important reason and ignore the rest.
  • Marry when most of your peers have gotten married.
  • Try to get the partner that your peers desire.
  • Set your aspiration level. 2. Choose the first alternative that meets your aspiration level and then stop searching. This strategy can help you find a spouse, a house, or other important things. Unless the aspiration level is too high, it will lead to fast decisions. If it proves to be too high, it can be lowered, step by step.
  • Avoid Dietary Supplements. Vitamins, minerals, and other nutrients should be consumed through food and drinks, not supplements. Supplements might have unexpected adverse effects causing cancer. Supplements are only needed for people who have diseases that make it difficult to absorb naturally occurring vitamins.
  • Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius—and a lot of courage to move in the opposite direction. -E. F. Schumacher
  • You have to work hard to get your thinking clean to make it simple. -Steve Jobs
  • A leverage ratio is a rule of thumb that aims at being roughly right instead of precisely wrong.
  • I want to encourage people to form and trust their opinions and to express doubts.
  • The more the media report on a health risk, the smaller the danger for you.
  • Becoming informed and speaking out are important steps toward a participatory democracy.
  • The most interesting information comes from children, for they tell all they know and then stop. -Mark Twain
  • Perhaps the most important feature is that the Finnish system places responsibility before accountability. Part of its success is based on a rule of thumb that we encountered in the toolbox of successful leaders:
  • Hire well and let them do their jobs.
  • Don’t just test last month’s topic; include what was learned before and what has not yet been learned.

Analysing Trusses – a python program

truss_in_python

Was digging into my laptop and found this Truss program written in python. Computes, displacement, stresses and reactions.


"""
Created on Thu May 08 07:07:24 2014

@author: Sukhbinder Singh

Truss FEM

"""
from __future__ import division
import numpy as np

modE=30.0e6
Area=2.0


#numElem=3
#numNodes=4

elemNodes=np.array([[0,1],[0,2],[0,3]])
nodeCords=np.array([[0.0,0.0],[0.0,120.0],[120.0,120.0],[120.0,0]])

#'''
elemNodes=np.array([[0,1],[0,2],[1,2],[1,3],
                    [0,3],[2,3],[2,5],[3,4],[3,5],[2,4],[4,5]])

nodeCords=np.array([
[0.0,0.0],[0.0,3000.0],
[3000.0,0.0],[3000.0,3000.0],
[6000.0,0.0],[6000.0,3000.0]
])


modE=70000
Area=300
#'''

numElem=elemNodes.shape[0]
numNodes=nodeCords.shape[0]

xx=nodeCords[:,0]
yy=nodeCords[:,1]

EA=modE*Area
tdof = 2*numNodes #total number of degrees of freedom
disps=np.zeros((tdof,1))
force=np.zeros((tdof,1))
sigma=np.zeros((numElem,1))
stiffness=np.zeros((tdof,tdof))
np.set_printoptions(precision=3)

'''
force[1]=-10000.0
presDof=np.arange(2,9)

'''
force[3]=-50000.0
force[7]=-100000.0
force[11]=-50000.0

presDof=np.array([0,1,9])
#'''

for e in xrange(numElem):
    indice= elemNodes[e,:]
    elemDof=np.array([indice[0]*2, indice[0]*2+1, indice[1]*2, indice[1]*2+1 ])
    xa=xx[indice[1]]-xx[indice[0]]
    ya=yy[indice[1]]-yy[indice[0]]
    len_elem=np.sqrt(xa*xa+ya*ya)
    c=xa/len_elem
    s=ya/len_elem
    k1=(EA/len_elem)* np.array([[c*c,c*s,-c*c, -c*s],
                                [c*s,s*s,-c*s ,-s*s],
                                [-c*c,-c*s,c*c,c*s],
                                [-c*s,-s*s,c*s,s*s]])
    stiffness[np.ix_(elemDof,elemDof)] +=k1


actDof=np.setdiff1d(np.arange(tdof),presDof)

disp1=np.linalg.solve(stiffness[np.ix_(actDof,actDof)],force[np.ix_(actDof)]);
disps[np.ix_(actDof)]=disp1


# stresses at elements

for e in xrange(numElem):
    indice= elemNodes[e,:]
    elemDof=np.array([indice[0]*2, indice[0]*2+1, indice[1]*2, indice[1]*2+1 ])
    xa=xx[indice[1]]-xx[indice[0]]
    ya=yy[indice[1]]-yy[indice[0]]
    len_elem=np.sqrt(xa*xa+ya*ya)
    c=xa/len_elem
    s=ya/len_elem
    sigma[e] = (modE/len_elem) * np.dot(np.array([-c,-s,c,s]),disps[np.ix_(elemDof)])

        
print disps
print sigma

react = np.dot(stiffness,disps)
print react.reshape((numNodes,2))



Follow

Get every new post delivered to your Inbox.

Join 1,085 other followers

%d bloggers like this: