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
F2PY(1) 						      General Commands Manual							   F2PY(1)

NAME
f2py - Fortran to Python interface generator SYNOPSIS
(1) To construct extension module sources: f2py [<options>] <fortran files> [[[only:]||[skip:]] <fortran functions> ] [: <fortran files> ...] (2) To compile fortran files and build extension modules: f2py -c [<options>, <config_fc options>, <extra options>] <fortran files> (3) To generate signature files: f2py -h <filename.pyf> ...< same options as in (1) > DESCRIPTION
This program generates a Python C/API file (<modulename>module.c) that contains wrappers for given Fortran or C functions so that they can be called from Python. With the -c option the corresponding extension modules are built. OPTIONS
-h <filename> Write signatures of the fortran routines to file <filename> and exit. You can then edit <filename> and use it instead of <fortran files>. If <filename>==stdout then the signatures are printed to stdout. <fortran functions> Names of fortran routines for which Python C/API functions will be generated. Default is all that are found in <fortran files>. skip: Ignore fortran functions that follow until `:'. only: Use only fortran functions that follow until `:'. : Get back to <fortran files> mode. -m <modulename> Name of the module; f2py generates a Python/C API file <modulename>module.c or extension module <modulename>. Default is 'unti- tled'. --[no-]lower Do [not] lower the cases in <fortran files>. By default, --lower is assumed with -h key, and --no-lower without -h key. --build-dir <dirname> All f2py generated files are created in <dirname>. Default is tempfile.mktemp(). --overwrite-signature Overwrite existing signature file. --[no-]latex-doc Create (or not) <modulename>module.tex. Default is --no-latex-doc. --short-latex Create 'incomplete' LaTeX document (without commands documentclass, ableofcontents, and egin{document}, end{document}). --[no-]rest-doc Create (or not) <modulename>module.rst. Default is --no-rest-doc. --debug-capi Create C/API code that reports the state of the wrappers during runtime. Useful for debugging. -include'<includefile>' Add CPP #include statement to the C/API code. <includefile> should be in the format of either `"filename.ext"' or `<filename.ext>'. As a result <includefile> will be included just before wrapper functions part in the C/API code. The option is depreciated, use `usercode` statement in signature files instead. --[no-]wrap-functions Create Fortran subroutine wrappers to Fortran 77 functions. --wrap-functions is default because it ensures maximum portability/com- piler independence. --help-link [..] List system resources found by system_info.py. [..] may contain a list of resources names. See also --link-<resource> switch below. --quiet Run quietly. --verbose Run with extra verbosity. -v Print f2py version ID and exit. --include_paths path1:path2:... Search include files (that f2py will scan) from the given directories. CONFIG_FC OPTIONS The following options are effective only when -c switch is used. --help-compiler List available Fortran compilers [DEPRECIATED]. --fcompiler=<name> Specify Fortran compiler type by vendor. --compiler=<name> Specify C compiler type (as defined by distutils) --fcompiler-exec=<path> Specify the path to F77 compiler [DEPRECIATED]. --f90compiler-exec=<path> Specify the path to F90 compiler [DEPRECIATED]. --help-fcompiler List available Fortran compilers and exit. --f77exec=<path> Specify the path to F77 compiler. --f90exec=<path> Specify the path to F90 compiler. --f77flags="..." Specify F77 compiler flags. --f90flags="..." Specify F90 compiler flags. --opt="..." Specify optimization flags. --arch="..." Specify architecture specific optimization flags. --noopt Compile without optimization. --noarch Compile without arch-dependent optimization. --debug Compile with debugging information. EXTRA OPTIONS
The following options are effective only when -c switch is used. --link-<resource> Link extension module with <resource> as defined by numpy_distutils/system_info.py. E.g. to link with optimized LAPACK libraries (vecLib on MacOSX, ATLAS elsewhere), use --link-lapack_opt. See also --help-link switch. -L/path/to/lib/ -l<libname> -D<define> -U<name> -I/path/to/include/ <filename>.o <filename>.so <filename>.a -DPREPEND_FORTRAN -DNO_APPEND_FORTRAN -DUPPERCASE_FORTRAN -DUNDERSCORE_G77 Macros that might be required with non-gcc Fortran compilers. -DF2PY_REPORT_ATEXIT To print out a performance report of F2PY interface when python exits. Available for Linux. -DF2PY_REPORT_ON_ARRAY_COPY=<int> To send a message to stderr whenever F2PY interface makes a copy of an array. Integer <int> sets the threshold for array sizes when a message should be shown. REQUIREMENTS
Python 1.5.2 or higher (2.x is supported). Numerical Python 13 or higher (20.x,21.x,22.x,23.x are supported). Optional Numarray 0.9 or higher partially supported. numpy_distutils from Scipy (can be downloaded from F2PY homepage) SEE ALSO
python(1) BUGS
For instructions on reporting bugs, see http://cens.ioc.ee/projects/f2py2e/FAQ.html AUTHOR
Pearu Peterson <pearu@cens.ioc.ee> INTERNET RESOURCES
Main website: http://cens.ioc.ee/projects/f2py2e/ User's Guide: http://cens.ioc.ee/projects/f2py2e/usersguide/ Mailing list: http://cens.ioc.ee/mailman/listinfo/f2py-users/ Scipy website: http://www.numpy.org COPYRIGHT
Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Pearu Peterson LICENSE
NumPy License VERSION
2.45.241 F2PY(1)
All times are GMT -4. The time now is 08:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy