![]() |
|
#1
|
|||
|
|||
![]() нужна программы строящая график арккос при нажатии только одной кнопки, так как вот эта прога (из учебника) строит для арктангенса
Пожалуйста все файлы программы - http://upwap.ru/1096645 код pas - Код:
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var xCenter, yCenter: Integer; i, screenX, screenY, x2:Integer; dx, x, y: Single; z: Extended; begin with canvas do begin xCenter:= 400; yCenter:= 300; MoveTo (xCenter-300,yCenter); LineTo (xCenter+300,yCenter); MoveTo (xCenter,yCenter-250); LineTo (xCenter,yCenter+250); canvas.TextOut(xCenter+10,yCenter+10,'0'); canvas.TextOut(xCenter+10,yCenter-250,'y'); canvas.TextOut(xCenter+300,yCenter+10,'x'); dx := 0.01; x := -3.0; y := -ArcTan (x); for i:=1 to 600 do begin screenX := Round (x * 100) + xCenter; screenY := Round (y * 100) + yCenter; MoveTo (screenX, screenY); x:= x + dx; y:= -ArcTan (x); screenX := Round (x * 100.0) + xCenter; screenY := Round (y * 100.0) + yCenter; LineTo (screenX, screenY); end; dx := 1.0; x := -3.0; for i:=1 to 7 do begin screenX := Round (x * 100) + xCenter; screenY := yCenter - 5; MoveTo (screenX, screenY); screenY := yCenter + 5; LineTo (screenX, screenY); if Round(x) <> 0 then canvas.TextOut(screenX, screenY + 5, IntToStr (Round(x))); x := x + dx; end; screenY := Round (1.57 * 100.0) + yCenter; screenX := xCenter - 5; MoveTo (screenX, screenY); screenX := xCenter + 5; LineTo (screenX, screenY); canvas.TextOut(screenX+5, screenY-2, 'pi/2'); screenY := -Round (1.57 * 100.0) + yCenter; screenX := xCenter - 5; MoveTo (screenX, screenY); screenX := xCenter + 5; LineTo (screenX, screenY); canvas.TextOut(screenX+5, screenY-2, '-pi/2'); end; end; end. end; end. Последний раз редактировалось Admin, 26.10.2010 в 22:39. |
#2
|
|||
|
|||
![]() Ну и в чем проблема заменить Arctan на Arccos (или как он там называется в модуле math)?
|
#3
|
|||
|
|||
![]() не помогает
|
#4
|
||||
|
||||
![]() Ошибка в 51 и 54 строчке
З.Ы. Как правильно задавать вопросы. Оставайтесь хорошими людьми... VK id2634397, ds [at] phoenix [dot] dj Последний раз редактировалось PhoeniX, 27.10.2010 в 02:34. |
#5
|
||||
|
||||
![]() Не буду заставлять всех очень долго думать.
Функция ArcCos(x) имеет диапазон -1<x<1, а у Вас от -3 до 3... З.Ы. не забыли Код:
uses Math Оставайтесь хорошими людьми... VK id2634397, ds [at] phoenix [dot] dj Последний раз редактировалось PhoeniX, 27.10.2010 в 02:35. |
#6
|
|||
|
|||
![]() Спасибо)))))
|