27-04-2013, 10:46 PM
|
#5
|
تاريخ التسجيل: Jul 2012
نوع الدراسة: إنتظام
المستوى: الثالث
الجنس: ذكر
المشاركات: 52
|
رد: برمجة الإحصاء ولغة c++
بصراحة ما فهمت السؤال الرابع لكن بحثت في اليوتيوب ووجدت شرح لل binomial dist فكتبت الكود بناءً عليه
هذا الشرح
كود:
كود:
This program is to calculate Binomial distribution with
parameters n,p ..were n = Number of tries and p = number of success
n = 5
p = 3
5
C = 10
3
The Result is : 0.000893061
.
وهذا الكود عدلي عليه بما يناسبك
كود PHP:
#include<iostream> #include<math.h> using namespace std;
//-----------------------[ Start Factorial ]--------------- double Factorial(double N) // Function of (Number)! { double F; F = 1; for( ; N > 0 ; ) { F = F * N ; N = N - 1 ; } return F; } //-----------------------[ End Factorial ]-----------------
//-----------------------[ Start Combination ]---------- long Formula(double n , double r,double NR) // Function of Formula { float Solve = 0; Solve = Factorial(n) / ( Factorial(r) * Factorial(NR)); return (long)Solve; } //-----------------------[ End Combination ]-----------
int main() { cout << "\n\tThis program is to calculate Binomial distribution with \n\tparameters n,p ..were n = Number of tries and p = number of success"; double x,n,p,combination,Result; cout << "\n\tn = "; cin >> n; cout << "\tp = "; cin >> p; x = n - p; combination = Formula(n,p,x); cout << "\n " << n << "\n C = " << combination << "\n " << p ; Result = combination * pow((double)1/6,n) * pow((double)5/6,x) ; cout << "\n\t\t The Result is : " << Result; return 0 ;}
أما السؤال الخامس .. شوفي هذا الكود الجاهز إن شاء الله يفيدك
http://www.softwareandfinance.com/CP...ceStdDevi.html
|
|
هذا مكـانـي وانت هـذا مـكانـك = والحيـره اللي تـجمـع اثنين علّـه
غـلطة زماني وانت غلطة زمانـك = مثـلي تــحمّـل ما تـحملت شلّـه
صبرك حبيبي جاير الوقت هانـك = من لا تـزهّـل لك تـجـنّب وخـلّـه
مـن لا يـهمــه عـزّك وعـزّ شـانك = قل لـه عـلى وعد السلاطين قل له
وإن كان ظنك فيه كذاب وخـانـك = مـا ضـرّنا فـي أول الـعـمــر زلّـه
البعض أقـرب لك من أول بنانك = كـم مـن يميـنٍ خانها الكف كـلّـه
|
التعديل الأخير تم بواسطة خزان الأحزان ; 27-04-2013 الساعة 10:49 PM.
|
|
|