1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran code

  1. May 16, 2012 #1
    we have to write a code to solve system of equations by writing them in matricies (tridiagonal matrix) form .....
    the first step is to enter the coefficients of the variables (r1,r2,r3,...) and then the answers to the equations (b1,b2,b3,...) by using array , and print the equations in the form:
    i made the code and i get the answers but i have to insert a code to check the answers that i get i.e: if x1=1 ,x2=6 ,r1=1,r2=2,b1=13
    then the program print
    i cant make this step can any1 help me please :(
    Last edited: May 16, 2012
  2. jcsd
  3. May 17, 2012 #2
    You have solved Ax=b where you have the 9 members of matrix A, three members of vector b and the the three roots making up vector x.

    Write a code that multiplies matrix A (which you'll have to populate with appropriate numbers) by roots x and compare to vector b. The multiplication can be done with two nested do loops such as

    do 2 i=1,3
    do 1 j=1,3
    1 continue
    2 continue
    100 format(1i5,1f10.5)

    If q is zero or some very small number, then you've solved it correctly. I am assuming you can use dimension statements correctly.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Fortran code
  1. Fortran Help! (Replies: 4)

  2. Graphs in fortran (Replies: 1)

  3. Fortran help (Replies: 16)

  4. Fortran 90 (Replies: 1)

  5. Searching on Fortran (Replies: 13)