2,350 karma · joined May 18, 2009
I think that movie would appeal to a lot of HN members -- it's broadly about people who obsessively pursue some interesting corner of skill or knowledge, and how that makes the world a richer place. Kind of like the "Fred Dibnah, Stepplejack" series that I learned about on HN ([1], and I know it made HN about 7 years ago as well).
You can write (or derive) the expression using sympy, then have sympy generate a numpy expression that can be evaluated. Sympy can also generate the LaTeX code for any expression. So while that isn't an in-LaTeX solution, it may be close to what you want.
Johansson's "Numerical Python" shows several examples of this. I will scavenge one of his examples below (trusting it falls under "fair use", and hoping I transcribe it correctly -- note I have left out the imports). The example uses sympy to generate and plot Taylor series expansions of sin(x).
The key bit to look for in the example is `sympy.lambdify()`.
sym_x = sympy.Symbol("x")
x = np.linspace(-2 * np.pi, 2 * np.pi, 100)
def sin_expansion(x, n):
return sympy.lambdify(sym_x, sympy.sin(sym_x).series(n=n+1).removeO(), 'numpy')(x)
fig, ax = plt.subplots()
ax.plot(x, np.sin(x), linewidth=4, color="red", label='exact')
colors = ["blue", "black"]
linestyles = [':', '-.', '--']
for idx, n in enumerate(range(1, 12, 2)):
ax.plot(x, sin_expansion(x, n), color=colors[idx // 3],
linestyle=linestyles[idx % 3], linewidth=3,
label="order %d approx." % (n+1))
ax.set_ylim(-1.1, 1.1)
ax.set_xlim(-1.5*np.pi, 1.5*np.pi)
ax.legend(bbox_to_anchor=(1.02, 1), loc=2, borderaxespad=0.0)
fig.subplots_adjust(right=.75)
I highly recommend the book. It's full of nuggets like this.Explicitly tagging the construct you are closing makes it easier to understand long swaths of code (where the start of a loop or function may have disappeared off the top of the page by the time you scroll to the end of the loop/function). It can also make compiler error messages more helpful.
I don't see it in the ParaSail code samples, but where this really shines in Fortran is letting you name loops. This makes the control structure much easier to understand (again, especially in longer loops). So you can have code like
loop_timesteps: do
...
loop_converge: do
...
loop_actors: do
...
end do loop_actors
...
end do loop_converge
...
end do loop_timesteps
Now to break out of a loop, you can be explicit about which one you want to break out of. Not only does that help with code clarity, it also allows you to jump out of a deeper nesting than just the immediate one, which means you don't have to set flags, or repeat tests, in order to get to where you want to go.I realize that most programmers on HN will be thinking "if I had a loop or function that long, I would break it up into smaller functions, and express my nesting that way."
That's generally good advice, but it's not always useful in numerical code (which ParaSail seems to target).
In numerical code, you tend to run through those loops a lot of times, and you tend to have a lot of local variables (for example, in a physics calculation you might take primary variables like pressure, temperature, and mass fractions, and use them to find a lot of related values like humidity ratio and molar concentration and gradient estimates &etc). So the overhead of making large numbers of function calls with long parameter lists can become too much.
Nobody I know hates his work, but nobody takes to him quite the way I have. Royal Physician is fairly conventional in structure and tone, but Enquist's more personal work -- the work that feels like it comes from his deep interior life, like Downfall, and Captain Nemo's Library -- seem even harder for a lot of people to get into.
Comes with a 5x5 LED array, an accelerometer, two physical push-buttons, three capacitive sensors, and a bluetooth antenna, already on-board. It means you can start programming without having to plug in to a breadboard and wire up your inputs. You can also hang external sensors and actuators off of it, but the point is you don't need to in order to move beyond toy demonstrations.
It was designed specifically for education, so there are lots of beginner-oriented tutorials available, as well as educator-oriented lesson plans.
As fusiongyro points out, you can program it using three high-level languages. The graphical language lets you toggle to the Javascript version, so there's a clear learning path built-in. These provide high-level commands, such as "get the orientation", or "get the number of button presses since the last query", which makes programming it very straightforward.
It removes a lot of toolchain fussiness. Just run an online editor, or a desktop editor (Mu). These produce binaries that you drag onto the Micro:bit, which mounts to your desktop like an external drive. You can also program it from a smart phone or iPad.
"She had exactly the German way; whatever was in her mind to be delivered, whether a mere remark, or a sermon, or a cyclopedia, or the history of a war, she would get it into a single sentence or die. Whenever the literary German dives into a sentence, that is the last you are going to see of him till he emerges on the other side of his Atlantic with his verb in his mouth."
If every species goes extinct, and if there is no reason to protect any species in and of itself, then what makes human endeavor so damn important?
This is the logic of the powerful, a pure might-makes-right argument. I see what I want, and I take it. It's easy to kill things, or at least hard to avoid killing them, when they get in our way, so don't worry about it.
In fact, profess to not having the "foggiest notion" why you might want to worry about it, even though the arguments in favor (biodiversity, makes life more wonderful, we don't know how the web is connected, etc.) are part of mainstream culture, and not at all hard to discover if you honestly wanted to try.
Briefly, rather than using topic titles ("Experimental Setup", "Results"), use assertions ("Sampling occurred over 5 days", "Sunlight causes significant degradation") as titles. Then the bulk of the slide is some information, preferably graphical, that supports the assertion. Reading the titles in order should give you a strong sense of the presentation content.
I strongly recommend "The Craft of Scientific Presentations" by Michael Alley, which covers the assertion-evidence approach, and a host of other practical topics.
This suggests that our sensory perceptions (and possibly, in the current research, our memories) lose fine detail in a way that can be analogized, if not explained directly, in terms of discarding or losing high-frequency information.
Hearing Robert Munsch read his own stories can be a revelation. He puts so much energy into the reading, in a way that kids seem to really enjoy. He also often deviates from the published text. Listening to him made me willing to take a lot more risks as a reader.
I read "Paper Bag Princess" to my daughter's kindergarten class, and then played them Munsch's rendition [0]. Whenever I go back, the kids ask if they can hear an author reading their own book.
Occasionally the person's comments only include political opinions, but I would say that, for the majority of these posters, the technical/programming comments outweigh the political ones.
I don't know about other discussion boards. HN is the only forum on which I actively participate -- maybe because it's so good at self-policing that the trolls don't tend to survive long here.
In all, I've converted 3 PDFs to Kindle format -- one is OK, one is a slog to read, and the third I forgot I was reading a converted version. Have never tried using it to convert a LaTeX-generated document of my own, though.
By contrast, LaTeX works the same everywhere -- to the extent that SymPy can derive an equation, output it as LaTeX, and it goes right into a paper or presentation without issues.
I really like this book so far (it's still in the early access stage of writing).
http://www.informit.com/promotions/programming-with-c-and-c-...
Here, the problem arises because the equational system is ill-conditioned. Yet you present the system as if the coefficients are known exactly.
In reality, this ill-conditioned model can arise for two reasons:
+ The equations represent a physical system that is ill-conditioned -- a slight change in the system can produce a huge change in its output. So where did those coefficients, with their 8 digits, come from? A minor error measuring the coefficients will throw off your "correct" solution. In this case, modeling error is every bit as important as floating-point error.
+ The physical system is not poorly conditioned, but the model is. In this case, by definition, modeling error overwhelms floating-point error.
So the essay still advances the correct perspective -- if you are modeling an ill-conditioned system, you had better spend a lot of time worrying about the effects of modeling errors, before you get hung up worrying about FP errors. And if you know the system is ill-conditioned, then poor conditioning in the model is one of the things that an experienced analyst will be prepared for.
One reason I like the book is it gives a high-level overview of what algorithms are available to solve a problem, and a sense of which is most appropriate to my problem. If I need rigor after that, I can go to an appropriate source.
The original idea of QSS was to bolt an ad hoc step length control mechanism onto the most basic explicit method, forward Euler. So at its core, the original QSS method is exactly a traditional explicit integration, except that the length of any individual step is not adjusted based on feedback about how well the step actually did.
Why would you do that? The motivation was to enable parallel execution of large modularly-composed systems, without getting bogged down with iterations. Basically every important design decision in QSS methods comes directly from, or is at least deeply influenced by, the desire to avoid iterations between components in the simulation. They want to avoid large communication overheads, and they want to enable components to step forward in time as independently of each other as possible. The dream is to enable the simulation of large systems by just connecting components together, and letting each one broadcast what it plans to do over the next time step, and how long it will do it. Thus the core idea of QSS is to choose the step length a component can take before it takes the step, and to not get too inquisitive about how well the step actually did.
I always thought that QSS methods would benefit from adapting a trust region approach to at least control errors going forward in time, but as far as I know, they never did.
By the way, later versions of QSS introduced some implicit-flavored methods. I believe they are still only implicit in the local information (i.e., only state variables defined within a component get an implicit model), and that state variables defined in other, communicating, components still have an unchanging, forward-projected model. However, it's been a long time since I looked at those methods, and I might be wrong about that.
If you've read much about Modelica, you probably know this, but one key to thinking about Modelica is to recognize that you're not defining a nodal system anymore -- at least, not in the way that an electrical engineering textbook would define it. Yes, you can define a network, which can have resistive/capacitive/inductive elements strung between nodes. However, in EE-speak, you would then form either the nodal equations or the mesh equations, depending on whether you wanted to add up currents into nodes, or voltages around loops. But in Modelica, you just state the component relations, and the rules that apply to the connections between components. Then the solver decides how to set up the system equations. Typically the solver uses graph-theoretical techniques to reduce the number of unknowns, or to achieve other nice system properties. So for example if you had a bunch of components in series, you might expect the common current to be a state variable, whereas in another part of the system you might find voltage state variables. Modelica encourages you to think about the components, and let the solver handle the system assembly and solution.
I believe Modelica got its start in the automotive simulation world, where there is a need for large-scale lumped-parameter multiphysics models. I'm not sure how ACSL fits in. In the building simulation world, there was also an earlier language called Neutral Model Format that attacked many of the same problems as Modelica.
It's been a long time since I studied bond graphs, but I would say Modelica is much more general, since it allows discrete as well as continuous components, and since it doesn't require the formalism of identifying the equivalent of voltages and currents in each domain (don't remember what bond graph theory calls those). I think Modelica even allows components to be defined by algorithms, although obviously those components may not have mathematical inverses that can be easily manipulated when assembling the system.
My impression is that the solver landscape is a little uneven (the solver reads a Modelica model and computes its solution). For one thing, open-source solvers seem to lag behind the commercial implementations, in terms of capabilities. Even with commercial solvers, there seems to be a non-negligible amount of work around taking correct models that don't run, and reformulating them to let the solvers run them. Caveats -- I don't work on this personally, but know people in my division who do. Also, these impressions are a few years old, and doubtless the situation is improving as time goes on.
[0] Library of component modules for building energy and control systems (http://simulationresearch.lbl.gov/modelica/)
[1] "Spawn of EnergyPlus", a prototype next-gen whole-building energy solver (https://energy.gov/eere/buildings/downloads/spawn-energyplus...)
If you really wanted to be malicious, you would curtail fresh air, rather than cut off heat. It would be harder to notice, and would give you an attack that didn't depend on cold weather.
And arguably the long-term consequences would be greater. The kids who got cold would bundle up and complain, leading to a (possibly energy-wasting) fix. The kids who got a low-grade headache and fatigue every afternoon might conclude "I'm just not cut out for learning."
It can actually be informative to look over his shoulder as a meeting progresses, to see what loose ends are still dangling, and where people focus the most attention.
For myself, I've moved to markdown-style in my handwritten notes. It isn't as fluid as mind maps, but the bullet points and headings still bring out structure, and the number of sub-bullets under any given item can hint to me if I haven't understood how things are going at a fine enough or coarse enough level.
All these, plus another component I personally enjoy in adventure books -- flawed characters who complement each other, and so become collectively stronger than they stand as individuals. For example, Bigwig has an amazing character arc, where he learns to subordinate his strength to Fiver's vision and Hazel's leadership.
Other examples include the foursome in "The Three Musketeers" (who explicitly arrange their affairs to contribute equitably from among their talents, money, and time), and "Kidnapped" (where David Balfour and Alan Breck have to learn to trust each other in order to negotiate the dangers they face on each other's behalf).
There are a few reasons this effect probably doesn't matter so much. First, the dead spaces tend to be places where people don't breath -- in closets, under furniture, in corners, near ceilings, etc. Second, where people do go, they bring thermal plumes and activity-generated eddies, which tend to mix up room air. In fact, the act of breathing also provides mechanical power that will promote mixing. The filter itself also blows air, giving more mixing than if the filter wasn't present.
The net effect is that the participating volumes of the room, where people tend to breath, probably get mixed at a rate similar to, or greater than, the rate at which the filter scrubs the air. Any non-participating volumes act as slow-filling and slow-releasing reservoirs, which delay the room's response to changes in outdoor concentrations.
I would worry more about the filter only cycling the air 4-5 times per hour. That's probably faster than the effective release rate of the indoor sources with which Mr. Hefferman (the expert cited in the NYTimes article) seems to have have experimented. However, it's the same order of magnitude at which outside air gets into most houses (especially in the parts of California affected by these fires). My gut feeling is that implies the filter isn't going to keep up so well -- though I'd want to model it to say anything definitive.