gnuplot svg quadratic curve

Persamaan kuadrat dapat dinyatakan dalam bentuk standar, terfaktorkan, dan verteks [1]. Bentuk terfaktorkan kadang disebut juga dengan bentuk memotong [2].

gnuplot features#

  • Informasi bentuk fungsi ditampilkan mengikuti nilai koefisiennya [3].
  • Titik-titik data tersimpan dalam berkas skrip gnuplot dan bukan dalam berkas terpisah [4].
  • Terdapat berbagai jenis bentuk titik data [5].

standard form#

Fungsi kuadrat dalam bentuk standar dapat digambarkan sebagai berikut.

 
Gnuplot Produced by GNUPLOT 5.4 patchlevel 1 -5 0 5 10 15 20 25 0 1 2 3 4 5 6 7 8 9 10 f(x) = 1x2 + -10x + 21 y x gnuplot_plot_1 gnuplot_plot_2
Gambar 1. Bentuk standar fungsi kuadrat dengan a=1, b=10, dan c=21.

Hasil pada Gambar 1 diperoleh dengan kode berikut ini

# quadratic-curve-standard.gnu
# plot quadratic curve using standard form
# Sparisoma Viridi
# dudung@gmail.com
# 2022.08.06.40198

# define a quadratic function
a = 1
b = -10
c = 21
f(x) = a * x**2 + b * x + c

# define data points
$data << EOD
3 0
7 0
EOD

# set terminal and output file
set output "quadratic-curve-standard.svg"
set term svg size 480,300 font "Times, 14"

# set axes settings
set xtics 1
set xrange [0:10]
set xlabel "x"
set ytics 5
set yrange [-5:25]
set ylabel "y"
set grid

# set number of samples
set samples 100

# do plotting
set label "f(x) = " . a . "x^2 + " . b . "x + " . c at 5,10 center
plot f(x) t "" lw 2 lc 7, "$data" w p t "" ps 1 pt 7 lc 6

yang dipanggil menggunakan gnuplot.

factored form#

Fungsi kuadrat dalam bentuk terfaktorkan dapat digambarkan sebagai berikut.

 
Gnuplot Produced by GNUPLOT 5.4 patchlevel 1 -5 -2.5 0 2.5 5 7.5 10 0 1 2 3 4 5 6 7 8 9 10 f(x) = 0.50 (x - 2.0) (x - 8.0) y x gnuplot_plot_1 gnuplot_plot_2
Gambar 2. Bentuk terfaktorkan fungsi kuadrat dengan a=0.5, x1=2, dan x2=8.

Hasil pada Gambar 2 diperoleh dengan kode berikut ini

# quadratic-curve-factored.gnu
# plot quadratic curve using factored form
# Sparisoma Viridi
# dudung@gmail.com
# 2022.08.06.40198

# define a quadratic function
a = 0.5
x1 = 2
x2 = 8
f(x) = a * (x - x1) * (x - x2)
y1 = f(x1)
y2 = f(x2)

# define data points
$data << EOD
2 0
8 0
EOD

# set terminal and output file
set output "quadratic-curve-factored.svg"
set term svg size 480,300 font "Times, 14"

# set axes settings
set xtics 1
set xrange [0:10]
set xlabel "x"
set ytics 2.5
set yrange [-5:10]
set ylabel "y"
set grid

# set number of samples
set samples 100

# do plotting
set label \
sprintf("f(x) = %.2f (x - %.1f) (x - %.1f)", a, x1, x2) \
at 5,2.5 center
plot f(x) t "" lw 2 lc 7, "$data" w p t "" ps 1 pt 7 lc 6

yang dipanggil menggunakan gnuplot.

vertex form#

Fungsi kuadrat dalam bentuk terfaktorkan dapat digambarkan sebagai berikut.

 
Gnuplot Produced by GNUPLOT 5.4 patchlevel 1 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8 9 10 f(x) = 0.20 (x - 5.0)2 + 3.0 y x gnuplot_plot_1 gnuplot_plot_2
Gambar 3. Bentuk verteks fungsi kuadrat dengan a=0.2, xp=5, dan k=3.

Hasil pada Gambar 3 diperoleh dengan kode berikut ini

# quadratic-curve-vertex.gnu
# plot quadratic curve using vertex form
# Sparisoma Viridi
# dudung@gmail.com
# 2022.08.07.40198

# define a quadratic function
a = 0.2
xp = 5
k = 3
f(x) = a * (x - xp)**2 + k

# define data points
$data << EOD
0 8
5 3
EOD

# set terminal and output file
set output "quadratic-curve-vertex.svg"
set term svg size 480,300 font "Times, 14"

# set axes settings
set xtics 1
set xrange [0:10]
set xlabel "x"
set ytics 1
set yrange [3:8]
set ylabel "y"
set grid

# set number of samples
set samples 100

# do plotting
set label \
sprintf("f(x) = %.2f (x - %.1f)^2 + %.1f", a, xp, k) \
at 5,6 center
plot f(x) t "" lw 2 lc 7, "$data" w p t "" ps 1 pt 7 lc 6

yang dipanggil menggunakan gnuplot.

forms conversion#

Konversi antara dua bentuk dari ketiga bentuk persamaan kuadrat dapat ditelusuri dengan mengubah satu bentuk menjadi bentuk lain sehingga diperoleh hubungan koefisien-koefisien antar bentuk asal dan bentuk tujuan.

Bentuk standar, terfaktorkan, dan verteks diberikan oleh persamaan

(1)fS(x)=ax2+bx+c,

(2)fF(x)=a(xx1)(xx2),

(3)fV(x)=a(xxp)2+k,

di mana indeks bawah S untuk standar, F untuk terfaktorkan, dan V untuk verteks.

Persamaan (2) dapat menjadi Persamaan (1) dengan

x1+x2=ba,x1  x2=ca,

dan Persaman (3) dapat menjadi Persamaan (1) dengan

xp=b2a,xp2=cka.

Koefisien a pada Persamaan (1), (2), dan (3) bernilai sama.

to-do#

  • Mempelajari karakter kurva parabola dan makna parameter a, b, c, x1, x2, xp, dan k.
  • Mengaitkannya dengan gerak parabola dan besaran kinematika x0, y0, v0x, v0y, ay.
  • Membuat template lintasan parabola dan besaran kinematika terkaitnya.

notes#

  1. The Albert Team, “Forms of Quadratics: Explanations, Tips, and Examples”, Learn By Doing, Inc., 1 Mar 2022, url https://www.albert.io/blog/forms-of-quadratics/ [20220806].
  2. Vivian Loh, “Converting Between Different Forms of a Quadratic”, Expii, Inc., 2019, url https://www.expii.com/t/converting-between-different-forms-of-a-quadratic-4852 [20220806].
  3. Tom Fenech, “Answer to ‘gnuplot title variables separated by text’”, Stack Overflow, 20 Sep 2014, url https://stackoverflow.com/a/25950105/9475509 [20220806].
  4. Ciro Santilli Путлер Капут 六四事, “Answer to ‘How to plot data without a separate file by specifying all points inside the Gnuplot script?’”, Stack Overflow, 18 Nov 2019, url https://stackoverflow.com/a/33064653/9475509 [20220806].
  5. Christoph, “Answer to ‘How set point type from data in gnuplot?’”, Stack Overflow, 14 Apr 2015, url https://stackoverflow.com/a/29624574/9475509 [20220806].
Cite as: viridi, "gnuplot svg quadratic curve", bugx, 7 Aug 2022, url https://dudung.github.io/bugx/0137 [20221011].