You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: minandmax.m
    path of file: ./repos/chebfun/@classicfun
    
    the code of the file until where you have to start completion: function [vals, pos] = minandmax(f)
%MINANDMAX   Global minimum and maximum of a CLASSICFUN on [a,b].
%   VALS = MINANDMAX(F) returns a 2-vector, VALS = [MIN(F); MAX(F)], with the
%   global minimum and maximum of the CLASSICFUN F on [a,b].  If F is an array-valued
%   CLASSICFUN then VALS is a 2-by-M matrix, where M is the number of columns of F.
%   VALS(1, K) is the global minimum of the Kth column of F on [a,b], and
%   VALS(2, K) is the global maximum of the same.
%
%   [VALS, POS] = MINANDMAX(F) returns also the 2-vector POS where the minimum
%   and the maximum of F occur.
%
%   If F is complex-valued the absolute values are taken to determine extrema
%   but the output values correspond to those of the original function. That is,
%   VALS = FEVAL(F, POS) where [~, POS] = MINANDMAX(ABS(F)).
%
% See also MIN, MAX.

% Copyright 2017 by The University of Oxford and The Chebfun Developers.

    
function [vals, pos] = minandmax(f)
%MINANDMAX   Global minimum and maximum of a CLASSICFUN on [a,b].
%   VALS = MINANDMAX(F) returns a 2-vector, VALS = [MIN(F); MAX(F)], with the
%   global minimum and maximum of the CLASSICFUN F on [a,b].  If F is an array-valued
%   CLASSICFUN then VALS is a 2-by-M matrix, where M is the number of columns of F.
%   VALS(1, K) is the global minimum of the Kth column of F on [a,b], and
%   VALS(2, K) is the global maximum of the same.
%
%   [VALS, POS] = MINANDMAX(F) returns also the 2-vector POS where the minimum
%   and the maximum of F occur.
%
%   If F is complex-valued the absolute values are taken to determine extrema
%   but the output values correspond to those of the original function. That is,
%   VALS = FEVAL(F, POS) where [~, POS] = MINANDMAX(ABS(F)).
%
% See also MIN, MAX.

% Copyright 2017 by The University of Oxford and The Chebfun Developers.
% See http://www.chebfun.org/ for Chebfun information.

% Call minandmax for the ONEFUN of f:
[vals, onefunPos] = minandmax(f.onefun);

% Map the position results obtained on [-1,1] to [a,b]:
pos = f.mapping.For(onefunPos);

end