funcplot.py revision ff1686586f92b1d23d6303765a9cffee59fd7fef
'''
Copyright (C) 2006 Johan Engelen, johan@shouraizou.nl
Copyright (C) 2005 Aaron Spike, aaron@ekips.org
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
This program is a modified version of wavy.py by Aaron Spike.
'''
from math import *
from random import *
# step is the distance between nodes on x
# coords and scales based on the source rect
# functions specified by the user
if fx != "":
if fpx != "":
# initialize function and derivative for 0;
# they are carried over from one iteration to the next, to avoid extra function calculations
else: # derivative given by the user
a = [] # path array
y1 = f(x)
else: # derivative given by the user
# create curve
return a
help="Start x-value")
help="End x-value")
help="Multiply x-range by 2*pi")
help="y-value of rectangle's bottom")
help="y-value of rectangle's top")
help="Samples")
help="f(x) for plotting")
help="Calculate the first derivative numerically")
help="f'(x) for plotting")
help="The selected UI-tab when OK was pressed")
help="dummy")
# create new path with basic dimensions of selected rectangle
#copy attributes of rect
try:
except AttributeError:
pass
w,h,x,y,
#newpath.setAttribute('desc', '!func;' + self.options.fofx + ';'
# + self.options.fpofx + ';'
# + `self.options.fponum` + ';'
# + `self.options.xstart` + ';'
# + `self.options.xend` + ';'
# + `self.options.samples`)
# add path into SVG structure
# TODO: make an option wether to remove the rectangle or not.
e = FuncPlot()
e.affect()