السلام عليكم ..
.
.
ابي كود هالبرنامج يعطيك الوسيط والمنوال والمتوسط الحاسبي ل المصفوفه
رجاء خاص
السلام عليكم ..
.
.
ابي كود هالبرنامج يعطيك الوسيط والمنوال والمتوسط الحاسبي ل المصفوفه
رجاء خاص
تم تعديل هذه المشاركة بواسطة فهرنهايت في 5 يناير 2011 في 01:43
أخي الكريم
لوتضع لنا المعادلة العمة لحل هذا اللوغوريثم
حتى يتنى لنا مشاعدتك
أو قم بالتوجه الى قسم <LI class=newposts>الرياضيات والخوارزميات
وهناك إن شاء الله تجد ضالتك
وَعَبْدٌ قَدْ يَنامُ عَلَى حَرِيرٍ ××× وَذُو نَسَبٍ مَفَارِشُهُ التُّرَابُ
هذا ما اعنيه وهذه القوانين
Mean:
-- Also known as the average. The mean is found by adding up all of the given data and
dividing by the number of data entries.
Example:
- the grade 10 math class recently had a mathematics test and the grades were as
follows:
78
66
82 464 / 6 = 77.3
89
75 Hence, 77.3 is the mean average of the class.
+ 74
464
Median:
-- The median is the middle number. First you arrange the numbers in order from lowest
to highest, then you find the middle number by crossing off the numbers until you reach the
middle.
Example:
- use the above data to find the median:
66 74 75 78 82 89\
- as you can see we have two numbers, there is no middle number. What do we do?
It is simple; we take the two middle numbers and find the average, ( or mean ).
75 + 78 = 153
153 / 2 = 76.5
Hence, the middle number is 76.5.
Mode:
-- this is the number that occurs most often.
Example:
- find the mode of the following data:
78 56 68 92 84 76 74 56 68 66 78 72 66
65 53 61 62 78 84 61 90 87 77 62 88 81
The mode is 78.
public static float Median(float[] values)
{
int size = values.Length - 1;
return ((values.Length % 2) == 0 ? (values[size/2 + 1] + values[size/2])/2 : values[size/2]);
} public static float Mean(float[] values)
{
float sum = 0;
foreach (float value in values)
{
sum += value;
}
return sum/(values.Length);
}أعمل حالياً على تابع المنوال.
Do as I say, not as I do
We are Anonymous. We are Legion. We don't forgive. We don't forget
up
public float[] Mode(float[] values)
{
Hashtable ht = new Hashtable();
int count = 0;
ArrayList mode = new ArrayList();
foreach (float value in values)
{
if (!ht.ContainsKey(value))
ht.Add(value, 1);
else
ht[value] = (int)ht[value] + 1;
if ((int)ht[value] > count)
count = (int)ht[value];
}
foreach (DictionaryEntry entry in ht)
{
if ((int)entry.Value == count)
mode.Add(entry.Key);
}
return (float[])mode.ToArray(typeof(float));
}التابع سيعيد مصفوفة بالأرقام الأكثر تكراراً فقد يكون هناك أكثر من رقم بذات عدد مرات التكرار.
بالنسبة للتابع Mean() نستطيع كتابته بالشكل التالي أيضاً:
public static float Mean(float[] values)
{
return (float)values.Average();
}بالتوفيق.
Do as I say, not as I do
We are Anonymous. We are Legion. We don't forgive. We don't forget
المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية
جارٍ التحقق من المتواجدين…