_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › 蠏覿襦襯蟲蠍

Contents

1 蠏 85願, 譴ク谿螳 5 蠏覿, 5%企伎 蟆所螳?
2 蟲伎 螻朱 譴 企 螻朱 煙 一螳?


1 蠏 85願, 譴ク谿螳 5 蠏覿, 5%企伎 蟆所螳? #

DECLARE 
	@mu float	-- 蠏
,	@sigma float	-- 譴ク谿
,	@min float	-- 豕螳
,	@max float	-- 豕螳
,	@munit float	-- (煙 蟆曙 豕 1企.)
,	@target_rate float

SET @mu = 85;
SET @sigma = 5;
SET @min = 0;
SET @max = 100;
SET @munit = 1
SET @target_rate = 5;

--SELECT (1/(SQRT(2*PI())*@sigma)) * EXP(-(1/(2*POWER(@sigma,2))) * POWER((@x-@mu), 2)) 襯覦

WITH Dumy(x)
AS
(
        SELECT @min x
        UNION ALL
        SELECT x + @munit FROM Dumy
        WHERE x + @munit <= @max
)
--蠏覿 朱 谿場覲伎..
SELECT
	MAX(CASE WHEN Val <= (100 - @target_rate) * 0.01 THEN x END) MinVal
,	MIN(CASE WHEN Val >= (100 - @target_rate) * 0.01 THEN x END) MaxVal
FROM (
	SELECT 
		B.x
	,	SUM((1/(SQRT(2*PI())*@sigma)) * EXP(-(1/(2*POWER(@sigma,2))) * POWER((A.x-@mu), 2))) Val
	FROM Dumy A INNER JOIN Dumy B
	ON A.x <= B.x
	GROUP BY B.x
) T
OPTION (MAXRECURSION 0);


/* 蟆郁骸

MinVal	MaxVal
92	93

--92~93  襷朱 . 
*/

2 蟲伎 螻朱 譴 企 螻朱 煙 一螳? #

/*
襴

豌 襯 90 覦螻, 螻朱 豌 蠏 85企.
譴ク谿 5企. 蟲企 85 覦朱, 蟲願骸覈 豌 蠏 70企. 
蟲願骸覈 譴ク谿 10企. 企 螻朱 煙  一螳? 
*/
WITH Dumy(x)
AS
(
        SELECT 0 x
        UNION ALL
        SELECT x + 1 FROM Dumy
        WHERE x + 1 <= 100.0
)
SELECT 
	螻朱
,	(1 - SUM((1/(SQRT(2*PI())*譴ク谿)) * EXP(-(1/(2*POWER(譴ク谿,2))) * POWER((x-蠏), 2)))) * 100 [%]
FROM (
	SELECT '' 螻朱, 90.0 , 85.0 蠏, 5.0 譴ク谿
	UNION ALL
	SELECT '蟲' 螻朱, 85.0 , 70.0 蠏, 10.0 譴ク谿) A CROSS JOIN Dumy
WHERE x <= 
GROUP BY 螻朱
OPTION (MAXRECURSION 0);

/*
蟆郁骸

螻朱	%
------- ----------------
蟲	6.04932387024276
	13.5265829069615


蟲企  6.04% 願,  13.52%企襦 蟲伎 煙  一.
*/


/*
DECLARE 
	@x float	-- 覲
,	@mu float	-- 蠏
,	@sigma float	-- 譴ク谿

SET @x = 90
SET @mu = 85
SET @sigma = 5;

--SELECT (1/(SQRT(2*PI())*@sigma)) * EXP(-(1/(2*POWER(@sigma,2))) * POWER((@x-@mu), 2)) 襯覦

WITH Dumy(x)
AS
(
        SELECT 0 x
        UNION ALL
        SELECT x + 1 FROM Dumy
        WHERE x + 1 <= 90.0
)
--蠏覿
SELECT SUM((1/(SQRT(2*PI())*@sigma)) * EXP(-(1/(2*POWER(@sigma,2))) * POWER((x-@mu), 2)))
FROM Dumy
OPTION (MAXRECURSION 0);
*/
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

磯Μ蟆 蟆 るジ 蟆 譴 蟆 訖企. (蠍伎る蠏)