📜  内斯比特的不等式

📅  最后修改于: 2021-04-23 06:08:57             🧑  作者: Mango

Nesbitt不等式是数学中最简单的不等式之一。根据不等式的陈述,对于任何3个给定的实数,它们都满足数学条件,

{a / (b + c)} + {b / (a + c)} + {c / (a + b)} >= 1.5对所有人a>0, b>0, c>0.

说明性示例:

C++
// CPP code to verify Nesbitt's Inequality
#include 
using namespace std;
  
bool isValidNesbitt(double a, double b, double c)
{
    // 3 parts of the inequality sum
    double A = a / (b + c);
    double B = b / (a + c);
    double C = c / (a + b);
    double inequality = A + B + C;
  
   return (inequality >= 1.5);
}
  
int main()
{
    double a = 1.0, b = 2.0, c = 3.0;
    if (isValidNesbitt(a, b, c)) 
        cout << "Nesbitt's inequality satisfied."
             << "for real numbers " << a << ", " 
             << b << ", " << c << "\n";
    else
       cout << "Not satisfied";
    return 0;
}


Java
// Java code to verify Nesbitt's Inequality
class GFG {
      
    static boolean isValidNesbitt(double a,
                          double b, double c)
    {
          
        // 3 parts of the inequality sum
        double A = a / (b + c);
        double B = b / (a + c);
        double C = c / (a + b);
        double inequality = A + B + C;
  
        return (inequality >= 1.5);
    }
  
    // Driver code
    public static void main(String args[])
    {
        double a = 1.0, b = 2.0, c = 3.0;
        if(isValidNesbitt(a, b, c) == true) 
        {
            System.out.print("Nesbitt's inequality"
                                  + " satisfied.");
            System.out.println("for real numbers "
                         + a + ", " + b + ", " + c);
        } 
        else
            System.out.println("Nesbitts inequality"
                                + " not satisfied");
    }
}
  
// This code is contributed by JaideepPyne.


Python3
# Python3 code to verify 
# Nesbitt's Inequality
  
def isValidNesbitt(a, b, c):
      
    # 3 parts of the
    # inequality sum
    A = a / (b + c);
    B = b / (a + c);
    C = c / (a + b);
    inequality = A + B + C;
  
    return (inequality >= 1.5);
  
# Driver Code
a = 1.0; 
b = 2.0;
c = 3.0;
if (isValidNesbitt(a, b, c)):
    print("Nesbitt's inequality satisfied." , 
          " for real numbers ",a,", ",b,", ",c);
else:
    print("Not satisfied");
  
# This code is contributed by mits


C#
// C# code to verify 
// Nesbitt's Inequality
using System;
  
class GFG
{
    static bool isValidNesbitt(double a,
                               double b, 
                               double c)
    {
          
        // 3 parts of the
        // inequality sum
        double A = a / (b + c);
        double B = b / (a + c);
        double C = c / (a + b);
        double inequality = A + B + C;
  
        return (inequality >= 1.5);
    }
  
    // Driver code
    static public void Main ()
    {
    double a = 1.0, b = 2.0, c = 3.0;
    if(isValidNesbitt(a, b, c) == true) 
    {
        Console.Write("Nesbitt's inequality" + 
                               " satisfied ");
        Console.WriteLine("for real numbers " + 
                      a + ", " + b + ", " + c);
    } 
    else
        Console.WriteLine("Nesbitts inequality" +
                               " not satisfied");
    }
}
  
// This code is contributed by ajit


PHP
= 1.5);
}
  
    // Driver Code
    $a = 1.0; 
    $b = 2.0;
    $c = 3.0;
    if (isValidNesbitt($a, $b, $c)) 
        echo"Nesbitt's inequality satisfied.", 
            "for real numbers ", $a, ", ", $b, 
                               ", ", $c, "\n";
    else
    cout <<"Not satisfied";
  
  
// This code is contributed by Ajit.
?>


输出 :
Nesbitt's inequality satisfied.for real numbers 1, 2, 3