Sponsored Content
Full Discussion: Nonsense error in FORTRAN
Top Forums UNIX for Beginners Questions & Answers Nonsense error in FORTRAN Post 303045973 by AkaAlteir on Monday 20th of April 2020 04:18:33 PM
Old 04-20-2020
Nonsense error in FORTRAN

Hello, I've been trying to set up a code for fortran, it's about integration, the problem comes when I try to compile the program, the log shows 2 errors: "Error: Expected a right parenthesis in expression " 2 times, and only in 1 shows the line in which it's apparently located (32), I'm going crazy cause i can't find the problem, does anyone know what's wrong?, the code is:

Code:
program main
  implicit none
  integer :: n,i,k
  real*8 :: a,b,x,trapecio,s,suma1,suma2,x2,formula1,formula2,eps,div,h

  !variables
  n=3
  a=0d8
  b=4d8


  !calculate the additions 1 a n-1 y 2 a n-2

  suma1=0d0
  suma2=0d0
  do n=3,300,2*n
   h=(b-a)/dble(n)

        do i=1,n-1,2
            x=a+dble(i)*h
            formula1= 1/(1+(x^2))
            suma1=  suma1 + formula1
        end do

        do k= 2,n-2,2
            x2=a+dble(k)*h
            formula2 =1/(1 + (x2^2)
            suma2= suma2+ formula2
        end do

     trapecio= h/3* &
     (1+ 4*suma1 + 2*suma2 + 1(1/n^2))
     div= trapecio/(trapecio/2)
            if (div < 1d-6) then
                exit
            end if

    write(*,*), trapecio
   end do
  end

 

4 More Discussions You Might Find Interesting

1. Programming

Error running FORTRAN code

Hi, I am new to this forum and do not know whether this is the appropriate place to post this question. Anyway am trying my luck. I have a fortran program swanhcat.ftn, which is part of a wave modelling system. There is also a file hcat.nml which is required to run this program. The program's... (9 Replies)
Discussion started by: sandhyakg
9 Replies

2. Programming

Fortran runtime error: Insufficient data descriptors in format after reversion

Hello, I have some Fortran code that is providing the following error: At line 1165 of lapc_shells_2.f Fortran runtime error: Insufficient data descriptors in format after reversion Here are the lines just above and including 1165: WRITE (*,"('ATTEMPTING TO READ PLATE... (1 Reply)
Discussion started by: jm4smtddd
1 Replies

3. Homework & Coursework Questions

FORTRAN error *** glibc detected ***

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I'm doing aproximation of derivative called five-point stencil. For every value of x, in interval , in step... (0 Replies)
Discussion started by: antonija
0 Replies

4. Programming

Error in my FORTRAN program

I have a Fortran program and I am writing out to logical unit 7. The program is reading from a text file and writing to the new file formatted. It gets through the read and writes some to the file but then stops with the following error: 1525-013 The sequential WRITE statement cannot be... (5 Replies)
Discussion started by: KathyB148
5 Replies
FC(1)							      General Commands Manual							     FC(1)

NAME
fc - frontend script to the f2c fortran compiler SYNOPSIS
/usr/bin/fc [-o objfile] [-c] [-S] [-C] [-u] [-w] [-w66] [-D switch] [-I includepath] [-Ntnnn] [-P] files [-l library] DESCRIPTION
fc is a script intended to be used as a front end to the f2c FORTRAN-to-C translator. It is supposed to make the whole f2c and C compiler setup look like a real Fortran compiler. File arguments with a .f suffix are compiled as Fortran source. Files with a .F suffix are passed through the C preprocessor cpp(1) first. Files with .c (C source) or .s (assembly source) suffixes are passed to the C compiler directly. Files with a .e suffix are treated as efl source files, and files with a .r suffix are treated as RATFOR source files. OPTIONS
-o objfile Produce an output executable named objfile rather than using the default name a.out. -c Do not call the linker; instead, leave relocatable object files as *.o. -S Produce assembly output as file.s -C Compile in extra code to check that array subscripts are in bounds. -l library Libraries specified with this option are passed to the linker. -U def Definitions specified with this option are passed to C compiler (for .c files) or to cpp (for .F files) to remove definition. -u Complain about undeclared variables. -v, --version Print version of f2c in use -w Omit all warning messages. -w66 Omit Fortran 66 (Fortran IV) compatibility warning messages. -D switch The given switch is passed to the C compiler (for .c files), to cpp (for .F files) and to f2c. -I includepath Passed to the C compiler (for .c files), to cpp (for .F files) and to f2c. -Ntnnn Allow nnn entries in table t. -P Emit .P files. BUGS
fc isn't really very good -- try fort77 (1), which does a better job. This manual page isn't really very good either... AUTHOR
S. Feldman, D. Gay, M. Maimone, N, Schryer are all mentioned in the paper on the conversion of Fortran to C. Peter Maydell (pmaydell@chiark.greenend.org.uk) wrote this manual page, and Alan Bain (alanb@chiark.greenend.org.uk) made some minor modi- fications. SEE ALSO
f2c(1), fort77(1), cc(1), cpp(1), ratfor(1) May 1999 FC(1)
All times are GMT -4. The time now is 01:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy