Saturday, June 8, 2019

Financial Calculations in Emacs Calc

In 2013, Andrew Hyatt posted couple of Emacs Calc tutorials to Google Plus, one that I particularly liked dealt with Time Value of Money / (Financial) calculations. Google Plus went away, so did the tutorials, but fortunately it was captured by I am posting them below.

Andrew Hyatt
Feb 16, 2013, Google Plus Emacs Community

I recently chatted with emacspeak creator +T.V. Raman, and told him I was writing a series of short tutorials about calc.  He is really a calc fanatic, and told me a story in which he astounded a loan officer by calculating scheduled loan payments with just a few keystrokes in calc. Raman is living proof that calc is a useful tool for so many situations, and it always pays to have emacs running.  He also mentioned that he found the explanation in the calc tutorial about the financial functions to be the clearest he's ever read.

So, yes, calc can do finance.  Let's say that you were sitting in front of a loan officer, and she told you that for your loan of $500,000, you need to pay in 30 installments with a 5% interest rate.  How much do you need to pay each month?  Wait a second!  Stop right there, loan officer!  I have calc!

M-x calc
500000  (the amount of the loan)
30   (the number of payments)
'5%  (equivalent to typing 0.05)
b M  (calc-fin-pmt, computing the amount of periodic payments to amortize a loan)

1:  25,000

OK, but that's a bit obvious, since $25,000 is just 5% of $500,000.  If the number of payments was much smaller, we'd get a larger value.  Let's take another question: if you wanted to only pay $10,000 in each installment?  How many installments would it take to pay off the loan?

10000  (the payment we want to make)
500000  (the loan amount)
b #  (calc-fin-nper, calculate the number of installments needed)

1:  nper(0.05, 10,000, 500,000)

What?  Oh, I see, I also go the message: "Payment too small to cover interest rate: 10000".  Oh, right, 5% of $500,000 is already $25,000, so we'd never pay it off at that rate.  What if we payed $50,000 instead?

50000  (the payment we want to make)
500000  (the loan amount)
b #

1: 14.2066908

So, it would take just over 14 payments to pay off the loan.

OK, one more cool one:  Let's say you meet an investment banker who gives you the following deal.  I've got a investment for you, she says.  Just give me $100,000 and I'll give you $10,000 at the end of each year for the next 10 years.  The interest rate will stay at 3% for the next 10 years.  Is it a good deal?

Hey, what are you asking me for?  I have no idea!  Calc knows, though, because it can tell you the break-even point for the cost of an investment that gives periodic payments.

'3%  (the interest rate)
10  (the number of payments)
10000  (the payment you get each time)
b P  (calc-fin-pv, calculate the "present value" of the investment, the break-even point for the investment)

1:  85,302.02837

In other words, the break-even point for the initial cost is $85,302.  If the investment costs more than this, it's no good at that assumed interest rate. Better reject the deal.  Trust calc more than any investment banker.

This is just a small sampling of some of the financial calculations that calc can perform.  The next time you are making an investment, fire up calc.  You'll not only have confidence in the deal, you may just amaze someone with the power of emacs, just like T.V. Raman did.

Thursday, March 21, 2019

Friendship with equals, dominance over the weak, and obedience with the strong.

Friendship with equals, dominance over the weak, and obedience with the strong.

I heard this (or a version of this) maxim many times growing up. It is probably from Chanakya's Arthasastra, I am not sure of the source. Could not find this in English search results. I had to do a couple of searches in Malayalam (I hardly ever search in Malayalam) before I could track it down in come blog posts.

സമനോട് സൗഹൃദം, ദുർബലനുമേൽ അധീശ്വത്വം, ശക്തനോട് വിധേയത്വം.
സമനോട് സൗഹൃദം ... ദുര്‍ബലനോട് അധീശ്വത്വം ..ശക്തനോട് വിധേയത്വം

Friday, April 27, 2018

Givers Gain

This is from Reddit.

Giver's gain. Good wisdom anyone can apply in their lives.

There's the mattress owner in Houston named Mattress Mack, and during Hurricane Harvey offered first aid responders to sleep on his mattresses, organized meals for the responders, and essentially converted his stores into a makeshift HQ for several relief programs. All funded by him, and without asking anything in return. He was ahead of the evacuations, offering his stores as a place for refuge for any who needed it, before the storm was serious.

Meanwhile at the same time, Joel Osteen's church, Lakewood, (one of the largest in America) closed it's doors due to flooding (there wasn't any in the church) and only opened their doors when citizens and the media tweeted Joel, asking why they were closed. His response in a live TV interview? "The city didn't ask us to be open." What visionary leadership, having to be asked from the city to use your former basketball stadium-turned-church as an emergency evacuation center.

The Mayor has given Mattress Mack ceremonial awards from the city, and thousands of people across the country bought furniture sets from him as a sign of thank you. He has probably earned millions already from his acts of generosity, and is beloved by the city for his leadership and role during tough times. Best part? He's still remained humble through all this success and attention. You can't buy love.

As for Joel? No one talks about him, or has the time of day to pay attention to what he is doing. No one asked us too.

Giver's gain.

Tuesday, August 15, 2017

Thinking and responding to negative emotions

Someone wrote, in a Hacker News disscussion, on how he thinks of dark or undesirable emotions. Some things can not be changed easily. That stray thought that makes you feel like a blasphemer, accept it as part of the normal. It does not mean you have to be overly concerned about it, instead, what we should do is think about it, recognise it, just don't assault yourself for these thoughts:

You, the thing listening to this advice, is just a small part of a greater whole, much of which you (the thing listening to this advice) are not consciously aware of. This is because you were built by your genes to be good mainly at one thing: reproducing. That's all your genes care about. They don't care about your happiness or achievements or having a fulfilled life. In fact, they don't even really "care" about reproducing, except the same way that water cares about flowing downhill.
Your negative emotions are real. The pain you feel is real. But it's not you. It's something that is being done to you. In that regard it is exactly the same as physical pain, which is also not part of you, but rather something done to you. The fact that you're depressed is no more a character flaw than the fact that it hurts when you skin your knee. - lisper

It is a beautiful way to look at things when it comes to emotions. An objective assessment of the situation, a contextualisation based on biology, so that you need not feel bad about it all, most of it is beyond your control.

Original post linked to a research news on how accepting negative thoughts without lashing out against yourself makes people better than beating yourself up for your thoughts. Feeling bad about feeling bad can make you feel worse

Wednesday, July 6, 2016

Review: The Art of Stillness: Adventures in Going Nowhere

The Art of Stillness: Adventures in Going Nowhere The Art of Stillness: Adventures in Going Nowhere by Pico Iyer
My rating: 1 of 5 stars

Art of Stillness talks about and around 'stillness' for the whole of the book. The author makes it clear in the beginning of the book itself that it is not a manual on how to meditate or a guide on practising 'stillness'. The fault lies with me for taking this up and giving a one start rating. But it the rating represents how I felt and has nothing to do with the book in objective terms. If you like to read an individuals stream of consciousness survey of stillness you may prefer to read this. I wanted to learn about dish washing, I do not want to listen to someone preaching for pages about dish washing philosophy (even though meditation lend itself to infinite philosophical thoughts).

View all my reviews

Sunday, June 12, 2016

Feynman's letter to Wolfram: You don't understand ordinary people; what is RFP;ht?

I saw Richard Feynman's letter to Stephen Wolfram: You don't understand "ordinary people". In the bottom of the letter I saw "RPF;ht". I was curious to understand this abbreviation. RPF is Richard P Feynman and "ht" is Helen Tuck:
'ht' is Helen Tuck, the secretary at Caltech's Theory Group for many years; that mark indicates she typed the letter. I was there many years after Feynman passed away, but I have fond memories of Helen and some of the stories she had to tell about the "old days". -kscaldef
Here is an article about Helen Tuck's retirement
The letter was in reply to Wolfram's letter seeking advice from Feynman on starting a new institute for complexity research to overcome the inhibitions imposed by his existing environment.

Needless to say Wolfram didn't heed his advice and the next year founded UIUC's Center for Complex Systems Research; then, in 1987, he formed Wolfram Research, the company responsible for releasing Mathematica in 1989 and, more recently, Wolfram Alpha. - Letters of Note
Feynman suggests, rather bluntly, Wolfram does not understand ordinary people:
You don’t understand "ordinary people." To you they are "stupid fools" - so you will not tolerate them or treat their foibles with tolerance or patience - but will drive yourself wild (or they will drive you wild) trying to deal with them in an effective way.
He further advice him to try to stay away from ordinary people as far as possible with one exception, to fall madly in love.

Here is the letter in full:


October 14, 1985

Dr. Stephen Wolfram
School of Natural Sciences
The Institute for Advanced Study
Princeton, NJ 08540

Dear Wolfram:

1. It is not my opinion that the present organizational structure of science inhibits "complexity research" - I do not believe such an institution is necessary.

2. You say you want to create your own environment - but you will not be doing that: you will create (perhaps!) an environment that you might like to work in - but you will not be working in this environment - you will be administering it - and the administration environment is not what you seek - is it? You won't enjoy administrating people because you won’t succeed in it.

You don’t understand "ordinary people." To you they are "stupid fools" - so you will not tolerate them or treat their foibles with tolerance or patience - but will drive yourself wild (or they will drive you wild) trying to deal with them in an effective way.

Find a way to do your research with as little contact with non-technical people as possible, with one exception, fall madly in love! That is my advice, my friend.


(Signed, 'Richard P. Feynman')

Richard P. Feynman


Friday, June 3, 2016

Evernote Clearly XPI

Evernote Clearly was shuttered (Evernote blog post) along with some other products. I use this addon frequently in Firefox, it has the ability to grab text from multiple pages and present in one page. Saves clicks and is very convenient to read without losing the flow.

I copied the Evernote Clearly from the profile folder. Profile folder can be easily accessed by going to about:support and click on the 'Show folder' in the 'Profile' row in the table.

It is a zip file, you have to extract to get the Evernote Clearly xpi. Drag and drop this xpi file to Firefox window. Done.

I don't know how long this copy of Clearly will continue to work considering the rapid changes happening in the extension environment in Firefox. I am on the lookout for another extension with similar fetching of multiple pages feature.