LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-07-2023, 01:47 PM   #1
rizitis
Member
 
Registered: Mar 2009
Location: Greece,Crete
Distribution: Slackware64-current, Slint
Posts: 626

Rep: Reputation: 482Reputation: 482Reputation: 482Reputation: 482Reputation: 482
Fortran and Bash script


Hello, I m not a programmer and I have no studies at all.
I m self learning , its my hobby and I love it.

I found this code
Code:
http://users.teiath.gr/vmouss/ebooks/fortran/parad/parad_syntetagmenes.htm
and its something I really need it in my life because I m a farmer. But the code is not compiling.
Code:
gfortran syntetagmenes.f 
syntetagmenes.f:1:2:

    1 | PROGRAM syntetagmenes
      |  1
Error: Non-numeric character in statement label at (1)
syntetagmenes.f:2:2:

    2 | IMPLICIT NONE
      |  1
Error: Non-numeric character in statement label at (1)
syntetagmenes.f:3:3:

    3 |  REAL:: X, Y, R, F, F2
      |   1
Error: Non-numeric character in statement label at (1)
syntetagmenes.f:4:3:

    4 |  WRITE(*,*) 'Dwse Tis Kartesianes Syntetagmenes X, Y:'
      |   1
Error: Non-numeric character in statement label at (1)
syntetagmenes.f:5:3:

    5 |  READ(*,*) X, Y
      |   1
Error: Non-numeric character in statement label at (1)
syntetagmenes.f:7:3:

    7 |  R = SQRT(X**2+Y**2)
      |   1
Error: Non-numeric character in statement label at (1)
syntetagmenes.f:7:5:

    7 |  R = SQRT(X**2+Y**2)
      |     1
Error: Invalid character in name at (1)
syntetagmenes.f:8:3:

    8 |  F = ATAN(Y/X)
      |   1
Error: Non-numeric character in statement label at (1)
syntetagmenes.f:8:5:

    8 |  F = ATAN(Y/X)
      |     1
Error: Invalid character in name at (1)
syntetagmenes.f:9:3:

    9 |  F2 = 180.0*F/3.141593
      |   1
Error: Non-numeric character in statement label at (1)
syntetagmenes.f:9:4:

    9 |  F2 = 180.0*F/3.141593
      |    1
Error: Invalid character in name at (1)
syntetagmenes.f:11:3:

   11 |  WRITE(*,*) 'Oi Sfairikes Syntetagmenes einai:'
      |   1
Error: Non-numeric character in statement label at (1)
syntetagmenes.f:12:3:

   12 |  WRITE(*,*) 'Aktina R = ', R
      |   1
Error: Non-numeric character in statement label at (1)
syntetagmenes.f:13:3:

   13 |  WRITE(*,*) 'Gwnia F = ',F,'rad =',F2,'moires'
      |   1
Error: Non-numeric character in statement label at (1)
syntetagmenes.f:14:2:

   14 | END
      |  1
Error: Non-numeric character in statement label at (1)
I dont know how to fix it. But I want to "convert" it in bash script which I understand better...if it possible..
The question is: can Bash do these mathematics like SQRT and ATAN in Fortran?
I search web and didnt find something, but i need a directly answer yes or no from people whose knows... Thank you.

Last edited by rizitis; 02-07-2023 at 01:50 PM.
 
Old 02-07-2023, 02:31 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Try compiling as
gfortran -ffree-form syntetagmenes.f -o syntetagmenes

Native bash is only capable of integer math but you can use bc. The equivalent of atan is arctan.
 
1 members found this post helpful.
Old 02-07-2023, 02:42 PM   #3
rizitis
Member
 
Registered: Mar 2009
Location: Greece,Crete
Distribution: Slackware64-current, Slint
Posts: 626

Original Poster
Rep: Reputation: 482Reputation: 482Reputation: 482Reputation: 482Reputation: 482
thank you!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash as input to Fortran Natski Linux - Newbie 2 11-02-2009 02:39 PM
g77 in gcc 4.1.0 not found only gfortran fortran 95 compiler! I need fortran 77. TheBrick Linux - Software 3 07-04-2007 06:39 AM
bash + fortran into .exe would this work TheBrick Programming 10 10-03-2006 06:35 PM
Gnu Fortran versus Intel Fortran tomatoefish Linux - Software 3 02-20-2006 01:31 PM
does linux fortran compiler in fedora 4 support VAX FORTRAN? terrence Programming 17 08-31-2005 08:59 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration