Hi Fortran expert here,
I am trying to learn the basic of FEM with John Burkardt’s 1D FEM1D_LAGRANGE_PRB.
I have some difficulty to make sense of a few line of codes.
below is the subroutine for evaluation of lagrange basis polynomials.
regarding below code:
li(i,j) = product ( ( xi(i) - xd(1:j-1) ) / ( xd(j) - xd(1:j-1) ) ) &
* product ( ( xi(i) - xd(j+1:nd) ) / ( xd(j) - xd(j+1:nd) ) )
why is there two product here? should we just make:
li(i,j) = product ( ( xi(i) - xd(1:j-1) ) / ( xd(j) - xd(1:j-1) ) ) , ( ( xi(i) - xd(j+1:nd) ) / ( xd(j) - xd(j+1:nd) ) )
basically multiply two matrix?
sorry for bring up this very basic question, there are no people around that know enough of FEM.
Thanks
Martin
!*****************************************************************************80
!
!! LAGRANGE_VALUE evaluates the Lagrange basis polynomials.
!
! Licensing:
!
! This code is distributed under the GNU LGPL license.
!
! Modified:
!
! 09 October 2012
!
! Author:
!
! John Burkardt
!
! Parameters:
!
! Input, integer ( kind = 4 ) ND, the number of data points.
!
! Input, real ( kind = 8 ) XD(ND), the interpolation nodes.
!
! Input, integer ( kind = 4 ) NI, the number of evaluation points.
!
! Input, real ( kind = 8 ) XI(NI), the evaluation points.
!
! Output, real ( kind = 8 ) LI(NI,ND), the value, at the I-th point XI,
! of the Jth basis function.
!
implicit none
integer ( kind = 4 ) nd
integer ( kind = 4 ) ni
integer ( kind = 4 ) i
integer ( kind = 4 ) j
real ( kind = 8 ) li(ni,nd)
real ( kind = 8 ) xd(nd)
real ( kind = 8 ) xi(ni)
do i = 1, ni
do j = 1, nd
li(i,j) = product ( ( xi(i) - xd(1:j-1) ) / ( xd(j) - xd(1:j-1) ) ) &
* product ( ( xi(i) - xd(j+1:nd) ) / ( xd(j) - xd(j+1:nd) ) )
end do
end do
return
end subroutine lagrange_value