Sponsored links: Algebra eBooks ### The Maxima on-line user's manual

Algebra Calculator

#### Search: #### Fortran

Function: fortran (<expr>) Prints <expr> as a Fortran statement. The output line is indented with spaces. If the line is too long, `fortran` prints continuation lines. `fortran` prints the exponentiation operator `^` as `**`, and prints a complex number `a + b %i` in the form `(a,b)`. <expr> may be an equation. If so, `fortran` prints an assignment statement, assigning the right-hand side of the equation to the left-hand side. In particular, if the right-hand side of <expr> is the name of a matrix, then `fortran` prints an assignment statement for each element of the matrix.

If <expr> is not something recognized by `fortran`, the expression is printed in `grind` format without complaint. `fortran` does not know about lists, arrays, or functions.

`fortindent` controls the left margin of the printed lines. 0 is the normal margin (i.e., indented 6 spaces). Increasing `fortindent` causes expressions to be printed further to the right.

When `fortspaces` is `true`, `fortran` fills out each printed line with spaces to 80 columns.

`fortran` evaluates its arguments; quoting an argument defeats evaluation. `fortran` always returns `done`.

Examples:

```     (%i1) expr: (a + b)^12\$
(%i2) fortran (expr);
(b+a)**12
(%o2)                         done
(%i3) fortran (x=expr);
x = (b+a)**12
(%o3)                         done
(%i4) fortran (x=expand (expr));
x = b**12+12*a*b**11+66*a**2*b**10+220*a**3*b**9+495*a**4*b**8+792
1   *a**5*b**7+924*a**6*b**6+792*a**7*b**5+495*a**8*b**4+220*a**9*b
2   **3+66*a**10*b**2+12*a**11*b+a**12
(%o4)                         done
(%i5) fortran (x=7+5*%i);
x = (7,5)
(%o5)                         done
(%i6) fortran (x=[1,2,3,4]);
x = [1,2,3,4]
(%o6)                         done
(%i7) f(x) := x^2\$
(%i8) fortran (f);
f
(%o8)                         done```

```(%o1)                                true
(%i2) ```

### Related Examples

##### fortran-matrix

a:matrix([a11,a12,a13...

fortran(a);

Calculate

##### fortran-plot2d-sin-taylor-tex f(x):= sin(x);

t(x):=taylor(f(x), x,...

t2(x):=taylor(f(x), x...

Calculate

##### fortran-sin-taylor-tex

f(x):= sin(x);

g(x):= taylor(f(x),x,...

fortran(taylor(f(x),...

Calculate

##### fortran-plot2d-sin-taylor-tex f(x):= sin(x);

t1(x):=taylor(f(x), x...

t3(x):=taylor(f(x), x...

Calculate

##### fortran-sqrt

A:(e*L^2+M^2+N^2);

B:(2*e*L*x+2*M*y+2*N*...

C:(e*x^2+y^2+z^2-2*R*x);

Calculate

##### fortran-log-plot2d-taylor-tex f(x):= log(1+x);

t4(x):=taylor(f(x), x...

t7(x):=taylor(f(x), x...

Calculate

##### fortran-sin-taylor

taylor(sin(x),x,0,15);

fortran(f);

Calculate

##### fortran-log-sum

dLdB:1/B*sum(Ni[i],i,...

fortran(dLdB);

Calculate

##### fortran-log-plot2d-taylor-tex f(x):= log(1+x);

t4(x):=taylor(f(x), x...

t7(x):=taylor(f(x), x...

Calculate

##### fortran-solve

IP: (%K1 *(%PBase+(PB...

solve(IP=%LimIP, PBra...

fortran(solve(IP=%Lim...

Calculate 