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
Template::Plugin::XML::Style(3pm)			User Contributed Perl Documentation			 Template::Plugin::XML::Style(3pm)

NAME
Template::Plugin::XML::Style - Simple XML stylesheet transfomations SYNOPSIS
[% USE xmlstyle table = { attributes = { border = 0 cellpadding = 4 cellspacing = 1 } } %] [% FILTER xmlstyle %] <table> <tr> <td>Foo</td> <td>Bar</td> <td>Baz</td> </tr> </table> [% END %] DESCRIPTION
This plugin defines a filter for performing simple stylesheet based transformations of XML text. Named parameters are used to define those XML elements which require transformation. These may be specified with the USE directive when the plugin is loaded and/or with the FILTER directive when the plugin is used. This example shows how the default attributes "border="0"" and "cellpadding="4"" can be added to <table> elements. [% USE xmlstyle table = { attributes = { border = 0 cellpadding = 4 } } %] [% FILTER xmlstyle %] <table> ... </table> [% END %] This produces the output: <table border="0" cellpadding="4"> ... </table> Parameters specified within the USE directive are applied automatically each time the "xmlstyle" FILTER is used. Additional parameters passed to the FILTER directive apply for only that block. [% USE xmlstyle table = { attributes = { border = 0 cellpadding = 4 } } %] [% FILTER xmlstyle tr = { attributes = { valign="top" } } %] <table> <tr> ... </tr> </table> [% END %] Of course, you may prefer to define your stylesheet structures once and simply reference them by name. Passing a hash reference of named parameters is just the same as specifying the named parameters as far as the Template Toolkit is concerned. [% style_one = { table = { ... } tr = { ... } } style_two = { table = { ... } td = { ... } } style_three = { th = { ... } tv = { ... } } %] [% USE xmlstyle style_one %] [% FILTER xmlstyle style_two %] # style_one and style_two applied here [% END %] [% FILTER xmlstyle style_three %] # style_one and style_three applied here [% END %] Any attributes defined within the source tags will override those specified in the style sheet. [% USE xmlstyle div = { attributes = { align = 'left' } } %] [% FILTER xmlstyle %] <div>foo</div> <div align="right">bar</div> [% END %] The output produced is: <div align="left">foo</div> <div align="right">bar</div> The filter can also be used to change the element from one type to another. [% FILTER xmlstyle th = { element = 'td' attributes = { bgcolor='red' } } %] <tr> <th>Heading</th> </tr> <tr> <td>Value</td> </tr> [% END %] The output here is as follows. Notice how the end tag "</th>" is changed to "</td>" as well as the start tag. <tr> <td bgcolor="red">Heading</td> </tr> <tr> <td>Value</td> </tr> You can also define text to be added immediately before or after the start or end tags. For example: [% FILTER xmlstyle table = { pre_start = '<div align="center">' post_end = '</div>' } th = { element = 'td' attributes = { bgcolor='red' } post_start = '<b>' pre_end = '</b>' } %] <table> <tr> <th>Heading</th> </tr> <tr> <td>Value</td> </tr> </table> [% END %] The output produced is: <div align="center"> <table> <tr> <td bgcolor="red"><b>Heading</b></td> </tr> <tr> <td>Value</td> </tr> </table> </div> AUTHOR
Andy Wardley COPYRIGHT
Copyright (C) 2001-2006 Andy Wardley. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
Template::Plugin perl v5.8.8 2008-03-01 Template::Plugin::XML::Style(3pm)
All times are GMT -4. The time now is 08:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy