PGraph


Deutsch

DOWNLOAD

 

Program for Drawing and Analyzing Math Functions. 

FEATURES:

    · Draw Functions and First derivatives

    


    · Find intersections (Regula Falsi)


    · Numerical integration (Simpson's Rule)


    · Length of curve


    · Volume


    · Lateral surface


    · Points of Gravity of:

                                        - curves

 

                                        - surfaces

 

                                        - bodies

 

    · Moments of Inertia from:

                                    - surfaces

 

                                     - bodies


 

 

  Following User Interface Languages are available:

    - English
    - German
    - DE - EDV (German without special characters)
    - Bulgarian (Take care that 3rd-party software is needed to use Bulgarian on Palm)
    - BG - LAT (Bulgarian uses Latin characters), so the Program can be used without 3rd party software)

    - Internal Texteditor

    - The complete POWER of PLUA can now be accessed trough the built-in MACROEDITOR

    - Screenshot* - PGRaph can save the screen contents in to a standart BMP file (which can be opened on Desktop PC)

    - HTML Report generator* - PGraph can create standart HTML (wich can be viewed with any standart WEB browser) file (+screenshot) that contains the result from the last calculation.

    *-To use this functions you will need a Palm Device with External Memory Card (MMC / SD etc.)



Unpack PGRAPH.ZIP
Contents:
PGraph.prc    -    Program
PGT.pdb        -    Database
PluaRT.prc    -    run time environment
MathLib.prc    -    mathematics library
Liesmich.txt    -    Read Me German
Readme.txt    -    Read Me
ReadmeBG.txt    -    Read Me Bulgarian


FOLLOWING FILES MUST BE ON YOUR PALM:
1) PGraph.prc
2) PluaRT.prc
3) MathLib.prc
4) PGT.pdb


If you already have MathLib installed, it is not necessary to reinstall.
EARLIER VERSIONS OF PLUART.PRC AND PGRAPH.PRC MUST BE REMOVED!

PGraph is developed and tested with:
Palm Tungsten C
PalmOS Simulator
High resolution (320x320) Palm devices are supported. All other will run in Low-Res mode.

Start the programm. Draw...

Up - left on the screen is:

Menu:

Menu - the same as About PGraph - displays short Information

Help - this here

f(x)=... - opens input field where you can input (edit) the function f(x)
g(x)=... - the same

Only Plua expressions and functions with one variable are permitted. Name of the variable is "x". The program uses "dostring(expression)". Under "expression" is every Plua - expression to be understand. All deviations from Plua - syntax lead to error message! Here a short Manual.:

Square root: sqrt(Expression)

ln(x): log(Expression)

exp: exp(Expression)

Exponentiation: (Expression)^Exponent

Root Extraction: (Expression)^(1/Root)

Multiply: (Expression)*(Expression)

Sum: (Expression)+(Expression)

Divide: (Expression)/(Expression)

Subtract: (Expression) - (Expression)

Arc functions: asin(Expression), acos(Expression), atan(Expression)

Trigonometric functions:

sin(deg(Expression)), cos(deg(Expression)), tan(deg(Expression))

WARNING - the Argument of all trigonometric functions must first be converted trough deg()! Otherwise you will get falsified values!

Hyperbolic functions and AREA functions:

sinh(x), cosh(x), tanh(x), coth(x), arsinh(x), arcosh(x), artanh(x), arcoth(x)

Examples:

        - sqrt(exp(sin(deg(x)))+cos(deg(x))) - !!! deg() !!!

        - (x^3+3*x^2-x+16)/(x^5-x^8).

    - (sinh(x)^2+tanh(x)^2)^(1/5)



Work with... - switches between Curve, Surface, Body (built trough Rotation of the selected function around the X-Axis) 
Built by... - switches between f(x), g(x) and f(x)-g(x)
- According to your choice in the those both positions different things are drawn and can be calculated
Example: "Work with Surface" & "Built by f(x)" - draws surface between f(x) and X-Axis and you can do all Surface-relevant calculation types - Area, Point of Gravity, Moment of inertia


- Min. / Max. X / Y Axis - ... 

- Scale - the distance for the grid

- Density - Density of Points for Drawing - lower Numbers results beautiful Graphs but takes more time to draw. The programm calculates internal an suitable numer, but you can change it.

- f(x)' draw and g(x)' draw - changes from "Yes" to "No" and again, makes what is written - draws (or not) the according first Derivative on the screen.

- Lower and Upper Limits - Limits for Calculation (Integration, Regula Falsi etc.)- By choosing this entry, the programm asks you if Regula Falsi should be started at last X coordinates - according to the choice you make in Work with.../built by..., for different intersections will be searched - after you say "YES". As example "Work with Curve" "Built by f(x)-g(x)" looks for intersection between f(x) and g(x). If you do not wish to use Regula Falsi, an input field is shown and you can input suitable value.

TAKE CARE: that all of the values (xmin, xmax, limits) are tested to be suitable and if not the old value is restored!
As example: you input lower limit that is bigger than the existing upper limit, the old lower limit is restored. You should first change the upper limit first.

- Find intersections (Regula Falsi)
- Numerical integration (Simpson)
- Length of curve
- Volume
- Lateral surface
- Points of Gravity of curves, surfaces and bodies
- Moments of inertia surfaces and bodies

Choosing one of these starts the calculation, an report is created with the choosen calculation. This report (or parts of it) can be copied and inserted (also into other programs). The result(s) from the last calculation are stored into the variables Result 1 to 5 (depending from the kind of the calculation - with Simpson, Regula Falsi only Result 1, Point of gravity from curve Result 1, 2 & 3 etc.) and can be called up
Not all combinations are meaningful - e.g. lateral surface if you work with curve or surface, volume of surface etc., ERROR MESSAGE is displayed if you choose something like this.
Sincethe report is written in the Texteditor you can also save, edit and open (saved) reports.

- Result 1 to 5 -
Result(s) from previous Calculation are savedDBLK P here

- Memory 1 to 5 - Memory places to save Results or other Values

- "Colors" - here you can change the colors for drawing. Choose the element you wish to change. As example f(x)-g(x) this means the color of the area between f(x) and g(x). The saved color is shown automatically after you choose this item, use the slide bars to change the color (you can compare previous / changed color), the new value is saved automatically, "Back" goes back to the "Draw" screen

- "User interface" - I will surely win no price for translation quality, neither German nor English are my native language, so I give you the opportunity to change the used texts for the UI. If you send me an optimised PGUIText, I can add it for next PGraph versions (you can also translate PGraph into other Languages, these is also welcome)

- Save / Load Settings - the "Settings" - this means all of the variables which controls the PGraphs behaviuor are automatically saved in the PGini file (in this file not exists, will be created every time you start PGraph), without your action, here you can save/load your (customer) "INI" files, so you can easy change between different functions/parameters - otherwise (without those functions) you should every time hardly input all of the variables.

- "Texteditor
" - Here you can edit text (;-), load saved reports, you can also open PalmDoc files (max 8 KB!). But take care - by saving PGraph has only one option - StreamDB, this means you should change the name of the opened PalmDoc file, otherwise the "DOC structure" will be lost and you can open this file with PGraph/Plua only (and no more with your preferred DocWiever/Editor!) StreamDBs can be readed on Desktop PC without problems (I am using KWrite under Linux/KDE)

- Run - Runs single line of Plua code

- Run Macro - Runs saved Plua macro

- Macroeditor - Calls the texteditor in "macro mode" so you can write your own macros

Here I am giving you very powerfull tool to extend the PGraph according to your needs - you can do allmost all - define your own functions, call PGraphs's functions, or even create completelly new programm!
But take care I am not able to make Programm-Routine to save you from errors, if there are some errors the COMPLETE PGraph / Plua environment will be exited (this means you must start PGraph again)

Here briefly manual:

-- Comments are written this way in Lua / Plua

PGraph internal variables:

xmin - ...

xmax - ...

ymin - ...

ymax - ...

scl - Scale

step - Density of Points

Example:

xmin,xmax,ymin,ymax=-3,3,-3,3

-- take care of the multiple var set (typical for Lua), this here is the same as:

xmin=-3
xmax=3
ymin=-3
ymax=3




ft[1] - f(x) as text

ft[2] - g(x) as text

Example:

ft[1]="sin(deg(x))
dostring("function f(x) return y="..ft[1].." end"])

-- You should call dostring("function f(x) return y="..ft[1].." end"]) in order to change f(x), the same for g(x)

ft[1],ft[2]=ft[2],ft[1]

-- tricky, switches the values of the both variables, ft[1] becomes the value from ft[2], ft[2] from ft[1]


a - lower limit
b - upper limit

Example:

a=exp(1)

--sets a to 2.71828....

b=PI
--sets b to 3.14...

b=-a
-- tricky

text[1] ... text[60] the texts for the UI

fkr - internal screen faktor for Low / Hi Res devices, so you can place everything on the right screen position without knowledge are we runing on Hi Res or Low Res device.
using the pmode() command of Plua (as per Plua Manual)
pmode(): returns 4 numbers: screen width, screen height, screen depth and 1 or 0 indicating if the screen supports color.

w,h,d,c=pmode()
--take care of the use of a,b,c,d,e=... this way you can take more than one value returned from function

fkr=w/320
-- this way fkr is 1 on HiRes and 0.5 on LowRes devices
-- if you multiply the HiRes coordinate you wish to have with the fkr, your object will be shown everytime at same (relative) screen position, even you run the programm on 160x160 device.

xc - center of the grid X -component
yc - center of the grid Y -component

xf and yf are the correction factors for the X/Y axis.

M0-M4 - Result 1 .. Result 5

M5-M9 - Memory 1 .. Memory 5 variables

Example

M5=M0-M1*PI


PGraph internal functions:

rf(a,b,n) - calls Regula Falsi
-- a, b are the lower/upper limit (local variables for rf)
--n can be:
-- 0 - works with f(x) - means search intersection between f(x) and X - Axis
-- 1 - works with g(x) - means search intersection between g(x) and X - Axis
-- 2 - works with f(x)-g(x) - means search intersection between f(x) and g(x)

returns the found x coordinate or 0 if nothing found

Example:

x=rf(0,1,0) - searches for intersection from f(x) and X-axis from 0 till 1

simpson(n) - calls the Numerical integration
-- n has the same meaning as by rf(a,b,n) - "0" - works with f(x) - area under f(x), "2" g(x), etc.
-- the variables a & b (global) must have the needed values before you call this function.
-- returns the Surface under the function / between functions in the M0 variable

Usage:
a=-1
b=1
simpson(1)
--calculates the area between g(x) and the X-Axis


volumen(n)
-- n has the same meaning as by rf(a,b,n)
-- the variables a & b (global) must have the needed values before you call this function.
-- returns the Volume of Rotation body in the M0 variable

schwerk(n)
- Point of gravity of Curve
-- n has the same meaning as by rf(a,b,n)
-- the variables a & b (global) must have the needed values before you call this function.
-- returns - returns the Point of gravity of Curve as follows
-- M0 - Length
-- M1 - Xs*Lenght
-- M2 - Ys*Lenght
-- M3=M1/M0 -Xs
-- M4=M2/M0 -Ys


schwerf(n)
- Point of gravity of Area
-- n has the same meaning as by rf(a,b,n)
-- the variables a & b (global) must have the needed values before you call this function.
-- returns the Point of gravity of Area as follows
-- M0 - Area
-- M1 - Xs*Area
-- M2 - Ys*Area
-- M3=M1/M0 -Xs
-- M4=M2/M0 -Ys

schwerb(n) - Point of gravity of Body
-- n has the same meaning as by rf(a,b,n)
-- the variables a & b (global) must have the needed values before you call this function.
-- returns the Point of gravity of Body as follows
-- M0 - Xs
-- M1 - Volume
-- (Ys=Zs=0)


momentf(n) - Moment of Inertia of Area
-- n has the same meaning as by rf(a,b,n)
-- the variables a & b (global) must have the needed values before you call this function.
-- returns the Moment of Inertia of Area as follows:
-- M0 - Ix
-- M1 - Iy
-- M2 =M1+M0 - Ip


momentb(n)-
Moment of Inertia of Body
-- n has the same meaning as by rf(a,b,n)
-- the variables a & b (global) must have the needed values before you call this function.
-- returns the Moment of Inertia of Body as follows:
-- M0 - Jx


wurzabl(n) - returns the numerical solution of the integral from sqrt(1-f'(x))
wurzabla(n) - returns the numerical solution of the integral from f(x)*sqrt(1-f'(x))
wurzablb(n) - returns the numerical solution of the integral from x*sqrt(1-f'(x))
-- n has the same meaning as by rf(a,b,n)
-- the variables a & b (global) must have the needed values before you call this function.
-- these are used in the calculating of Curvelenght and Lateral surface
Usage:
var=wurzabl(1)
--integral from sqrt(1-f'(x))

var=wurzabla(2)
--integral from g'(x)*sqrt(1-g'(x))


Plua functions:

palert("TEXT")
-- displays small window with "TEXT" and OK Button, you can use numbers instead of text

var=pinput("text", initial_value)
-- displays input field, var becomes the value inputed or NIL if Cancel was pressed


Sample macro:

-- shows the calculated point of gravity of Curve or Area
-- before startting the macro you should have an Curve/Area defined and run "Point of gravity" option in the menu
-- the values are then in the M3 and M4, for Xs and Ys respektivelly

pcolor(prgb(245,45,178))
-- set color to have 245 for Red , 45 for Green and 178 for Blue component.

pline(0, yc-M4*yf, 320*fkr, yc-M4*yf)
pline(xc+M3*xf,320*fkr,xc+M3*xf)

-- this draws two lines with color as defined, directly trough the calculated Point of gravity

For better / further information please take a look in the very well documented Lua / Plua projects (simply type Lua or Plua at google...).

- About PGraph - ... ;-)

 


For improvement suggestions, bug reports etc. etchekov@yahoo.de

LICENSE:
PGraph is Freeware.
PGraph is called in the following software.

LIMITED WARRANTY:
THIS SOFTWARE IS PROVIDED 'AS-IS' AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EXCEPT TO THE EXTENT OF ANY UNAVOIDABLE STATUTARY LIABILITY.

USE AND DISTRIBUTION OF THIS SOFTWARE IS FREE:
YOU ARE HEREBY LICENSED TO MAKE AS MANY COPIES OF THIS SOFTWARE AS YOU WISH; GIVE EXACT COPIES OF THE ORIGINAL VERSION TO ANYONE; AND DISTRIBUTE IN ITS UNMODIFIED FORM VIA ELECTRONIC MEANS. THERE IS NO CHARGE FOR ANY OF THE ABOVE. YOU ARE AUTHORIZED TO FREELY USE THIS SOFTWARE. 

Copyright (C) 2004 Emil Tchekov. All rights reserved.

 

Mathematical Backgrounds

PGraph uses two approximation methods which I will try to describe. For deep-going information, please look into all good mathematics books.  This text serves only as extension for the PGraph operating instructions, other purposes are not intended.


Regula Falsi

The so called "Wrong rule" (or Secant Method) is a procedure for determination of intersections (Method for solving equations).


We look for the x - value, that makes F(x) to 0 (intersection of F(x) and the x - Axis).  F(x) is replaced by the secant, so the formula: 



supplies us an approximate value (the intersection of the secant with the x axis). If we repeat this procedures often enough with values x1 and x3 or x2 and x3 (PGraph makes this 1000 times, or until F(x1)=F(x2))- we will become an Value that is very close to the real one . The approximation is sufficient for ordinary purposes, mathematical is it however NOT correct. These procedure functions only if some basic conditions are given - for further information please look into the appropriate books.

PGraph example: We look for the 1. solution of the equation sin(x)=1/x-1. So we input for f(x) sin(deg(x)) and for g(x) 1/x-1. First we want to take a look over these Functions, then we should click somewhat left from the 1. Intersection (the 1. Solution) and take the value (about 0.5...) for the lower bound, for upper limit you can input 1 (we can also draw the function one more time, so we were able to click this time right from the intersection and receive a value for the upper limit). Then we are so far and can call Regula Falsi  ->



 
Simpson's Rule (Numeric integration)

The procedures for numeric determination of surface under function (integration) are based on the same basic principle: The surface must be divided into many strips, finding the surface or every single strip, and then sum of all strips.


 

The Simpson procedure uses parabola as upper delimitation of the stripes (other procedures use straight lines). This supplies better approximate values. To define a parabola we needs at least 3 points, also Simpson Method uses double strips.


First the surface is divided at even number of stripes (PGraph - uses 100), then find the strip width h. Afterwards the three sums are created (Summe1 = first + last strips, Summe2 = sum of the odd strips, Summe3 = sum of the even strips). Then the last formula is used and we receives a numeric approximate value for the surface under the function.

Example in PGraph: How big  is the surface between the functions sqrt(1 x^2) and sqrt(1 x^2)?
First we must shift the functions into the upper quadrants, otherwise we will get we falsified values (there is visibly a surface present, but we will become 0). So we must take 1+sqrt(1 x^2) and 1-sqrt(1-x^2) instead. Thus both functions stand above the x axis. It is easy to recognize that we have a circle with r=1, so the lower limit is -1, upper limit is 1, the surface is equal to a natural constant -  ... p.

All further abilities of PGraph, which are based on integration, develop on the Simpson procedure.


SPECIAL THANK TO:

Marcio Miguelleto de Andrade - for the development of PLua

TeCeGraf and PUC Rio - for the development of Lua

My wife and my children for their PATIENCE with my additional job.

DOWNLOAD