{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 2: Simple and compound interest" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.10: Calculate_simple_interest.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Exa9\n", "clc;\n", "clear;\n", "close;\n", "//given data is :\n", "CI=102;//in rupees\n", "r=4;//in % per annum\n", "n=2;//in years\n", "//Let principal amount is P\n", "//Amount will be: A=P+102\n", "//formula : A=P(1+r/100)^n=P+102;\n", "P=102/((1+r/100)^n-1);\n", "SI=(P*r*n)/100;\n", "disp('Simple interest is : '+string(SI)+' Rupees.')" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.1: Calculate_compound_interest.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Exa1\n", "clc;\n", "clear;\n", "close;\n", "//given data is :\n", "P=10000;//in rupees\n", "n=3;//in years\n", "r=10;//% per annum\n", "A=P*(1+r/100)^n;\n", "CI=A-P;//in rupees\n", "disp('Compound interest is : '+string(CI)+' Rupees.')\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.2: Find_compound_interest.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Exa2\n", "clc;\n", "clear;\n", "close;\n", "//For first year\n", "P1=500;//in rupees\n", "n=3;//in years\n", "r=10;//% per annum\n", "T=1//in year\n", "I1st=(P1*r*T)/100;\n", "A1=P1+I1st;\n", "//For second year\n", "P2=A1;\n", "I2nd=(P2*r*T)/100;\n", "A2=P2+I2nd;\n", "//For third year\n", "P3=A2;\n", "I3rd=(P3*r*T)/100;\n", "A3=P3+I3rd;\n", "//compound interest or 3 years\n", "CI=A3-P1;\n", "disp('Compound interest is : '+string(CI)+' Rupees.')\n", "\n", "\n", "\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.3: Find_the_ammount_and_compounded_interest.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Exa2\n", "clc;\n", "clear;\n", "close;\n", "//given data is :\n", "P=5000;//in rupees\n", "n=3/2;//in years\n", "r=10/2;//% per annum paid half yearly\n", "m=2;//freq of compounding\n", "A=P*(1+r/100)^(m*n);\n", "CI=A-P;//in rupees\n", "disp('Compound interest is : '+string(CI)+' Rupees.')\n", "\n", "\n", "\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.4: Find_the_time.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Exa4\n", "clc;\n", "clear;\n", "close;\n", "//given data is :\n", "n=3;// in years \n", "disp('Let P=x then A=2*x');\n", "disp('Let r% be the rate of interest');\n", "//formula : A=P(1+r/100)^n;\n", "//putting values\n", "disp('2*x=x(1+r/100)^3');\n", "disp('or');\n", "disp('2=(1+r/100)^3')\n", "//on solving this eqn\n", "r=((2^(1/3))-1)*100;//in %\n", "disp(r,'rate is comtuted :')\n", "disp('suppose in n years the amount x will become 16*x, then by formula')\n", "//16=(1+r/100)^n;\n", "n=log(16)/log(1+r/100);\n", "disp('Time is : '+string(n)+' years');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.5_a: Find_compound_interest_reckoned_quarterly.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Exa5(a)\n", "clc;\n", "clear;\n", "close;\n", "//given data is :\n", "P=4000;//in rupees\n", "N=9;// months\n", "R=6;// in % per annum\n", "//if interest is reckoned quarterly\n", "r=R/4;// in % per quarter,as there are 4 quarters in a year\n", "n=(N/12)*4;//in quarters\n", "Amount1=P*(1+r/100)^n;\n", "CI1=Amount1-P;\n", "disp(CI1,'Compound interest while reckoned quarterly :')\n", "//Ans in the book is not correct" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.5_b: Find_compound_interest_reckoned_half_yearly.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Exa5(b)\n", "clc;\n", "clear;\n", "close;\n", "//given data is :\n", "P=4000;//in rupees\n", "N=9;// months\n", "R=6;// in % per annum\n", "//if interest is reckoned half yearly\n", "r=R/2;// in % per half yearly,as there are 2 half years in a year\n", "n=(N/12)*2;//in half years\n", "Amount2=P*(1+r/100)^n;\n", "CI2=Amount2-P;\n", "disp(CI2,'Compound interest while reckoned half yearly :')\n", "//Ans in the book is not correct" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.5_c: Find_compound_interest_reckoned_yearly.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Exa5(c)\n", "clc;\n", "clear;\n", "close;\n", "//given data is :\n", "P=4000;//in rupees\n", "N=9;// months\n", "R=6;// in % per annum\n", "//if interest is reckoned yearly\n", "r=R;// in % per annum\n", "n=(N/12);//in years\n", "Amount3=P*(1+r/100)^n;\n", "CI3=Amount3-P;\n", "disp(CI3,'Compound interest while reckoned yearly :')\n", "//Ans in the book is not correct" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.6: Find_compound_interest.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Exa6\n", "clc;\n", "clear;\n", "close;\n", "//given data is :\n", "P=10000;//in rupees\n", "N=3;// years\n", "r1=4;// in % per annum for 1st year\n", "r2=5;// in % per annum for 2nd year\n", "r3=10;// in % per annum for 3rd year\n", "A=P*(1+r1/100)*(1+r2/100)*(1+r3/100);\n", "CI=A-P;\n", "disp('Compound interest is : '+string(CI)+' Rupees.')\n", "\n", "\n", "\n", "\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.7: Find_the_amount.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Exa7\n", "clc;\n", "clear;\n", "close;\n", "//given data is :\n", "CI=496.50;//compound interest in rupees\n", "n=3;//in years\n", "r=10;//rate in % per annum\n", "disp('CI is given by : ');\n", "disp('CI=P(1+r/100)^n-P');\n", "//solving this eqn\n", "P=CI/((1+r/100)^n-1);\n", "disp('Principal amount is : '+string(P)+' Rupees.')\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.8: Find_the_time.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Exa8\n", "clc;\n", "clear;\n", "close;\n", "//given data is :\n", "P=2000;//in rupees\n", "A=2662;//in rupees\n", "r=10;//% per annum\n", "//formula : A=P(1+r/100)^n;\n", "//solving for n\n", " n=log(A/P)/log(1+r/100);\n", " disp('The time in which Rs.2000 will rise to Rs. 2662 is : '+string(n)+' years.')" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.9: Find_the_principal_amount.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Exa9\n", "clc;\n", "clear;\n", "close;\n", "//given data is :\n", "r=5;//% per annum\n", "n=2;//in years\n", "//let amount=P\n", "//CI=P(1+r/100)^n-P;\n", "//SI=(P*r*n)/100;\n", "//CI-SI=15 Rupees;given\n", "disp('solving eqns for CI and SI, we get : ')\n", "disp('CI=0.1025*P');\n", "disp('SI=0.10*P');\n", "P=15/(0.1025-0.10);//using CI-SI\n", "disp('Principal amount is : '+string(P)+' Rupees.')\n", "\n", "\n", "\n", "" ] } ], "metadata": { "kernelspec": { "display_name": "Scilab", "language": "scilab", "name": "scilab" }, "language_info": { "file_extension": ".sce", "help_links": [ { "text": "MetaKernel Magics", "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" } ], "mimetype": "text/x-octave", "name": "scilab", "version": "0.7.1" } }, "nbformat": 4, "nbformat_minor": 0 }