diff options
Diffstat (limited to 'Numerical_Methods_Principles_by_Analysis/4-Programming_Tools_and_Techniques.ipynb')
-rw-r--r-- | Numerical_Methods_Principles_by_Analysis/4-Programming_Tools_and_Techniques.ipynb | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/Numerical_Methods_Principles_by_Analysis/4-Programming_Tools_and_Techniques.ipynb b/Numerical_Methods_Principles_by_Analysis/4-Programming_Tools_and_Techniques.ipynb new file mode 100644 index 0000000..ca962cb --- /dev/null +++ b/Numerical_Methods_Principles_by_Analysis/4-Programming_Tools_and_Techniques.ipynb @@ -0,0 +1,143 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4: Programming Tools and Techniques" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.1: Quadratic_Equatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 4.1\n", +"//Quadratic Equation\n", +"//Page no. 96\n", +"clc;clear;close;\n", +"a=input('Enter value of a= ');\n", +"b=input('Enter vlaue of b= ');\n", +"c=input('Enter value of c= ');\n", +"x1=(-1*b+sqrt((b^2)-4*a*c))/(2*a); //1st root\n", +"x2=(-1*b-sqrt((b^2)-4*a*c))/(2*a); //2nd root\n", +"printf('\n1st Root= %f', x1);\n", +"printf('\n2nd Root= %f', x2);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.2: Database_Management.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 4.2\n", +"//Database Management\n", +"//Page no. 112\n", +"clc;clear;close;\n", +"M=[12,25,21,35;25,7,23,29;10,27,7,36;26,26,26,35;29,0,23,30]; //marks\n", +"\n", +"//calculation of composite score\n", +"for i=1:5,\n", +" j=1;k=0;\n", +" max1=M(i,j);\n", +" if(max1<M(i,j+1))\n", +" max1=M(i,j+1)\n", +" else\n", +" k=1;\n", +" end,\n", +" \n", +" if(M(i,j+2)>M(i,j+k))\n", +" max2=M(i,j+2);\n", +" else\n", +" max2=M(i,j);\n", +" end,\n", +" CS(i,1)=max1+max2+M(i,4);\n", +"end\n", +"\n", +"I=['Reg. No.','Name of Students','Test 1','Test 2','Test 3','Final';\n", +"'CS/01','C.V.Rajan','12','25','21','35';\n", +"'CS/02','B.X.Roy','25','07','23','29';\n", +"'CS/03','P.C.Sasikumar','10','27','07','36';\n", +"'CS/04','B.D.Box','26','26','26','35';\n", +"'CS/05','K.K.Mukherjee','29','0','23','30';]\n", +"printf('\n')\n", +"for i=1:6\n", +" for j=1:6\n", +" if(j>2)\n", +" printf('\t')\n", +" end\n", +" \n", +" printf('%s ',I(i,j));\n", +" if(i~=1)\n", +" if(j>2)\n", +" printf('\t')\n", +" end\n", +" printf(' ')\n", +" \n", +" end\n", +" if(i==1 & j==6)\n", +" printf('Composite Score\n')\n", +" end\n", +" \n", +" end\n", +" \n", +" if(i~=1)\n", +" printf('%i\n',CS(i-1,1));\n", +"end\n", +"\n", +"end\n", +"//disp(CS,'Composite Score',I);\n", +"max1=CS(1,1);j=1;\n", +"for i=2:5\n", +" if(max1<CS(i,1))\n", +" max1=CS(i,1);j=i;\n", +" end,\n", +"end\n", +"printf('\n\nTopper is:\n%s\t%s\t%s',I(1,1),I(1,2),'Composite Score')\n", +"printf('\nCS/0%i\t\t%s\t\t\t%i',j,I(j+1,2),CS(j,1))" + ] + } +], +"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 +} |