当前位置: 首页>>代码示例>>C#>>正文


C# BigNumber.Power方法代码示例

本文整理汇总了C#中BigNumber.Power方法的典型用法代码示例。如果您正苦于以下问题:C# BigNumber.Power方法的具体用法?C# BigNumber.Power怎么用?C# BigNumber.Power使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BigNumber的用法示例。


在下文中一共展示了BigNumber.Power方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Exp

        /// <summary>e次幂</summary>
        public static BigNumber Exp(BigNumber value, int precision) {
            BigNumber sum = new BigNumber("0");

            for (BigNumber n = new BigNumber("0"); ; n++) {
                BigNumber r = BigNumber.Division(value.Power(n), n.Factorial(), precision + 1);

                if (r.GetPrecision(0) > precision)
                    break;
                sum = sum + r;
            }
            Remove(sum, precision);
            return sum;
        }
开发者ID:JoshuaHe2015,项目名称:VISAP2.0_GUI,代码行数:14,代码来源:TaylorFunction.cs

示例2: round

        static string round(string number, int digits)
        {
            int NumOriginLen = number.Length;
            char[] digit_dot = { '.' };
            string[] NumberBroken;
            NumberBroken = number.Split(digit_dot);
            if (digits < 0)
            {
                digits = 0;
            }
            if (NumberBroken[0].Length == NumOriginLen)
            {
                return NumberBroken[0] + ".".PadRight(digits + 1, '0');
            }
            else
            {
                string decimal_part = " ";
                BigNumber zero_point_one = new BigNumber("0.1");
                BigNumber one = new BigNumber("1");
                if (NumberBroken[1].Length > digits)
                {
                    if (Convert.ToInt32(NumberBroken[1].Substring(digits, 1)) > 4)
                    {
                        BigNumber carry = new BigNumber(digits.ToString());
                        carry = zero_point_one.Power(carry, 200);
                        BigNumber number_changed = new BigNumber(number);
                        number_changed = number_changed + carry;
                        return number_changed.ToString().Substring(0, NumOriginLen - (NumberBroken[1].Length - digits));
                    }
                    else
                    {
                        decimal_part = NumberBroken[1].Substring(0, digits);
                    }

                }
                else
                {
                    decimal_part = NumberBroken[1].PadRight(digits, '0');
                }
                return NumberBroken[0] + '.' + decimal_part;
            }
        }
开发者ID:JoshuaHe2015,项目名称:VISAP_Basic,代码行数:42,代码来源:MeanAndSort.cs

示例3: CI1

 //CI = Confidence Interval
 //置信区间的计算,返回string
 //CI1为单样本估计
 //len 为样本数
 //Tail = "less"为左单尾检验,Tail = "greater"为右单尾。Tail = "two" 为双尾检验
 //对于无需使用的值赋为-1即可,比如均值估计时无需使用比例,则赋值为-1。
 //type = "Mean.Esti"为均值估计
 //type = "Proportion.Esti"为比例估计
 //返回为字符串,如: 3.5,7.6  以逗号分隔
 //如果没有输入正确的type则返回NA
 public static string CI1(BigNumber Mean, BigNumber Variance, BigNumber Proportion,BigNumber len, double Significance, string Tail, string type)
 {
     Tail = Tail.ToLower();
     if (type == "Mean.Esti")
     {
         //均值估计
         BigNumber std = Variance.Power(new BigNumber("0.5"), 30);
         if (Tail == "two") { 
         Significance = Significance / 2;
         BigNumber lower = Mean - new BigNumber(NORMSINV(Significance).ToString()) * std / len.Power(new BigNumber("0.5"), 30);
         BigNumber upper = Mean + new BigNumber(NORMSINV(Significance).ToString()) * std / len.Power(new BigNumber("0.5"), 30);
         return lower.ToString()+ ","+upper.ToString();
         }
         else
         {
             if (Tail == "greater") //H0:mu>0
             {
                 Significance = Significance / 1;
                 BigNumber lower = Mean - new BigNumber(NORMSINV(Significance).ToString()) * std / len.Power(new BigNumber("0.5"), 30);
                 return lower.ToString() + ",";
             }
             else
             {
                 if (Tail == "less") //H0:mu>0
                 {
                     Significance = Significance / 1;
                     BigNumber upper = Mean + new BigNumber(NORMSINV(Significance).ToString()) * std / len.Power(new BigNumber("0.5"), 30);
                     return "," + upper.ToString();
                 }
                 else
                 {
                     return "NA";
                 }
             }
             
         }
         
       }
    
     else if (type == "Proportion.Esti")
     {
         BigNumber std = Variance.Power(new BigNumber("0.5"), 30);
         if (Tail == "two")
         {
             Significance = Significance / 2;
             BigNumber lower = Proportion - new BigNumber(NORMSINV(Significance).ToString()) * ((Proportion * (new BigNumber("1") - Proportion)) / (new BigNumber(len.ToString()))).Power(new BigNumber("0.5"));
             BigNumber upper = Proportion + new BigNumber(NORMSINV(Significance).ToString()) * (Proportion * (new BigNumber("1") - Proportion) / (new BigNumber(len.ToString()))).Power(new BigNumber("0.5"));
             return lower.ToString() + "," + upper.ToString();
         }
         else
         {
             if (Tail == "greater") //H0:mu>0
             {
                 Significance = Significance / 1;
                 BigNumber lower = Proportion - new BigNumber(NORMSINV(Significance).ToString()) * ((Proportion * (new BigNumber("1") - Proportion)) / (new BigNumber(len.ToString()))).Power(new BigNumber("0.5"));
                 return lower.ToString() + ",";
             }
             else
             {
                 if (Tail == "less") //H0:mu>0
                 {
                     Significance = Significance / 1;
                     BigNumber upper = Proportion + new BigNumber(NORMSINV(Significance).ToString()) * ((Proportion * (new BigNumber("1") - Proportion)) / (new BigNumber(len.ToString()))).Power(new BigNumber("0.5"));
                     return "," + upper.ToString();
                 }
                 else
                 {
                     return "NA";
                 }
             }
             
         }
         
     }
     else
     {
         return "NA";
     }
 }
开发者ID:Yangruipis,项目名称:Genesis,代码行数:89,代码来源:MatCorr.cs

示例4: ParaEasti

        static string ParaEasti(BigNumber[] NumberSeries, double significance, int tail)
        {
            //单样本总体均值的区间估计
            //tail == 1右单尾,H0:x>= x_0,tail == -1 左单尾H0:x<= x_0,,为2则双尾
            BigNumber mean_series = Mean(NumberSeries);
            BigNumber var_series = Variance(NumberSeries);
            BigNumber sd_series = var_series.Power(new BigNumber("0.5"), 30);
            BigNumber n = new BigNumber(NumberSeries.Length.ToString());
            if (tail == 2)
            {
                significance = significance / 2;
                BigNumber lower = mean_series - new BigNumber(NORMSINV(significance).ToString()) * sd_series /n.Power(new BigNumber("-0.5"), 30);
                BigNumber upper = mean_series + new BigNumber(NORMSINV(significance).ToString()) * sd_series / n.Power(new BigNumber("-0.5"), 30);
                return   lower.ToString() + "," + upper.ToString()  ;
            }
            else
            {
                significance = significance / 1;
                BigNumber lower = mean_series - new BigNumber(NORMSINV(significance).ToString()) * sd_series /( n.Power(new BigNumber("-0.5"), 30));
                if (tail == 1)
                {
                    return lower.ToString() + ",";
                }
                else
                {
                    BigNumber upper = mean_series + new BigNumber(NORMSINV(significance).ToString()) * sd_series / (n.Power(new BigNumber("-0.5"), 30));
                    return "," + upper.ToString();
                }
            }
            
            
            

        }
开发者ID:Yangruipis,项目名称:Genesis,代码行数:34,代码来源:proportion+two+sample+(2).cs

示例5: ParaEasti

 static string ParaEasti(BigNumber[] NumberSeries, double significance,int tail)
 {
     //总体均值的区间估计
     //tail == 1单尾,为2则双尾
     if (tail == 2){
         significance = significance / 2;
     }
     BigNumber mean_series = Mean(NumberSeries);
     BigNumber var_series = Variance(NumberSeries);
     BigNumber sd_series = var_series.Power(new BigNumber("0.5"), 30);
     BigNumber n = new BigNumber(NumberSeries.Length.ToString());
     BigNumber lower = mean_series - new BigNumber(NORMSINV(significance).ToString()) * sd_series * n.Power(new BigNumber("-0.5"), 30);
     BigNumber upper = mean_series + new BigNumber(NORMSINV(significance).ToString()) * sd_series * n.Power(new BigNumber("-0.5"), 30);
     return lower.ToString() + "," + upper.ToString();
     
 }
开发者ID:JoshuaHe2015,项目名称:VISAP_Basic,代码行数:16,代码来源:HypothesisTesting.cs

示例6: HT1

        static string HT1(BigNumber H0, BigNumber len ,BigNumber mean ,BigNumber variance,BigNumber proportion, double significance, int tail)
        {
            BigNumber sd_series = variance.Power(new BigNumber("0.5"), 30);
            if ( CompareNumber.Compare(proportion,new BigNumber("0")) == 0 )
            {
            BigNumber tvalue = (H0-mean)/((variance/len).Power(new BigNumber("0.5"),10));
            Double t_value = Convert.ToDouble(tvalue.ToString());
            BigNumber pvalue = new BigNumber(NORMSDIST(t_value).ToString());

            if(tail == 2){
    
                significance = significance / 2;
                BigNumber lower = mean - new BigNumber(NORMSINV(significance).ToString()) * sd_series / len.Power(new BigNumber("-0.5"), 30);
                BigNumber upper = mean + new BigNumber(NORMSINV(significance).ToString()) * sd_series / len.Power(new BigNumber("-0.5"), 30);
                return "["+ lower.ToString() + "," +upper.ToString() +"]";
                if (CompareNumber.Compare(lower, H0) == -1 && CompareNumber.Compare(upper, H0) == 1)
                {
                    return "t ="+ tvalue.ToString() +",P = " + pvalue.ToString() + "," + "不拒绝原假设";
                }
                else
                {
                    return "t =" + tvalue.ToString() + ",P = " + pvalue.ToString() + "," + "拒绝原假设";
                }
            }
            else
            {
                significance = significance / 1;
                BigNumber lower = mean - new BigNumber(NORMSINV(significance).ToString()) * sd_series / (len.Power(new BigNumber("-0.5"), 30));
                if (tail == 1)
                {
                    return "["+ lower.ToString() + ",]";
                    if (CompareNumber.Compare(lower, H0) == -1)
                    {
                        return "t =" + tvalue.ToString() + ",P = " + (new BigNumber("2") * pvalue - new BigNumber("1")).ToString() + "," + "不拒绝原假设";
                    }
                    else
                        if(tail == -1)
                    {
                        return "t =" + tvalue.ToString() + ",P = " + (new BigNumber("2") * pvalue - new BigNumber("1")).ToString() + "," + "拒绝原假设";
                    }
                        else{
                            return "请输入正确的值";
                        }
                }
                else
                {
                    BigNumber upper = mean + new BigNumber(NORMSINV(significance).ToString()) * sd_series / (len.Power(new BigNumber("-0.5"), 30));
                    return "[," + upper.ToString()+ "]";
                    if (CompareNumber.Compare(upper, H0) == 1)
                    {
                        return "t =" + tvalue.ToString() + ",P = " + (new BigNumber("2") * pvalue - new BigNumber("1")).ToString() + "," + "不拒绝原假设";
                    }
                    else
                    {
                        return "t =" + tvalue.ToString() + ",P = " + (new BigNumber("2") * pvalue - new BigNumber("1")).ToString() + "," + "拒绝原假设";
                    }
                }
            }
            }   
            else{
                BigNumber tvalue = (proportion - H0) / ((H0 * (new BigNumber("1") - H0) / len).Power(new BigNumber("0.5"), 10));
                Double t_value = Convert.ToDouble(tvalue.ToString());
                BigNumber pvalue = new BigNumber(NORMSDIST(t_value).ToString());
            if (tail == 2)
                {
                    significance = significance / 2;
                    BigNumber lower = proportion - new BigNumber(NORMSINV(significance).ToString()) * ((proportion * (new BigNumber("1") - proportion)) / (new BigNumber(len.ToString()))).Power(new BigNumber("0.5"));
                    BigNumber upper = proportion + new BigNumber(NORMSINV(significance).ToString()) * (proportion * (new BigNumber("1") - proportion) / (new BigNumber(len.ToString()))).Power(new BigNumber("0.5"));
                    return "["+lower.ToString() + "," + upper.ToString()+"]";
                    if (CompareNumber.Compare(lower, H0) == -1 && CompareNumber.Compare(upper, H0) == 1)
                    {
                        return "t =" + tvalue.ToString() + ",P = " + pvalue.ToString() + "," + "不拒绝原假设";
                    }
                    else
                    {
                        return "t =" + tvalue.ToString() + ",P = " + pvalue.ToString() + "," + "拒绝原假设";
                    }
                }
                else
                {
                    significance = significance / 1;
                    if (tail == 1)
                    {

                        BigNumber lower = proportion - new BigNumber(NORMSINV(significance).ToString()) * (proportion * (new BigNumber("1") - proportion) / (new BigNumber(len.ToString())).Power(new BigNumber("0.5")));
                        return "["+lower.ToString() + ",]";
                        if (CompareNumber.Compare(lower, H0) == -1)
                        {
                            return "t =" + tvalue.ToString() + ",P = " + (new BigNumber("2") * pvalue - new BigNumber("1")).ToString() + "," + "不拒绝原假设";
                        }
                        else
                        {
                            return "t =" + tvalue.ToString() + ",P = " + (new BigNumber("2") * pvalue - new BigNumber("1")).ToString() + "," + "拒绝原假设";
                        }
                    }
                    else{
                        if(tail == -1)
                       {
                        BigNumber upper = proportion + new BigNumber(NORMSINV(significance).ToString()) * (proportion * (new BigNumber("1") - proportion) / (new BigNumber(len.ToString())).Power(new BigNumber("0.5")));
                        return "["+"," + upper.ToString()+ "]";
//.........这里部分代码省略.........
开发者ID:Yangruipis,项目名称:Genesis,代码行数:101,代码来源:假设检验2.cs


注:本文中的BigNumber.Power方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。