📜  由具有坐标轴的椭圆的任何切线形成的三角形的最小面积

📅  最后修改于: 2021-04-17 14:56:36             🧑  作者: Mango

给定两个整数AB ,分别表示方程(x 2 / A 2 )+(y 2 / B 2 )= 1的椭圆的半长轴和半短轴的长度任务是找到坐标轴与椭圆的任何切线所形成的三角形的最小面积。

例子:

方法:

该想法基于以下观察结果:上图中椭圆上的坐标(A *cosθ,B *sinθ)处的切线方程为:

PQ的坐标分别为(A /cosθ,0)(0,B /sinθ)
由椭圆的切线和坐标轴形成的三角形的面积由下式给出:

为了使面积最小, sin2θ的值应为最大可能值,即1。
因此,最小可能面积为A * B。

下面是上述方法的实现:

C++
// C++ program for the above approach
#include 
using namespace std;
 
// Function to find the minimum area
// of triangle formed by any tangent
// to ellipse with the coordinate axes
void minimumTriangleArea(int a, int b)
{
    // Stores the minimum area
    int area = a * b;
 
    // Print the calculated area
    cout << area;
}
 
// Driver Code
int main()
{
    int a = 1, b = 2;
    minimumTriangleArea(a, b);
 
    return 0;
}


Java
// Java program for the above approach
class GFG{
 
// Function to find the minimum area
// of triangle formed by any tangent
// to ellipse with the coordinate axes
static void minimumTriangleArea(int a, int b)
{
     
    // Stores the minimum area
    int area = a * b;
 
    // Print the calculated area
    System.out.println(area);
}
 
// Driver Code
public static void main(String[] args)
{
    int a = 1, b = 2;
     
    minimumTriangleArea(a, b);
}
}
 
// This code is contributed by AnkThon


Python3
# Python3 program for the above approach
 
# Function to find the minimum area
# of triangle formed by any tangent
# to ellipse with the coordinate axes
def minimumTriangleArea(a, b):
     
    # Stores the minimum area
    area = a * b
 
    # Print the calculated area
    print(area)
 
# Driver Code
a = 1
b = 2
 
minimumTriangleArea(a, b)
 
# This code is contributed by rohitsingh07052


C#
// C# program for the above approach
using System;
 
class GFG{
     
// Function to find the minimum area
// of triangle formed by any tangent
// to ellipse with the coordinate axes
static void minimumTriangleArea(int a, int b)
{
     
    // Stores the minimum area
    int area = a * b;
 
    // Print the calculated area
    Console.WriteLine(area);
}
 
// Driver Code
public static void Main()
{
    int a = 1, b = 2;
     
    minimumTriangleArea(a, b);
}
}
 
// This code is contributed by ukasp


Javascript
// JavaScript program for the above approach
 
// Function to find the minimum area
// of triangle formed by any tangent
// to ellipse with the coordinate axes
function minimumTriangleArea(a, b)
{
     
    // Stores the minimum area
    var area = a * b
 
    // Print the calculated area
   console.log(area)
     
}
 
// Driver Code
var a = 1
var b = 2
 
minimumTriangleArea(a, b)
 
// This code is contributed by AnkThon


输出
2

时间复杂度: O(1)
辅助空间: O(1)