Position of minimum and maximum of value in R Programming

Position of Minimum and Maximum of value in R Programming Language 

Top online courses in Programming Languages

 

Maxima and minima refer to the highest and lowest values of a function, respectively. In mathematical terms, maxima are points where a function reaches its highest value, while minima are points where it attains its lowest value. These critical points are crucial in optimization problems, where finding the maximum or minimum is essential.

To identify maxima and minima, calculus plays a pivotal role. In calculus, critical points are found by setting the derivative of a function equal to zero. The second derivative test helps determine whether a critical point is a minimum, maximum, or neither.

Determines the location, i.e., index of the (first) minimum or maximum of a numeric vector.

Usage
which.min(x)
which.max(x)

x <- c( 1, 4, 3, 9, 6, 7) 
which.max(x)

Output:

$Rscript main.r
[1] 4 # position

{Or}

Position particular number(another way)
x [which.max(x)]

Output:

[1] 9

For Minimum Value:

x <- c( 1, 4, 3, 9, 6, 7) 
which.min(x)

output:

$Rscript main.r
[1] 1

Position particular number

x [which.min(x)]

Output:

[1] 1

Range: A function called range() is also available which returns the minimum and maximum in a two element vector.

Range(x) [1 ] 1 9

Conclusion :

Maxima and minima are fundamental concepts in mathematics, providing insights into the optimal points of functions and sets of values. Their applications are widespread, from determining the maximum profit in economics to finding the path of least resistance in physics.

The process of identifying maxima and minima involves calculus techniques and critical point analysis, enabling us to solve real-world problems by optimizing functions. In conclusion, maxima and minima are powerful tools that contribute significantly to the understanding and application of mathematics across various disciplines.

Scroll to Top