Question:
Convert latex code to fortran code?
anonymous
2007-12-09 13:22:15 UTC
I have very large equations that I need to solve using numerical techniques. The equations are in latex. From these now I need to form matrix in fortran and then continue the solution procedure in fortran. Can anyone advice how I can do this conversion from latex code to fortran code. The number of equations is so large and the size of each equation is also huge. So to rewrite those in fortran would be very cumbersome. This work is related to scientific compuation. Thank you very much
Three answers:
Rector
2007-12-09 13:31:14 UTC
latex is a word processor of sorts and fortran is a programming language. Its like converting an apple into a monkey. Can not be done. I am afraid you have to rewrite these equations in fortran using numerical techniques. If we are talking about solving the equations, there is an excellent book by the name of "numerical recipes in fortran" comes with a CD of all the subroutines and functions.

Hope this helps.
anonymous
2007-12-09 14:11:38 UTC
The way your equations are formulated is most likely not suitable for a numerical solution. This is true in almost 100% f numerical problems which derive from naive formulations of science or engineering problems in text books.



Since your questions does not address what kinds of equations we are talking about and since you are asking in the wrong place (you are NOT likely to find professional help here), I have to assume you are new to numerical math. That alone makes the probability that you have the expertise to succeed with solving these equations extremely low. And without giving us ANY details, NOBODY will be able to help you.



There are dozens of different techniques available for most numerical problems and they all have limitations. One needs to understand these in detail and then chose the right methods judiciously. Most problems require to be reformulated before they can be solved, at all.



In addition, the problem you are trying to solve might have been solved before. There might be some or hundreds of tools out there which solve it in ways you can't even imagine.



Latex to Fortran is not your problem. Your problem is that you seem to lack the expertise about the problem your equations describe.
garnet
2016-05-22 12:45:00 UTC
Here is an example of a C program and the equivalent version in Fortran-77. I used the Intel Fortan compiler for validation. The program implements Simpson's rule to calculate the integral for the function f(x) = 4/(1+x*x) The value of this integral is pi -- C version starts here ---------------------- #include #include double f(double x) { return 4.0/(1.0+x*x); } int _tmain(int argc, _TCHAR* argv[]) { int i, n ; double a=0.0, b=1.0, h, s1=0.0, s2=0.0, s3=0.0; printf("Enter number of partitions (must be even) = "); scanf("%d", &n) ; h = (b-a)/(2.0*n) ; s1 = (f(a)+ f(b)); for (i=1; i<2*n; i=i+2) s2 = s2 + f(a + i*h); for (i=2; i<2*n; i=i+2) s3 = s3 + f(a + i*h); printf("%20.12lf\n", (h/3.0)*(s1+ 4.0*s2 + 2.0*s3)) ; return 0; } ------ fortran version starts here -------- program fsimp implicit none integer i, n double precision a, b, h, s1, s2, s3, f a=0.0 b=1.0 s1=0.0 s2=0.0 s3=0.0 print *, 'Enter number of partitions (must be even) = ' read *, n n = 10 h = (b-a)/(2.0*n) s1 = (f(a)+ f(b)) i = 1 do while (i .lt. 2*n) s2 = s2 + f(a + i*h) i = i + 2 enddo i = 2 do while (i .lt. 2*n) s3 = s3 + f(a + i*h) i = i + 2 enddo print '(f20.12 )', (h/3.0)*(s1+ 4.0*s2 + 2.0*s3) end program fsimp function f(x) double precision x, f f = 4.0/(1.0+x*x) end


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...