load(fourier_elim)$
load(draw)$

## Domena funkcije

1. zadatak

f(x):=(log((x-1)/(3-2*x)-2)/log(1/2))^(1/2);

fourier_elim([(x-1)/(3-2*x)-2>0],[x]);

fourier_elim([log((x-1)/(3-2*x)-2)/log(1/2)>=0],[x]);

fourier_elim([(x-1)/(3-2*x)-2>0,(5*x-7)/(3-2*x)<=1],[x]);

2. zadatak

f(x):=(log(x+5)^2/log(10))^(-1);

fourier_elim([(x+5)^2>0,(x+5)^2#1],[x]);

3. zadatak

f(x):=sqrt(-x)+(2+x)^(-1/2);

fourier_elim([-x>=0,2+x>0],[x]);

4. zadatak

f(x):=log(log(log(x+1)/log(2))/log(4))/log(8);

fourier_elim([x+1>0,log(x+1)/log(2)>0,log(log(x+1)/log(2))/log(4)>0],[x]);

fourier_elim([x>-1,log(x+1)/log(2)>1,x+1>1], [x]);

fourier_elim([x>0,x+1>2],[x]);

5. zadatak (samo je prikazan na slici crvenom bojom jedan dio domene)

f(x):=sqrt(sin(2*x));

wxdraw2d(grid=true,xaxis=true,xaxis_width=1,xaxis_type=solid,xlabel="x",
yaxis=true,yaxis_width=1,yaxis_type=solid,ylabel="y",line_width=3,color=blue,
xtics=[-2*%pi,%pi/2,2*%pi],key="sin(2x)",
explicit(sin(2*x),x,-7,7),color=red,key="domena",explicit(0,x,0,%pi/2),key="",explicit(0,x,%pi,3*%pi/2),
explicit(0,x,-%pi,-%pi/2),xrange=[-4,6],yrange=[-2,2]), wxplot_size=[700,400];

draw2d(terminal=wxt,grid=true,xaxis=true,xaxis_width=1,xaxis_type=solid,xlabel="x",
yaxis=true,yaxis_width=1,yaxis_type=solid,ylabel="y",line_width=3,color=blue,
xtics=[-2*%pi,%pi/2,2*%pi],key="sin(2x)",
explicit(sin(2*x),x,-7,7),color=red,key="domena",explicit(0,x,0,%pi/2),key="",explicit(0,x,%pi,3*%pi/2),
explicit(0,x,-%pi,-%pi/2),xrange=[-4,6],yrange=[-2,2]);

## Domena i nultočke

1. zadatak

f(x):=(2*sqrt(x))/(3-x^2);

fourier_elim([x>=0,(x-sqrt(3))*(x+sqrt(3))#0],[x]);

solve(f(x)=0,x);

2. zadatak (domena je čitav skup realnih brojeva, a realnih nultočaka nema)

f(x):=sqrt(x^2+x+5);

fourier_elim([x^2+x+5>=0],[x]);

solve(x^2+x+5=0,x);

wxplot2d([x^2+x+5], [x,-5,5],[y,-5,20])$

solve(f(x)=0,x);

3. zadatak

f(x):=log((x-2)/(3-x))/log(1/2);

fourier_elim([(x-2)/(3-x)>0],[x]);

solve(f(x)=0,x);

4. zadatak

f(x):=%e^((log(5-x))/(x^2-4));

fourier_elim([5-x>0,x^2-4#0],[x]);

solve(f(x)=0,x);

## Injekcija, surjekcija, bijekcija

1. zadatak

f(x):=2^(x+3);

wxplot2d ( 2^(x+3), [x, -3, 2], [y, -2, 15], [style, [lines,4]])$

2. zadatak

f(x):=log(4*x^2)/log(2);

wxplot2d ( log(4*x^2)/log(2), [x, -3, 3], [style, [lines,4]])$

3. zadatak

f(x):=3/(3*x^2+1);

wxplot2d ( 3/(3*x^2+1), [x, -3, 3],[y,0,5], [style, [lines,4]])$

4. zadatak

f(x):=x/(4-2*x);

wxplot2d ( [x/(4-2*x),-1/2], [x, -8, 6],[y,-10,10],[style, [lines,3]])$

## Kompozicija funkcija

1. zadatak

f(x):=(2*x)/(x-5);
g(x):=1-x;

f(g(x));

g(f(x));

factor(g(f(x)));

2. zadatak

f(x):=log(4*x^2)/log(2);
g(x):=2^(x+3);

f(g(x));

expand(f(g(x)));

g(f(x));

radcan((g(f(x))));

3. zadatak

f(x):=(2*x+3)/(3*x+2);
g(x):=x/(4-2*x);

f(g(x));

ratsimp(f(g(x)));

g(f(x));

ratsimp(g(f(x)));

## Inverzna funkcija

1. zadatak

f(x):=(2*x-1)/(1-x);

solve(f(x)=y,x);

wxplot2d([f(x),(x+1)/(x+2),x],[x, -8, 6],[y,-10,10],[style, [lines,3]])$

2. zadatak

f(x):=5^(1-x/3);

solve(f(x)=y,x);

wxplot2d([f(x),3-3*log(x)/log(5),x],[x, 0.1, 6],[y,-1,10],[style, [lines,3]])$

3. zadatak

f(x):=log(x)/log(3)+2;

solve(f(x)=y,x);

wxplot2d([f(x),3^(x-2),x],[x, 0.1, 6],[y,-1,10],[style, [lines,3]])$

4. zadatak

f(x):=log(x+2)/log(3);

solve(f(x)=y,x);

wxplot2d([f(x),3^x-2,x],[x, -5, 6],[y,-5,10],[style, [lines,3]])$

5. zadatak

f(x):=(x+1)^(1/2);

solve(f(x)=y,x);

wxplot2d([f(x),x^2-1,x],[x, -1, 6],[y,-2,5],[style, [lines,3]])$

preciznija slika

wxdraw2d(grid=true,xaxis=true,xaxis_width=1,xaxis_type=solid,xlabel="x", proportional_axes=xy,
yaxis=true,yaxis_width=1,yaxis_type=solid,ylabel="y",line_width=3,color=blue,
explicit((x+1)^(1/2),x,-1,6),color=red,explicit(x^2-1,x,0,5),color=green,explicit(x,x,-2,6),
xrange=[-2,6],yrange=[-2,10]),wxplot_size=[400,400];

draw2d(terminal=wxt, grid=true,xaxis=true,xaxis_width=1,xaxis_type=solid,xlabel="x",
yaxis=true,yaxis_width=1,yaxis_type=solid,ylabel="y",line_width=3,color=blue,
explicit((x+1)^(1/2),x,-1,6),color=red,explicit(x^2-1,x,0,5),color=green,explicit(x,x,-2,6),
xrange=[-2,6],yrange=[-2,10]);

## Omeđenost i monotonost

1. zadatak

f(x):=2*sqrt(x)/(3-x^2);

wxplot2d(f(x),[x, 0, 6],[y,-20,20],[style, [lines,3]])$

2. zadatak

f(x):=sqrt(x+5);

wxplot2d(f(x),[x, -6, 20],[y,-2,6],[style, [lines,3]])$

3. zadatak

f(x):=4/(x^2+3);

wxplot2d(f(x),[x, -6, 6],[y,-2,3],[style, [lines,3]])$

4. zadatak

f(x):=%e^(5-x);

wxplot2d(f(x),[x, -2, 3],[y,-100,1200],[style, [lines,3]])$

5. zadatak

f(x):=3*sin(2*x+%pi);

wxplot2d(f(x),[x, -6, 6],[y,-4,4],[style, [lines,3]])$

## Parnost, neparnost

1. zadatak

f(x):=2*x^2/(3-x^2);

f(-x);

wxplot2d(f(x),[x, -6, 6],[y,-10,10],[style, [lines,3]])$

2. zadatak

f(x):=(x+5*x^5)^(1/3);

f(-x);

wxplot2d(f(x),[x, -3, 3],[y,-4,4],[style, [lines,3]])$

wxplot2d(f(-x),[x, -3, 3],[y,-4,4],[style, [lines,3]])$

3. zadatak

f(x):=%e^(5-x);

f(-x);

wxplot2d(f(x),[x, -2, 3],[y,-100,1200],[style, [lines,3]])$

4. zadatak

f(x):=abs(x-4)+abs(x+4);

f(-x);

wxplot2d(f(x),[x, -10, 10],[y,-1,20],[style, [lines,3]])$

5. zadatak

f(x):=cos(x^5)/x+sin(x^10)/x;

f(-x);

wxplot2d(f(x),[x, -3, 3],[y,-10,10],[style, [lines,2]])$