Displaying Markdown and Latex in Jupyter output cells

Categories: Journal
Tags: ,
Comments: Comments Off
Published on: August 14, 2018

Just out of curiosity I started looking into how to get jupyter to display text and math formatted as markdown and latex in output cells. This got into my head when I was looking at symbolic integration and differentiation of functions and how to format the output in a more civilized manner. I don’t have the full solution to the question but formatting output as markdown turned out to be ridiculously easy since the heavy lifting had already been done.

Displaying markdown and Latex in jupyter output cells


  • And of course the new WordPress editor is helpfully mangling both the code highlighting and output. Trust me, it works. I’ll have to sort out how to get “Gutenberg” to do the right thing later.
  • Thrashing around a bit now get’s the code highlighted but now the crayon tag is visible. Still no love for the actual Latex.
  • Rolling back to the old editor and fixing these posts. I’ll deal with the gutenberg editor issues when I’m dragged kicking and screaming to it

So far this morning

Categories: Journal, Projects
Comments: Comments Off
Published on: August 11, 2018

So far this morning I’ve

  • Gotten jupyter notebooks running natively on my workstation rather than using the linux subsystem as a workaround
  • Learned how to integrate functions in python using scipy
  • Got exporting of jupyter notebooks to html working properly
  • Built a scale model of the terrain around my home town in Unity
  • Gained three levels on my warlock

Now I’m going to put my pants on.

Integrating Functions

Quick example on integrating functions with jupyter, matplotlib, numpy, and scipy

Import the required libraries

Define your function

For this example we’ll be using \(f(x) = e^{-x}sin(3x)\) as our function.

Set the range for your plot and integration

To plot \(f(x)\) we get an array of linearly spaced values from numpy, pass that array and our function to the plot function, and show the plot.

Evalating the integral \(\int_{0}^{2\pi}e^{-x}sin(3x)\) simply requires passing our function and the range of the intgral to scipy’s quad function which will return a tuple of the integral and the estimated error.

Integral: 0.29943976718048754
Estimated error 5.05015300411582e-13


Categories: Journal
Comments: Comments Off
Published on: August 6, 2018

There comes a point when it’s clear that you’re not the central figure in your kid’s life. It’s a good thing. You know it’s going to happen someday. You accept it as a natural part of growing up.

The problem is, that moment sneaks up on you when you least expect it and then punches you in the kidney without the slightest warning. Sure, they still want to do things with you but, the fact is, you’re no longer at the top of the priority list and, in fact, you’re further down that list than you’d like to admit.

God, it hurts.

But, it’s good. It’s necessary. And I’d be the worst kind of parent if I manipulated my kid into doing things that make me happy rather than the things that make her happy. So, here I sit, going through another block of python code while she talks and laughs with her friends in the next room rather than playing video games with me.

It’s the right thing but damn if it doesn’t suck ass.

Plugin testing

Categories: Journal
Tags: ,
Comments: Comments Off
Published on: August 5, 2018

One of the benefits of coming back to an existing wordpress blog rather than continuing to try to roll my own in github.io is that I can easily piggyback on other people writing plugins to solve the same problems. So far, the Crayon and MathJax-Latex plugins seem to fit the bill.

Testing syntax highlighting

Testing Latex / Math

J(\theta) &= \frac{1}{m}\sum_{i=1}^{m}Cost(h_\theta(x)^{(i)},y^{(i)}) \\
Cost(h_\theta(x),y) &= -log(h_\theta(x))& y=1 \\
Cost(h_\theta(x),y) &= -log(1-h_\theta(x))& y=0

Three years of silence

Categories: Family, Journal, Social Media
Tags: No Tags
Comments: Comments Off
Published on: August 5, 2018

I’ve been disconnected from social media for two years now. I still occasionally shitpost on reddit but that’s a habit I’ve largely broken myself of. I find, however, that I do need to find someplace to write things down that is both isolated enough from the internet that I don’t get much traffic but public enough that it’s accessible to the people who matter so I’ve dusted off this old wordpress blog. I shuttered it about the time I withdrew from most social media engagement and put the house in AR up for sale for the move to OR; too much to do, too little time.

Going back through the posts and republishing what had been previously made private simply reaffirms that keeping some form of journal is a good idea. I’ve been reminded of things I’d forgotten and identified trends and behaviors that you don’t see in your day to day grind. The short notes about life with my wife and daughter are what took me most by surprise. The reminders of how my little girl has been growing up and how much I love my wife hit hard.

I don’t get the last three years of silence back. I don’t know what I’ve forgotten but the value of keeping some sort of journal, even if it’s just to jog my own memory, is clear.

First world problems

Categories: Life
Tags: No Tags
Comments: Comments Off
Published on: July 23, 2015

I don’t know when this phrase entered my vocabulary. The only recollection I have of it is a comment that I can’t remember by a person I can’t recall on a messages board I’m uncertain of: definitely a first world problem. That little phrase so accurately and powerfully put into perspective the minor irritation the poster was referring to that it immediately became a reflexive yardstick in my own mind.

The grocery store is out of the yogurt I like, definitely a first world problem. Someone is wrong in the internet, definitely a first world problem. I’m out of the artificial sweetener I like, definitely a first world problem. There is a login queue for the MMO I’m playing, absolutely a first world problem.

Looking it up in google it’s clear that this is a meme that has soaked into my mind through osmosis. Reddit has a firstworldproblems board and #tagdef has a definition for it.

It’s like coming across something in your house that you didn’t buy and didn’t borrow. You’re not entirely sure how and why it got to be there and yet it fits with the decor.

This is the beginning of the song

Categories: Journal
Tags: No Tags
Comments: Comments Off
Published on: July 23, 2015

Cultural identity pings

Bad Buddhist: I don’t like prostration

Categories: Journal
Tags: No Tags
Comments: Comments Off
Published on: July 23, 2015

I was looking at some photos taken at a recent festival at Bodghaya and one of them were of the boards used by people making multiple prostrations. I’ve meditated with people who similarly, although less frequently, prostrate themselves. I never prostrate myself.

I understand many of the reasons for prostration but it never feels like anything other than an ostentatious display when public and a meaningless gesture when private. I’m sure that’s part of my western upbringing. Looking at the common rationals for prostration, it isn’t surprising that I’m not inclined to bow my head and bend my back: accumulation of merit, veneration of the Buddha, cultivating humility / negating pride.

The accumulation of merit has always struck me as a very simplistic way to get people to do good things when they might not otherwise be disposed to it. The performance of good deeds in the hopes of a better reincarnation smacks of the belief in something that is actually reincarnated. This runs counter to my own belief that I’m simply a temporary confluence of flesh, mind, thought and experience; that what lives on after I die are simply the echos and ripples of my thoughts and actions, not me. Good deeds aren’t for me, they’re for other people and if that moves the needle on the cosmic balance enough that I benefit indirectly, that’s my better life. Not the next life, this one.

Venerating the Buddha is similarly not a strong motivation to bow. Bowing before someone or some thing to venerate it just isn’t a big part of my cultural experience. My view of Siddhartha Gautama is closer to how a basketball fan might view Michael Jordan. I recognize the accomplishment and feel the desire to emulate it but, just as most basketball fans don’t bow to effigies of Jordan. My veneration takes the form of reaffirming my commitment and taking refuge.

Finally, the real reason I don’t want to prostrate myself is that I don’t want to bow my head or bend my back for anyone. I’m not vain but I am prideful. I should bow for no other reason than to cultivate humility. The trap there is when does prostration stop being an exercise in humility and become a display.

Snowpocalypse 2014: The Homecoming

Categories: Journal
Tags: No Tags
Comments: Comments Off
Published on: July 23, 2015

Getting from the airport to the house yesterday was… interesting. First I had to identify my car among all the other lumps of snow in the economy lot. This consisted of wading in knee deep snow, up and down the rows in the general area of where I remembered parking and listening for the muffled chirp from my car alarm as I repeatedly enabled and disabled it…

Once I’d dug out the driver’s side door I began my fervent appeals to any deity which both existed and might be listening that the thing would start or I’d be wading back to the terminal to try to get a cab. Thanks to a hastily cobbled together “you scratch my back and I’ll scratch yours” deal with Nyarlothotep, the car started, allowing me to put it into a half hour defrost cycle while a dug it out with a hastily modified cardboard box I’d been meaning to recycle.

After some digging and scraping I had most of the snow off the machine and had managed to chip through enough ice that I could see out the windshield and the sides. At this point a plume of steam was coming off my body from a combination of exercise and cold. Time to hit the road.

I say road in the loosest possible terms since what I was driving on was a raised platform of packed snow and ice with Arkansas storm drains on either side i.e. a ditch. I couldn’t actually see the ditches since they were filled with snow but the occasional car trunk projecting from the snow like some long buried Easter Island monolith assured me that they were there.


Player stats and min/maxing

Categories: Game Design, Gaming
Tags: , ,
Comments: Comments Off
Published on: July 23, 2015

One of the things I noticed when playing Diablo 3 is that you no longer allocate points to stats when you level up. The justification for that for Diablo 3 makes perfect sense i.e. that players would identify the optimum stats for their class and then stack their main stat and their HP stat and leave everything else as a dump stat. That is exactly what happened in Diablo 2 and Blizzard learned that lesson well. Stats allocation was made redundant by the game mechanics that tied class abilities to one or two stats.

The problem I have with this is that it is ultimately uninteresting. There is no down side for a tank who is only slightly smarter than a bowl of oatmeal, he’s there to act as a meat shield and the player who’s driving him isn’t made dumber by his stats selection. Therefore, all tanks stack endurance, all rogues stack agility, all mages stack intelligence, all prists stack wisdom and all dps warriors stack strength with everyone stacking just enough endurance that they don’t fold when some mob gives them a dirty look.

Min/maxing has become the rule in MMOs because the various stats are so strongly bound to a particular class. Take agility for example. It’s generally the rogue / melee dps stat because it increases avoidance and chance to crit for melee. There is no reason why a mage or priest type character would put a single point in agility. It simply doesn’t affect any of their mechanics. Fast forward to end game and people start complaining when gear has stats that are not optimized for min/maxing a particular class. Why would heavy armor have wisdom or leather gloves intelligence? The gear does not allow players to optimally min/max for a particular role and so players feel cheated looking at those points ‘wasted’ on a stat that they are not stacking. The end result is that gear is designed to reinforce min/maxing and stacking primary role stats and the game loses a degree of freedom.

Ideally, I think that stats should play a more diverse role in game mechanics than they currently do. Players could continue to build the dumb, clumsy brute of a tank but a more interesting system would make that a challenging path to walk. Consider the following stats effects

Strength –
Primary effect: modifies melee damage
Secondary effect: modifies the number of bag slots available

Intelligence –
Primary effect: modifies spell damage and chance to crit
Secondary effect: modifies experience gain

Wisdom –
Primary effect: modifies mana pool
Secondary effect: modifies spell and stun resistance

Primary effect: modifies health
Secondary effect: modifies resistance to status effects like slows, roots

Primary effect: modifies avoidance and melee crit chance
Secondary effect: modifies movement speed

Primary effect: modifies reputation gain
Secondary effect: modifies NPC interactions and quest rewards

This adds only a single secondary effect to each stat but the effect is wide ranging. Our dumb brute of a tank who stacks nothing but strength and endurance will be slow to level, vulnerable to spell damage, moves slowly, is vulnerable to stuns and generally has a bad time attempting to gain reputation with NPC factions and gets the short end of the stick on quest rewards.

This is only a simple example intended to illustrate how even a minor change to how stats affect game mechanics opens the door for more player choice. Players are presented with choices and trade offs, do they increase melee damage at the expense of experience gain? Will that improved damage translate into a faster kill rate and thus offset the lower xp/kill ratio? Suddenly, a few points of intelligence on heavy armor doesn’t seem like such a waste.

«page 2 of 13»
Welcome , today is Saturday, July 11, 2020