Wednesday, June 05, 2013
Using GoogleCL to post from the terminal
I'm really just testing out using googleCl to post from my terminal to the blog. As simple as pacman -S googlecl, then authenticate via oauth (almost totally automatic, just enter your username and password in the browser window, grant access and done), and then $ google blogger post etc. Very basic. I wonder if I can post a text file....
Saturday, April 20, 2013
Using xmobar to display rcirc status from emacs
I use the emacs rcirc as my main irc client, and via BitlBee, facebook and skype chat. I use XMonad as my window manager, and xmobar as my display bar. Today I added the rcirc status line to my xmobar, so that I can see if I have new messages on any channels/facebook chat/skype. I wrote a short bash scriptlet that I execute in xmobar with
the script is as follows:
#!/usr/bin/env bash
if emacsclient -e rcirc-activity-string > rcirc-string;then
if ircstr=$(cat rcirc-string | tr '"' '\n' | grep '\[');then
echo "<fc=#00ff00>"$ircstr"</fc>"
else
echo "<fc=#0000ff>[]</fc>"
fi
else
echo "<fc=#ff0000>[]</fc>"
fi
This contacts my running emacs server and asks for the status string, and then displays it. I'd have it in the .xmobarrc, but it doesn't handle escaped " so well. If my server isn't running or rcirc isn't, there is no field that contains [, so the output will be empty and my xmobar will just have a few spaces. The echos give me different colors on the xmobar based on what happened, green and the status if rcirc on, blue if emacs on but rcirc not, and red if emacs turned off. Try it!
[Edit: I've decided to try and use erc instead. The command is almost the same (the ircActivity), but the if clause is replaced with:
i
f ercBuffers=$(emacsclient -e "(if (functionp erc-track-shorten-function) (funcall erc-track-shorten-function (mapcar 'buffer-name (mapcar 'car erc-modified-channels-alist))) (nil))");then
if ircstr=$(echo ${ercBuffers:1:${#ercBuffers}-2} | tr ' ' ',' | tr -d '"');then
echo "<fc=#00ff00>["$ircstr"]</fc>"
A little more complicated, but it works, and I believe erc is more feature rich.]
I'll later try to explain my xmonad config, and include the (current) file. It handles everything for me, from handling my workpaces, windows etc.. to changing my keyboardlayout and handling my media keys. It rocks!
Run Com "~/.scritpstouse/rcircActivity" [] "rcirc" 100
the script is as follows:
#!/usr/bin/env bash
if emacsclient -e rcirc-activity-string > rcirc-string;then
if ircstr=$(cat rcirc-string | tr '"' '\n' | grep '\[');then
echo "<fc=#00ff00>"$ircstr"</fc>"
else
echo "<fc=#0000ff>[]</fc>"
fi
else
echo "<fc=#ff0000>[]</fc>"
fi
This contacts my running emacs server and asks for the status string, and then displays it. I'd have it in the .xmobarrc, but it doesn't handle escaped " so well. If my server isn't running or rcirc isn't, there is no field that contains [, so the output will be empty and my xmobar will just have a few spaces. The echos give me different colors on the xmobar based on what happened, green and the status if rcirc on, blue if emacs on but rcirc not, and red if emacs turned off. Try it!
[Edit: I've decided to try and use erc instead. The command is almost the same (the ircActivity), but the if clause is replaced with:
i
f ercBuffers=$(emacsclient -e "(if (functionp erc-track-shorten-function) (funcall erc-track-shorten-function (mapcar 'buffer-name (mapcar 'car erc-modified-channels-alist))) (nil))");then
if ircstr=$(echo ${ercBuffers:1:${#ercBuffers}-2} | tr ' ' ',' | tr -d '"');then
echo "<fc=#00ff00>["$ircstr"]</fc>"
A little more complicated, but it works, and I believe erc is more feature rich.]
I'll later try to explain my xmonad config, and include the (current) file. It handles everything for me, from handling my workpaces, windows etc.. to changing my keyboardlayout and handling my media keys. It rocks!
Sunday, February 03, 2013
The MIT License
When I make code publicly available, I usually do it under the MIT License. Why? Because it is a so called copyfree license, which, in contrast to copyright, merely states that anyone is free to use the provided code, if they include the license (and thus preserving my name in the codebase). It is as follows:
This, in contrast to copyright, does not restrict use of my code in other work, and in contrast to copyleft, does not force them to apply a specific license to their own code. It is thus a true free software license, allowing anyone to use my ideas for free - as long as they acknowledge my participation by including the license. Thus I enrich society by showing more examples of code, maybe help someone out on the project, and gain better reputation - instead of burdening it with pointless legal battles about something no one can really own. If you ever give out any code, use the MIT License, or at least a copyfree license.
[Edit 2013-04-24: After reading tldr;legal, I've decided that the GPL is actually a better license, by making more software free as in freedom. I have thus changed most of my projects to the GPL, and I recommend that you read up on tldr;legal and decide for yourself what license fits your project best. I hope that you'll choose the GPL, though anyone should of course be free to do with their work as they please.]
Copyright (C) <year> <copyright holders> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This, in contrast to copyright, does not restrict use of my code in other work, and in contrast to copyleft, does not force them to apply a specific license to their own code. It is thus a true free software license, allowing anyone to use my ideas for free - as long as they acknowledge my participation by including the license. Thus I enrich society by showing more examples of code, maybe help someone out on the project, and gain better reputation - instead of burdening it with pointless legal battles about something no one can really own. If you ever give out any code, use the MIT License, or at least a copyfree license.
[Edit 2013-04-24: After reading tldr;legal, I've decided that the GPL is actually a better license, by making more software free as in freedom. I have thus changed most of my projects to the GPL, and I recommend that you read up on tldr;legal and decide for yourself what license fits your project best. I hope that you'll choose the GPL, though anyone should of course be free to do with their work as they please.]
Thursday, November 01, 2012
Errata for "A note on the Icelandic crash from an amateur Austrian perspective".
After receiving some comments on my previous post, I've decided to update it with some errata, and just leave the post as it currently is. The following is verbatim from a comment by user herbert_spencer on reddit.com:
>busts are mainly caused by low interest rates.
It may be more accurate to say that they are caused by unsustainable investments because of *artificially* low interest rates.
> Due to the large size of the Icelandic banks (among other things), the belief in Icelandic Krona was high, causing it to be seemingly overvalued.
The fact that that the CBI said it would act as a lender of last resort and that the IMF was believed to have the capability to provide stability seems more important than the size of the banking system (which was albeit probably oversized) to the proliferation of currency mismatching.
>Central Bank of Iceland, through the Floating exchange rate policy raised the exchange rate.
The CBI does not determine the exchange rate directly. The fact that the krona had a floating rate means that it can fluctuate on the market. There is the issue of foreign currencies having lower interest rates than the krona and the consequent currency mismatching because of the implicit guarantee of bailout from the IMF.
> They might have tried to offer the krona undervalued, and then foreign currency would have flowed into the Central Banks stash, as always happens between good money and bad money, for all would have wanted to get their hands on the krona instead of the foreign currency, seeing as it was seen as being better.
Again, a floating exchange rate does not allow the legal undervaluing or overvaluing of currencies. The state may however, as Iceland did following the crash of the krona, limit the use of foreign exchange.
> This enabled Icelanders to get pretty cheap loans
Its not so much the value of the currency that allowed this as the easy monetary policy pursued by the ICB along with the low worldwide interest rates. Short term borrowing expanded as those rates remained low, which, in conjunction with increased long term investment created maturity mismatching (classic Austrian malinvestment) during the boom period.
> for various items, and was used to buy cars etc.
It is also important to remember, and perhaps mention that the credit expansion was not limited to loans for purchases of consumer goods but also in industry and capital goods (and international business). This is where the malinvestment comes into play.
>The price of housing was also artificially high
It may be good to explain the causal relation between the monetary policy and housing prices.
>Then, when the Icelandic banks fell, due to being in a "liquidity trap"
The Keynesian notion of a liquidity trap is questionable and not exactly the cause of the bank crash. It is important to note the difference between the liquidity crisis we saw, where the ICB had lent to insolvent banks (and to the government, which was insolvent). This is where the currency mismatching came back to haunt the ICB. Since debt was owed in foreign currency, there could be no bailout.
>this of course raised the cost of capital to even higher levels than it should have been.
The bust merely reveals the malinvestment.
>The belief in the Icelandic Krona fell, and thus the exchange rate set by the Central Bank was too high, causing an outflow of foreign currency, as it was now determined as being overvalued, and now no one wanted the Icelandic Krona. They then lowered the exchange rate, and thus the foreign currency loans which so many thought were so cheap turned out to be not so cheap at all, merely a fluke.
Again, the exchange rate is not set but is determined by the foreign exchange market. When the bust reared its ugly head in Iceland, and bankruptcy ensued, faith in the krona collapsed, people tried to sell kronur for foreign currency, and its exchange rate naturally collapsed in consequence.
>How could the banks grow so large?
Also, it is important to ask how the banks could make such bad loans.
>We could start by going onto a gold standard, or some other standard in which the value of the currency is based on some commodity.
While it would definitely be an improvement, a denationalized currency may be even better from an Austrian perspective.
>It is a hassle to dig up more gold (certainly more than just to print more money/issue government bonds)
If gold money is mined (on the market. If done by governments, then yes, there is still a problem but the state would probably rather resort to debasing the currency than to mine) to make money, then it is not even inherently a problem. The mining entrepreneur is acting as an arbitrageur since he realized people value gold more than anything else those miners (and the mining equipment) could be doing.
End verbatim.
As I've previously stated, I'm still studying Austrian economics, and many of these points highlight some of my misunderstandings. I believe that reading the book Deep Freeze by Phillip Bagus will further clarify this, and I hope to make another post after having read said book.
>busts are mainly caused by low interest rates.
It may be more accurate to say that they are caused by unsustainable investments because of *artificially* low interest rates.
> Due to the large size of the Icelandic banks (among other things), the belief in Icelandic Krona was high, causing it to be seemingly overvalued.
The fact that that the CBI said it would act as a lender of last resort and that the IMF was believed to have the capability to provide stability seems more important than the size of the banking system (which was albeit probably oversized) to the proliferation of currency mismatching.
>Central Bank of Iceland, through the Floating exchange rate policy raised the exchange rate.
The CBI does not determine the exchange rate directly. The fact that the krona had a floating rate means that it can fluctuate on the market. There is the issue of foreign currencies having lower interest rates than the krona and the consequent currency mismatching because of the implicit guarantee of bailout from the IMF.
> They might have tried to offer the krona undervalued, and then foreign currency would have flowed into the Central Banks stash, as always happens between good money and bad money, for all would have wanted to get their hands on the krona instead of the foreign currency, seeing as it was seen as being better.
Again, a floating exchange rate does not allow the legal undervaluing or overvaluing of currencies. The state may however, as Iceland did following the crash of the krona, limit the use of foreign exchange.
> This enabled Icelanders to get pretty cheap loans
Its not so much the value of the currency that allowed this as the easy monetary policy pursued by the ICB along with the low worldwide interest rates. Short term borrowing expanded as those rates remained low, which, in conjunction with increased long term investment created maturity mismatching (classic Austrian malinvestment) during the boom period.
> for various items, and was used to buy cars etc.
It is also important to remember, and perhaps mention that the credit expansion was not limited to loans for purchases of consumer goods but also in industry and capital goods (and international business). This is where the malinvestment comes into play.
>The price of housing was also artificially high
It may be good to explain the causal relation between the monetary policy and housing prices.
>Then, when the Icelandic banks fell, due to being in a "liquidity trap"
The Keynesian notion of a liquidity trap is questionable and not exactly the cause of the bank crash. It is important to note the difference between the liquidity crisis we saw, where the ICB had lent to insolvent banks (and to the government, which was insolvent). This is where the currency mismatching came back to haunt the ICB. Since debt was owed in foreign currency, there could be no bailout.
>this of course raised the cost of capital to even higher levels than it should have been.
The bust merely reveals the malinvestment.
>The belief in the Icelandic Krona fell, and thus the exchange rate set by the Central Bank was too high, causing an outflow of foreign currency, as it was now determined as being overvalued, and now no one wanted the Icelandic Krona. They then lowered the exchange rate, and thus the foreign currency loans which so many thought were so cheap turned out to be not so cheap at all, merely a fluke.
Again, the exchange rate is not set but is determined by the foreign exchange market. When the bust reared its ugly head in Iceland, and bankruptcy ensued, faith in the krona collapsed, people tried to sell kronur for foreign currency, and its exchange rate naturally collapsed in consequence.
>How could the banks grow so large?
Also, it is important to ask how the banks could make such bad loans.
>We could start by going onto a gold standard, or some other standard in which the value of the currency is based on some commodity.
While it would definitely be an improvement, a denationalized currency may be even better from an Austrian perspective.
>It is a hassle to dig up more gold (certainly more than just to print more money/issue government bonds)
If gold money is mined (on the market. If done by governments, then yes, there is still a problem but the state would probably rather resort to debasing the currency than to mine) to make money, then it is not even inherently a problem. The mining entrepreneur is acting as an arbitrageur since he realized people value gold more than anything else those miners (and the mining equipment) could be doing.
End verbatim.
As I've previously stated, I'm still studying Austrian economics, and many of these points highlight some of my misunderstandings. I believe that reading the book Deep Freeze by Phillip Bagus will further clarify this, and I hope to make another post after having read said book.
Wednesday, October 10, 2012
A note on the Icelandic crash from an amateur Austrian perspective.
[Disclaimer: I am not an authority on these matters, and there may be mechanics to which I am oblivious at play. You should by all means try to come to your own conclusions, rather than blindly trusting something on the internet.]
[Edit: This was posted on reddit, and after having received some feedback, there are some parts of this note which are wrong. I'll make a later post that will serve as errata for this post later.]
By ABCT, Austrian Business Cycle Theory, busts are mainly caused by low interest rates. We see the phenomenon here in Iceland, when Icelanders could borrow money in the form of foreign currency. Due to the large size of the Icelandic banks (among other things), the belief in Icelandic Krona was high, causing it to be seemingly overvalued.
This increased demand for the krona, and responding to this, the Central Bank of Iceland, through the Floating exchange rate policy raised the exchange rate. They might have tried to offer the krona undervalued, and then foreign currency would have flowed into the Central Banks stash, as always happens between good money and bad money, for all would have wanted to get their hands on the krona instead of the foreign currency, seeing as it was seen as being better.
This enabled Icelanders to get pretty cheap loans for various items, and was used to buy cars etc. The price of housing was also artificially high, causing many entrepreneurs to go into housing construction, trapping capital in projects in which there was not as much demand as it seemed.
Then, when the Icelandic banks fell, due to being in a "liquidity trap", this of course raised the cost of capital to even higher levels than it should have been. When capital was now more expensive, the nations companies could not delve into projects they had planned, and many had to stop existing projects, like the famous Harpa, and the building of the University of Reykjavik. The belief in the Icelandic Krona fell, and thus the exchange rate set by the Central Bank was too high, causing an outflow of foreign currency, as it was now determined as being overvalued, and now no one wanted the Icelandic Krona. They then lowered the exchange rate, and thus the foreign currency loans which so many thought were so cheap turned out to be not so cheap at all, merely a fluke.
But why did this happen? How could the banks grow so large? Well, for one thing, they can count on getting bailouts if they over extend themselves, causing them to take bigger risks. When the Icelandic banks were originally privatized, the Icelandic State guaranteed some portion of the deposits, thus leaving even less worries for those in charge to having to meet their obligations, if things should ever go wrong.
So what is the lesson here? How can we prevent this from happening again?
Well, we could start by going onto a gold standard, or some other standard in which the value of the currency is based on some commodity (though not many commodities, as this would fix the exchange rate between them). Gold is seen as a pretty good commodity to base this on, for there seems always to be demand for gold, it is a hassle to dig up more gold (certainly more than just to print more money/issue government bonds), and as it does not corrode, it does not decrease in value. It is also almost universally acknowledged that gold is valuable so people would accept gold as an exchange for other commodities.
This would stifle inflation, as it is caused mainly by more money entering the system, and through the gold standard this becomes hard. It also helps people pick up the notion that we have an economy because of scarce resources, and to actually raise prices of every thing (that is demand more resources for everything), there must be more resources to demand. Demand is caused by, as I've gone into before, people having supply and wanting to exchange it for something else. More demand for everything would mean that people had more supply of everything to demand for, and thus the problem would resolve itself.
Another step would be to not bailout banks, and letting the market actually control itself. Removing the safety net of guaranteeing the deposits would also force people to evaluate whether they trust the bank to store their money, and as they'd be on a gold standard, they wouldn't actually be losing money to inflation by keeping it at home. If they want to get interests, they will have to give their money to the banks, and face the fact that if you want your money to make money for you, you'll have to risk losing some of the money.
Not allowing the banks to borrow out their depositors money except when explicitly allowed to do so would also be a step, for if they have a deal with every depositor that they'll give them their money back at any time, they are actually committing fraud the moment when they can't pay all back at once. Don't worry though, they would still be able to loan out money, though this would have to be on money that people put into locked accounts, say for three months, and the bank could then loan out the money for those three months and pay them back after that time, without having committed fraud.
All this would create a much stabler banking system, which wouldn't have to rely on bailouts time and time again to be functional, nor having it committing fraud just to meet their expected obligations. With a stable banking system, the market could function as it should and inflation would be less.
Though I'm by no means a fan, I'd like to end this note by quoting Keynes via Wikipedia, on how the government can use inflation to confiscate wealth from the citizen, for he seems to have gotten this one right:
"John Maynard Keynes, who had argued against such a gold standard, proposed to put the power to print money in the hands of the [then] privately owned Bank of England. Keynes, in warning about the menaces of inflation, said, "By a continuous process of inflation, governments can confiscate, secretly and unobserved, an important part of the wealth of their citizens. By this method, they not only confiscate, but they confiscate arbitrarily; and while the process impoverishes many, it actually enriches some"." - Wikipedia: Gold standard
This turned out a bit longer than I anticipated (I actually removed "short" from the title), but I hope it leaves you a bit more understanding of the crash and how we could break the cycle. If you are interested in more, I recommend What Has Government Done to Our Money? by Murray N. Rothbard, available for purchase or free at the link provided.
tl;dr: Busts are caused by over expansion of credit. By limiting the possibility of this over-expansion we might be able to break the boom and bust cycle.
P.s.:
If you spot any error, feel free to notify me so I can rectify it.
[Edit: This was posted on reddit, and after having received some feedback, there are some parts of this note which are wrong. I'll make a later post that will serve as errata for this post later.]
By ABCT, Austrian Business Cycle Theory, busts are mainly caused by low interest rates. We see the phenomenon here in Iceland, when Icelanders could borrow money in the form of foreign currency. Due to the large size of the Icelandic banks (among other things), the belief in Icelandic Krona was high, causing it to be seemingly overvalued.
This increased demand for the krona, and responding to this, the Central Bank of Iceland, through the Floating exchange rate policy raised the exchange rate. They might have tried to offer the krona undervalued, and then foreign currency would have flowed into the Central Banks stash, as always happens between good money and bad money, for all would have wanted to get their hands on the krona instead of the foreign currency, seeing as it was seen as being better.
This enabled Icelanders to get pretty cheap loans for various items, and was used to buy cars etc. The price of housing was also artificially high, causing many entrepreneurs to go into housing construction, trapping capital in projects in which there was not as much demand as it seemed.
Then, when the Icelandic banks fell, due to being in a "liquidity trap", this of course raised the cost of capital to even higher levels than it should have been. When capital was now more expensive, the nations companies could not delve into projects they had planned, and many had to stop existing projects, like the famous Harpa, and the building of the University of Reykjavik. The belief in the Icelandic Krona fell, and thus the exchange rate set by the Central Bank was too high, causing an outflow of foreign currency, as it was now determined as being overvalued, and now no one wanted the Icelandic Krona. They then lowered the exchange rate, and thus the foreign currency loans which so many thought were so cheap turned out to be not so cheap at all, merely a fluke.
But why did this happen? How could the banks grow so large? Well, for one thing, they can count on getting bailouts if they over extend themselves, causing them to take bigger risks. When the Icelandic banks were originally privatized, the Icelandic State guaranteed some portion of the deposits, thus leaving even less worries for those in charge to having to meet their obligations, if things should ever go wrong.
So what is the lesson here? How can we prevent this from happening again?
Well, we could start by going onto a gold standard, or some other standard in which the value of the currency is based on some commodity (though not many commodities, as this would fix the exchange rate between them). Gold is seen as a pretty good commodity to base this on, for there seems always to be demand for gold, it is a hassle to dig up more gold (certainly more than just to print more money/issue government bonds), and as it does not corrode, it does not decrease in value. It is also almost universally acknowledged that gold is valuable so people would accept gold as an exchange for other commodities.
This would stifle inflation, as it is caused mainly by more money entering the system, and through the gold standard this becomes hard. It also helps people pick up the notion that we have an economy because of scarce resources, and to actually raise prices of every thing (that is demand more resources for everything), there must be more resources to demand. Demand is caused by, as I've gone into before, people having supply and wanting to exchange it for something else. More demand for everything would mean that people had more supply of everything to demand for, and thus the problem would resolve itself.
Another step would be to not bailout banks, and letting the market actually control itself. Removing the safety net of guaranteeing the deposits would also force people to evaluate whether they trust the bank to store their money, and as they'd be on a gold standard, they wouldn't actually be losing money to inflation by keeping it at home. If they want to get interests, they will have to give their money to the banks, and face the fact that if you want your money to make money for you, you'll have to risk losing some of the money.
Not allowing the banks to borrow out their depositors money except when explicitly allowed to do so would also be a step, for if they have a deal with every depositor that they'll give them their money back at any time, they are actually committing fraud the moment when they can't pay all back at once. Don't worry though, they would still be able to loan out money, though this would have to be on money that people put into locked accounts, say for three months, and the bank could then loan out the money for those three months and pay them back after that time, without having committed fraud.
All this would create a much stabler banking system, which wouldn't have to rely on bailouts time and time again to be functional, nor having it committing fraud just to meet their expected obligations. With a stable banking system, the market could function as it should and inflation would be less.
Though I'm by no means a fan, I'd like to end this note by quoting Keynes via Wikipedia, on how the government can use inflation to confiscate wealth from the citizen, for he seems to have gotten this one right:
"John Maynard Keynes, who had argued against such a gold standard, proposed to put the power to print money in the hands of the [then] privately owned Bank of England. Keynes, in warning about the menaces of inflation, said, "By a continuous process of inflation, governments can confiscate, secretly and unobserved, an important part of the wealth of their citizens. By this method, they not only confiscate, but they confiscate arbitrarily; and while the process impoverishes many, it actually enriches some"." - Wikipedia: Gold standard
This turned out a bit longer than I anticipated (I actually removed "short" from the title), but I hope it leaves you a bit more understanding of the crash and how we could break the cycle. If you are interested in more, I recommend What Has Government Done to Our Money? by Murray N. Rothbard, available for purchase or free at the link provided.
tl;dr: Busts are caused by over expansion of credit. By limiting the possibility of this over-expansion we might be able to break the boom and bust cycle.
P.s.:
If you spot any error, feel free to notify me so I can rectify it.
Thursday, October 04, 2012
Proposal for a 3D screen.
This paste from Markus Persson (aka. Notch) got me thinking on how we could create a real life 3-D screen. Now, this has probably already been figured out before, but here is my proposal:
Have n^3 little translucent cube each with a built in radio/Wi-Fi/Bluetooth receiver (preferably translucent too) and LED light. Assemble them into a cube, and ta-da, you have a 3-D screen that is n pixels on each side. I think the main challenge here would be to a) create the transparent receivers/lights and b) make them small enough so that a high resolution screen could be built without it being too big. Then, one could use Notch's standard to control the screen, up to 1000 pixels, but it could of course be easily extended further. I think it would be pretty neat, especially for plotting various 3-D functions, and just general displaying of designs, many of which are already drawn up in 3-D. This might also help designers realize their designs better. I think the possibility of this warrants further investigation.
Have n^3 little translucent cube each with a built in radio/Wi-Fi/Bluetooth receiver (preferably translucent too) and LED light. Assemble them into a cube, and ta-da, you have a 3-D screen that is n pixels on each side. I think the main challenge here would be to a) create the transparent receivers/lights and b) make them small enough so that a high resolution screen could be built without it being too big. Then, one could use Notch's standard to control the screen, up to 1000 pixels, but it could of course be easily extended further. I think it would be pretty neat, especially for plotting various 3-D functions, and just general displaying of designs, many of which are already drawn up in 3-D. This might also help designers realize their designs better. I think the possibility of this warrants further investigation.
Tuesday, September 11, 2012
Fast multiplication using bitshift and addition.
I have realized a method which one can use to multiply two numbers faster than using only addition, by utilizing bitshift in addition to addition. By using the same idea as the fast fast power adding, but utilizing operators of a lower degree, so instead of using powers and multiplication, we are using multiplication and addition.
Now, when multiplying by a power of two in a binary environment, we are simply preforming a number of bitshifts to the left equal to the power of two, so this is an efficient operation. To get the multiplication of a number which is not a power of two, we can simply go over the bits in the number we are multiplying with, and adding up the bitshifts of each power of two times the number where the bit is equal to one.
I think it is best to describe this with an example, e.g.:
Let us say we're multiplying 5 by 3, that is 0101 and 0011. Now, we go over the number and find that in 3, there are bits in slot 0 and 1 (enumerated from the left in a little-endian system such as this), so we find that
5*3 = (0101*0011) = (1010 + 0101) = 1111 = 15.
And all this pretty efficiently!
We can use this to efficiently compute multiplication, and we can also use this to efficiently compute powers. Might we also use it to efficiently compute addition, using addition and successors? Or even higher order operators? Probably!
Update: By efficiently, I mean that it minimizes the amount of additions needed to be done, in favor of the (I believe) computationally simpler bitshift operation, reducing the additions to floor(log_2(N)), where N is the lower number being multiplied with, if preformed correctly.
Now, when multiplying by a power of two in a binary environment, we are simply preforming a number of bitshifts to the left equal to the power of two, so this is an efficient operation. To get the multiplication of a number which is not a power of two, we can simply go over the bits in the number we are multiplying with, and adding up the bitshifts of each power of two times the number where the bit is equal to one.
I think it is best to describe this with an example, e.g.:
Let us say we're multiplying 5 by 3, that is 0101 and 0011. Now, we go over the number and find that in 3, there are bits in slot 0 and 1 (enumerated from the left in a little-endian system such as this), so we find that
5*3 = (0101*0011) = (1010 + 0101) = 1111 = 15.
And all this pretty efficiently!
We can use this to efficiently compute multiplication, and we can also use this to efficiently compute powers. Might we also use it to efficiently compute addition, using addition and successors? Or even higher order operators? Probably!
Update: By efficiently, I mean that it minimizes the amount of additions needed to be done, in favor of the (I believe) computationally simpler bitshift operation, reducing the additions to floor(log_2(N)), where N is the lower number being multiplied with, if preformed correctly.
Subscribe to:
Posts (Atom)