Posts

Showing posts with the label fortran

equation of state in fortran program

 Equation of state in fortran program In thermodynamics, different gas laws, for example, Boyle's law, Charles law, have been derived by using the concept of ideal gas. Ideal gas is actually an ideal concept. No ideal gas exists in atmosphere.  Equation of state is the thermodynamical equation based on concept of ideal gas. Real gases, that are present in the atmosphere, are studied by using this equation.  For n mole of ideal gas, the ideal gas equation or equation of state is given as, PV = nRT  ................. (1)   Where,  P = pressure V = volume T = absolute temperature R = Universal gas constant. At normal temperature and pressure, that is, normal conditions,  P = `1.01 \times 10^(5)` Pascal V = `22.4 \times 10^(-3)` `m^3` T= `0^o` C = (0 + 273) K = 273 K   Then equation (1) gives, `R =  \frac(P \times V)(n \times T)` `R = \frac(1.01 \times 10^5 \times 22.4 \times 10^(-3))(n \times 273)` For one mole ideal gas, n =1, `R = \frac{1.01 \...

projectile motion in fortran | relation of angle of projection and horizontal range

Image
 Have you ever tried to visualize projectile motion in fortran program? This post will help you to generate data and plot the graph of projectile motion.   Above figure shows you the angle of projection(°) versus horizontal range (meter) plot, where the speed of projection is 30 m/s. 👉 Click on link for NEB grade 12  physics numerical problem-solutions:-  LINK Let's start with some basic things: What is projectile and projectile motion ? Projectile:  A projectile is an object thrown to the sky with certain velocity against the earth's gravity. The motion that the projectile possesses during it's journey until it returns to the same surface, from where it was thrown, is called the projectile motion. In above figure, the projectile starts it's journey from point o and follows the curved path to reach another point on the same surface.  Suppose, `\theta` = angle of projection `\therefore` Angle of projection is the angle between the horizontal surface of ...

sum of even numbers, odd numbers, numbers divisible by number in fortran

 Have you tried to determine the sum of even numbers ? Have you tried this for odd numbers ? Have you tried calculate the sum of numbers divisible by a number ?  You will learn answers of all these questions with the help FORTRAN program through this post.  ...................................................................... 1.  sum of even numbers from 1 to 350.   The even numbers those lie between 1 and 350 including 350 are 2,4,6,8,10,..................., 346,348,350. The task is to calculate sum of all these even numbers.  Fortan codes :  program even_sum implicit none integer:: i, n,sum1 sum1=0 do i=1,175 n=2*i sum1=sum1+n print*, n end do  print*, 'The sum is ', sum1 end program  ................................................................. After running the code, you get answer 30800. .................................................................... 2. sum of odd numbers from 1 to 350. The odd numbers from 1 to 350 are 1,3,5,7...

value of π by Gregory-Leibniz series in fortran

Image
An infinite sum series first given by Madhava and later rediscovered by Gregory and Leibniz is expressed as,  `\sum_{n=0}^{\infty} \frac{(-1)^n}{2n+1} = \frac{\pi}{4} ` or, `\frac{\pi}{4} = \sum_{n=0}^{\infty} \frac{(-1)^n}{2n+1}` `\therefore \pi = 4 \times \sum_{n=0}^{\infty} \frac{(-1)^n}{2n+1} ` Where n  = 0,1,2,3,4,5, ..................................,  positive integer. For n =0 `\pi = 4 \times 1` For n = 0,1    `\pi = 4 \times (1- \frac{1}{3})` For n = 0,1,2 `\pi = 4 \times (1 - \frac{1}{3} + \frac{1}{5})` For n = 0,1,2,3 `\pi = 4 \times (1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7})` and so on. Continuiing this process  up to `n \approx \infty`,  you obviously get,    `\pi =4 \times ( 1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \frac{1}{9} - \frac{1}{11} + ....................)     (2)` This is called Gregory-Leibniz series to estimate value of `\pi`.  fig. 1. n vs. `\pi` plot n gives number of terms i...