On the checking of inexact coefficients

October 2, 2018

I am writing this post as a way to formally record my solution to a certain problem, and to make some observations on just how does one check if a problem has been solved.

The starting point of this entry is this little challenge posted in the Wolfram Challenges website:

Given four points, write a function ParabolasThrough4 that returns two parabolic expressions whose parabolas pass through the points.

The website gives a hint to use Newton’s original solution. Taking the hint, I thought writing the solution was pretty straightforward and nicely compact:

ParabolasThrough4[pts_] := Module[{d, h, q, r},
   {q, r} = {Det[{##, Times[##], 1} & @@@ pts],
             Det[{##, #2^2, 1} & @@@ pts]}/Det[{##, #^2, 1} & @@@ pts];
   h = -q - Sign[q] Sqrt[q^2 - r]; d = {r/h, h};
   (#1 x + y)^2 + {1, x, y}.{##2} & @@@
   Transpose[Prepend[LinearSolve[PadLeft[pts, {3, 3}, 1],
                                 -(Rest[pts].{d, {1, 1}})^2], d]]]

Note the use of a stabilized form of the quadratic formula.

Checking this implementation against randomly generated convex point sets, it seems to fit the bill, both graphically and after evaluating the resulting parabolas at the original four points.

Alas, trying to submit this solution to the Challenges site fails. What gives?

As it turns out, whenever a proposed solution is rejected, the Challenges site tries to give the exact input that caused the proposed solution to fail. However, the site seemed to be testing against machine precision points, which have been (unhelpfully in this case) truncated for display.

But, checking the parabola coefficients that made it to the display of the message reveals that the “accepted solution” and the proposal have their coefficients differ in the last few places, which caused the rejection. One would try to do a manual check, but again, the input points’ display has been truncated.

So, frustrated by an inflexible solution checker, I gave up and decided to move on to other things; nevertheless, one wonders just how to check solutions in the face of inexact arithmetic.


on auspicious returns

September 24, 2018

Hello readers,

It’s been a long while since I put something up on this blog.

As some of you may already know, I have been in poor health for quite sometime. There has been a collection taken up to help me with my medical stuff, and it has helped in defraying my expenses.

Very unfortunately, I got waylaid again, enough to keep me hospitalized for the last few months. I am not entirely okay now, but at least I can type on the computer again for short periods.

(Speaking of, I really should be lying down after writing this.)

Suffice it to say that I really missed being able to write and code while I was recovering. It was also during that time that I came to the realization that if I, heaven forbid, get into even more serious trouble, all the unreleased code and ideas I had gathered and written over the years would be wasted.

So, I am now actively working to document or finish some of the stuff I had been developing and keeping for years. I am really hoping what I can produce over the next few weeks would be useful to a lot of people.

Thus, please watch this space, as well as my GitHub, and my Stack Exchange and Wolfram Community profiles. Maybe you’ll see something you like.

~ Jan

A health status update

April 12, 2018

I will try to do less of these non-math related posts, since this really isn’t what I intended this blog for. Nevertheless, I am very thankful for the outpouring of help I had gotten when I mentioned my condition in a previous entry.

Now, I was able to fetch my lab results to take to my doc today (all while in the middle of preparing to move to the province). I was supposed to have my check-up yesterday, but it got postponed.

Good news first: the problems with my liver (basically, decreased functioning, as shown by an abnormally high level of liver enzymes), and the problems with my nervous system (the migraines, tremors, etc.) are unrelated. More luckily, the problem with my liver was caught just in time before it could get worse; my doctor is still a bit peeved that I took so long to get tested (I couldn’t exactly tell him I was financially short).

The bad news, however, is that my doc decided to add two new drugs to my regimen. My doctor was reluctant to prescribe the medicine for my tremors until he was sure about the results for my liver tests; now that things have been cleared up, he has given me this new drug. The other new pill is to help treat my liver problem, in addition to the medicines I was already taking previously. I need to take these for three months, up to July.

I am glad that the fundraising effort by halirutan, as well as the assistance given by other donors, has managed to offset my medical costs, but these new prescriptions are now a bit of a problem. (I managed to find generic versions of these new prescriptions, but they still are a bit costly.)

So, I am asking again for some help. As always, please give only what you are comfortable with. Also, a common sentiment I’ve seen in some donors is that they felt 20 dollars or euros was a small contribution, even though these correspond to sizable amounts here. Therefore, please do not feel bad about these amounts; they still help in getting me treated, hopefully so that I can go back to being healthy enough to help even more people.

Thanks for reading.

~ Jan


April 12, 2018

As some of you might know, I am moving out of Manila in a few days. This is to help defray medical costs (the meds I am taking are rather pricey), since my rent in Manila comes to around $180.00 (utilities not included), while renting in the province is comparatively cheaper at $40.00. That is, instead of money going to rent, it can go to doctor’s visits and needed pills instead.

Read the rest of this entry »

Some health updates, and a plea for help.

March 26, 2018

Regular readers of this blog, and people who know me through my Stack Exchange activities, may be quite aware of my frequent hiatuses from the Internet, due to my poor health.

About a few days ago, I was able to scrape enough money for a routine checkup. The doctor who was looking at me, based on my past records, is aware of problems with my liver and nervous system.

Due to me being in slightly less good shape than my last checkup, he has wanted me to get additional tests, and to take on a new medicine regimen.

The catch is that these cost way more than the (already thinly stretched) budget I had for health stuff. Not having insurance of any sort definitely did not help matters.

So, I am going to need to ask for help from kind people again.

Currently, I reckon that I need at least $250.00 for both the additional lab tests, and two weeks’ supply of the medicine. (I was able to bring down that initially higher cost estimate by asking around for labs with cheaper rates, and looking around for generic equivalents of some of the drugs I was prescribed to.)

Still, $250.00 is a bit beyond my reach with the money I have. This is why I am asking if people can chip in some spare change. (Please, contribute only if you are comfortable with doing so.)

People who still have my GMail address can contact me for additional details; people who don’t have my address, but wish to help, can leave a comment on this blog post with your e-mail address, and I’ll drop you a line.

Any contribution, no matter how little, would be very much appreciated.

~ Jan

Addendum, 03/28/2018

I am both overwhelmed and overjoyed by the many e-mails I have received regarding this matter. It is also because of this that I apologize if I am unable to respond promptly; rest assured that I will write a response to everyone.

Additionally, I have already received word that some donors have already sent money my way; please send me the amount you sent so I can track my receipt of the amount, and can thank you properly. I estimate based on the usual delays in processing wire transfers that the first few donations will arrive in a few hours.

Thank you very much for the show of support!

Addendum, 03/31/2018

I am amazed that I am still getting a lot of e-mails about this; I hadn’t realized that that many people care. Now, as it always has been since my first time on the Internet, I am deeply in debt to the “kindness of strangers”. I only hope I can compensate for this someday.

In the interim, prominent user halirutan of Mathematica Stack Exchange has set up a funding page on my behalf:

Help Jan (J.M.) to receive his medical treatment

where you can direct your contributions, if you prefer that method. Otherwise, please leave a comment on this entry so I can e-mail you with the necessary details.

Yet another little personal update

March 5, 2018

Some of y’all may have noticed my increased activity on this blog and in Stack Exchange. This is going to remain a pretty rare occurrence; I will say that I have been ill since October of last year, and have yet to fully recuperate.

In fact, the last two posts were drafts that had been sitting around for a while, and were edited only slightly before posting. Vertigo attacks have compelled me to only sit in front of the computer for no more than 10-15 minutes at a time, before I need to lie down. Because of this, I have not been able to write that much new content this year. (This is not to mention other maladies that all conspire to keep me bedridden for hours at a time.)

Even though I am still in poor health, I remain cautiously optimistic, that one of these days, my condition might improve, and I can go back to being slightly less sporadic in updating this blog.

Here’s hoping.

~ Jan

On emulating the “parula” colormap in Mathematica

March 5, 2018

MATLAB’s current default colormap, after years of (ab)using jet, is called parula. This colormap was named after a gaudy tropical bird.

Read the rest of this entry »