Program LinearEquations
! solving the matrix equation A*x=b using LAPACK
implicit none
! declarations, notice single precision
Real*4 A(3,3), b(3)
integer i, j, pivot(3), ok
! define matrix A
A(1,1)=3.1
A(1,2)=1.3
A(1,3)=-5.7
A(2,1)=1.0
A(2,2)=-6.9
A(2,3)=5.8
A(3,1)=3.4
A(3,2)=7.2
A(3,3)=-8.8
! define vector b, make b a matrix and you can solve multiple
! equations with the same A but different b
b(1)=-1.3
b(2)=-0.1
b(3)=1.8
! find the solution using the LAPACK routine SGESV
call SGESV(3, 1, A, 3, pivot, b, 3, ok)
!
! parameters in the order as they appear in the function call
! order of matrix A, number of right hand sides (b), matrix A,
! leading dimension of A, array that records pivoting,
! result vector b on entry, x on exit, leading dimension of b
! return value
! print the vector x
do i=1, 3
write(*,*) b(i)
end do
end Program LinearEquations
Would it be possible to one day be able to perform symbolic calculus and the like using lfortran ?
Would the stdlib from Fortran-lang be also included ?
Omg I didn’t realize you were one of the devs for SymPy
SymPy is one solution for symbolic calculus, and a great one at that.
Have you seen or heard about maxima though ? SageMath uses it along with SymPy and it still does a pretty good job
Yes. I used to use Maxima, but I wanted to have a solution in Python, and designed in a way that can be easily extended from Python, so I started SymPy. One of the first packages were limits. In Maxima you have to fix them from within Lisp, it was really hard for me to understand the code and fix it. It was also easier to find contributors to a Python package than a Lisp package.