The calculator available on my mobile as well as the calculator on my laptop did not have a button for calculating the natural logs. It became inevitable for me to write a small javascript for the purpose. This is based on the help scripts available on the Net. I express my gratitude to such helpful netizens.
Here is the script. Open a text editor (say note pad in windows - or gedit in linux) and type the following code.
<html><head><script language='javascript' >
function fnatlogcalc(){
var vtemp = prompt("Enter the number for which log is to be calculated", 2.718)
var vnatlog = Math.log(vtemp)
alert(vnatlog)
} //end func fnatlogcalc
</script>
</head>
<body onload='fnatlogcalc()'>
<input type='button' onclick='fnatlogcalc()' value='Calculate natural logarithm of the number you feed'></button>
</body></html>
Try the above script here:
After pasting the above script in your note pad /gedit, save the file as some name.html (e.g. natlogcalc.html). Select 'all types' at the bottom of the save window in notepad.
Open the html in your browser. You will see the button 'Calculate natural logarithm of the number you feed'. Click it. You will get an alert to enter the number for which you need the natural log. Default appears as 2.718. You can enter any number and click ok button. You will get another alert showing the natural logarithm.
I am not an expert on javascript. I had to write it because a compulsion arose. While going to the Derivative Dealer's test, I believe, you will be permitted to use a scientific calculator which will have a natural log button.
The above javascript is intended for a situation where you have a laptop/pc in hand, but no scientific calculator.
No comments:
Post a Comment