Recent content by Lukejambo

  1. L

    Fortran Can complex numbers be used in Fortran array constructors?

    Thanks for your help, I've declared each matrix as complex and used exp(i)(theta) instead of cos and sine however the problem still remains, here is my programme below: program implicit none REAL, PARAMETER :: pi=3.14159 real :: ph complex, dimension(2,2) :: B, D complex :: z, ic ph= 1.0 ic =...
  2. L

    Fortran Can complex numbers be used in Fortran array constructors?

    Hi, so I need to write a fortran code with 2, 2x2 matrices. These matrices are in the form of B=(1 exp(i)(theta) 0 0) and D=(0 0 exp(i)(theta) 1) where i is sqrt of -1 and theta is an angle between 0 and 2pi. I've expanded the exponential so it reads cos(theta)+isin(theta) and let theta=pi/2...
  3. L

    Fortran Using Integer Expressions in an If Statement: Help Needed!

    Hi, so I'm trying to use the following if statement: if (sum(i,j) <=1.0 ) then sidash=(si)*(Death) else if (1 <= sum(i,j) <= 2) then sidash=(si)*((sqrt(2.0)+1.0)*(2.0-sum(i,j))*(Death)+(sum(i,j)-1.0)*(Survive)) else if (sum(i,j)<=3 .and. sum(i,j)=>2) then...
  4. L

    Fortran Can Fortran be used to create a video of changing arrays?

    Okay thanks and I'd need to do this in the terminal, is there a way of recording each array snapshot from a dat/text file?
  5. L

    Fortran Can Fortran be used to create a video of changing arrays?

    I need to change the size of the arrays each time I run the programme but they vary from 10x10 to 100x100. Will I need to snapshot the screen manually? I can have over 100 arrays written to the file and it'll take a while to screen shot each one manually.
  6. L

    Fortran Can Fortran be used to create a video of changing arrays?

    Hi, using Fortran that writes a large amount of arrays to a text/dat file. Is there some kind of software where I can create a video of these arrays changing from beginning to end? I've tried using VMD, but cannot get dat/text files working on it. Any input will be appreciated.
  7. L

    Fortran [Fortran] Rounding up Random Numbers

    And the output:0.7180.3280.1310.5310.1930.5790.1660.4610.7620.613 0.7380.1280.4020.4000.2200.9330.0800.7640.9990.505 0.6310.6970.8230.9630.6980.4480.9360.3010.9390.489 0.9860.4930.3490.4180.1700.8120.8390.0900.4720.117 0.4600.9490.5750.1400.0460.8190.8350.4690.0500.043...
  8. L

    Fortran [Fortran] Rounding up Random Numbers

    Here is the code:! This programme produces a 10x10 matrix of 0's and 1's using the random number and random seed function. program randomex implicit none integer :: n real :: a(100) integer :: i(100) open(unit=20, file='randomex')n=100 call random_seed() call random_number(a) ! Below writes...
  9. L

    Fortran Fortran 90/95: Array Help with IF Statement

    Hi, For fortran 90/95, I've written a 10x10 array of numbers. 2 do loops (n,m) from 1 to 10 indicate the subscript of the elements in this array. I've applied a generic rule to the array elements where they become 0 if they are above a certain number. Using an if statement to change the...
  10. L

    Fortran [Fortran] Rounding up Random Numbers

    Thanks very much for your help, I've managed to produce a matrix of ones and zeroes which are all randomly placed.
  11. L

    Fortran [Fortran] Rounding up Random Numbers

    Thanks for the quick reply Dave! Here is the code: program random implicit none integer :: n real :: a(10) integer :: i(10) n=10 call random_seed() call random_number(a) write(6,*) (a(n),n=1,10) write(6,*) '' i(n) = NINT(a(n)) write(6,*) (i(n),n=1,10) end program random
  12. L

    Fortran [Fortran] Rounding up Random Numbers

    Hi, So I'm writing a programme in Fortran95 atm and I want to produce an array of 1s and 0s. I've used a random number and random seed generator to produce 10 numbers between 0 and 1 and I want to use a NINT statement to round these random numbers to 0 or 1. However when I try this the...
Back
Top