_覓 | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁 |
FrontPage › T-SQL襦譴蠏覿襷り鍵
|
|
[edit]
1 螳螻 #豌 '蠏碁 襷れ 覲手?'朱 螳朱 襷り鍵襯 . 螻旧 襷蟇 螳 螳螻. float企 蠏碁一 螳 譬 伎. 蠏碁 碁. 轟 譯 襷 譴蠏覿襯 覲企 3.0 蟆曙 0.4987 碁, るゼ ろ覃 0.500623螳 . <;; 覘.. 伎姶 襯企 伎 豢 願 讌 蟾?
[edit]
2 譴蠏覿 襷 #DECLARE @x float -- 覲 , @mu float -- 蠏 , @sigma float -- 譴ク谿 SET @x = 0.35 SET @mu = 0 SET @sigma = 1; --SELECT (1/(SQRT(2*PI())*@sigma)) * EXP(-(1/(2*POWER(@sigma,2))) * POWER((@x-@mu), 2)) WITH Dumy(x) AS ( SELECT convert(float, 0) x UNION ALL SELECT x + 0.01 FROM Dumy WHERE x + 0.01 < 3.09 ) /* SELECT ROUND(A.x, 2) x , B.Pr Pr FROM Dumy A CROSS APPLY ( SELECT --蠍郁 譟磯 覦 覿 覿覿企. SUM((1/(SQRT(2*PI())*@sigma)) * EXP(-(1/(2*POWER(@sigma,2))) * POWER((x-@mu), 2))) / 100 Pr FROM Dumy B WHERE x < A.x ) B WHERE ROUND(A.x, 2) = @x OPTION (MAXRECURSION 0); */ SELECT LEFT(x, 3) z , MIN(CASE WHEN RIGHT(x, 1) = 0 THEN Pr END) [0.00] , MIN(CASE WHEN RIGHT(x, 1) = 1 THEN Pr END) [0.01] , MIN(CASE WHEN RIGHT(x, 1) = 2 THEN Pr END) [0.02] , MIN(CASE WHEN RIGHT(x, 1) = 3 THEN Pr END) [0.03] , MIN(CASE WHEN RIGHT(x, 1) = 4 THEN Pr END) [0.04] , MIN(CASE WHEN RIGHT(x, 1) = 5 THEN Pr END) [0.05] , MIN(CASE WHEN RIGHT(x, 1) = 6 THEN Pr END) [0.06] , MIN(CASE WHEN RIGHT(x, 1) = 7 THEN Pr END) [0.07] , MIN(CASE WHEN RIGHT(x, 1) = 8 THEN Pr END) [0.08] , MIN(CASE WHEN RIGHT(x, 1) = 9 THEN Pr END) [0.09] FROM ( SELECT CONVERT(char(4), CONVERT(numeric(36, 2), A.x)) x , CONVERT(numeric(36, 6), ISNULL(B.Pr, 0)) Pr FROM Dumy A CROSS APPLY ( SELECT SUM((1/(SQRT(2*PI())*@sigma)) * EXP(-(1/(2*POWER(@sigma,2))) * POWER((x-@mu), 2))) / 100 Pr FROM Dumy B WHERE x < A.x ) B ) T GROUP BY LEFT(x, 3) ORDER BY LEFT(x, 3) OPTION (MAXRECURSION 0);
鏤
|
襷 襦蟆 螳讌. 蠏碁覃 蠏碁 襦讌 蟆企. |