I will use the classic book of Koonin which is very good specialy in the first chapter
primero se tiene que tener en cuenta que las operaciones principales para un fisico o matematicas aplicadas es la derivación, integración y encontrar las raices de una ecuación.
Por lo tanto, vamos a usar las formulas de Taylor y McLaurin para encontrar las derivadas e integrales por metodos numericos
PROGRAMA EN FORTRAN PARA DERIVAR E INTEGRAR
LOS COMPILADORES DE WINDOWS FUNCIONANDO BIEN
Microsoft Windows [Versión 10.0.17134.950]
(c) 2018 Microsoft Corporation. Todos los derechos reservados.
C:\Users\admin>cd \
C:\>cd g95
C:\g95>g95
g95: no input files
C:\g95>
C:\g95>dir
El volumen de la unidad C es Windows
El número de serie del volumen es: CA17-A5F2
Directorio de C:\g95
08/31/2019 11:55 AM <DIR> .
08/31/2019 11:55 AM <DIR> ..
07/02/2018 09:44 PM 346,986 a.exe
07/02/2018 09:38 PM <DIR> bin
07/21/2018 01:03 AM 254 chap1a.for
07/21/2018 12:43 AM 12 chap1b.for
08/31/2019 11:55 AM 658 chapman1.for
08/30/2019 11:11 PM 952 constants.mod
12/27/2007 09:23 AM 2,192 crt1.o
12/27/2007 09:23 AM 2,288 crt2.o
12/27/2007 09:23 AM 1,239 dllcrt2.o
07/02/2018 09:38 PM <DIR> doc
08/30/2019 11:11 PM 592 functions.mod
08/30/2019 09:15 PM 346,986 hello.exe
08/30/2019 09:15 PM 111 hello.f90
07/02/2018 09:38 PM <DIR> lib
07/20/2018 11:51 PM 240 nestedloops.f95
07/02/2018 09:22 PM 61 PROG1.f90
07/02/2018 09:27 PM 61 PROG1.f95
07/02/2018 09:22 PM 61 PROG1.txt
08/30/2019 11:15 PM 356,671 program4.exe
08/30/2019 11:15 PM 1,244 PROGRAM4.F90
07/20/2018 11:23 PM 348,105 statisticsDS.exe
07/20/2018 11:22 PM 837 statisticsDS.f95
07/20/2018 09:41 PM 336 tempconvert.f95
07/20/2018 09:41 PM 346,986 tempconverter.exe
07/20/2018 11:38 PM 346,986 testcycle.exe
07/20/2018 11:37 PM 131 testcycle.f95
07/20/2018 11:52 PM 346,986 testexit.exe
07/20/2018 11:52 PM 141 testexit.f95
25 archivos 2,451,116 bytes
5 dirs 53,932,896,256 bytes libres
C:\g95>g95 chapman1.for -o chapman1
Error: Unexpected end of file in 'chapman1.for'
C:\g95>g95 chapman1.for -o chapman1
Error: Unexpected end of file in 'chapman1.for'
C:\g95>gfortran
gfortran: no input files
C:\g95>gfortran chapman1.for -o chapman1
Error: Unexpected end of file in 'chapman1.for'
C:\g95>gfortran chapmancorrect1.f90 -o chapman1
C:\g95>chapman1
This program solves for the roots of a quadratic
equation of the form A * X**2 + B * X + C = 0.
Enter the coefficients A, B, and C:
2 4 5
The coefficients A, B, and C are: 2.0000000 4.0000000 5.0000000
This equation has complex roots:
X1 = -1.0000000 +i 1.2247449
X2 = -1.0000000 -i 1.2247449
C:\g95>g95 chapmancorrect1.f90 -o chapman1a
C:\g95>chapman1a
This program solves for the roots of a quadratic
equation of the form A * X**2 + B * X + C = 0.
Enter the coefficients A, B, and C:
2 4 5
The coefficients A, B, and C are: 2. 4. 5.
This equation has complex roots:
X1 = -1. +i 1.2247449
X2 = -1. -i 1.2247449
C:\g95>
me estaba dando error el g95 en windows
USANDO MAC TIGER OX, GFORTRAN
Last login: Sat Aug 31 10:20:15 on ttyp1
Welcome to Darwin!
indefinido-indefinidos-imac-g5:~ indefinidoindefinido$ cd usr~
-bash: cd: usr~: No such file or directory
indefinido-indefinidos-imac-g5:~ indefinidoindefinido$ cd /usr
indefinido-indefinidos-imac-g5:/usr indefinidoindefinido$ ls
]X11R6 include libexec sbin standalone
bin lib local share
indefinido-indefinidos-imac-g5:/usr indefinidoindefinido$ export PATH=$PATH:/usr/local/bin
indefinido-indefinidos-imac-g5:/usr indefinidoindefinido$ gfortran
powerpc-apple-darwin8-gfortran-4.2: no input files
indefinido-indefinidos-imac-g5:/usr indefinidoindefinido$ cd /Users/indefinidoindefinido/Documents/yatested
indefinido-indefinidos-imac-g5:~/Documents/yatested indefinidoindefinido$ ls
DERIVADA1.for SIMPSON.F hello.f plot.f
indefinido-indefinidos-imac-g5:~/Documents/yatested indefinidoindefinido$ gfortran DERIVADA1.for /o derivada
powerpc-apple-darwin8-gfortran-4.2: /o: No such file or directory
powerpc-apple-darwin8-gfortran-4.2: derivada: No such file or directory
indefinido-indefinidos-imac-g5:~/Documents/yatested indefinidoindefinido$ gfortran DERIVADA1.for -o derivada
indefinido-indefinidos-imac-g5:~/Documents/yatested indefinidoindefinido$ ls
DERIVADA1.for SIMPSON.F derivada hello.f plot.f
indefinido-indefinidos-imac-g5:~/Documents/yatested indefinidoindefinido$ ./derivada
Enter value of h (.le. 0 to stop)
10
H= 0.10000000E+02 ERROR= 0.56969589E+00
Enter value of h (.le. 0 to stop)
0.5
H= 0.50000000E+00 ERROR= 0.22232831E-01
Enter value of h (.le. 0 to stop)
0.01
H= 0.99999998E-02 ERROR= 0.10013580E-04
Enter value of h (.le. 0 to stop)
0.0002
H= 0.19999999E-03 ERROR=-0.13828278E-04
Enter value of h (.le. 0 to stop)
0.02
H= 0.20000000E-01 ERROR= 0.36835670E-04
Enter value of h (.le. 0 to stop)
0.000000005
H= 0.50000000E-08 ERROR= 0.54030228E+00
Enter value of h (.le. 0 to stop)
^[[A
At line 4 of file DERIVADA1.for
Fortran runtime error: Bad real number in item 1 of list input
indefinido-indefinidos-imac-g5:~/Documents/yatested indefinidoindefinido$ ls
indefinido-indefinidos-imac-g5:~/Documents/yatested indefinidoindefinido$ gfortran SIMPSON.F -o simpson
SIMPSON.F:26: warning: no newline at end of file
indefinido-indefinidos-imac-g5:~/Documents/yatested indefinidoindefinido$ ./simpson
ENTER N PAR (EVEN), (.LT. 2 TO STOP)
4
N= 4 ERROR=-0.37193298E-04
ENTER N PAR (EVEN), (.LT. 2 TO STOP)
8
N= 8 ERROR=-0.23841858E-05
ENTER N PAR (EVEN), (.LT. 2 TO STOP)
16
N= 16 ERROR=-0.35762787E-06
ENTER N PAR (EVEN), (.LT. 2 TO STOP)
32
N= 32 ERROR= 0.00000000E+00
ENTER N PAR (EVEN), (.LT. 2 TO STOP)
64
N= 64 ERROR=-0.35762787E-06
ENTER N PAR (EVEN), (.LT. 2 TO STOP)
128
N= 128 ERROR=-0.11920929E-06
ENTER N PAR (EVEN), (.LT. 2 TO STOP)
1000
N= 1000 ERROR=-0.59604645E-06
ENTER N PAR (EVEN), (.LT. 2 TO STOP)
150000
N=***** ERROR=-0.10609627E-04
ENTER N PAR (EVEN), (.LT. 2 TO STOP)
15000000
N=***** ERROR= 0.34258723E-01
ENTER N PAR (EVEN), (.LT. 2 TO STOP)
REFERENCIA DE WIKIPEDIA PARA RECORDAR
Recordando que
Serie de Taylor
- la derivación e integración de una de estas series se puede realizar término a término, que resultan operaciones triviales;
- se puede utilizar para calcular valores aproximados de funciones;
- es posible calcular la optimidad de la aproximación.
Definición[editar]
,
- n! es el factorial de n
- f (n)(a) denota la n-ésima derivada de f para el valor a de la variable respecto de la cual se deriva.
Función exponencial y logaritmo natural[editar]
Serie geométrica[editar]
Funciones trigonométricas[editar]
-
- Donde Bs son los Números de Bernoulli.
Funciones hiperbólicas[editar]
Función W de Lambert[editar]
Varias variables[editar]
- biblio
Print
Statement Purpose
The print statement is used to send output to the standard output unit ( usually your monitor, or sometimes your printer ) of your computer system.
Examples and Rules of Use
The concept of the PRINT statement is a pretty basic thing for most people to understand. You need only remember a few details of the details of its use. For starters take a look at the following print statement.
print *, 'The velocity on impact is', v1
The first thing that you should notice right away is the '*' that follows the initial print statement. This star tells the computer to output the data that follows in a format compatible with the type of items contained in the following comma delimmited list.
The next thing that you should look at is the data list that is slated to be output. It contains a combination of a character string and a variable ( v1 ). A comma like the one that separates the character string and the variable v1 is always used to separate two different output list items. Next, the entire character string in the above print statement except for the single quotes will be printed. In FORTRAN 77 you had to use single quotes to encapsulate any character string marked for output, but in FORTRAN 90 it is equally valid to use double quotes. If you have a need to output a character string that contains either a single quote or double quote, you'll can place two quotes in a row as in the following example so the computer knows that the quotes are not being used to mark the end of the character string.
Print *, 'The car''s speed is', cspeed, 'mph'
Alternately, knowing that you want single quotes in your output, you can bound the entire string with double quotes, removing confusion (Fortran 90 only).
Print *, "The car's speed is", cspeed, "mph"
Although the "*" (list directed) format is good for many situations, it is sometimes necessary to use a specific output format for full control of output appearance. This can be accomplished using the format statement. To reference a format statement a statement label should be inserted in place of the '*' in the print statement. The following example should clarify this point.
Print 1000, x,y,z 1000 format (1x,3(f5.2))
Remember that PRINT always routes your output to the standard output unit for your system. Now, the standard output unit for most systems is your computer's monitor. Although, you should be aware that there are still a few systems that use the printer as its standard output device. If you need to write your output to a file, or put it into a character variable, use the write statement.
Before I close the book on the print statement I want to point out one more thing concerning the print statement. In the format statement for the above print statement you'll notice that I used the X edit descriptor to skip one space before I begin to actually output my results. The reason why I do this is to make sure that the output of my results don't get messed up by the printer control variables. Printer control variables date to the dawn of FORTRAN. They really aren't necessary anymore, but like a few other outdated constructs in FORTRAN we can't seem to get rid of them. The story behind the control variables was that the first character in a line from PRINT or WRITE statements was interpreted by the printer as a special command. It told the printer how many lines to scroll down before it began printing. There were four primary characters that were used to do this, two of which were zero and one. Zero told the printer to double space things and one told it scroll to the top of the next page. So, if the very first thing you output is a number that begins with zero or one you run the risk of invoking the old printer control variables. This problem is normally encountered when routing the output to some printers. Therefore, it is a good idea to skip a space before you begin printing using a format statement to control the layout of your output.
- https://docs.oracle.com/cd/E19957-01/805-4939/6j4m0vnap/index.html
PRINT
The PRINT statement writes from a list to stdout.
PRINT f [, iolist]
Parameter
Description
f
Format identifier
iolist
List of variables, substrings, arrays, and records
grname
Name of the namelist group
Description
The PRINT statement accepts the following arguments.
Format Identifier
f is a format identifier and can be:
An asterisk (*), which indicates list-directed I/O. See "List-Directed I/O " on for more information.
The label of a FORMAT statement that appears in the same program unit.
An integer variable name that has been assigned the label of a FORMAT statement that appears in the same program unit.
A character expression or integer array that specifies the format string. The integer array is nonstandard. @
Output List
iolist can be empty or can contain output items or implied DO lists. The output items must be one of the following:
Variables
Substrings
Arrays
Array elements
Record fields
Any other expression
A simple unsubscripted array name specifies all of the elements of the array in memory storage order, with the leftmost subscript increasing more rapidly.
Implied DO lists are described on "Implied DO Lists".
Namelist-Directed PRINT
The second form of the PRINT statement is used to print the items of the specified namelist group. Here, grname is the name of a group previously defined by a NAMELIST statement.
Execution proceeds as follows:
The format, if specified, is established.
If the output list is not empty, data is transferred from the list to standard output.
If a format is specified, data is edited accordingly.
In the second form of the PRINT statement, data is transferred from the items of the specified namelist group to standard output.
Restrictions
Output from an exception handler is unpredictable. If you make your own exception handler, do not do any FORTRAN output from it. If you must do some, then call abort right after the output. Doing so reduces the relative risk of a program freeze. FORTRAN I/O from an exception handler amounts to recursive I/O. See the next point.
Recursive I/O does not work reliably. If you list a function in an I/O list, and if that function does I/O, then during runtime, the execution may freeze, or some other unpredictable problem may occur. This risk exists independent of parallelization.
Example: Recursive I/O fails intermittently:
PRINT *, x, f(x) Not allowed because f() does I/O. END FUNCTION F(X) PRINT *, X RETURN END
Examples
CHARACTER TEXT*16 PRINT 1, NODE, TEXT 1 FORMAT (I2, A16)
Example 2: List-directed array:
PRINT *, I, J, (VECTOR(I), I = 1, 5)
INTEGER VECTOR(10) PRINT '(12 I2)', I, J, VECTOR
CHARACTER LABEL*16 REAL QUANTITY INTEGER NODE NAMELIST /SUMMARY/ LABEL, QUANTITY, NODE PRINT SUMMARY