Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Approximate_exp_13112020
//Rextester.Program.Main is the entry point for your code. Don't change it. //Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f2354) using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static double A = 10.76843263; public static double B = 5.45234329; public static double g(double y) { return Math.Log(y);} public static double f(double x) { return A*Math.Exp(-B*x); } public static void Main(string[] args) { //Your code goes here Console.WriteLine("Hello, world!"); // y=0.5843*e^(-0.7892*x) double[] Mx={-10, -9, -8, -7,-6,-5,-4,-3,-2,-1,0,1,2,3}; double[] My={1559.5,708.5,321.9,146.2,66.4,30.2,13.7,6.2,2.8,1.3,0.6,0.3,0.1,0.1}; int N = Mx.Length; for(int i=0;i<N;i++) {My[i]= f(Mx[i]);} double Sx = 0; // сумма аргументоа for (int i = 0; i < N; i++) { Sx += Mx[i]; } double Sx2 = 0; // сумма квадратов аргументов for (int i = 0; i < N; i++) { Sx2 += Mx[i]*Mx[i]; } double Sgx = 0; for (int i = 0; i < N; i++) { Sgx += g(My[i]); } double Sgxx = 0; for (int i = 0; i < N; i++) { Sgxx += g(My[i]) * Mx[i]; } double _a = Math.Exp( (Sgx * Sx2 / Sx - Sgxx)/(N * Sx2 / Sx - Sx) ); double _b = (N*Math.Log(_a) - Sgx)/(Sx); Console.WriteLine(_a); Console.WriteLine(_b); } } }
run
|
edit
|
history
|
help
0
Demo
Wait
30272 Program Ex5 if else
Catch redirect link
Concatenate string with null.
sdfgrthyjuytgr
Test
Half Sum
MidtermsGame_Rampage_12Geronimo
Recomment toTheGit(TestArray)