0% found this document useful (0 votes)
24 views26 pages

CC8 (Python) P

Calcutta University python practical 2023
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
24 views26 pages

CC8 (Python) P

Calcutta University python practical 2023
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
1, (@) © (a¢4th Sim. -Physles-H/Pr/CC-BP/CBCS) (Syllabus-2019-20 & 2018-19)/Dap-1 2023 PHYSICS — HONOURS — PRACTICAL Paper : CC-8P (Syllabus : 2019-2020 and 2018-2019) Full Marks : 30 DAY-1| [Experiment : 20, Laboratory Notebook : 5, Viva voce : 5] ‘The heat equation in one dimension is given by K where u(x, 4) is the temperature function, Consider a wire of length 0 0. ux, 0)=x+sinx, OSxsm. Write a Python program to solve heat equation and plot the temperature distribution throughout the wire at 1= 10s. Take K= 1.0 unit, [Code : 10+ Plot : 2, Total : 12] (2¢4h Sm)-Physes-H/P:ACC-BP/CBCS) (Syllabus-2019.20 & 2018-19)/Day-3 2. (a) Write a Python program to show the convolution of the following Gaussian functions is also a Gaussian : Plot the functions f(x), g(x) and the convoluted function on the same graph. Note:(fea)(0)= J Soe de [Code : 10+ Plot : 2, Total : 12] (b) Solve by using odeint package from SciPy. Take 1 € [0, 5] Exact solution : x(t) 3 4.2417 6403 +3¢0s4) @ Plot x(2) vs. ¢ and compare it with exact solution. Gi Plot © vs. [Program : 5 + Graph : 1+1+1, Total : 8] (Z(dth Sm.)-Physis-H/Pr/CC-8P/CBCS!) (Gyllabus-2019-20 & 2018-19)/Day-3 3. (a) The number of surviving nuclei in a radioactive sample is given by : NO dt Write a Python program to solve this equati AN() to find the number of nuclei present after r= 20 years, if the sample had 104 nuclei at the beginning (¢= 0), Take = 6.93%10- year". Print the answer. Plot N(o) vs. # for tin [o 3. [Code : 8 + Plot : 2, Total : 10] (0) The Fourier expansion of a given function F(x) periodic over interval [-/, 7] can be written as 1 1 en 2 = ifreosn(F) ae =1,2,3, Write a program to compute the first five Fourier’s coefficients (a,, 6,) of a square wave. Plot the constructed series and the square wave signal in the same graph using matplotlib. Set appropriate axes labelling and legend at suitable location in the graph. [Program : 6 + Graph : (1+1)+(1+1), Total : 10] (2¢4t Sm) “WPr/CC-SP/CBCS) Physics Mabus-2019-20 & 2018-19)/Day-3 4, (a) Write a program to solve 1d wave equation : instant 1(0 < ¢< 20). Label the axes and put appropriate legends in the graph. [Program 2 24(L+1), Total : 14] (©) Compute the integral Plot the integrand in the range x € [1.001, 2.0]. Label the axes and write the integrand as a legend inside the graph. [Program : 3+ Output : 1+ Graph : 1+1, Total : 6] o) (2(4th Sm.)-Physics-H/Pr/CC-8P/CBCS) Dirichlet Boundary conditions are : Left B. C. U(0,y)= for 0 0. Taking suitable values of «and 6, show that the convolution of these two Gaussians is also a Gaussian. Plot them. Note : (F* 20) J raee—ode [ora 7+ Geagh 2, Teal: 9] 7. (@) © (2(4th Sm-Physics-H/PrICC-BPICBCS) (Shilabus-2019-20 & 2018-19)/Day-3 Consider the following forced harmonic motion : Px de Sa ttG thea Fessor ‘where the exact solution of the amplitude of the steady state, A=" __. Take y= 0. e-0%) +0? k=2 and F=1, Solve the differential equation by using odeint from SeiPy module. Plot the amplitude resonance curve, Compare with the exact formula. [Program : 7+ Graph : 2+1, Total : 10] ‘Compute the improper integral : 1 | aa Take the flowing contnatos of «and 6 al, b=2 oz, b= Plot the integrand vs. x for any set of (a, 5). (Program : 6 + Output : 1+1 + Plot : 2, Total : 2023 PHYSICS — HONOURS — PRACTICAL Paper : CC-8P (Syllabus : 2019-2020 and 2018-2019) Full Marks : 30 DAY -4) [Experiment : 20, Laboratory Notebook : 5, Viva voce : 5] 1. (a) Consider a rod (length L) of uniform cross-section and made of homogeneous material which is . perfectly insulated so that heat flows only along the length. Two ends of the rod are inserted into ‘two ice baths to maintain fixed temperature at both the ends and of £0) =100 Consider the following 1D diffusion equation : BU(xt)_ PU(x1) ot x Using one initial condition and two boundary conditions, solve this partial differential equation and plot the temperature profile along the length of the rod with time. [Program : 10 + Graph : 2, Total : 12] (b) Evaluate the Integral for n=-3/2, 1/2, 1/2, 1, 3/2, 5/2. 1n)= fers" 0 [Program : 4+ Output : 4, Total : 8] 2. (@) Suppose /(#) = €-* and g(0) = sin(b1), Taking suitable values of a and B, compute the convolution of the given functions. Plot f(0), g(#) and convoluted function. Note : Convolution over finite range: (f* 2X0 := | F(@g(¢-9a. 0 (Program : 8-+ Graph : 2, Total : 10) © Solve 2, £2, Aes BE =Coosor dt by using odeint package fiom SciPy, Take : A=12, B=0.2, C=1.8 and o= 1.5, ¢€ [0,15] @ Plot x vs. &. (i) Plot & Ws. t Label the axes and put appropriate legends in the graph. [Program : 7+ Graph : 14141, Total : 10] (24th Sm.) Physies-H/Pr/CC-BP/CBCS) (Syllabus-2019-20 & 2018-19)Day-4 3. (@) The Fourier expansion of a given function F(x) periodic over interval [-/, 1] can be written as Fx)= ae 2 (% ooo), sn(%=)), =a, 12=0,1,2,3,.05 0 fi 1 where a,= i] Foe by i aa( OE if Fenn( n=1,2,3,.. Write a program to compute the first five Fourier’s coefficients (a, 5,) of a square wave. Plot the constructed series and the square wave signal in the same graph using matplotlib. Set appropriate axes labelling and legend at suitable location in the graph. [Program : 6 + Graph : (1+1)+(1+1), Total : 10] (b) An useful improper integral is fees () Using SciPy module, show the result for n=3, a= 1: frere > Gi) Such integrals are usually performed numerically by gradually increasing the upper limit to fa large value (say, 10), Plot the value of the integral : Ha)= [rede against the upper ° limit ‘a’. The plot must converge to the desired answer. [Code : 345+ Plot : 2, Total : 10] 4. (a) b) (20 Sm.)-Physies-HPe/CC-8P/CBCS) (Spilabus-2019-20 & 2018-19)/Day-4 Write a program to solve Laplace’s equation on square grid Dirichlet Boundary conditions are : Left B.C. U(0,3)=0.0 for 0

You might also like