0% found this document useful (0 votes)
29 views9 pages

Computational II Unsolved

Computational physics past papers

Uploaded by

Arooj Fatima
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)
29 views9 pages

Computational II Unsolved

Computational physics past papers

Uploaded by

Arooj Fatima
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
You are on page 1/ 9
ry ei yee A Na '| UNIVERSITY OF paePuNsAB | fe , Eighth Semester 2014 | ~~Examination:-B.S.4 Years Programme 1 T ‘IME ALLOWED: 2 hirs. & 30,mins. MAX. MARKS: 50 npuls ional Physies-I1 ynipt this Paper on Separate Ant py SUBJECTIVE Q2 ‘Write short answers of the following Questions: L Give simple example to calculate an average of an array’? he Write syntax with example for the fag jin MATLA 4 TPE Whiteyytoop (by alt (cy dae) (Be tt g--8° Pwrite MATLAB program code segment for the Tollawin, . gqne tly éo generate and plot complex numbers — (6 rn ‘ to give'one example to do partial derivative Pee oS plow di to find roots of a polynomial: x? + 6x7 -212 +290 eu Wr . tocalculate the area ofa circle by taking the values of radius fromthe user PEG Set@) 2 | oS ic alii | sn FEY yrytcs @ The acceleration of a spherical body moving jin viscous medium is Qk (| given by a= g—ev where e= 611 r/m wih the conditions: g= | 64 ‘ ee 9.8 msec’, §=1-2, r= 0.2 m, m=] kg, in position x = 0, v=I . v" m/sec, b= 0.1 sec and tmax=2.5sec. Write MATLAB program to . : sete. | plo and print ime, position, velocity and ascleration values, ‘Also 4 ey P8522) draw estimate out Atfr proper curve labels, x & y labels y and title fan t(D * b2 | How sandomty-senme_poins-p be used to show Brownian a 1 motion? Write MATLAB program to simulate Brownian motion of |, , a particle. Note: Plot estimate graph if any. Vio AT (ay) & mass is suspended by three cables with tensions Ty, Tz and Ts, | 743 ON ‘hich are related by the following equations: / 4 Ty V35 31a N34 +Ts 42-0 37 /V35 -AT3 1142-0 ry G . . { : Ty {35 372134 47s (42 =mg v . 7 3 Write MATLAB: program to solve for the tensions using three PP . Take mg=1. Write MATLAB ‘program to determine equivalent resistance of n resistances connected in series (Read resistances from the user), fos. “Gy, Write MATLAB program to study the dam i 0 harmonic moti be LPH (DM) ofa mass ached witha spring ee ander | the following conditions: (g=9.8 mis*, i iti { 7 "i initial ' velocity 15 mvs, time step 0.1 sec. and maximum me Sse ” i { i Nim, m=Ikg, damping coefficient = 0.5 N/ms, ). Print and plot values for time, position, velocity and change the same or Sie arse pow you gan im for Simple i ed Write MATLAB code 10-plot st yt) i that: 10.10}, y=sin(nx). Applicatis ~ — supbplot such Ise n=[1 4] and step size =1 Ropisted}mads $ _ Pat 8 Sol (OH) UNLV IDI YU Raat See | f 25 bight eee vet Prograysm s Al 7 LOWE] 2 hrs. & 39 . : iy TIME AL ‘ a AE Goal inal Physics AX. 50 EM Eatin | wt MAX. MARKS: Attempt thi Tr, wer Sheet provided, i this Paper, on Separate Answer Sheet pi Hemp) r rb TW fhe following Questions: : ; .2. Write short answers of tl ne Me “gt @) cence ollyine(aMATLABs, 5 yd @ Lb 3a) Write synt yi garni es i ia De hye ene wet Onl Je Segrnent for The followir Pal sely rBraph Yeo 10 it Fandom nuinbers and plot ber grap Ue, | Ge a oon caleulate detivative: PatboS fad | Firg.9 “4 | MQ) t0 find roots of pencil 24 4x) ~ 274489 , : fi @uan € two arrays, | | (¢) to evaluate [Pa ° W)The temperature measurement of conta jiven in| x table: Write Program to determine: (i) tetiperatiré of A’ greater'| 842 a uv ‘than that of B Gi) temperature of B ‘equal to that of A with day (iii) 4 paleo temp. of B> 60 with days and (iv) find out the day when average | PH) t — Teed + | temperature Of A and B is maximum, Di 1 2 30405 60562 63 64 58 54.6 562 64 6059 m fe conversions of length from mto km, -a tH set GI in electric resistance network has five re [Glas sistances and two applied | 7p i: The curent end ly are re fil Oe id multiply both by elements {*1! £2, {he iners A and B 1s given in related by the following . Grn Rat, =v, a 371 abn Pelt @eRAR) 1 —Re peo - Reh-Q+Rslmv, 200 150 250}k9 and Vi=100 & Ve50V A PSR Sle Forth eumaa oo Using three | Write May B Program to. determin, using a use Write Ma’ 1 factorial of a tion. > p umber read a “ i ea 828 \ FAATLAB prograiforihg Decay of Curent fy 2 simple RE-|737—— J Re ait Wa) } ett se Ear retat i initial conditions: ra ° ims 0 time sep 0 aol : n | mA, 12Ammp and vollape Baie Ssec,, BC HH 4 pee values pr estimate griphs igh id Plot Be *88inst tim 7 | Convert the same program forthe growth of <. You can Surent inthe eireuit? Ghee eat ae ACU TT | SQ) =41p way ii Calculate, print and prot Values for 9 averas Yalues imum of fx) - . aA cca eighth Semester 2016 ee Examination: B.S, 4 Years Programme PAPER: Compr ional Physies-1E TIME ALLOWED: 2 hes, Course Cole: PYTY-429 MAX. MARKS: 50 er Sheet provided. 3 1 Ateapt this Paper on Separate dana SUBJECTIVE ‘is short answers of the Following Questions ; mple example to calciilate average of an array? 3% [2 4, | Witeayntas with example fos the following in MATLAB; ii, “) if-else fy cin Sen nux(), 8g Wrilg MATLAB progeam cude sepniont forthe followin re, Senetate a matrix of 10 by 10 numbers and plot matrix | 10 ‘(OFtosive one example to calculate derivative “Eto fiud roots ofa polynomial: x! 47x? —dy42 Ho Ysfine two arrays and determine dot produet of elements Yor® evaluate Fexpce)sin(ayae on rhogy. * Tl cceleration of ag, given hy a =p pierical body moving in viscous medium is | 6-+4 ev where e= 6 x1 x / m with the conditions: g = okt 98 mise’, W=L2, v= 02 mi, a0: kg, imitial position x = 0, y=i a wise, b= O.1 vec and imaz~2.5uee, Write MATLAB program to plot ancl print time, position, velocity tion values. Also (gees oulout graphs swith proper curve labels, x & y labels |, seme ud site (How randomly generated points can be used to show Brownian motion? Write MATLAB program to simulate Brownian motion of a particle. Note: Plot estimate graph ifany. A parallel plate capacitor is constructed from vo or more-parallel | Gd conducting *s such that its capacitance C canbe computed from the formula Fties Oy BR CH (nleA/d Where n_is number of plates, ¢ =.084-10'? farnd/meter is dielectiic constant, A = 20cm? is the area of each plate separated 4 mim, Construct a table to print number of plates lanes values for a maximum Of10 plates in MATLAB expression such that M= 1 20 3 4 5 6 71 3 nN og 75 4a ! 1 2 064 a 16 3 64 Also find the maximum and mean value of M, Q5:(@) | The height 0 and speed vO oFa prajaalila punched with speed y atan angle, to the horizontal are pi r s . M)=vtsinA-OSgea 1 v(i W~2yetsind + ge ye fe ground when h(i) $20 mis 3 0 in time t. ay | ~. ~! ont §=9.8 m/s” use MATLAB . , is at a aud ical spoiaon to find the Fine: ‘wen eight is n0 b) {an 6.0 and speed is si UO greater m/s te [Mille a prog f fo calculate the equivalent resistance of n resistances in series. Take n from the user! t fom the us Fay UNIVERSITY OF THE PUNJAB Eighth Semester - 2017 Examination: B.S. 4 Years Programme Roll No, PAPER: Computational Physics-II TIME ALLOWED: 2 hrs. & 30 mins. Course Code: PHY-422 MAX. MARKS: 50 ‘Attempt this Paper on Separate Answer Sheet provided. SUBJECTIVE Write short answers of the following Questions: i. | Give simple example to find index of maximum value of the array? | 2 Write syntax with example for the following in MATLAB: i. | (a) for (b) sumQ (©) rand() (4) dsolveQ, 8 Write MATLAB program code segment for the following: iii. | (@) to generate a matrix (8 x 6) with all 1°s as entries and plot matrix | 10 (©) to give one example to calculate polynomial derivative (©) tox vsy such as y= 7x* =2x? —x+1 and x=[-15 15] (@) to define two arrays and determine sum of two array values (©) to evaluate Jexpca)sincavinte Q3. If y=4 x° Write MATLAB symbolic operations to calculate (i) first | 6+4 derivative w.r1. x ji) perform integration of your result. If y=f(x) = x- 6 x’ +9 x +2, Write program to plot x vs y using | x=[-1 5]. Find and plot marks at extremes. Find maximum of y. | How randomly generated points can be used to show Brownian motion? Write MATLAB program to simulate Brownian motion of particle. Note: Plot estimate graph if any. ea. ‘A mass m is suspended by three cables with tensions Ty, Ty and Ts, | 46 @) which are related by the following equations: Ty N35 372134 +73 /J42=0 | 3Ty/V35 -4Ts/V42=0 | Ty -V35 -312 V34 +13 1/42 =mg Write MATLAB program to solve for the tensions using three methods . Take mg=1. ©) Write MATLAB program to determine equivalent capacitances of n resistances connected in series (Read capacitances from the user). | Using rand(), create a matrix N (5 x 7). Then i) plot and Sth rows. fi) find maximum of column 6 and iii - find the maximum_and mean value of N _ @5.(@)_| Write MATLAB program to study the damped harmonic motion | 73 (DHM) of @ mass attached with a spring using Euler's method under the following conditions: (g=9.8 mis, initial position zero and velocity 15 mvs, time step 0.1 sec. and maximum time 15 see., k= 1 Nim, m=1kg, damping coefficient = 0.5 Nims, ). Print and plot values for time, position, velocity and acceleration. How you can change the same program for Simple harmonic motion? CO) Write a program to a 3D plot in matlab. Take three variables as x,y and z.. plot 3rd row sort N. Also UNIVERSITY OF THE PUNJAB & ‘ighth Semester - 2018 \ Examination: B.S. 4 Years Program e : 5 A MAX. TIME: 2 Hrs. 45 2, Computational Physies-II Mt MARS de: PHY-422 Part—IL Co 180, —TEMPT THIS (SUBJECTIVE) ON THE SEPARATE ANSWER SHEET PROVIDED Jers oF the Following Questions: i. FGive simple example to find nonzero index of an array” | Write tax with example for the following in MATLAB: Zit) (@) Melse (b) std) (€) plot) (A) dill, 7, Write MATLAB program cole segment for the following: iii. | (a) to generate and plot complex numbers (b) to give one example to find out factorial of a number | () to find derivative ofa polynomial: 3x° 47x! ~ Bx +20 # (a) to calculate the circumference of'a cirele lor radius “8 (e) to define two arrays and determine dot produce faz Write short an: 545. t ' 3 Use matlab code te solve for [sy 422=1 7 By tz-6 | | Using rand(), ereate a matrix K (5 x 5). Then 1) plot K, plot 2nd row and 3th rows. ii) find maximum of column 2 and iii) sort K, Also ZL ____| find the minimum _and standard deviation value of K_ | (Qa. The temperature measurement of containers A and B is given in the | 6+4 ro) table, Write program to determine: (i) temperature of A less than that of B (ii) temp. of A equal to that of B with day (iii) temp. of A and B > 60 with days and (iv) find out the day when average =| obtained from A and B is minimum. (Dy jt 2 3 4 he A____ | 60 56.2 63 6438 i It {Bo 362 64 60 59 | j Write MATLAB code to plot ‘x’ against y(x) with supbplot such that: [-10 10]. y =sintnx). Use 14) and step size =1 TOs. (a) | The height h(i) and speed v(1) of a projectile launched wi sd | at an angle A to the horizontal are given by: ened wilt speed) G4 hQ)=ytsind-0.5 ¢0 . vi =(vr = 2 ye tsind +g? e the projectile will hit the ground when h(t) i i he proj vill bit the es O in time hit = 2 sind /g. If A= 40°, v,=20 nvs and g=9.8 m/s? use MATLAG relational and logical operators to find i the ight i (of | tess than 6 m and speed is simultaneously Toma tan ten Write a program to calcula i 1 te the equi esi resistances in series, Take n from the user TESStANE OF UNIVERSITY OF THE PUNJAB B.S. 4 Years Program / Eighth Semester— 2019 Computational Physics-I! HY-422 Pal Time Hrs. 45 Min, Marks: 50 ATTEMPT THIS (SUBJECTIVE) ON THE SEPARATE ANSWER SHEET PROVIDED Q2. Write short answers of the following Questions: T_ i. | Give simple example to find zero index of values in an array? 2 Write syntax with example for the following in MATLAB: ii. | @ ginputt) (b) dsolve() (6) gtextO (a) input(), 8 Write MATLAB program code segment for the following: iii, (a) to generate and plot 20 x 20 matrix of numbers 10 (b) to give one example to find out cumulative sum of [2 5 87] (¢) to find integral of a polynor ix? 20+ 20 (¢) to calculate the roots of a polynomi (e) to multiply two polynomial and determine derivative Suppose A be a 3x3 matrix, Write MATLAB program which reads Q3. in random numbers as entries of the matrix A and calculate (i) sum and average of the all matrix elements, (ii) transpose of the matrix A {also plot the matrix), (iii) also check whether the Matrix A is an identity matrix? (iv) Also sort the matrix elements, (v) divide matrix tows by its row average. Write MATLAB program for a half wave rectifier circuit, rs 4 Q4. "Write MATLAB program for the forced harmonic motion (FHM) | 6+4 © of a mass attached with a spring using Euler's method under the following conditions: (g=9.8 m/s‘, initial position zero and velocity 15 mis, time step 0.1 sec. and maximum time 15 sec., k= Nim, m=1kg, damping coefficient = 0.5 Nims, @=0.01 sand fo=1.5N.). Calculate and print with proper labels the values of time against position, velocity and acceleration. How you can change the same program for the Simple H.M., Damped. H.M. The necessary ) equations are as follows: A=(-kx-bv + fo cos (wt) Vmxextvhvevetahtatth, ‘Also draw estimate output graphs with proper curve labels, x &y labels and title. How randomly generated points can be used to show Brownian motion? Write MATLAB program to simulate Brownian motion of 1 particle for 31 collisions. Also calculate the distance traced by the particle. Note: Plot estimate graph if any. 5. (a) | Write MATLAB program to calculate and print out factorial of a| 10 number taken from the user by using two methods. Implement your program using functions. 20 Calculate and print the series and sum of S, such that: $= 779° i () How you can improve the answer to evaluate Jsincxyae a a Paper: Computational Physics-tI Course Code: PHY-422 Part-II UNIVERSITY OF THE PUNJAB B.S. 4 Years Program / Eighth Semester ~ 2020 Roll No, Ol! Timo: 2 Hrs. 45 Min. ASA Marks: 50 ATTEMPT. THIS (SUBJECTIVE) ON THE SEPARATE ANSWER SHEET PROVIDED Q.2, Write short answers of the following Questions: . | Give simple example to find out standard deviation of an array? 2 Write syntax with example for the following in MATLAB: (a) for loop (b) while loop (c) if (d) sum () . 8 Write MATLAB program code segment for the following: (a) to generate and plot complex numbers 10 (b) 10 find out integral of x* + 4x? - 27x +89 (c) to find derivative of: x* + 6x* — 21x +290 (d) to calculate the roots of the polynomials in (b) and (c) (e) to divide polynomial in (c) by the derivative of (b) Q3. The acceleration of a spherical body moving in viscous medium is 9.8 misec’, n=1.2, r = 0.2 m, m=1 kg, initial position x = 0, v=1 m/sec, h= 0.1 sec and (max=2.5sec. Write MATLAB program to plot and print time, position. velocity and acceleration values. Also draw estimate output graphs with proper curve labels, x & y labels and title, How randomly generated points can be used to show Brownian motion? Write MATLAB program to simulate Brownian motion of a particle. Note: Plot estimate graph if any. given by a= g—c y where e =6 my F/m with the conditions: g =| 6+4 OF (a) (b) Q.5. (a) (b) Write MATLAB program for the simple harmonic motion( | 6 SHM) of a mass attached with a spring using Euler's method under the following conditions: (g=9.8 m/s*, initial position zero and velocity 15 m/s, time step 0.1 sec. and maximum time 15 sec.. k = 1 Nim, m=Ikg, damping coefficient = 0.5 N/ms, w =0,01 s* and fo=1.5N,). Calculate and print with proper labels the values of time against position, velocity and acceleration. How you can change the same program for the Forced H.M.. Damped. H.M. The necessary equations are as follows: A=(kx—bv+f,cos(wt) /mx=xtvhveveahcetth, Also draw estimate output graphs with proper curve labels, x & y labels and title, Write MATLAB program for a Full wave rectifier circuit, Note: Plot estimate graph if any. Write @ program with function to calculate, print and plot x and f(x) for f(x) = x’ +6x?-21x+290. Also find out sum, average. minimum of f{x) values for ten different values of x. Write MATLAB program to determine factorial of a number read from the user, Write MATLAB program to determine equivalent resistance of n resistances connected in series. 8 UNIVERSITY OF THE PUNJAB B.S. 4 Years Program / Eighth Semester ~ 2021 7: Computational Physics-tI Course Code: PHY-422 Part-I! ATTEMPT. THIS ( BJECTIVE! ON THE SEPARATE AN: IR SHEET PROVIDED Timo: 2 Hrs. 45 Min. Marks: 50 a2 Wrie short answers of the following Questions: | ~“" j. | Give simple example to find out zero elements of an array? 2 ii, | Write syntax with example for the following in MATLAB: (a) if-if() (b) gtextO, (€) polyint() and (4) diff) i, | Write MATLAB program code segment for the following: 10 | (a) to generate a matrix (5 x 6) having random entries and plot matrix rows (0) to give one example to 3D plot (c) to plot x vs y such as y= 3x? 24x? + Bx 4-42 for [-15, 15] (d) to define two arrays and determine sum of two array values (e) to evaluate | sincxyae Q Suppose A be a 3x3 matrix. Write MATLAB program which reads Q3. in random numbers as entries of the matrix A and calculate (i) sum and average of the all matrix elements, transpose of the matrix A {also plot the matrix), (iii) also check whether the Matrix A is an identity matrix? (iv) sort the matrix elements, (v) divide matrix rows by its row average, 0 Q4. (a) | Write MATLAB program to calculate and print out factorial of a] 64 number taken from the user by using two methods. Implement your program using functions. () | Suppose v, t and d are three linear arrays each of length is ten representing velocity, time and distance Tespectively. Write MATLAB program which reads in values for v and t & Prints values of d. Also print values of total distance and average distance values Q.5. (a) | Write MATLAB program for the growth of Current in a simple RL-| 10 circuit using Euler's Method with initial conditions: ™10Q, L=SH, initial time 0, time step 0.1, maximum time 2.Ssec, initial curees 9 and voltage v=4 volts. Print and Plot current against time values, Draw estimate graphs with Proper labels. How you can convert the same program for the decay of current in the circuit? (®) | Write MATLAB Program to plot time (t) against sin(t) and cos(t) Curves on the same graph with different colors, Use t= (0 4x] Write MATLAB Program to determine equivalent capacitor of n Capacitors connected in parallel, 8 UNIVERSITY OF THE PUNJAB .. B.S. 4 Years Program / Elghth Semosl Roll No. THE NSW E TED ON THE AN: R SHEET PROVIDED Q.4. Solvo tho following questions. (6x5=30) i) Give an example to generate and display clements of an array. Also find out maximum, standard deviation, sum and mean of data, ii) Write example to show the function of the following. (a) prod() (b) min() (c) int() (d) size() and (¢) diag() itiy IP mf 23 | yl [16 22 14 | & y2 = [13.22 21 |, Write code to plot x vs yl, x vs sum of yl & y2, x vs mean of yl & y2 and find transpose of yl, iv) If'x = (16 5 13 25 15] & y = (75 20 22 10], Write code to find values of x, number of times and locations when x is greater than y. v) Write code to general any two polynomials f and f2. Find sum, difference and product of fl and f2. vi) Write one example to show the use of the following: for, polyval(), rand(), and diff() Solve the following questions. (3x10=30) is Q2. Write MATLAB code to simulate Brownian motion, Also calculate the total distance and average distance traced by a particle during © Brownian motion describe by (x.y) values. Write code to solve for the system of equations for x, y and z by using two different methods.Such that 2x+y+2z =17, 4x-3yt82=6 and x-3y+z=6. Qa. Write general syntax for a user defined function in MATLAB. Write a program to implement the functions volume and power such that volume = 2? rh, and power = (27N T ) /60, Take values of variables from the user. Ify =(45 0 32 0 89 044), Write program to find out number of zero values with thelr index numbers, number of nonzero values, and sum of nonzero values of y. Find maximum of y. Also plot y. Qa. ‘The acceleration of a spherical body experiencing air drag is given byane-k v' where k= xp r*/2 m with the conditions: g= 9.8 misec’, c=0.46 (drag constant), p= 1.2 kg/m3, r=Im, v=0 m/sec, h= 0.1 sec and tmax=2.Ssec. Write MATLAB program to plot and print time, position, velocity and acceleration values, Also draw estimate ‘output graphs with proper curve labels, x & y labels and title, Write code to plot graph of t against y(t) such that y(t) =e" sin(9.7 t rs + 1/2) and O

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy