functions & plots (pertemuan ke-3 & 4)

22
Pendahuluan String 2D 3D Latihan Referensi Readme Author Exit MAPLE FUNCTIONS & PLOTS FUNCTIONS & PLOTS Dosen pengampu: Juhari, m.SI UNIVERSITAS ISLAM NEGERI MAULANA MALIK IBRAHIM MALANG

Upload: jaditaqwa

Post on 24-Oct-2015

18 views

Category:

Documents


2 download

TRANSCRIPT

Slide 1

Karakter String Home NextBack

style : style grafik, ada 3 macam, point (titik), line (garis), dan patch ( ).* Bagian yang bertanda star ( * ) bersifat opsional, jadi boleh tidak ditambahkan Mendefinisikan Fungsi Home NextBackDefining a function[> f:=x^2+4*x-5;

Theory:

Plotting a function:

If we want to plot the function, use plot (function, variable range, plot options); The function can be defined by any of the ways discussed in defining a function. The variable range will be anything between infinity to +infinity. e.g. x=-2..2 if the function is specified by f(x) otherwise if the function is specified by f then we will write the range without variable. The plot options can be style, color, etc. See maple help for more options.We can also define function as follows: [> f:=x->x^2+3;

Menggambar Fungsi Home NextBack Menggambar Grafik Fungsi.

Satu fungsi dalam satu sumbu koordinat XOY.

Syntak yang digunakan adalah plot( f(x), x = a..b, y = c..d, color = warna , style= style); f(x) : fungsi yang akan dibuat grafiknya. x : variabel a..b : range sumbu X c..d : range sumbu Y * color : warna grafik, dalam bahasa inggris * style : style grafik, ada 3 macam, point (titik), line (garis), dan patch ( ). *Contoh:Gambarlah grafik fungsi untuk pada interval [-2,3]> plot(x^3+2,x=-2..3);> plot(x^3+2,x=-2..3,y=-8..30,color=blue,style=point); Definisi Fungsi Home NextBack Lebih dari satu fungsi dalam satu sumbu koordinat XOY.

Syntak yang digunakan adalah plot( [f 1(x), f2(x), ... ], x = a..b, y = c..d, color = [warna1,warna2, ... ], style = [ style1, style2, ... ] ); f1(x), f2(x), ... : fungsi pertama, fungsi kedua, dst...Contoh :

Butlah grafik fungsi untuk, dan pada interval [-1,3]. Warna fungsi pertama adalah biru dengan style garis, warna fungsi ke dua merah dengan style titik, dan fungsi ke tiga berwarna hijau dengan style patch.

Plot Option Home NextBack Dalam plot ada beberapa pilihan atau option yang harus diperhatikan yaitu: ColorStyleTitleLinestyleLabels Beberapa contoh plotPlotting dataParametric PlotPolar CoordinatesPlotting with piecewise-defined functions Plot Options Home NextBackSometimes we want to import some data into Maple and compare it with a formula that we have coded in Maple, so Maple stores and plots data in matrix form which can plot it using the pointplot command, in the plots package with the data in list of lists of the form [[x1,y1],[x2,y2],[x3,y3],,[xn,yn]]> with(plots):> data_1:=[-2,4],[-1,1],[0,0],[1,1],[2,4],[3,9]]> pointplot(data_1);

Use the style=line option to plot the lines.> pointplot(data_1, style=line);Plotting data Plot Option Home NextBackTo plot a curve defined by (x, y)= (f(t), g(t)). For t from a to b; where f(t) and g(t) are expressions depending on t.

> restart; with(plots):> plot([cos(t),sin(t)],t=0..2*Pi);2. Parametric plots

Plot Option Home NextBackWe can plot a function in polar coordinates by using polarplot command in the plots package.(r,)> restart; with(plots):> polarplot(1,theta=0..2*Pi): if r=1If r=sin(3)> restart; with(plots): polarplot(sin(3*theta),theta=0..2*Pi):If r=> restart; with(plots): polarplot(theta,theta=0..4*Pi):3. Polar Coordinates Plot Option Home NextBack4. Plotting with piecewise-defined functions

So define f(x) in Maple as:> restart; f:=x->piecewise(x plot(f(x),x=0..3, discont=true); Latihan Home NextBack

Plot Option Home NextBack Penggunaan implicitplot Perintah implicitplot digunakan untuk menggambarkan kurva yang disajikan oleh fungsi secara implicit.

Akan digambarkan kurva yang disajikan oleh persamaan:

[> implicitplot(x^2y^2=1 , x=Pi . . Pi , y=Pi . . Pi ) ;

Plot Option Home NextBack Grafik Daerah Penyelesaian PertidaksamaanDiberikan sistem ketidaksamaanUntuk menggambarkan daerah penyelesaian (feasible area) sistem ini, kita lakukan perintah berikut:[> inequal({x+y>0,xy implicitplot3d(x^2+y^2+z ^2=1,x=1..1,y=1..1, z= 1..1);

Plot Option Home NextBack Visualizing Vector Fields[> restart;with(plots):[> fieldplot([y,x],x=-1..1,y=-1..1,grid=[20,20], color=red,arrows=SLIM);Maple's fieldplot command allows us to visualize vector fields in two dimensions in the plot package, for example

There is also a fieldplot3d command which works similarly in three dimensions. Task Home NextBack