Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure TForm1.Button1Click(Sender: TObject);
- var
- h : Real; // крок
- a , b , mash : SmallInt; // межі і масштаб
- x, y : Real; // x i y
- begin
- try
- //Зчитуємо дані з форми
- a := StrToInt(Form1.Edit1.Text);
- b := StrToInt(Form1.Edit2.Text);
- h := StrToFloat(Form1.Edit3.Text);
- mash := StrToInt(Form1.Edit4.Text);
- except
- ShowMessage('!!!'); // якщо неправильно ввели числа
- exit; // якщо неправильно введені дані - вихід з процедури
- end;
- Form1.Repaint; // Викликаємо функцію перемалювання
- x := min(a , b); // мінімаьне значення
- while (x < max(a , b)) do // в циклі малюємо
- begin
- // y = ln(x) - (2x)^(3/2)
- // y = x^(3/2) * (cos(x))^(1/3)
- if x > 1 then
- begin
- // малюємо перший графік
- y := ln(x) - Power(2 *x , 0.33);
- Form1.Canvas.Pixels[center_x + Round(x * mash), center_y - Round(y * mash) ] := ClGreen;
- // і зразу другий
- y := Power(x , 0.66) * (Power( cos(FRAC(x)) , 0.33 ));
- Form1.Canvas.Pixels[center_x + Round(x * mash), center_y - Round(y * mash) ] := ClRed;
- end;
- x := x + h;// крок
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement