International Baccalaureate Organization (IBO) Alexander Pushkin School Perm Russian Federation

Total Page:16

File Type:pdf, Size:1020Kb

International Baccalaureate Organization (IBO) Alexander Pushkin School Perm Russian Federation

International Baccalaureate Organization (IBO) Alexander Pushkin School Perm Russian Federation

Municipal Autonomic Educational Institution "Alexander Pushkin secondary primary school № 9 with in-depth study of subjects physics and mathematics”

Personal project

Creation of a site for helping students in mathematics and information technology

The author - Sergey Tsaplin student MYP 5 student of 9G grade

Supervisor - Vyazmina Olga Nikolaevna The teacher of algebra and geometry

Content 1. Title page…...... 1 2. Content…………………………………………………………….. 2 3. Introduction………….…………………………………………….. 3 4. The main part ...... 5 5. Conclusion…………………………………………………………10 6. Bibliography……………………………………………………….12 7. Addition…………………………………………………………….13

Introduction Topic: creation a site to help students in learning mathematics and IT.

Purpose: To create a site that will help students in computer science and mathematics. The site will also have a program that implement some algorithms in mathematics, for example, a program that draws the graphs of functions and some algorithms in IT. For the user it should be very easy to download any program from my site.

For whom? This site will be helpful for many people. In it will be interested students who want to check their answers in math, for example, if students were given a task to build several graphs of functions, they can use the program from my site that draws these charts to see their results. The site will be useful for programmers because it is much easier to use an algorithm that is already written, than write it by your self. In any program you can choose language: English or Russian. This makes possible to use my programs not only in Russia but also in other countries. Building a graph of the function – is a very popular topic for students. Statistics in Yandex (http://wordstat.yandex.ru) shows that each month more than 30,000 people are searching for such programs.

Product. Product will be a site written on «Wordpress».The site will contain the algorithms for programmists with explanation, in which cases, and what algorithm to use. Also, there will be some useful programs in mathematics. The product has been tested by Professor of "Mathematical modeling of systems and processes", candidate of technical sciences of PNIPU (PSTU) Nyashina N.D.

Why I have chosen this topic? I have chosen this topic because in the 9th grade, we where given a lot of hard work to do on maths lessons, and I thought that not every student is able to cope with them, and it will be much easier if there would be some programs to help you in maths. After a long searching in the Internet, I haven’t found any site that would contain lot of these programs, so I decided to create it. Also I decided that the site will contain algorithms for IT, since some times you need some new algorithms that you don’t know for your program and having all of them on one site will greatly help many programmers and reduse the time of writing the code. I decided to create a site using «Wordpress», because I was advised this program by my dad, who created his personal website http://tsaplin.ru/ with using it. I liked it very much. After I learned how to work in this program, I realized that it would be very easy and quick to make my site with use of it, so my site is also written with the help of «Wordpress». Methods and techniques. Oral interviews. I interviewed many of my friends and classmates, and as a result I understood what types of tasks cause a lot of problems, and what features for programming they would like to have. To address these types of tasks were written program and where added functions for writing programs.

Comparing. After reviewing many similar programs on the Internet, with their flaws and positive traits I had thought out scheme of work and the interface of each program.

The area of interaction – Community and service. My website is made to help people involve their knowledge in mathematics and computer science.

For creating a project was made following plan: 1.Collection of information and analysis. 2. Product Creation 2.1. Creating a shell of the site 2.2. Evaluation of similar programs from the Internet 2.3. Planning each program 2.4. Creating programs 2.5. Creating functions for programming 2.6. Placing programs on the site 2.7. Placing the site on the Internet 3. Testing the project. 3.1. Changing and editing the site and programs in accordance with feedback on them. 4. Creation of the written work in English and Russian languages 5. Preparing the presentation 6. Protection of the project Description of the process

Poll

After polling my friends and classmates, I realized what programs would be helpful to pupils and students. So I decided to create programs to draw graphs of functions and working with scales of notation, namely, to transfer a number from one scale of notation to another and do simple arithmetic operations (addition, subtraction, multiplication and division) with numbers written in the same notation.

Creating a shell of a site

I created a site with a shell program Denwer. Denver - a set of Web development. The name translates as DNVR - Gentleman's suite of web developer. With this program I made my computer a server for my site. The program has been downloaded from the official site - http://www.denwer.ru. Installation and operation of the program is very clear and understandable. I really like this program.After creating a shell website I needed to learn the system «Wordpress», with which I will continue to fill the site. This helped me to my dad. Also, I often turned to the site http://codex.wordpress.org/ is the official site, with easy and convenient to operate. It gave me a lot of useful information.

Evaluation of similar programs from the Internet

I had found 5 sites on the Internet which where building the graphs online: http://school35.ucoz.ru/grapher/grapher_e.htm, http://um-razum.ru/graph/, http://www.kontrolnaya-rabota .ru / s / grafik / xy /, http://matesha.ru/schedule_function.php, http://www.reshalki.ru/yasam/graph.htm. Program on sites http://school35.ucoz.ru/grapher/grapher_e.htm, http://um- razum.ru/graph/ and http://www.reshalki.ru/yasam/graph.htm were absolutely identical . These programs work bad with the modules, don’t always build the correct graph of the module containing the variable, there were no features both integer and fractional parts of numbers.

The program from the site http://www.kontrolnaya-rabota.ru/s/grafik/xy/ contains all the same flaws as the previous three. On this site can not be selected for plotting scale on the axis Y (vertical axis), which can greatly interfere with the perception of some graphs. I do not like this program by the fact that, after drawing the graph of a regular site goes to another page, and to construct the following graph, it is necessary to return to the previous, and it is too long and uncomfortable.

The program from the site http://matesha.ru/schedule_function.php also contains all the flaws, that the first three, but the program does not have the constants - numbers e and π, which are often needed for plotting, such as f (x) = e ^ x. It is unclear what functions are in the program, and how they should be used.

Thus, my program should contain besides the basic functions and features as the integer and fractional parts of numbers. The program should be understandable to use and must contain a statement to the users of the program did not raise questions about its operation and that they know all its functions and how to work with them. Also, in all the programs I have not viewed the visual effect of the construction schedule. My program will build the schedule gradually.

I have found six sites, online programs, like my second program: http://math.semestr.ru/inf/index.php, http://eict.ru/calsystem.html, http://allcalc.ru/node/418, http://life-prog.ru/servis.php?id=1, http://numsys.ru/calculator, http://live.mephist.ru/show/calc/help/ numeral- systems.

The site http://life-prog.ru/servis.php?id=1 does good translation from one scale of notation to another, but it is not possible to do arithmetic operations on numbers.

The site http://math.semestr.ru/inf/index.php allows you to convert fractional numbers in other number systems, but it only works with binary, octal, decimal and hexadecimal number system.

The site http://allcalc.ru/node/418 can translate numbers only from the decimal number system in a number system with base 2, 8 or 16, or vice versa.

On the web sites http://live.mephist.ru/show/calc/help/numeral-systems http://eict.ru/calsystem.html you can do the translation, and arithmetic.

Web site http://numsys.ru/calculator allows arithmetic operations on long numbers (up to 50 characters).

Thus, my program should be able to handle very large numbers (up to 1000 characters) and should be able to translate numbers from one system to another, and to do simple operations on numbers written in any number system.

Planning the programs The main component of the program, building the graph of the function is a procedure that by the function f (x) and the value of x will show its value. After user selects the extreme value of the variable X under consideration, the program will break the interval from minimum to maximum values at several points of equal parts, considers the value of the function at each point, to build all the points on the graph and connect them in series.

In the program, working with the scales of notation, will be the two main routines. One would be to transfer the number in the usual decimal notation. For storing very large numbers in the decimal system will set up special structures. The second sub-program will convert the resulting transformations after the number written in decimal notation, the desired number system.

Creating the programs

I was advised to write my programs use PascalABC.net. This programming environment is very similar to the Delphi 7, which is known to me, so I decided to study it. On the Internet has been found a site with tutorials on this program: http://sunschool.math.rsu.ru/pabc/. It was a presentation showing all the differences PascalABC.net from Delphi 7, and that I needed. The presentations were made by one of the authors of the programm - S.S.Mihalkovich. So I was sure that I learned all the important differences between these two programs and signed off on this search for sites with tutorials.

I had two options - write a program in Delphi 7 or PascalABC.net. Each of these programs have their pros and cons.

In Delphi, faster and more convenient to create a program interface, Delphi quickly.It makes for a second hundred million operations, and PascalABC.net only a million, that is, PascalABC.net a hundred times slower, which will affect, for example, the accuracy of the graph, as for one and the same time, we can build a hundred times smaller than the points for a schedule.Delphi has worse graphics, and it often flies in the presence of small missteps, than I do, this program is not like that. In PascalABC.net easier to write code, since there are many built-in algorithms that do not exist in Delphi, which reduces the code.

After long reflection, having weighed all the pros and cons of each program, I decided to write their programs in Delphi 7.

The interface to the program was created with the help of the book written by C.Bobrovskiy – “Delphi 7 training course.” This book has a wonderful description of all parts of the interface. Also, there are examples of correct and clear instructions for their use.

The site http://www.delphi-manual.ru/drawing.php has descriptions and examples of functions which draws the lines, dots and circles in Delphi 7. The site had a lot of examples, which allowed me to learn all the possibilities. The functions described on this site have been used in my work. I was pleased with the site.

While working on the programs I needed to establish the exact time. At different sites has been described many solutions to this problem, but the method described on the site http://forum.3dnews.ru/archive/index.php/t-57874.html allow time to consider the program with high accuracy, so I chose it. Create functions for programming

Also I posted on my website various features for programming. They were taken from various sites, for example, http://codeforces.ru - is a site of online competitions in IT, After regular olympiad you can watch the decision of its members.From this site were taken out many functions. They are certainly right and work smoothly, as taken from the solution of the problem which has received a full score, that is absolutely right decision.

Some functions have been taken from the site http://ejudge.179.ru - this is the site of the Summer Computer School, where I was this summer. On this website have been saved a lot of my programs that were written by me and tested in this school.

Also, several functions have been written and tested by me, such as programs written by me on IT lessons at our school. They were tested on the system testing and stored on the site of our school http://www.school9.perm.ru/gate/tester/.

Placement programs on the site

The program «Wordpress», allows you to put on your website files up to 2 megabytes.My programs weigh less, thus placing them on my website wasn’t hard.

Placing the site on the Internet

The site was placed under the name http://sergei.tsaplin.ru, as it is placed under the domain of my family - tsaplin.ru. In my opinion, create a new domain name is meaningless, as for the use of the domain you have to pay money, but for the use of the domain tsaplin.ru you don’t need to pay.

Testing the site

The site was launched, and all users can send their feedback to my e-mail, shown on the site. On February 16 at 10:00 pm were received 3 reviews for my site and programs. All of them are in the adding to the project.

Changing the product.

In one of the reviews said about the software interface, and it was described how to make it better and more intuitive for users of my programs. The background was made white, as in the two reviews was mentioned that the gray background makes the program an old-fashioned and ugly. After the changes it has become more clear how to work in the program, there was a statement on the use of various functions of the program. Changing the interface can be seen in the following figures.

In the process, I showed my site to my classmates. Gregory Shartsev have found a few mistakes in my product, for example, the program did not build the graph of the square root of the module X. Because of this, I had found some errors in the code of my program, and it was perfected.

The picture (see Annex 1) shows the old and ugly interface and improper construction of the graph of f (x) = 1 / (x ^ 2). It also strikes a lot of space to the right of the graph and it is unclear what to do with some of the cells (see Annex 2). It is also convenient that all the parameters of the function are pressed on the upper edge and elongated in one line. It is also unclear where the boundaries of the graph. In general, all this makes the program inconvenient to use and ugly. With this program convenient to work with.

The following picture (see Annex 3), there is a clear interface and the proper construction of the graph. One can see the boundaries of schedule. There is no extra space, and everything is clear for use. With such a program is very convenient to operate. Introduced animation plotting gives a certain "flavor" of my program and distinguishes it from others. Also instruction appeared. Conclusion

In general, a product of my project (the site for those who are engaged in mathematics and computer science) turned out as I had planned. I was pleased with his project. The site is laid out on the Internet under the name http://sergei.tsaplin.ru.

I have created a program that draws graphics functions. It contains all of the previously scheduled function. The program is very useful. I myself have used it for a work in algebra. It was possible to reduce the weight of both programs. They weigh less than a megabyte, which allows you to quickly download. Also I got rid of the installation program, that is to start using my program you just download them and do not need to run any load. This makes the program more useful. It also turned out to create a program that works with the degrees of notation, which performs arithmetic operations with numbers in any base and converts the number in any radix. It turned out to make it possible to use the programs in English. To use this program you need just to download it. This program also weighs not very much, and it will download quickly.

Successfully created a function for programming. Almost all of them are written in several programming languages, mostly Pascal, C + + and Java - the most popular programming languages. Due to the abundance of built structures in C + +, many of the functions are written very shortly.

But there were things that I could not do, for example, in the program, which draws graphs of functions, an error appears - the program connects to the point of the graph, which should not be connected (see Annex 4). This happened due to the fact that the program builds a graph of the points, and very difficult to determine whether to join the regular line of two points - is there a gap chart or not. This will probably be removed soon and the site will be a new program.

In another program I failed to make it work with long integers as difficult to work with very long numbers and perform arithmetic operations with them. The program will be fixed soon. This operation will be placed on my website along with other functions.

The site lacks some features in Java, since don’t know it all programs are taken from the Internet or website http://codeforces.ru. Some of the features I have not found. In the future, I plan to add new programs to the site to assist in the teaching of mathematics, update old ones. Maybe there will some entertainment to make the site more interesting.

I selected the interaction region contains two key questions - How can I help others? and what can I do for people? In my project I'm helping others to study mathematics and computer science.

In the course of the project I have improved my knowledge in the creation of presentations and work with a text editor. I improved my knowledge in mathematics and computer science, learned how to build applications, how to carry out various surveys to gather feedback and analyze information.

In the end I want to thank people who helped me in writing of the project, namely my dad - Tsaplin Vitaliy Alekseevich, who introduced me to «Wordpress», helped to deal with the site and post it on the Internet. Because of his advice on the interface of programs, they look more beautiful and clear. I also want to thank my classmate - Gregory Shartsevu for that at the time of writing programs, he advised me how to improve my programs. Because of this in my programs there are no mistakes, and they are working properly. Also Gregory wrote a great review about my program, which draws graphs of functions. Bibliography

1) http://wordstat.yandex.ru

2) http://codex.wordpress.org/

3) http://wordpress.org/download/

4) http://www.delphi-manual.ru/drawing.php

5) S. Bobrovskiy. Delphi7.training course. 2008.

6) http://forum.3dnews.ru/archive/index.php/t-57874.html

7) http :// ejudge .179. ru

8) http :// codeforces .ru

9) http://www.school9.perm.ru/gate/tester/

10) http://www.denwer.ru Addition 1.

2. 3. 4. Texts of the programs:

Program that works whit the scales of notation. unit it1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Menus; const kol = 14; //const l = 1; const lng: array[1..2, 1..kol] of string = (('Выполнить арифметические действия', 'Перевод в другую систему счисления', 'Посчитать', 'Запомнить', 'Система счисления', 'Число', '+,-,*,/', 'Выберите действие', 'Достать из памяти', 'Очистить ячейку памяти', 'Число не соответствует системе счисления','Нет свободной ячейки памяти', 'Ячейка памяти пуста','Вы выбрали русский язык'), ('Do arithmetic', 'Transfer to another scale of notation', 'Count', 'Remember', 'Scale of notation', 'Number', '+,-,*,/', 'Select the action', 'Get from memory', 'Clear memory cell', 'Number don''t feet in the scale of notation','No empty memory cell','Memory cell is empty','You choosed english language')); type TForm1 = class(TForm) Label2: TLabel; Button1: TButton; Label3: TLabel; Label4: TLabel; Button2: TButton; Button3: TButton; Button4: TButton; Edit1: TEdit; Label5: TLabel; Edit2: TEdit; Label6: TLabel; Edit3: TEdit; Edit4: TEdit; Label7: TLabel; Label8: TLabel; Button5: TButton; Button6: TButton; Label9: TLabel; RadioButton1: TRadioButton; RadioButton2: TRadioButton; RadioGroup1: TRadioGroup; Button7: TButton; MainMenu1: TMainMenu; File1: TMenuItem; Exit1: TMenuItem; Label1: TLabel; //procedure CheckBox1Click(Sender: TObject); //procedure CheckBox2Click(Sender: TObject); procedure CheckBox3Click(Sender: TObject); //procedure CheckBox4Click(Sender: TObject); procedure Button5Click(Sender: TObject); procedure RadioButton1Click(Sender: TObject); procedure RadioButton2Click(Sender: TObject); procedure RadioGroup1Click(Sender: TObject); procedure Button6Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure Button7Click(Sender: TObject); procedure Exit1Click(Sender: TObject); //procedure Button7Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; l, i, activity: longint; st1, st2: int64; u1, u2, rg1: boolean; st, h: string; cod: integer; implementation function max(var a, b: integer): integer; begin if a > b then max := a else max := b; end;

Procedure PutBig(var a: string); begin for i := 1 to length(a) do if a[i] in ['a'..'z'] then a[i] := chr(ord(a[i]) + ord('A') - ord('a')); end;

Function chekSys(a: string; s: int64): boolean; var fail: boolean; begin fail := false; while length(a) > 0 do begin if (a[length(a)] >= '0') and (a[length(a)] <= '9') and (a[length(a)] >= chr(ord('0') + s)) then fail := true else if (a[length(a)] >= chr(ord('A') + s - 10)) then fail := true; delete(a, length(a), 1); end; chekSys := fail; end;

Function Tto10(var a: string; s1: int64): int64; var k, p, h: int64; i, j: longint; begin k := 0; p := 1; while length(a) > 0 do begin if (a[length(a)] <= '9') then h := ord(a[length(a)]) - ord('0') else h := ord(a[length(a)]) - ord('A') + 10; k := p * h + k; p := p * s1; delete(a, length(a), 1); end; Tto10 := k; end;

Function Tfrom10(var a, s: int64): string; var k, h, p: int64; st: string; begin p := s; st := ''; while a > 0 do begin

h := a mod p; if h <= 9 then st := chr(ord('0') + h) + st else st := chr(ord('A') + h - 10) + st; a := a div p; end; Tfrom10 := st; end;

Function trans(var a: string; s1, s2: int64): string; var k, p, q: int64; b: int64; begin b := Tto10(a, s1); trans := Tfrom10(b, s2); end;

{$R *.dfm} procedure TForm1.CheckBox3Click(Sender: TObject); begin L := 1; Label2.Caption := lng[l, 8]; Form1.Label5.Caption := ''; Form1.Label6.Caption := ''; Form1.Label7.Caption := ''; Form1.Label8.Caption := ''; Button5.Caption := lng[l, 3]; Button6.Caption := lng[l, 4]; Button1.Caption := lng[l, 9]; Button2.Caption := lng[l, 9]; Button3.Caption := lng[l, 10]; Button4.Caption := lng[l, 10]; Label3.Caption := ''; Label9.Caption := ''; Label4.Caption := ''; Edit1.Text := ''; Edit2.Text := ''; Edit3.Text := ''; Edit4.Text := ''; Form1.RadioButton1.Caption := lng[l, 2]; Form1.RadioButton2.Caption := lng[l, 1]; Form1.RadioGroup1.Items.Add('Ðóññêèé'); Form1.RadioGroup1.Items.Add('English'); Form1.Canvas.Rectangle(5, 75, 510, 37); end; procedure TForm1.Button5Click(Sender: TObject); var s1: string; ste1, ste2: integer; begin s1 := Edit1.text; PutBig(s1); ste1 := strtoint(Edit2.Text); ste2 := strtoint(Edit3.Text); if ChekSys(s1, max(ste1, ste2)) then Label9.Caption := lng[l, 11] else if activity = 1 then begin

val(Edit4.Text, st1, cod); Label9.Caption := ''; st := Edit1.Text; h := Edit3.Text; if (cheksys(st, st1) = false) or (cheksys(h, st1) = false) then Label9.Caption := lng[l,11] else begin st := Edit1.Text; h := Edit3.Text; if Edit2.Text = '+' then st2 := TTo10(st,st1) + TTo10(h, st1); if Edit2.Text = '-' then begin st2 := TTo10(st,st1) + TTo10(h, st1); if st2 < 0 then Label9.Caption := '-'; st2 := -st2; end; if Edit2.Text = '/' then st2 := round(Tto10(st,st1) / Tto10(h,st1)); if Edit2.Text = '*' then st2 := TTo10(st,st1) * TTo10(h, st1);

Label9.Caption := Tfrom10(st2, st1); end; end else begin st := Edit1.Text; val(Edit2.Text, st1, cod); val(Edit3.Text, st2, cod); st := trans(st, st1, st2); Label9.Caption := st; end; end; procedure TForm1.RadioButton1Click(Sender: TObject); begin if l = 0 then l := 1; Form1.Label5.Caption := lng[l, 6]; Form1.Label6.Caption := lng[l, 5] + ' 1'; Form1.Label7.Caption := lng[l, 5] + ' 2'; Form1.Label8.Caption := ''; activity := 0; Form1.Edit4.Text := '-'; end; procedure TForm1.RadioButton2Click(Sender: TObject); begin if l = 0 then l := 1; Form1.Label5.Caption := lng[l, 6] + ' 1'; Form1.Label6.Caption := lng[l, 7]; Form1.Label7.Caption := lng[l, 6] + ' 2'; Form1.Label8.Caption := lng[l, 5]; Form1.Edit4.Text := ''; activity := 1; end; procedure TForm1.RadioGroup1Click(Sender: TObject); begin

if Form1.RadioGroup1.ItemIndex = 0 then begin L := 1; Button5.Caption := lng[l, 3]; Button6.Caption := lng[l, 4]; Button1.Caption := lng[l, 9]; Button2.Caption := lng[l, 9]; Button3.Caption := lng[l, 10]; Button4.Caption := lng[l, 10]; Label3.Caption := ''; Label4.Caption := ''; Edit1.Text := ''; Edit2.Text := ''; Edit3.Text := ''; Edit4.Text := ''; Label9.Caption := ''; Form1.RadioButton1.Caption := lng[l, 2]; Form1.RadioButton2.Caption := lng[l, 1]; Form1.Canvas.Rectangle(5, 75, 510, 37); activity := 2; Form1.Label9.Caption := lng[l, 14]; Form1.Label2.Caption := lng[l, 8]; end; if Form1.RadioGroup1.ItemIndex = 1 then begin L := 2; Label2.Caption := lng[l, 8]; Button5.Caption := lng[l, 3]; Button6.Caption := lng[l, 4]; Button1.Caption := lng[l, 9]; Button2.Caption := lng[l, 9]; Button3.Caption := lng[l, 10]; Button4.Caption := lng[l, 10]; Label3.Caption := ''; Label9.Caption := ''; Label4.Caption := ''; Edit1.Text := ''; Edit2.Text := ''; Edit3.Text := ''; Edit4.Text := ''; Form1.RadioButton1.Caption := lng[l, 2]; Form1.RadioButton2.Caption := lng[l, 1]; // Form1.RadioGroup1.InsertComponent(RadioButton1); Form1.Canvas.Rectangle(5, 75, 510, 37); activity := 2; Form1.Label9.Caption := lng[l, 14]; Form1.Label2.Caption := lng[l, 8]; end; end; procedure TForm1.Button6Click(Sender: TObject); begin st := Form1.Label9.Caption; if (u1) and (u2) then begin Form1.Label9.Caption := lng[l, 12]; end else if not u1 then begin label3.Caption := st; u1 := true; end else if not u2 then begin label4.Caption := st; u2 := true; end; end; procedure TForm1.Button1Click(Sender: TObject); begin if not u1 then Form1.Label9.Caption := lng[l, 13] else Edit1.Text := Label3.Caption; end; procedure TForm1.Button2Click(Sender: TObject); begin if not u2 then Form1.Label9.Caption := lng[l, 13] else Edit1.Text := Label4.Caption; end; procedure TForm1.Button3Click(Sender: TObject); begin u1 := false; Label3.Caption := ''; end; procedure TForm1.Button4Click(Sender: TObject); begin u2 := false; Label4.Caption := ''; end; procedure TForm1.Button7Click(Sender: TObject); begin L := 1;

RadioGroup1.Caption := ''; if not rg1 then begin Form1.RadioGroup1.Items.Add('Ðóññêèé'); Form1.RadioGroup1.Items.Add('English'); rg1 := true; end; Form1.Canvas.Rectangle(5, 75, 510, 37); end; procedure TForm1.Exit1Click(Sender: TObject); begin halt; end; end.

Graphic builder: unit graphic_builder; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Math; const eps = 0.00000001; const dotes = 8000; type Temas = array[1..10000] of extended; type Tdmas = array[1..10000] of integer; type Wh = record str: string; oth: Temas; end; type Wfail = record x: extended; fail: boolean; end; type TForm1 = class(TForm) Edit1: TEdit; Label1: TLabel; Edit2: TEdit; Label2: TLabel; Edit3: TEdit; Edit4: TEdit; Label3: TLabel; Label4: TLabel; CheckBox1: TCheckBox; Edit5: TEdit; Button1: TButton; Label6: TLabel; Label7: TLabel; ListBox1: TListBox; Label5: TLabel; Label8: TLabel; Label9: TLabel; Label10: TLabel; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; hait_of_form, hait, wid: longint; implementation procedure set_constants; begin hait_of_form := 800; wid := 690; hait := 690; end; procedure draw_osi; var x, y, m: longint; h, xmin1, ymin1, xmin, ymin, xmax, ymax: longint; size: longint; s: string; begin Form1.Canvas.MoveTo(3, hait_of_form - 3); Form1.Canvas.LineTo(712, hait_of_form - 3); Form1.Canvas.LineTo(712, hait_of_form - 11 - hait); Form1.Canvas.LineTo(3, hait_of_form - 11 - hait); Form1.Canvas.LineTo(3, hait_of_form - 3); Form1.Canvas.MoveTo(5, hait_of_form - 5); Form1.Canvas.LineTo(710, hait_of_form - 5); Form1.Canvas.LineTo(710, hait_of_form - 9 - hait); Form1.Canvas.LineTo(5, hait_of_form - 9 - hait); Form1.Canvas.LineTo(5, hait_of_form - 5); xmin := strtoint(Form1.Edit1.text); xmax := strtoint(Form1.Edit2.text); ymin := strtoint(Form1.Edit3.text); ymax := strtoint(Form1.Edit4.text); if xmin * xmax < 0 then begin xmin1 := -xmin; x := round(wid * xmin1 / (xmin1 + xmax)); Form1.Canvas.MoveTo(x + 10, hait_of_form - 10); Form1.Canvas.LineTo(x + 10, Hait_of_form - hait); Form1.Canvas.LineTo(x + 8, hait_of_form - hait + 6); Form1.Canvas.LineTo(x + 12, Hait_of_form - hait + 6); Form1.Canvas.LineTo(x + 10, Hait_of_form - hait); end; if ymin * ymax < 0 then begin ymin1 := -ymin; y := round(hait_of_form - hait * ymin1 / (ymin1 + ymax)); Form1.Canvas.MoveTo(10, y); Form1.Canvas.LineTo(wid, y); Form1.Canvas.LineTo(wid - 6, y + 2); Form1.Canvas.LineTo(wid - 6, y - 2); Form1.Canvas.LineTo(wid, y); end; Form1.Canvas.TextOut(x - 5, hait_of_form - hait - 5, 'Y'); Form1.Canvas.TextOut(wid - 5, y + 8, 'X'); Form1.Canvas.TextOut(x - 5, y + 8, '0'); size := 1; m := x + round(wid / (xmax - xmin) * size); str(size, s); Form1.Canvas.TextOut(m + 5, y + 8, s); Form1.Canvas.MoveTo(m + 10, y + 3); Form1.Canvas.LineTo(m + 10, y - 3); size := 1; m := y - round(hait / (ymax - ymin) * size); Form1.Canvas.TextOut(x - 5, m, s); Form1.Canvas.MoveTo(x + 13, m); Form1.Canvas.LineTo(x + 7, m); end; function tan(x: extended): extended; begin tan := sin(x) / cos(x); end; function find_close(var s: string; num: integer): integer; var i, k: integer; begin k := 1; i := num; while k <> 0 do begin inc(i); if s[i] = '(' then inc(k); if s[i] = ')' then dec(k); end; find_close := i; end; function end_of_sin(var s: string; n: integer): integer; var i: integer; begin if s[n + 3] = '2' then end_of_sin := find_close(s, n + 4) else end_of_sin := find_close(s, n + 3); end; procedure prepare(var s: string); var l, r, i: integer; begin for i := 1 to length(s) do begin if s[i] in ['s', 'c', 't'] then begin r := end_of_sin(s, i); if s[i + 3] = '2' then l := 4 else l := 3; delete(s, i + 1, l); if (l = 3) and (s[i] = 's') then begin s[i] := '@'; s[r - l] := '#'; end; if (l = 3) and (s[i] = 'c') then begin s[i] := '$'; s[r - l] := '%'; end; if (l = 3) and (s[i] = 't') then begin s[i] := '&'; s[r - l] := '?'; end; if (l = 4) and (s[i] = 's') then begin s[i] := '"'; s[r - l] := ';'; end; if (l = 4) and (s[i] = 'c') then begin s[i] := ':'; s[r - l] := '\'; end; if (l = 4) and (s[i] = 't') then begin s[i] := '`'; s[r - l] := '~'; end; end; if s[i] = '|' then if (i = 1) or (s[i - 1] in ['+', '-', '*', '/', '^', '!', '<', '[', '{', '(', '@', '$', '&', '"', ':', '`']) then s[i] := '!'; end; end; function sk(ch: char): boolean; begin if ch in ['<', '>', '(', ')', '[', ']', '{', '}', '|', '!', '@', '#', '$', '%', '&', '?', '"', ';', ':', '\', '`', '~'] then sk := true else sk := false; end; function count_in_skoba(var sk: char; n: extended): extended; var rez: extended; begin rez := 0; if sk in ['<', '>'] then if n + eps > 0 then rez := sqrt(n) else rez := -1; if sk in ['[', ']'] then rez := trunc(n); if sk in ['{', '}'] then rez := n - trunc(n); if sk in ['(', ')'] then rez := n; if sk in ['|', '!'] then rez := abs(n); if sk in ['@', '#'] then rez := sin(n); if sk in ['$', '%'] then rez := cos(n); if sk in ['&', '?'] then rez := tan(n); if sk in ['"', ';'] then rez := sin(n) * sin(n); if sk in [':', '\'] then rez := cos(n) * cos(n); if sk in ['`', '~'] then rez := tan(n) * tan(n); count_in_skoba := rez; end; function pr(ch: char): integer; begin if ch in ['+', '-'] then pr := 2 else if ch in ['*', '/'] then pr := 3 else if ch = '^' then pr := 4 else if sk(ch) then pr := 1 else pr := -1; end; function checkoz(var o, z: char): boolean; begin if ((o = '!') and (z = '|')) or ((o = '{') and (z = '}')) or ((o = '[') and (z = ']')) or ((o = '(') and (z = ')')) or ((o = '<') and (z = '>')) or ((o = '@') and (z = '#')) or ((o = '$') and (z = '%')) or ((o = '&') and (z = '?')) or ((o = '"') and (z = ';')) or ((o = ':') and (z = '\')) or ((o = '`') and (z = '~')) then checkoz := true else checkoz := false; end; function make_string(var s: string; l, r: integer): string; var k: string; i: integer; begin k := ''; for i := l to r do k := k + s[i]; make_string := k; end; function mins(var s: string; i: integer): boolean; begin if s[i] <> '-' then mins := false else begin if i = 1 then mins := true else begin if s[i - 1] = '(' then mins := true else mins := false; end; end; end; function make(var s: string; x: extended): Wh; var j, i, kol, cot: integer; q: string; w: extended; n: Temas; k: string; minus: longint; begin kol := 0; k := ''; fillchar(n, sizeof(n), 0); i := 1; while i <= length(s) do begin if (pr(s[i]) > 0) or (s[i] in ['s', 'c', 't']) then begin if s[i] in ['s', 'c', 't'] then begin k := k + make_string(s, i, end_of_sin(s, i)); i := end_of_sin(s, i); end else k := k + s[i]; end; inc(i); end; i := 1; kol := 0; while i <= length(s) do begin q := 'z'; while pr(s[i]) > 0 do inc(i); if s[i] in ['s', 'c', 't'] then begin i := end_of_sin(s, i); inc(kol); end; minus := 1;//if mins(s, i - 1) then minus := -1 else minus := 1; while (i <= length(s)) and ((pr(s[i]) < 0) or ((q[1] in ['s', 'c', 't']) and (not sk(s[i])))) do begin if q = 'z' then q := ''; q := q + s[i]; inc(i); end; val(q, w, cot); if cot = 0 then begin inc(kol); n[kol] := w * minus; end; if q = 'x' then begin inc(kol); n[kol] := x * minus; end; if (q = 'pi') or (q = 'p') then begin inc(kol); n[kol] := pi * minus; end; if q = 'e' then begin inc(kol); n[kol] := 2.71828182846 * minus; end; inc(i); if i <= length(s) then end; kol := 0; {for i := 1 to length(k) do begin if not sk(k[i]) then inc(kol); if k[i] = '-' then begin j := i + 1; if pr(k[j]) = 2 then begin k[i] := '+'; n[kol + 1] := -n[kol + 1]; end; end; end; } kol := 0; for i := 1 to length(k) do begin if not sk(k[i]) then inc(kol); if k[i] = '/' then begin j := i + 1; if pr(k[j]) = 3 then begin k[i] := '*'; if n[kol + 1] <> 0 then n[kol + 1] := 1 / n[kol + 1]; end; end; end; make.str := k; make.oth := n; end; function op(var s: string; n: integer): boolean; begin if s[n] in ['(', '{', '[', '<', '!', '@', '$', '&', '"', ':', '`'] then op := true else op := false; end; function cl(var s: string; n: integer): boolean; begin if s[n] in [']', '}', ')', '>', '|', '#', '%', '?', ';', '\', '~'] then cl := true else cl := false; end; function krut(var s: string; n: integer): boolean; var f, w: boolean; begin f := false; w := false; if (n = 1) or ((not cl(s, n - 1)) and (pr(s[n]) >= pr(s[n - 1]))) then f := true; if(n = length(s)) or ((not op(s, n + 1)) and (pr(s[n]) >= pr(s[n + 1]))) then w := true; if (f) and (w) then krut := true else krut := false; end; function operation(var ch: char; a, b: extended; err: integer): WFail; var st: longint; ans: WFail; begin if err = 0 then begin if ch = '+' then b := a + b; if ch = '-' then b := a - b; if ch = '*' then b := a * b; if ch = '^' then begin if (a < 0) and (abs(b - round(b)) < eps) then begin st := round(b); if st mod 2 = 0 then b := power(-a, b) else b := -power(-a, b); end else if ((a = 0) and (b = 0)) or (a < 0) then err := 1 else b := power(a, b); end; if ch = '/' then if abs(b) < eps then err := 1 else b := a / b; end else b := 0; ans.x := b; if err = 1 then ans.fail := true else ans.fail := false; operation := ans; end; procedure ydal(var k: string; u: Tdmas); var s: string; i: integer; begin s := ''; for i := 1 to length(k) do if u[i] <> 100500 then s := s + k[i]; k := s; end; function get_value(var s: string; x: extended): WFail; var n: Temas; u, uk: Tdmas; k, t: string; y, q, kl, l, r, i, j, kol, err, op: integer; rez, m: extended; yd, fail: boolean; wth: Wh; b, ans: Wfail; daleko: longint; begin err := 0; prepare(s); wth := make(s, x); k := wth.str; n := wth.oth; i := 1; kol := 0; err := 0; for i := 1 to length(k) do u[i] := 0; fail := false; while not fail do begin kol := 0; fillchar(u, sizeof(u), 0); fillchar(uk, sizeof(uk), 0); op := 0; i := 1; while i <= length(k) do begin yd := false; if not sk(k[i]) then inc(kol); if (i <> 1) and (checkoz(k[i - 1], k[i])) then begin n[kol + 1] := count_in_skoba(k[i], n[kol + 1]); if (k[i] in ['<', '>']) and (n[kol + 1] < 0) then err := 1; delete(k, i - 1, 2); i := i - 2; yd := true; end; if (not yd) and (length(k) > 0) and (not sk(k[i])) and (krut(k, i)) then begin ans := operation(k[i], n[kol], n[kol + 1], err); n[kol + 1] := ans.x; if ans.fail then err := 1; u[kol] := 1; uk[i] := 100500; inc(op); if err = 1 then fail := true; end; inc(i); end; kl := 0; i := 1; q := 1; while q <= length(k) + 1 do begin while u[q] = 1 do inc(q); n[i] := n[q]; inc(i); inc(q); end; ydal(k, uk); kol := 0; for i := 1 to length(k) do begin if not sk(k[i]) then inc(kol); if k[i] = '-' then begin j := i + 1; if pr(k[j]) = 2 then begin k[i] := '+'; n[kol + 1] := -n[kol + 1]; end; end; end; kol := 0; for i := 1 to length(k) do begin if not sk(k[i]) then inc(kol); if k[i] = '/' then begin j := i + 1; if pr(k[j]) = 3 then begin k[i] := '*'; if n[kol + 1] = 0 then begin fail := true; err := 1; break; end else n[kol + 1] := 1 / n[kol + 1]; end; end; end; if length(k) = 0 then fail := true; end; if err = 0 then fail := false; if err = 1 then fail := true; get_value.x := n[1]; get_value.fail := fail; end; procedure get_reed_of_minus(var s: string); var i: longint; begin i := 1; while i <= length(s) do begin if (s[i] = '-') and ((i = 1) or (s[i - 1] = '(')) then insert('0', s, i); inc(i); end; end; procedure final(); var i, code: integer; s: string; xprz, yprz, yd, x0, ypr, ylast, xd, xpr, x, y, xl, xh, yl, yh: extended; mid, ylst, ycan: Wfail; prev: boolean; begin if Form1.CheckBox1.State = cbUnchecked then Form1.refresh; s := Form1.Edit1.text; val(s, xl, code); s := Form1.Edit2.text; val(s, xh, code); s := Form1.Edit3.text; val(s, yl, code); s := Form1.Edit4.text; val(s, yh, code); s := Form1.Edit5.text; get_reed_of_minus(s); x := xl; prev := false; for i := 1 to dotes do begin x := x + ((xh - xl) / (dotes - 1)); ycan := get_value(s, x); y := ycan.x; if x > -15 then x := x; if (not ycan.fail) and (y - yl + eps > 0) and (yh - y + eps > 0) then begin xd := wid * ((x - xl) / (xh - xl)); yd := hait_of_form - hait * ((y - yl) / (yh - yl)); if prev then begin mid := get_value(s, (x + xpr) / 2); if (not mid.fail) and ((mid.x - y) * (mid.x - ypr) < eps) then begin Form1.Canvas.MoveTo(round(xprz) + 10, round(yprz)); Form1.Canvas.LineTo(round(xd) + 10, round(yd)); end; end; prev := true; xpr := x; ypr := y; xprz := xd; yprz := yd; end else prev := false; end; end;

{$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin set_constants; final; draw_osi; end; procedure TForm1.Button2Click(Sender: TObject); begin Form1.ListBox1.Items.Add('Тригонометрические функции записываются:'); Form1.ListBox1.Items.Add('sin(), cos(), tan(), sin2(), cos2(), tan2().'); Form1.ListBox1.Items.Add('Квадратный корень - <...>.'); Form1.ListBox1.Items.Add('Выражение, из которого извлекается'); Form1.ListBox1.Items.Add('квадратный корень должно быть'); Form1.ListBox1.Items.Add('записано в следующих скобках: < и >.'); Form1.ListBox1.Items.Add('Например, корень и х должен быть'); Form1.ListBox1.Items.Add('записан, как .'); Form1.ListBox1.Items.Add('Программа умеет работать с функциями'); Form1.ListBox1.Items.Add('модуля - |x|, целой части - [x] и'); Form1.ListBox1.Items.Add('дробной части - {x}.'); Form1.ListBox1.Items.Add('Пожалуйста, записывайте функции правильно,'); form1.ListBox1.Items.Add('иначе вылезет ошибка.'); end; end.

Recommended publications