تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[مسابقة الخوازمية] - الجولة الاولى
#17
انتهت الجولة الاولى



النتائج توجد هنا









الحل




PHP كود :
       /// <summary>
 
       /// Find Tangent Line Equation of function on specific point
 
       /// </summary>
 
       /// <param name="function">string of cupic function</param>
 
       /// <param name="atPoint">x coordinate of tangent</param>
 
       /// <returns>Equation of Tangent Line</returns>
 
       /// This Algorithm wrote by Mohammed Almubarak (vb4arb)
 
       static string FindTangentLineEquation(string function, int atPoint)
 
       {
 
           string output;



 
           #region Input Processing


 
           //function string processing (get terms)
 
           string equation = function.Split('=')[1];
 
           string[] terms Regex.Split(equation, @"(?=[+-])");

 
           //remove any space
 
           for (int i 0terms.Lengthi++)
 
               terms[i] = terms[i].Replace(" """);

 
           
            
#endregion

 
           #region Algorithm Processing

 
           //Algorithm processing ( 1-Find Slope, 2-Find Y )

 
           double slope 0;
 
           double y 0;


 
           /*
             * 1-Find Slope
            */

 
           foreach (string term in terms)
 
           {
 
               if (term.Trim() != string.Empty)
 
               {
 
                   //if term has power
 
                   if (term.IndexOf('^') > -1)
 
                   {
 
                       double powercoefficient;
 
                       power double.Parse(term.Split('^')[1].Trim());
 
                       coefficient double.Parse(term.Split('x')[0].Trim());
 
                       //find derivative of term and plug in
 
                       slope += (coefficient power) * Math.Pow(atPoint, (power 1));
 
                   }
 
                   else if (term.IndexOf('x') > -1)
 
                   {
 
                       //find derivative of term and plug in
 
                       double coefficient double.Parse(term.Split('x')[0].Trim());
 
                       slope += coefficient;
 
                   }
 
               }
 
           }
 
           /*
             * 2-Find Y
            */

 
           foreach (string term in terms)
 
           {
 
               if (term.Trim() != string.Empty)
 
               {
 
                   //if term has power
 
                   if (term.IndexOf('^') > -1)
 
                   {
 
                       double powercoefficient;
 
                       power double.Parse(term.Split('^')[1].Trim());
 
                       coefficient double.Parse(term.Split('x')[0].Trim());
 
                       //find derivative of segment and plug in
 
                       y += (coefficient) * Math.Pow(atPointpower);
 
                   }
 
                   else if (term.IndexOf('x') > -1)
 
                   {
 
                       //find derivative of term and plug in
 
                       double coefficient double.Parse(term.Split('x')[0].Trim());
 
                       y += coefficient atPoint;
 
                   }
 
                   else
                    
{
 
                       double constantNumber double.Parse(term);
 
                       y += constantNumber;
 
                   }
 
               }
 
           }


 
           #endregion

 
           #region Output
 
           //output


 
           /*
             * Plug in Equation (y = mx + c)  
            */

 
           double c = (slope * -atPoint) + (y);
 
           output "y = " slope "x " c.ToString("+ #;- #;0");

 
           #endregion



 
           return output;
 
       









طبعا خط المماس هو الخط الذي يمس منحنى الدالة عن نقطة معينة :-





برمجيا: كيف استفاد المبرمجين من خط المماس ومعادلاته ؟

استفاد منه المبرمجين في صنع مايسمى بالbezier curve وهذه الميزة موجودة في جميع برامج الرسم بدأ بالphotoshop والillustrator وانتهاء ببرامج التصميم الثلاثية الابعاد :








----------------

في النهاية ، طريقة الحل موجودة في هذه الصفحة :-

http://www.wikihow.com/Find-the-Equation-of-a-Tangent-Line
الرد }}}
تم الشكر بواسطة: abulayth


الردود في هذا الموضوع
RE: [مسابقة الخوازمية] - الموضوع الاول - بواسطة الشاكي لله - 09-10-15, 11:03 PM

المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  [مسابقة الخوارزمية 3] - شروط المسابقة الشاكي لله 24 42,840 25-12-18, 01:01 AM
آخر رد: hicham716
  [مسابقة الخوارزمية 3] - النتائج النهائية للمسابقة abulayth 6 8,279 28-01-17, 12:09 AM
آخر رد: السندبااد
  [مسابقة الخوارزمية 3] - الجولة الخامسة والاخيرة abulayth 18 14,198 26-01-17, 10:20 PM
آخر رد: Fantastico
  [مسابقة الخوارزمية 3] - الجولة الرابعة abulayth 57 44,998 25-01-17, 06:45 PM
آخر رد: abulayth
  [مسابقة الخوارزمية 3] - المواعيد الشاكي لله 16 14,028 16-01-17, 04:13 PM
آخر رد: allobaed
  [اقتراح] [مسابقة الخوارزمية 3] - اقتراح واستغتاء اسلام الكبابى 12 11,309 13-01-17, 11:35 PM
آخر رد: اسلام الكبابى
  [مسابقة الخوارزمية 3] - الجولة الثالثة الشاكي لله 75 43,810 08-01-17, 09:18 PM
آخر رد: samira20
  [مسابقة الخوارزمية 3] - الجولة الثانية abulayth 26 23,494 29-12-16, 11:44 PM
آخر رد: اسلام الكبابى
  [مسابقة الخوارزمية 3] - الجولة الاولى الشاكي لله 46 31,541 22-12-16, 09:13 PM
آخر رد: الشاكي لله
  مسابقة الخوارزمية 3 abulayth 21 18,532 17-12-16, 08:08 PM
آخر رد: الشاكي لله

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم