Solving Fredholm Equation: Step-by-Step Guide

  • Thread starter Thread starter huyhohoang
  • Start date Start date
AI Thread Summary
The discussion centers on a subroutine named "fred2," which is part of a program designed to solve integral equations. The main focus is on the purpose of the array "omk(i,j)" within the code. Initially, "omk" is set up as an identity matrix. The line "omk(i,j) = omk(i,j) - ak(t(i),t(j)) * w(j)" indicates that the matrix is being modified to reflect the equation OMK = I - AK * W, where I is the identity matrix, AK is a function applied to the input arrays, and W is a vector. This suggests that the author intended to optimize memory usage by repurposing the "omk" matrix to store the results of this operation. The clarification provided helps to understand the author's intent in the code structure.
huyhohoang
Messages
12
Reaction score
0
Hi! I am now building a program to solve integral equation. I have understood the numerical method to solve it as well as others subroutines gauleg, ludcmp, lubksb but when I read this subroutine fred2 below, I don't know exactly the purpose of the author when putting the array omk(i,j) in the code. Can anyone give me some advice or instruction please?
Many thanks.
Fortran:
      SUBROUTINE fred2(n,a,b,t,f,w,g,ak)
      INTEGER n,NMAX
      REAL a,b,f(n),t(n),w(n),g,ak
      EXTERNAL ak,g
      PARAMETER (NMAX=200)
CU    USES ak,g,gauleg,lubksb,ludcmp
      INTEGER i,j,indx(NMAX)
      REAL d,omk(NMAX,NMAX)
      if(n.gt.NMAX) pause 'increase NMAX in fred2'
      call gauleg(a,b,t,w,n)
      do 12 i=1,n
        do 11 j=1,n
          if(i.eq.j)then
            omk(i,j)=1.
          else
            omk(i,j)=0.
          endif
          omk(i,j)=omk(i,j)-ak(t(i),t(j))*w(j)
11      continue
        f(i)=g(t(i))
12    continue
      call ludcmp(omk,n,NMAX,indx,d)
      call lubksb(omk,n,NMAX,indx,f)
      return
      END
 
Technology news on Phys.org
I'm not sure what the code is supposed to do but the omk array is setup basically like an identity matrix

and the line omk(i,j)-ak(t(i),t(j))*w(j) looks like the matrix equation OMK = I - AK*W

where I and AK are matrices and W is a vector.

OMK starts out in the code as the identity matrix and then its reused to hold the result of I - AK*W

so I guess the author was trying to save space by repurposing the OMK matrix memory.
 
Thanks. Now I understand the purpose of the authors.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top