CN102393818A - Digital function graph drawing method - Google Patents

Digital function graph drawing method Download PDF

Info

Publication number
CN102393818A
CN102393818A CN2011102057706A CN201110205770A CN102393818A CN 102393818 A CN102393818 A CN 102393818A CN 2011102057706 A CN2011102057706 A CN 2011102057706A CN 201110205770 A CN201110205770 A CN 201110205770A CN 102393818 A CN102393818 A CN 102393818A
Authority
CN
China
Prior art keywords
function
expression
stack
symbol
functional
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN2011102057706A
Other languages
Chinese (zh)
Inventor
丁万年
廖强
何永安
陈日良
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
FUZHOU RETURNSTAR DIGITAL TECHNOLOGY Co Ltd
Original Assignee
FUZHOU RETURNSTAR DIGITAL TECHNOLOGY Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by FUZHOU RETURNSTAR DIGITAL TECHNOLOGY Co Ltd filed Critical FUZHOU RETURNSTAR DIGITAL TECHNOLOGY Co Ltd
Priority to CN2011102057706A priority Critical patent/CN102393818A/en
Publication of CN102393818A publication Critical patent/CN102393818A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention provides a digital function graph drawing method, which comprises the following steps of: creating a canva window, receiving a function expression formula input by a user, and a to-be-drawn function graph X-axis interval definitional domain; analyzing the function expression formula to obtain a symbol of an operator of the function expression formula and a symbol of a function name; judging whether the expression formula input by the user is a legitimate infix expression formula or not according to the format of an infix expression formula, if not, giving out a prompting window and exiting, and if so, analyzing a suffix expression formula; computing function values corresponding to points in the function graph X-axis interval definitional domain, simultaneously, forming a series of point coordinates by the points in the definitional domain and the function values corresponding to the points; and drawing a to-be-drawn function graph through a graph function interface provided by a 2D (the 2nd-dimensional) drawing library. According to the invention, the function expression formula input by the user and the to-be-drawn graph X-axis interval definitional domain are realized, the function graph required is automatically drawn, and convenience is provided for the teaching of teachers.

Description

The digital function pattern drawing method
[technical field]
The present invention relates to computer software fields, relate in particular to a kind of digital function pattern drawing method.
[background technology]
" infix expression " that the present invention told about; The concrete characteristics of " postfix expression " " simple data structure " these chapters and sections in " algorithm and the data structure " of peaceful positive element work have detailed introduction, and wherein expression formula is divided into three kinds of forms: infix expression, postfix expression, prefix expression.
Infix expression: operational symbol is placed in the middle of two operands, as: (2+1) * 3;
Postfix expression: do not comprise bracket, operational symbol is placed on the back of two operands, the order that all calculating occurs by operational symbol, strictness carry out from left to right (no longer consider the priority rule of operational symbol, as: 2 1+3 *);
Prefix expression: the same with postfix expression, do not comprise bracket, operational symbol is placed on the front of two operands, as: *+2 13.
The algorithm thought that at present converts infix expression into postfix expression is to accomplish by means of stack in the data structure and team, and its overall algorithm thought is following: directly deliver in the output queue when reading numeral; When reading operational symbol t, the operational symbol that all priority in the stack is greater than or equal to t ejects, and delivers in the output queue; When reading left parenthesis, always it is pressed in the stack; When reading right parenthesis, will all eject successively near first operational symbol above left parenthesis of stack top, deliver to output queue after, abandon left parenthesis again; Accomplish infix expression at last and convert postfix expression into.
The specific practice that the utilization postfix expression calculates is following:
At first, set up a stack S;
Secondly, from left to right read postfix expression, read numeral and just convert it into numerical value and be pressed among the stack S, read operational symbol and then from stack, eject two numbers successively and give variable Y and X respectively, the form computing machine with " X operational symbol Y " goes out the result then, and pressure adds among the stack S again;
At last, if postfix expression does not run through, just repeat top process, the numerical value of exporting stack top at last is then for finishing.
Along with developing rapidly of computing machine, relevant mapping software also arises at the historic moment.At present a lot of softwares have been realized can the visual function of explicit function.Making a general survey of these software, all is pre-designed several kinds of fixing functions, that is to say that software can only show the graph of function picture that these are pre-designed.Yet in practical application, the user often need import the expression formula of a function, and given function figure X axle section definition territory, and software just can directly provide the pairing functional image of expression formula.Implementation method just compares hommization like this, and makes things convenient for teacher's teaching.
[summary of the invention]
The technical matters that the present invention will solve is to provide a kind of digital function pattern drawing method, as long as function expression of user's input and the functional digraph X axle section definition territory that will draw can be drawn out desired functional digraph automatically.
The present invention is achieved in that a kind of digital function pattern drawing method, comprises the steps:
Step 10, establishment project engineering are created a painting canvas window in said project engineering;
Step 20, painting canvas window receive function expression of user's input and the functional digraph X axle section definition territory that will draw;
Step 30, in the painting canvas window, parse function expression of user input, obtain the operational symbol symbol of function expression, the function name symbol; And the expression formula legal infix expression whether that comes the judges input of the form through infix expression, if illegal, then provide prompt window, and withdraw from; If legal, then parse postfix expression;
Step 40, the functional digraph X axle section definition territory that utilizes the user to import to draw; And the postfix expression that parses; Method through the data structure stack; Try to achieve the corresponding functional value of each point on the functional digraph X axle section definition territory, simultaneously each point on the field of definition and the corresponding functional value of each point are formed the series of points coordinate;
The point coordinate of step 50, the functional digraph that will draw of trying to achieve according to step 40, the picture function interface that utilizes the 2D draw library of operating system to provide, the functional digraph that will draw come out with smooth curve plotting.
Through the stack method in the data structure, try to achieve the functional value that each point is corresponding on the functional digraph X axle section definition territory and specifically comprise following method in the wherein said step 40:
Step 41, set up a data structure stack S, and defining variable M, N;
Step 42, from left to right read said postfix expression; Just be converted into numerical value and be pressed among the stack S when reading numeral, then from stack, eject two numerical value successively and distribute to variable M and N respectively when reading operational symbol, the form with M operational symbol N calculates the result then; Press again and add among the stack S; Then from stack, eject a numerical value and distribute to variable M when reading the function name symbol, the form with the function name symbol M calculates the result then, presses to add among the stack S again;
If step 43 postfix expression does not run through, with regard to the process of repeating step 42, the data of exporting stack top at last then are the corresponding functional value of point on the field of definition.
The present invention has following advantage: the present invention receives function expression of user's input and the functional digraph X axle section definition territory that will draw through the painting canvas window; Analytical function is expressed formula, obtains the operational symbol symbol of function expression, the function name symbol; And the infix expression of function expression resolved to postfix expression; Through the stack method in the data structure, try to achieve the corresponding functional value of each point on the functional digraph X axle section definition territory; The picture function interface that provides with the 2D draw library of operating system at last, the explicit function figure.The present invention has realized drawing out desired functional digraph automatically, for teachers ' teaching provides convenience by function expression of user's input and the functional digraph X axle section definition territory that will draw.
[description of drawings]
Fig. 1 is the inventive method schematic flow sheet.
[embodiment]
Please with reference to shown in Figure 1, a kind of digital function pattern drawing method comprises the steps:
Step 10, establishment project engineering are created a painting canvas window in said project engineering;
Step 20, painting canvas window receive function expression (as: sin (x), cos (x), tan (x), abs (x), the expression formula of log (x) etc. and arithmetic combination in any) of user's input and the functional digraph X axle section definition territory that will draw;
Step 30, in the painting canvas window, parse function expression of user input, obtain the operational symbol symbol of function expression, the function name symbol; And the form through infix expression (its form can referring to the definition of the infix expression in the background technology) the expression formula legal infix expression whether that comes the judges input, if illegal, then provide prompt window, and withdraw from; If legal, then parse postfix expression (its by infix expression parse the method for postfix expression can be referring to " infix expression converts the algorithm thought of postfix expression into " in the background technology its relevant knowledge that mainly uses formation in the computing machine " data structure ", stack and tree obtain postfix expression);
Step 40, the functional digraph X axle section definition territory that utilizes the user to import to draw; And the postfix expression that parses; Method through the data structure stack; Try to achieve the corresponding functional value of each point on the functional digraph X axle section definition territory, simultaneously each point on the field of definition and the corresponding functional value of each point are formed the series of points coordinate;
The point coordinate of step 50, the functional digraph that will draw of trying to achieve according to step 40, the picture function interface that utilizes the 2D draw library of operating system to provide, the functional digraph that will draw come out with smooth curve plotting.
Through the stack method in the data structure, try to achieve the functional value that each point is corresponding on the functional digraph X axle section definition territory and specifically comprise following method in the wherein said step 40:
Step 41, set up a data structure stack S, and defining variable M, N;
Step 42, from left to right read said postfix expression; Just be converted into numerical value and be pressed among the stack S when reading numeral, then from stack, eject two numerical value successively and distribute to variable M and N respectively when reading operational symbol, the form with M operational symbol N calculates the result then; Press again and add among the stack S; Then from stack, eject a numerical value and distribute to variable M when reading the function name symbol, the form with the function name symbol M calculates the result then, presses to add among the stack S again;
If step 43 postfix expression does not run through, with regard to the process of repeating step 42, the data of exporting stack top at last then are the corresponding functional value of point on the field of definition.
Below in conjunction with a specific embodiment whole operation process of the present invention is elaborated:
Function expression of supposing user's input is: sin (x+3), and its X axle section definition territory is (3,3), then handles as follows:
At first, parse by the sin (x+3) of user input: function name symbol sin, (, x ,+, 3), our infix expression of wanting just, promptly infix expression is sin (x+3),
Secondly, infix expression is resolved to postfix expression: x, 3 ,+, sin;
Suppose to require the point 2 on the X axle section definition territory (3,3) this moment, then infix expression is that x is an argument of function among the sin (x+3), and value is 2, just makes x=2; Sin is that we discern the function (sin, cos, abs, sqrt, sqr, tran etc.) in the storehouse, its postfix expression: 2,3 ,+, sin; Then through the stack method in the data structure, the functional values of trying to achieve point 2 correspondences on the functional digraph X axle section definition territory specifically comprise following method:
Step 41, set up a data structure stack S, and defining variable M, N;
Step 42, from left to right read said postfix expression: 2,3 ,+, sin; Just be converted into numerical value and be pressed among the stack S when reading numeral 2, just be converted into numerical value and also be pressed among the stack S when reading numeral 3; When read operational symbol+; Then from stack, eject two numerical value (2,3) successively and distribute to variable M=2 and N=3 respectively, calculating the result with the form (being 2+3) of M operational symbol N then is 5; Press again and add among the stack S; Then from stack, eject a numerical value and promptly 5 distribute to variable M when reading function name symbol sin, then M=5 calculates result-0.96 with the form (being sin5) of function name symbol M then, presses to add among the stack S again; The data of exporting stack top at last then are the corresponding functional value of point on the field of definition, and will put 2 and form coordinate (2 ,-0.96) with point 2 corresponding functional values-0.96.
At last, calculate X axle section definition territory (3,3) respectively with this principle and go up other the corresponding functional value of point; Each point on the field of definition and the corresponding functional value of each point are formed the series of points coordinate.
According to the point coordinate of the above-mentioned functional digraph that will draw of trying to achieve, the picture function interface that utilizes the 2D draw library of operating system to provide, the functional digraph that will draw come out with smooth curve plotting.
The above is merely preferred embodiment of the present invention, and all equalizations of doing according to claim of the present invention change and modify, and all should belong to covering scope of the present invention.

Claims (2)

1. a digital function pattern drawing method is characterized in that: comprise the steps:
Step 10, establishment project engineering are created a painting canvas window in said project engineering;
Step 20, painting canvas window receive function expression of user's input and the functional digraph X axle section definition territory that will draw;
Step 30, in the painting canvas window, parse function expression of user input, obtain the operational symbol symbol of function expression, the function name symbol; And the expression formula legal infix expression whether that comes the judges input of the form through infix expression, if illegal, then provide prompt window, and withdraw from; If legal, then parse postfix expression;
Step 40, the functional digraph X axle section definition territory that utilizes the user to import to draw; And the postfix expression that parses; Method through the data structure stack; Try to achieve the corresponding functional value of each point on the functional digraph X axle section definition territory, simultaneously each point on the field of definition and the corresponding functional value of each point are formed the series of points coordinate;
The point coordinate of step 50, the functional digraph that will draw of trying to achieve according to step 40, the picture function interface that utilizes the 2D draw library of operating system to provide, the functional digraph that will draw come out with smooth curve plotting.
2. digital function pattern drawing method according to claim 1 is characterized in that: through the stack method in the data structure, try to achieve the functional value that each point is corresponding on the functional digraph X axle section definition territory and specifically comprise following method in the said step 40:
Step 41, set up a data structure stack S, and defining variable M, N;
Step 42, from left to right read said postfix expression; Just be converted into numerical value and be pressed among the stack S when reading numeral, then from stack, eject two numerical value successively and distribute to variable M and N respectively when reading operational symbol, the form with M operational symbol N calculates the result then; Press again and add among the stack S; Then from stack, eject a numerical value and distribute to variable M when reading the function name symbol, the form with the function name symbol M calculates the result then, presses to add among the stack S again;
If step 43 postfix expression does not run through, with regard to the process of repeating step 42, the data of exporting stack top at last then are the corresponding functional value of point on the field of definition.
CN2011102057706A 2011-07-21 2011-07-21 Digital function graph drawing method Pending CN102393818A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2011102057706A CN102393818A (en) 2011-07-21 2011-07-21 Digital function graph drawing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2011102057706A CN102393818A (en) 2011-07-21 2011-07-21 Digital function graph drawing method

Publications (1)

Publication Number Publication Date
CN102393818A true CN102393818A (en) 2012-03-28

Family

ID=45861147

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2011102057706A Pending CN102393818A (en) 2011-07-21 2011-07-21 Digital function graph drawing method

Country Status (1)

Country Link
CN (1) CN102393818A (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105243049A (en) * 2015-10-15 2016-01-13 武汉筑信科技有限公司 Method for reading-in, analyzing and calculating mathematical function expression based on executable file of stack
CN105955725A (en) * 2016-04-22 2016-09-21 南京南瑞继保电气有限公司 Dynamic graph implementation method
CN107832271A (en) * 2017-10-31 2018-03-23 广州视睿电子科技有限公司 Functional image method for drafting, device, equipment and computer-readable storage medium
CN108062372A (en) * 2017-12-12 2018-05-22 北京百度网讯科技有限公司 image generating method and device based on artificial intelligence
CN108288298A (en) * 2018-01-23 2018-07-17 广州视源电子科技股份有限公司 Method for drafting, device, computer equipment and the storage medium of functional image
CN108520068A (en) * 2018-04-13 2018-09-11 卓易法智(上海)网络科技有限公司 User report generation method, device, storage medium and terminal device
CN108563610A (en) * 2017-07-28 2018-09-21 上海云角信息技术有限公司 A kind of mathematical function CAI software based on mixed reality
CN109388773A (en) * 2018-09-14 2019-02-26 北京金双狐油气技术有限公司 A kind of figure coordinate operation method and device
CN111708540A (en) * 2020-04-30 2020-09-25 北京配天技术有限公司 Variable parameter function analysis method, analyzer and storage device
CN112446001A (en) * 2020-11-05 2021-03-05 西安中科星图空间数据技术有限公司 Waveband calculation method and device suitable for distributed architecture and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101477697A (en) * 2009-01-21 2009-07-08 施昊 Network information inputting editor, network information inputting editing system and method
CN101770451A (en) * 2009-01-21 2010-07-07 施昊 Network editor capable of inputting chemical equation and chemical structural formula and system
CN101777194A (en) * 2009-01-21 2010-07-14 施昊 Network editor capable of inputting functional images and network information inputting and editing system
CN101789131A (en) * 2009-01-21 2010-07-28 施昊 Network editor capable of inputting diagrams and network information input edition system
CN101794455A (en) * 2009-01-21 2010-08-04 施昊 Drawable network editor and network information input editing system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101477697A (en) * 2009-01-21 2009-07-08 施昊 Network information inputting editor, network information inputting editing system and method
CN101770451A (en) * 2009-01-21 2010-07-07 施昊 Network editor capable of inputting chemical equation and chemical structural formula and system
CN101777194A (en) * 2009-01-21 2010-07-14 施昊 Network editor capable of inputting functional images and network information inputting and editing system
CN101789131A (en) * 2009-01-21 2010-07-28 施昊 Network editor capable of inputting diagrams and network information input edition system
CN101794455A (en) * 2009-01-21 2010-08-04 施昊 Drawable network editor and network information input editing system

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105243049A (en) * 2015-10-15 2016-01-13 武汉筑信科技有限公司 Method for reading-in, analyzing and calculating mathematical function expression based on executable file of stack
CN105955725A (en) * 2016-04-22 2016-09-21 南京南瑞继保电气有限公司 Dynamic graph implementation method
CN108563610A (en) * 2017-07-28 2018-09-21 上海云角信息技术有限公司 A kind of mathematical function CAI software based on mixed reality
CN107832271A (en) * 2017-10-31 2018-03-23 广州视睿电子科技有限公司 Functional image method for drafting, device, equipment and computer-readable storage medium
CN108062372A (en) * 2017-12-12 2018-05-22 北京百度网讯科技有限公司 image generating method and device based on artificial intelligence
CN108288298A (en) * 2018-01-23 2018-07-17 广州视源电子科技股份有限公司 Method for drafting, device, computer equipment and the storage medium of functional image
CN108288298B (en) * 2018-01-23 2021-08-10 广州视源电子科技股份有限公司 Method and device for drawing function image, computer equipment and storage medium
CN108520068A (en) * 2018-04-13 2018-09-11 卓易法智(上海)网络科技有限公司 User report generation method, device, storage medium and terminal device
CN109388773A (en) * 2018-09-14 2019-02-26 北京金双狐油气技术有限公司 A kind of figure coordinate operation method and device
CN111708540A (en) * 2020-04-30 2020-09-25 北京配天技术有限公司 Variable parameter function analysis method, analyzer and storage device
CN111708540B (en) * 2020-04-30 2023-11-28 北京配天技术有限公司 Variable parameter function analysis method, analyzer and storage device
CN112446001A (en) * 2020-11-05 2021-03-05 西安中科星图空间数据技术有限公司 Waveband calculation method and device suitable for distributed architecture and storage medium

Similar Documents

Publication Publication Date Title
CN102393818A (en) Digital function graph drawing method
CN105404497A (en) Logic expression analysis method and apparatus
WO2010062862A3 (en) Open entity extraction system
GB2478230A (en) Gesture based edit mode
CN103116513B (en) A kind of heterogeneous multi-nucleus processor compiler
WO2011114228A3 (en) System and method for real-time, push style, distributed dashboard networks
CN104020944A (en) Data input method based on sliding block
EP2677396A3 (en) Method for inputting character and information processing apparatus
JP2008148164A5 (en)
US20100053092A1 (en) Control Method for Touch Screen Device
Chauhan et al. Integral boundary-value problem for impulsive fractional functional differential equations with infinite delay
CN103178962B (en) General-purpose fingerprint authentication method and device
HK1150463A1 (en) Image sharpening processing device, method, and software
CN102314781A (en) Answer system, answer method, computer program product and storage medium
CN105096678A (en) Method and apparatus for assisting in evaluating answer quality of mathematical question
CN115167718A (en) OFD document local amplification display method, device, equipment and storage medium
CN103399780A (en) Integer overflow detecting method based on virtual machine technique and dynamic symbolic execution
CN102033858A (en) Method and system for typesetting and outputting formula
EP2672375A3 (en) Information pinning for contextual and task status awareness
Ciepliński et al. Approximate multi-Jensen and multi-quadratic mappings in 2-Banach spaces
Phat et al. An application of Razumikhin theorem to exponential stability for linear non-autonomous systems with time-varying delay
CN106372359A (en) Universal framework for equipment virtual prototype system
CN102147681A (en) Input method and device based on touch screen
CN106777104A (en) A kind of system and implementation method for obtaining heterogeneous software system data
CN103294788A (en) Universal background processing method and system for websites

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20120328