• Aucun résultat trouvé

Some Elementary Functions

Dans le document Undergraduate Topics in Computer Science (Page 27-35)

Real-Valued Functions

2.2 Some Elementary Functions

Fig. 2.6 Inverse function and

reflection in the diagonal

Experiment 2.8 The term inverse function is clearly illustrated by theMATLABplot command. The graph of the inverse function can easily be plotted by interchanging the variables, which exactly corresponds to flipping the listsyx. For example, the graphs in Fig.2.6are obtained by

x = 0:0.01:1;

y = x.ˆ2;

plot(x,y) hold on plot(y,x)

How the formatting, the dashed diagonal and the labelling are obtained can be learned from the M-filemat02_1.m.

2.2 Some Elementary Functions

The elementary functions are the powers and roots, exponential functions and loga-rithms, trigonometric functions and their inverse functions, as well as all functions which are obtained by combining these. We are going to discuss the most important basic types which have historically proven to be of importance for applications. The trigonometric functions will be dealt with in Chap. 3, the hyperbolic functions in Chap. 14.

Linear Functions (Straight Lines) A linear function R→ R assigns each x-value a fixed multiple asy-value, i.e.,

y=kx.

Here

k=increase in height increase in length =y

x

18 2 Real-Valued Functions

Fig. 2.7 Equation of a straight line

is the slope of the graph, which is a straight line through the origin. The connection between the slope and the angle between the straight line andx-axis is discussed in Sect. 3.1. Adding an interceptd∈Rtranslates the straight linedunits iny-direction (Fig.2.7). The equation is then

y=kx+d.

Quadratic Parabolas The quadratic function with domain D=Rin its basic form is given by

y=x2.

Compression/stretching, horizontal and vertical translation are obtained via y=αx2, y=(xβ)2, y=x2+γ .

The effect of these transformations on the graph can be seen in Fig.2.8.

α >1. . . compression inx-direction 0< α <1. . . stretching inx-direction α <0. . . reflection in thex-axis

β >0. . . translation to the right γ >0. . . translation upwards β <0. . . translation to the left γ <0. . . translation downwards The general quadratic function can be reduced to these cases by completing the square:

y=ax2+bx+c

=a

x+ b 2a

2

+cb2 4a

=α(xβ)2+γ .

2.2 Some Elementary Functions 19

Fig. 2.8 Quadratic parabolas

Power Functions In the case of an integer exponentn∈Nthe following rules apply:

xn=x·x·x· · · · ·x (nfactors), x1=x, x0=1, xn= 1

xn (x=0).

The behaviour of y=x3 can be seen in the picture on the right-hand side of Fig. 2.3, the one of y =x4 in the picture on the left-hand side of Fig. 2.4. The graphs for odd and even powers behave similarly.

Experiment 2.9 On the website ofmaths onlinego to Functions 1 in the gallery area and experiment with the applets Graphs of simple power functions and Cubic polynomials and familiarise yourself with the Function plotter.

As an example of fractional exponents we consider the root functionsy=√n x= x1/n forn∈Nwith domainD= [0,∞). Here y=√n

x is defined as the inverse function of thenth power; see Fig.2.9 left. The graph ofy =x1 with domain D=R\ {0}is pictured in Fig.2.9right.

Absolute Value, Sign and Indicator Function The graph of the absolute value function

y= |x| =

x, x≥0,

x, x <0

has a kink at the point(0,0); see Fig.2.10left.

20 2 Real-Valued Functions

Fig. 2.9 Power functions with fractional and negative exponents

Fig. 2.10 Absolute value and sign

The graph of the sign function or signum function

y=signx=

⎧⎪

⎪⎩

1, x >0, 0, x=0,

−1, x <0

has a jump atx=0 (Fig.2.10right). The indicator function of a subsetA⊂Ris defined as

1A(x)=

1, xA, 0, x /A.

Exponential Functions and Logarithms Integer powers of a numbera >0 have just been defined. Fractional (rational) powers give

a1/n=√n

a, am/n=(n

a)m=√n am.

Ifris an arbitrary real number, thenar is defined by its approximationsam/n, where

m

n is the rational approximation torobtained by decimal expansion.

2.2 Some Elementary Functions 21

Fig. 2.11 Exponential functions

Example 2.10 2π is defined by the sequence

23, 23.1, 23.14, 23.141, 23.1415, . . . , where

23.1=231/10= 10

231; 23.14=2314/100= 100

2314; . . . etc.

This somewhat informal introduction of the exponential function should be suffi-cient to have some examples at hand for applications in the following sections. With the tools we have developed so far we cannot yet show that this process of approx-imation actually leads to a well-defined mathematical object. The success of this process is based on the completeness of the real numbers. This will be thoroughly discussed in Chap. 5.

From the definition above we obtain the following rules of calculation, valid for rational exponents:

aras =ar+s, ars

=ars= asr

, arbr =(ab)r

for a, b >0 and arbitraryr, s∈Q. The fact that these rules are also true for real-valued exponentsr, s∈Rcan be shown by employing a limiting argument.

The graph of the exponential function with basea, the functiony=ax, increases for a >1 and decreases fora <1; see Fig.2.11. Its proper range isB=(0,);

the exponential function is bijective from Rto(0,). Its inverse function is the logarithm to the base a (with domain(0,)and rangeR):

y=axx=logay.

For example, log102 is the power by which 10 needs to be raised to obtain 2:

2=10log102.

22 2 Real-Valued Functions

Other examples are, for instance, 2=log10

102

, log1010=1, log101=0, log100.001= −3.

Euler’s number1e is defined by e=1+1

≈2.718281828459045235360287471. . . .

That this summation of infinitely many numbers can be defined rigorously will be proven in Chap. 5 by invoking the completeness of the real numbers. The logarithm to the base e is called natural logarithm and is denoted by log:

logx=logex.

In some books the natural logarithm is denoted by lnx. We stick to the notation logx, which is used, e.g., inMATLAB. The following rules are obtained directly by rewriting the rules for the exponential function:

u=elogu, log(uv)=logu+logv, log

uz

=zlogu,

foru, v >0 and arbitraryz∈R. In addition, the following holds:

u=log

2.3 Exercises 23 Fig. 2.12 Logarithms to the

base e and to the base 10

witha,b,c,d ∈R? Distinguish the following different cases fora:

a <−1, −1≤a <0, 0< a≤1, a >1, and forb,c,d the cases

b, c, d >0, b, c, d <0.

Sketch the resulting graphs.

2. Let the functionf:D→R:x→3x4−2x3−3x2+1 be given. UsingMATLAB

plot the graphs off for

D= [−1,1.5], D= [−0.5,0.5], D= [0.5,1.5]. Explain the behaviour of the function forD=Rand find

f

[−1,1.5]

, f

(−0.5,0.5)

, f

(−∞,1]

. 3. Which of the following functions are injective/surjective/bijective?

f :N→N: nn2−6n+10;

g:R→R: x→ |x+1| −3;

h:R→R: xx3.

Hint. Illustrative examples for the use of the MATLAB plot command may be found in the M-filemat02_2.m.

4. Check that the following functionsDB are bijective in the given regions and compute the inverse function in each case:

y= −2x+3, D=R, B=R;

y=x2+1, D=(−∞,0], B= [1,∞); y=x2−2x−1, D= [1,∞), B= [−2,∞).

24 2 Real-Valued Functions 5. On the website ofmaths onlinego to Functions 1 in the gallery area and solve the exercises set in the applets Recognize functions 1 and Recognize graphs 1.

Explain your results. Go to Interactive tests, Functions 1 and work on The big function graph puzzle.

6. On the website ofmaths onlinego to Functions 2 in the gallery area and solve the exercises set in the applets Recognize functions 2 and Recognize graphs 2.

Explain your results.

7. Find the equation of the straight line through the points(1,1)and(4,3)as well as the equation of the quadratic parabola through the points(−1,6),(0,5)and (2,21).

8. Let the amount of a radioactive substance at timet=0 beAgrams. According to the law of radioactive decay, there remainA·qt grams aftertdays. Compute q for radioactive iodine 131 from its half life (8 days) and work out after how many days 1001 of the original amount of iodine 131 is remaining.

Hint. The half life is the time span after which only half of the initial amount of radioactive substance is remaining.

9. LetI [W/cm2] be the sound intensity of a sound wave that hits a detector sur-face. According to the Weber–Fechner law, its sound levelL [Phon] is com-puted by

L=10 log10(I /I0)

whereI0=1016W/cm2. If the intensityI of a loudspeaker produces a sound level of 80 Phon, which level is then produced by an intensity of 2I by two loudspeakers?

10. Forx∈Rthe floor functionxdenotes the largest integer not greater thanx, i.e.,

x =max{n∈N; nx}.

Plot the following functions with domainD= [0,10]using theMATLAB com-mandfloor: Try to program correct plots in which the vertical connecting lines do not ap-pear.

11. Draw the graph of the functionf :R→R:y=ax+signxfor different values ofa. Distinguish between the casesa >0,a=0,a <0. For which values ofa is the functionf injective and surjective, respectively?

12. A functionf:D= {1,2, . . . , N} →B= {1,2, . . . , N}is given by the list of its function values y=(y1, . . . , yN),yi=f (i). Write aMATLABprogram which determines whether f is bijective. Test your program by generating random y-values using

(a) y = unirnd(N,1,N), (b) y = randperm(N).

Hint. See the two M-filesmat02_ex12a.mandmat02_ex12b.m.

Dans le document Undergraduate Topics in Computer Science (Page 27-35)

Documents relatifs