我有一个复数数组,我想用fortran的write输出成6*6矩阵,format里写什么?
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/08/24 08:41:24
我有一个复数数组,我想用fortran的write输出成6*6矩阵,format里写什么?
parameter(n=6)
dimension a(n,n)
complex ::a
a(1,1)=(1.0,0.0)
a(1,2)=(1.0,2.0)
a(1,3)=(2.0,1.0)
a(1,4)=(0.0,0.0)
a(1,5)=(3.0,0.0)
a(1,6)=(2.0,0.0)
a(2,1)=(1.0,-2.0)
a(2,2)=(2.0,0.0)
a(2,3)=(2.0,0.0)
a(2,4)=(0.0,2.0)
a(2,5)=(0.0,0.0)
a(2,6)=(1.0,0.0)
a(3,1)=(2.0,-1.0)
a(3,2)=(2.0,0.0)
a(3,3)=(3.0,0.0)-w
a(3,4)=(0.0,3.0)
a(3,5)=(0.0,0.0)
a(3,6)=(0.0,0.0)
a(4,1)=(0.0,0.0)
a(4,2)=(0.0,-2.0)
a(4,3)=(0.0,-3.0)
a(4,4)=(0.0,0.0)
a(4,5)=(0.0,0.0)
a(4,6)=(0.0,0.0)
a(5,1)=(-3.0,0.0)
a(5,2)=(0.0,0.0)
a(5,3)=(0.0,0.0)
a(5,4)=(0.0,0.0)
a(5,5)=(0.0,0.0)
a(5,6)=(0.0,0.0)
a(6,1)=(-2.0,0.0)
a(6,2)=(-1.0,0.0)
a(6,3)=(0.0,0.0)
a(6,4)=(0.0,0.0)
a(6,5)=(0.0,0.0)
a(6,6)=(0.0,0.0)
write(*,643) ((a(i,j),j=1,n),i=1,n)
643 format(?)
parameter(n=6)
dimension a(n,n)
complex ::a
a(1,1)=(1.0,0.0)
a(1,2)=(1.0,2.0)
a(1,3)=(2.0,1.0)
a(1,4)=(0.0,0.0)
a(1,5)=(3.0,0.0)
a(1,6)=(2.0,0.0)
a(2,1)=(1.0,-2.0)
a(2,2)=(2.0,0.0)
a(2,3)=(2.0,0.0)
a(2,4)=(0.0,2.0)
a(2,5)=(0.0,0.0)
a(2,6)=(1.0,0.0)
a(3,1)=(2.0,-1.0)
a(3,2)=(2.0,0.0)
a(3,3)=(3.0,0.0)-w
a(3,4)=(0.0,3.0)
a(3,5)=(0.0,0.0)
a(3,6)=(0.0,0.0)
a(4,1)=(0.0,0.0)
a(4,2)=(0.0,-2.0)
a(4,3)=(0.0,-3.0)
a(4,4)=(0.0,0.0)
a(4,5)=(0.0,0.0)
a(4,6)=(0.0,0.0)
a(5,1)=(-3.0,0.0)
a(5,2)=(0.0,0.0)
a(5,3)=(0.0,0.0)
a(5,4)=(0.0,0.0)
a(5,5)=(0.0,0.0)
a(5,6)=(0.0,0.0)
a(6,1)=(-2.0,0.0)
a(6,2)=(-1.0,0.0)
a(6,3)=(0.0,0.0)
a(6,4)=(0.0,0.0)
a(6,5)=(0.0,0.0)
a(6,6)=(0.0,0.0)
write(*,643) ((a(i,j),j=1,n),i=1,n)
643 format(?)
我从来不用format语句,如果要求不高的话可以
write(*,*) ((a(i,j),j=1,n),i=1,n)
或者
do i=1,6
write(*,*) a(i,:)
enddo
如果你对格式要求很高,那么最不济的办法可以用循环并分实部和虚部来输出,这样就全是实数了.
write(*,*) ((a(i,j),j=1,n),i=1,n)
或者
do i=1,6
write(*,*) a(i,:)
enddo
如果你对格式要求很高,那么最不济的办法可以用循环并分实部和虚部来输出,这样就全是实数了.
FORTRAN 90 的format语句怎么用?
fortran循环语句的数组输出
我有一个矩阵,有一定的对角线对称特性,但里面有复数,谁有没有什么办法能把这个复数矩阵变成实数矩阵?
10 format(1x,3I5)前面的10是怎么来的?后面括号里分别表示什么?刚学FORTRAN,看不懂.
写一个函数,使给定的一个3*3的二维整形数组转置,即行列互换.我写的输出有错误:
fortran中write什么意思
fortran语言怎么让一个数组赋值,使其是两个已知常量数组的积
关于fortran 想定义一个数组,即可以储存character,也可以储存real类型的数据比如一个数组a(10),有
fortran中的 write(222) dipole 输出的格式是怎么样子的?
用二维数组怎么输出矩阵的两条对角元素
用fortran语言编一个矩阵相乘的通用程序 急用
如何用C语言编一个程序,输入一个二维数组,然后以一个矩阵的方式输出.