
正文
高斯转换代码java代码 高斯程序
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
java程序产生高斯随机数,谁给调一下
这个跟 Random().nextDouble() 产生的数据有什么不同?有些时候需要改变一下需求。
这样的问题只有在学校的时候才会使用到,因为要学理论,在工作上不需要这样的数据。
相关问答
Q1: java实现生成高斯分布(0,1)随机数的函数
高斯0-1分布就是正态0-1随机分布。
在java中可用如下语句:
a=5;b=6;c=7;
A=randn(a);%生成正方矩阵
A=randn(a,b);%生成非正方矩阵
A=randn(a,b,c);%生成三维矩阵
Q2: python将高斯坐标转换经纬度 经纬度坐标与高斯坐标的转换代码
#网上搜来的
# 高斯坐标转经纬度算法 # B=大地坐标X # C=大地坐标Y # IsSix=6度带或3度带
import math
def GetLatLon2(B, C,IsSix):
#带号
D = math.trunc( C/ 1000000)
#中央经线(单位:弧度)
K = 0
if IsSix:
K = D * 6 - 3 #6度带计算
else:
K = D * 3 #3度带计算
L = B/(6378245*(1-0.006693421623)*1.0050517739)
M = L +(0.00506237764 * math.sin(2*L)/2-0.00001062451*math.sin(4*L)/4+0.0000002081*math.sin(6*L)/6)/1.0050517739
N = L +(0.00506237764 * math.sin(2*M)/2-0.00001062451*math.sin(4*M)/4+0.0000002081*math.sin(6*M)/6)/1.0050517739
O = L +(0.00506237764 * math.sin(2*N)/2-0.00001062451*math.sin(4*N)/4+0.0000002081*math.sin(6*N)/6)/1.0050517739
P = L +(0.00506237764 * math.sin(2*O)/2-0.00001062451*math.sin(4*O)/4+0.0000002081*math.sin(6*O)/6)/1.0050517739
Q = L +(0.00506237764 * math.sin(2*P)/2-0.00001062451*math.sin(4*P)/4+0.0000002081*math.sin(6*P)/6)/1.0050517739
R = L +(0.00506237764 * math.sin(2*Q)/2-0.00001062451*math.sin(4*Q)/4+0.0000002081*math.sin(6*Q)/6)/1.0050517739
S = math.tan(R)
T = 0.006738525415*(math.cos(R))**2
U = 6378245/math.sqrt(1-0.006693421623*(math.sin(R))**2)
V = 6378245*(1-0.006693421623)/(math.sqrt((1-0.006693421623*(math.sin(R))**2)))**3
W = 5+3*S**2+T-9*T*S**2
X = 61+90*S**2+45*S**4
Y = 1+2*S**2+T**2
Z = 5+28*S**2+24*S**4+6*T+8*T*S**2
Lat= (180/math.pi)*(R-(C-D*1000000-500000)**2*S/(2*V*U)+(C-D*1000000-500000)**4*W/(24*U**3*V)-(C-D*1000000-500000)**6*X/(7200*U**5*V))
Lon= (180/math.pi)*(C-D*1000000-500000)*(1-(C-D*1000000-500000)**2*Y/(6*U**2)+(C-D*1000000-500000)**4*Z/(120*U**4))/(U*math.cos(P))
Lat = Lat
Lon = K + Lon
return (Lon, Lat)
Q3: 高斯投影换带计算
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5490
ClientLeft = 60
ClientTop = 345
ClientWidth = 7410
LinkTopic = "Form1"
ScaleHeight = 5490
ScaleWidth = 7410
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "克氏计算"
Height = 495
Left = 2760
TabIndex = 19
Top = 4800
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "退出"
Height = 615
Left = 3960
TabIndex = 18
Top = 4080
Width = 2415
End
Begin VB.CommandButton Command1
Caption = "计算"
Height = 615
Left = 360
TabIndex = 17
Top = 4080
Width = 2175
End
Begin VB.Frame Frame3
Caption = "输出坐标"
Height = 1455
Left = 120
TabIndex = 12
Top = 2280
Width = 6855
Begin VB.TextBox Text6
Height = 495
Left = 3960
TabIndex = 16
Text = "Text6"
Top = 360
Width = 2175
End
Begin VB.TextBox Text5
Height = 375
Left = 720
TabIndex = 14
Text = "Text5"
Top = 480
Width = 1455
End
Begin VB.Label Label8
Caption = "Y="
Height = 375
Left = 3480
TabIndex = 15
Top = 480
Width = 255
End
Begin VB.Label Label7
Caption = "X="
Height = 375
Left = 240
TabIndex = 13
Top = 480
Width = 255
End
End
Begin VB.Frame Frame2
Caption = "输入换代的中央子午线"
Height = 855
Left = 0
TabIndex = 5
Top = 1080
Width = 7095
Begin VB.TextBox Text4
Height = 375
Left = 5280
TabIndex = 9
Text = "Text4"
Top = 240
Width = 1335
End
Begin VB.TextBox Text3
Height = 375
Left = 1800
TabIndex = 8
Text = "Text3"
Top = 240
Width = 1095
End
Begin VB.Label Label6
Caption = "要换到的带的中央子午线"
Height = 495
Left = 3600
TabIndex = 11
Top = 240
Width = 1095
End
Begin VB.Label Label5
Caption = "所在的带的中央子午线"
Height = 495
Left = 240
TabIndex = 10
Top = 240
Width = 1095
End
Begin VB.Label Label3
Caption = "L0="
Height = 375
Left = 4920
TabIndex = 7
Top = 360
Width = 255
End
Begin VB.Label Label4
Caption = "L0="
Height = 255
Left = 1440
TabIndex = 6
Top = 360
Width = 375
End
End
Begin VB.Frame Frame1
Caption = "输入坐标"
Height = 975
Left = 0
TabIndex = 0
Top = 0
Width = 7095
Begin VB.TextBox Text2
Height = 375
Left = 4080
TabIndex = 4
Text = "Text2"
Top = 360
Width = 2295
End
Begin VB.TextBox Text1
Height = 375
Left = 360
TabIndex = 2
Text = "Text1"
Top = 360
Width = 2175
End
Begin VB.Label Label2
Caption = "Y="
Height = 375
Left = 3600
TabIndex = 3
Top = 360
Width = 375
End
Begin VB.Label Label1
Caption = "X="
Height = 375
Left = 120
TabIndex = 1
Top = 360
Width = 255
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim x, y, b, L As Integer
Private Sub Command1_Click()
Dim x, y, L0, b1, c, bf, bf1, bf2, nf, z, b2, b3, b4, b5, b, L, l1 As Variant
x = Val(Text1.Text)
y = Val(Text2.Text)
L0 = Val(Text3.Text)
b1 = (x / 6367452.1328)
c = Cos(b1) * Cos(b1)
bf = b1 * 206264.806247096 + (52289760 + (2936975 + (2383 + 22 * c) * c) * c) * Sin(b1) * Cos(b1) / 10 ^ (10)
bf1 = bf / 206264.806247096
bf2 = Cos(bf1) * Cos(bf1)
nf = 6399596.652 - (21565.045 - (108.996 - 0.603 * bf2) * bf2) * bf2
z = y / (nf * Cos(bf1))
b2 = (0.5 + 0.00336975 * bf2) * Sin(bf1) * Cos(bf1)
b3 = 0.3333333 - (0.1666667 - 0.001123 * bf2) * bf2
b4 = 0.25 + (0.161612 + 0.005617 * bf2) * bf2
b5 = 0.2 - (0.16667 - 0.00878 * bf2) * bf2
b = bf - (1 - (b4 - 0.147 * z * z) * z * z) * z * z * b2 * 206264.806247096
L = (1 - (b3 - b5 * z * z) * z * z) * z * 206264.806247096
l1 = L0 * 3600 + L
Debug.Print l1
Debug.Print b
Dim l2, b6, c1, n, a0, a4, a6, a3, a5, x1, y1 As Variant
l2 = (l1 - Val(Text4.Text) * 3600) / 206264.806247096
b6 = b / 206264.806247096
c1 = Cos(b6) * Cos(b6)
n = 6399596.652 - (21565.045 - (108.996 - 0.603 * c1) * c1) * c1
a0 = 32144.5189 - (135.3646 - (0.7034 - 0.0041 * c1) * c1) * c1
a4 = (0.25 + 0.00253 * c1) * c1 - 0.04167
a6 = (0.167 * c1 - 0.083) * c1
a3 = (0.3333333 + 0.001123 * c1) * c1 - 0.1666667
a5 = 0.00878 - (0.1702 - 0.20382 * c1) * c1
x1 = 6367452.1328 * b / 206264.806247096 - (a0 - (0.5 + (a4 + a6 * l2 * l2) * l2 * l2) * l2 * l2 * n) * Cos(b6) * Sin(b6)
y1 = (1 + (a3 + a5 * l2 * l2) * l2 * l2) * l2 * n * Cos(b6)
Debug.Print x
Debug.Print y
Text5.Text = x1
Text6.Text = y1
End Sub
Private Sub Command3_Click()
Dim x, y, L0, b1, c, bf, bf2, bf1, nf, z, b2, b3, b4, b5, b, L, l1 As Variant
'可氏
x = Val(Text1.Text)
y = Val(Text2.Text)
L0 = Val(Text3.Text)
b1 = (x / 6367558.4969)
c = Cos(b1) * Cos(b1)
bf = b1 * 206264.806247096 + (50221746 + (293622 + (2350 + 22 * c) * c) * c) * Sin(b1) * Cos(b1) / 10 ^ (10)
bf1 = bf / 206264.806247096
bf2 = Cos(bf1) * Cos(bf1)
nf = 6399698.902 - (21562.267 - (108.973 - 0.612 * bf2) * bf2) * bf2
z = y / (nf * Cos(bf1))
b2 = (0.5 + 0.003369 * bf2) * Sin(bf1) * Cos(bf1)
b3 = 0.333333 - (0.166667 - 0.001123 * bf2) * bf2
b4 = 0.25 + (0.161612 + 0.00562 * bf2) * bf2
b5 = 0.2 - (0.1667 - 0.0088 * bf2) * bf2
b = bf - (1 - (b4 - 0.12 * z * z) * z * z) * z * z * b2 * 206264.806247096
L = (1 - (b3 - b5 * z * z) * z * z) * z * 206264.806247096
l1 = L0 * 3600 + L
Debug.Print l1
Debug.Print b
Dim l2, b6, c1, n, a0, a4, a6, a3, a5, x1, y1 As Variant
l2 = (l1 - Val(Text4.Text) * 3600) / 206264.806247096
b6 = b / 206264.806247096
c1 = Cos(b6) * Cos(b6)
n = 6399698.902 - (21562.267 - (108.973 - 0.612 * c1) * c1) * c1
a0 = 32140.404 - (135.3302 - (0.7092 - 0.004 * c1) * c1) * c1
a4 = (0.25 + 0.00252 * c1) * c1 - 0.04166
a6 = (0.166 * c1 - 0.084) * c1
a3 = (0.3333333 + 0.001123 * c1) * c1 - 0.1666667
a5 = 0.0083 - (0.1667 - (0.1968 + 0.004 * c1 * c1) * c1 * c1) * c1 * c1
x1 = 6367558.4969 * b / 206264.806247096 - (a0 - (0.5 + (a4 + a6 * l2 * l2) * l2 * l2) * l2 * l2 * n) * Cos(b6) * Sin(b6)
y1 = (1 + (a3 + a5 * l2 * l2) * l2 * l2) * l2 * n * Cos(b6)
Debug.Print x
Debug.Print y
Text5.Text = x1
Text6.Text = y1
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
Private Sub Command2_Click()
End
End Sub
Q4: GaussDB数据库的url如何写Java连接?
连接代码如下:
public static void main(String[] args){
// 驱动程序名
String driver = "com.mysql.jdbc.Driver";
// URL指向要访问的数据库名scutcs
String url = "jdbc:mysql://127.0.0.1:3306/scutcs";
// MySQL配置时的用户名
String user = "root";
// MySQL配置时的密码
String password = "root";
try {
// 加载驱动程序
Class.forName(driver);
// 连续数据库
Connection conn = DriverManager.getConnection(url, user, password);
if(!conn.isClosed())
System.out.println("Succeeded connecting to the Database!");
// statement用来执行SQL语句
Statement statement = conn.createStatement();
// 要执行的SQL语句
String sql = "select * from student";
// 结果集
ResultSet rs = statement.executeQuery(sql);
System.out.println("-----------------");
System.out.println("执行结果如下所示:");
System.out.println("-----------------");
System.out.println(" 学号" + "\t" + " 姓名");
System.out.println("-----------------");
String name = null;
while(rs.next()) {
// 选择sname这列数据
name = rs.getString("sname");
// 首先使用ISO-8859-1字符集将name解码为字节序列并将结果存储新的字节数组中。
// 然后使用GB2312字符集解码指定的字节数组
name = new String(name.getBytes("ISO-8859-1"),"GB2312");
// 输出结果
System.out.println(rs.getString("sno") + "\t" + name);
}
rs.close();
conn.close();
} catch(ClassNotFoundException e) {
System.out.println("Sorry,can`t find the Driver!");
e.printStackTrace();
} catch(SQLException e) {
e.printStackTrace();
} catch(Exception e) {
e.printStackTrace();
}
关于高斯转换代码java代码和高斯程序的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。







