summaryrefslogtreecommitdiff
path: root/Engineering_Physics_by_D_C_Ghosh/2-Electricity_and_Magnetism.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Engineering_Physics_by_D_C_Ghosh/2-Electricity_and_Magnetism.ipynb')
-rw-r--r--Engineering_Physics_by_D_C_Ghosh/2-Electricity_and_Magnetism.ipynb234
1 files changed, 234 insertions, 0 deletions
diff --git a/Engineering_Physics_by_D_C_Ghosh/2-Electricity_and_Magnetism.ipynb b/Engineering_Physics_by_D_C_Ghosh/2-Electricity_and_Magnetism.ipynb
new file mode 100644
index 0000000..a3cdc5e
--- /dev/null
+++ b/Engineering_Physics_by_D_C_Ghosh/2-Electricity_and_Magnetism.ipynb
@@ -0,0 +1,234 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 2: Electricity and Magnetism"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.12: Work_done_in_moving_a_particle_in_force_field.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Scilab Code Ex2.12: Page-80 (2008)\n",
+"clc; clear;\n",
+"t = poly(0, 't');\n",
+"x = t^2 + 1;\n",
+"y = 2*t^2;\n",
+"z = t^3;\n",
+"F = [3*x*y -5*z 10*x]; // Force acting on the particle, N\n",
+"t1 = 1; // lower limit\n",
+"t2 = 2; // upper limit\n",
+"dr = [derivat(x); derivat(y); derivat(z)]; // Infinitesimal displacement, m\n",
+"dW = F*dr; // Work done or infinitesimally small displcement, J\n",
+"work_exp = sci2exp(dW); // Convert the polynomial to the expression\n",
+"W = integrate(work_exp, 't', t1, t2); // Total work done in moving the particle in a force field, J\n",
+"printf('\nThe total work done in moving the particle in a force field = %d J', W);\n",
+"// Result "
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.13: Evaluation_of_force_integral.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Scilab Code Ex2.13: Page-80 (2008)\n",
+"clc; clear;\n",
+"x = poly(0, 'x');\n",
+"y = x^2-4;\n",
+"F = [x*y (x^2 + y^2)]; // Force acting on the particle, N\n",
+"x1 = 2; // lower limit\n",
+"x2 = 4; // upper limit\n",
+"dr = [derivat(x); derivat(y);]; // Infinitesimal displacement, m\n",
+"dW = F*dr; // Work done or infinitesimally small displcement, J\n",
+"work_exp = sci2exp(dW); // Convert the polynomial to the expression\n",
+"W = integrate(work_exp, 'x', x1, x2); // Total work done in moving the particle in a force field, J\n",
+"printf('\nThe total work done in moving the particle in the x-y plane = %d J', W);\n",
+"// Result \n",
+"// The total work done in moving the particle in the x-y plane = 732 J "
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.31: Electric_flux_through_a_surface_area.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Scilab Code Ex2.31: Page-93 (2008)\n",
+"clc; clear;\n",
+"E = [3 4 8]; // Coefficients of i, j and k in the electric field, N/C\n",
+"S = [0; 0; 100]; // Coefficients of i, j and k in the area vector, Sq. m\n",
+"phi_E = E*S; // Electric flux through the surface, N-Sq.m/C\n",
+"printf('\nThe electric flux through the surface = %d N-Sq.m/C', phi_E);\n",
+"// Result \n",
+"// The electric flux through the surface = 800 N-Sq.m/C "
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.32: Electric_flux_through_an_area_in_XY_plane.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Scilab Code Ex2.32: Page-93 (2008)\n",
+"clc; clear;\n",
+"E = [8 4 3]; // Coefficients of i, j and k in the electric field, N/C\n",
+"S = [0; 0; 100]; // Coefficients of i, j and k in the area vector, Sq. m\n",
+"phi_E = E*S; // Electric flux through the surface, N-Sq.m/C\n",
+"printf('\nThe electric flux through the area in XY plane = %d N-Sq.m/C', phi_E);\n",
+"// Result \n",
+"// The electric flux through the area in XY plane = 300 N-Sq.m/C "
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.33: Electric_flux_through_a_surface_in_YZ_plane.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Scilab Code Ex2.33: Page-93 (2008)\n",
+"clc; clear;\n",
+"E = [2 3 4]; // Coefficients of i, j and k in the electric field, N/C\n",
+"S = [10; 0; 0]; // Coefficients of i, j and k in the area vector, Sq. m\n",
+"phi_E = E*S; // Electric flux through the surface, N-Sq.m/C\n",
+"printf('\nThe electric flux through the surface in YZ plane = %d N-Sq.m/C', phi_E);\n",
+"// Result \n",
+"// The electric flux through the surface in YZ plane = 20 N-Sq.m/C"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.39: Magnetic_field_due_to_a_straight_conductor_carrying_current.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Scilab Code Ex2.39: Page-96 (2008)\n",
+"clc; clear;\n",
+"mu_0 = 4*%pi*1e-007; // Absolute magnetic permeability of free space, N/ampere-square\n",
+"I = 15; // Current through the wire, A\n",
+"x = 1e-002; // Distance of observation point from the wire, m\n",
+"B = mu_0/(4*%pi)*2*I/x; // Magnetic field at 1 cm distance, T\n",
+"printf('\nThe magnetic field due to the current carrying wire at %d cm distance = %1.0e tesla', x/1e-002, B);\n",
+"x = 5; // Distance of observation point from the infinite straight conductor, m\n",
+"I = 100; // Current through the straight conductor, A\n",
+"B = mu_0/(4*%pi)*2*I/x; // Magnetic field at 1 cm distance, T\n",
+"printf('\nThe magnetic field due to the current carrying infinite straight conductor at %d m distance = %1.0e tesla', x, B);\n",
+"// Result \n",
+"// The magnetic field due to the current carrying wire at 1 cm distance = 3e-004 tesla\n",
+"// The magnetic field due to the current carrying infinite straight conductor at 5 m distance = 4e-006 tesla "
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.40: Force_between_two_current_carrying_straight_wires.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"// Scilab Code Ex2.40: Page-96 (2008)\n",
+"clc; clear;\n",
+"mu_0 = 4*%pi*1e-007; // Absolute magnetic permeability of free space, N/ampere-square\n",
+"I1 = 30; // Current through the first wire, A \n",
+"I2 = 40; // Current through the second wire, A \n",
+"x = 2; // Separation distance between two wires, m\n",
+"F = mu_0/(4*%pi)*2*I1*I2/x; // Force between two current carrying straight wires, N\n",
+"printf('\nThe force between two current carrying straight wires = %3.1e N', F);\n",
+"// Result\n",
+"// The force between two current carrying straight wires = 1.2e-004 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
+}