Commit b4c3981b authored by Felipe Sateler's avatar Felipe Sateler

Imported Upstream version 1.0.7

parent 19deaa51
Wed Jul 29 15:11:16 2009 Jiri (George) Lebl <jirka@5z.com>
* Release 1.0.7
* src/gnome-genius.c: set all toolbar items to important so
that text always shows.
Tue Jul 28 14:04:33 2009 Jiri (George) Lebl <jirka@5z.com>
* NEWS: update,
* help/C/gel-function-list.xml: add more docs on the root finding
functions. There aren't very nice, but ...
* lib/equation_solving/find_root.gel: use true/false for booleans
rather than 0/1
Mon Jul 27 15:22:57 2009 Jiri (George) Lebl <jirka@5z.com>
* help/C/genius.xml, help/C/gel-function-list.xml: Update
documentation for all the new features and improve existing
parts a bit especially by adding a bunch of links for some
functions.
* NEWS: update
Fri Jul 24 17:23:04 2009 Jiri (George) Lebl <jirka@5z.com>
* lib/calculus/fourier.gel: fix cosine series and fix argument
checking on the fourier function creation
* src/geniustests.txt, src/testfourier.gel: add tests for the
fourier functions
* src/graphing.c: the create plot and plot dialogs are stupid as
dialogs because of the way metacity handles dialogs (annoyingly
as "keep above parent") so set the hint to normal.
Fri Jul 24 16:32:32 2009 Jiri (George) Lebl <jirka@5z.com>
* lib/calculus/fourier.gel: add NumericalFourierCosineSeriesFunction
and NumericalFourierSineSeriesFunction and fixup some doc strings
* src/eval.c, src/dict.c: build the subst_dict on first function
evaluate. This avoids subst lists for simple functions, plus
it makes the global identifier no-substitution behaviour slightly
more easy to see.
Fri Jul 24 16:01:28 2009 Jiri (George) Lebl <jirka@5z.com>
* src/calc.c, src/compil.c: Correctly compile/decompile all the new
function attributes
* src/calc.c: correctly print out the local stuff, handle local node
correctly when outside of functions
* src/funclib.c, src/graphing.c: handle eof errors from parsing
things correctly without dying.
* src/dict.c, src/eval.c, src/structs.h: is_local generally should
not be moved around with the function. Also correctly copy/free
all the other attributes when needed as well.
* src/eval.c: Set arguments BEFORE extradict. This should never
be an issue, but it feels more correct.
* src/dict.c: when the subst list becomes empty, remove from subst
list to avoid unnecessary lookups
* lib/*/*.gel: update and fix for the [] operator
* src/geniustests.txt: Add some testcases
* src/symbolic.c: just a comment change
Thu Jul 23 18:35:28 2009 Jiri (George) Lebl <jirka@5z.com>
* src/parse.y, src/eval.c, src/dict.c, src/structs.h: Add an optional
list of extra_dict parameters to function definition. In this
case the subst dance never happens and those variables are added to
extra dict at function definition time.
* lib/*/*.gel: Use local where appropriate and the [] extra dict
definition where appropriate
* src/testscope.gel, src/geniustests.txt: update test suite
* src/geniustest.pl: fix colors
Thu Jul 23 16:28:59 2009 Jiri (George) Lebl <jirka@5z.com>
* src/dict.c, src/eval.c: remove some forgotten debug prints
* src/eval.c: do not allow setting a new parameter over a protected
id
* src/funclib.c: Add UserVariables function
* src/geniustests.txt, src/testscope.gel: add new tests
Thu Jul 23 12:26:47 2009 Jiri (George) Lebl <jirka@5z.com>
* src/funclib.c: Add UndefineAll, ProtectAll, make Undefine an alias
for undefine.
* src/dict.[ch], src/eval.c: allow setting of protected parameters,
they just can't be deleted or changed
* lib/*.gel: Use the ProtectAll function
* src/testscope.gel: add extra tests
Wed Jul 22 14:44:10 2009 Jiri (George) Lebl <jirka@5z.com>
* configure.in: raise version, require slightly newer glib (2.10)
* src/compil.c, src/dict.[ch], src/eval.[ch], src/lexer.l,
src/parse.y, src/parseutil.[ch], src/structs.h: Add local
variables (not seen by higher contexts). Also fix several minor
issues relating to dictionaries and lookup, mainly subst list
function is not substituted again if it is passed up and down the
contexts, and substitution is done in a smarter way.
* src/dict.[ch], src/gnome-genius.c: Redo the way contexts are done
to get rid of some gslists
* src/mpwrap.[ch]: allocate new real nums in a smarter way (by large
blocks) and put no limit on the number of real number structures
on the free list.
* src/geniustests.txt, src/testscope.gel: Add scope tests
Wed Jul 22 00:30:36 2009 Jiri (George) Lebl <jirka@5z.com>
* lib/number_theory/primes.gel: update for newest info from
GIMPS. Also fix MersennePrimeExponents (it had 3 columns by
mistake)
Fri Jul 10 14:53:41 2009 Jiri (George) Lebl <jirka@5z.com>
* help/C/figures/genius_window.png, help/C/figures/line_plot.png,
help/C/figures/line_plot_graph.png, help/C/figures/parametric.png,
help/C/figures/parametric_graph.png,
help/C/figures/surface_graph.png, pixmaps/32x32/gnome-genius.png,
pixmaps/48x48/gnome-genius.png, pixmaps/genius-graph.png:
Optimize PNGs
Thu Apr 23 01:32:06 2009 Jiri (George) Lebl <jirka@5z.com>
* src/gnome-genius.c: Fix opening new files from the command line.
It just works now.
* lib/calculus/Makefile.am, lib/calculus/fourier.gel: Add some
Fourier series routines. This currently exposes a bug in scoping
rules
Sun Apr 19 19:27:09 2009 Jiri (George) Lebl <jirka@5z.com>
* src/geniustests.txt, src/testprec.gel: test the precision stuff
* src/graphing.c: Apply patch from Matthias Drochner of NetBSD to
fix unitialized variable in one dimensional function plots
Sun Apr 19 18:55:12 2009 Jiri (George) Lebl <jirka@5z.com>
* src/mpwrap.c: Fix conflict with changing precision and the mpfr
cache. Also fix a possible extra negation error in pow_z.
Fri Apr 03 15:42:40 2009 Jiri (George) Lebl <jirka@5z.com>
* src/graphing.c: joins and caps are round. Fixes bad looking joins
on graphs of quickly oscillating functions
Sun Mar 15 00:04:08 2009 Jiri (George) Lebl <jirka@5z.com>
* Release 1.0.6
......@@ -922,7 +1095,7 @@ Sat Nov 03 20:51:37 2007 Jiri (George) Lebl <jirka@5z.com>
* src/Makefile.am:
* src/gnome-genius.c: (get_source_language_manager), (new_program):
Optionally allow to use GtkSourceView2 instead of GtkSourceView1.
Version 2 is preffered if available, otherwise version 1 will be used.
Version 2 is preferred if available, otherwise version 1 will be used.
2007-11-03 Sebastian Dröge <slomo@circular-chaos.org>
......
......@@ -191,6 +191,7 @@ MSGFMT_OPTS = @MSGFMT_OPTS@
MSGMERGE = @MSGMERGE@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
......
Changes to 1.0.7
* SYNTAX: Added a possibility to exactly specify which variables are copied
into a function's extra dictionary when it is being returned.
E.g. "`(x) [x0] = (x-x0)" will copy x0 from the current context. This
is a lot more efficient than the current behaviour which tries to copy
everything referenced.
* SYNTAX: Add "local" variables by specifying "local x,y,z" or "local *" as
the first statement in a function. Local variables are not visible from
higher contexts (functions called within)
* CHANGE: all system parameters are now protected and cannot be redefined
using the "parameter" keyword
* Add UserVariables, UndefineAll, ProtectAll, and add Undefine as an alias to
undefine.
* Add trigonometric Fourier series related functions:
NumericalFourierSeriesFunction, NumericalFourierSineSeriesFunction,
NumericalFourierCosineSeriesFunction, FourierSeriesFunction,
NumericalFourierSeriesCoefficients, NumericalFourierSineSeriesCoefficients,
NumericalFourierCosineSeriesCoefficients, PeriodicExtension,
EvenPeriodicExtension, OddPeriodicExtension
* Fix changing floating point precision!
* Fix uninitialized variable in graphing (Matthias Drochner)
* Improve variable substitution for returned functions to be more efficient.
Slightly changes behaviour with respect to global functions and variables
used.
* Plot windows now not treated annoyingly as dialogs
* Fix compilation/decompilation of all function attributes.
* Parse/Evaluate with a syntax error at end of string no longer terminate
genius
* Updated Mersenne stuff for the newest data from mersenne.org and
fix MersennePrimeExponents
* Fix opening new files from the command line.
* Update the gel library to use the new language features.
* Various other minor fixes
* Translation updates (Philip Withnall, Jen Ockwell,
Rodrigo Luiz Marques Flores, Daniel Nylander, Mario Blättermann, me)
* For some of the changes the author (Jiri) was partially supported by
NSF grant DMS 0900885 and the University of Illinois at Urbana-Champaign
Changes to 1.0.6
* Draw grid and x/y axis on lineplots in gray, much better readability
......@@ -23,7 +63,7 @@ Changes to 1.0.6
Changes to 1.0.5
* Fix buffer overrun in print (Simon Munton)
* Fix EulersMethod (and also fix it's documentation)
* Fix EulersMethod (and also fix its documentation)
* EulersMethod and RungeKutta now solve systems by accepting vectors
* Fix several memory leaks
* Translation update (Jorge Gonzalez, Javier F. Serrador)
......@@ -223,7 +263,7 @@ Changes to 0.7.5
* SEMANTICS: DotProduct is now the normal (real) DotProduct not the
hermitian product, places that used DotProduct now use HermitianProduct,
InnerProduct is now an alias for HermitianProduct
* GramSchmidt now normalizes it's vectors
* GramSchmidt now normalizes its vectors
* GramSchmidt, Projection, VectorAngle have the inner product as optional
argument now and all take it in the same way
* OuterProduct now actually does outer product
......
-- document new things in 1.0.7
* Logfiles and/or save session
* Whack the readline nonsense in the GUI
* Check this strange thing of locals living on the global context somehow,
try the testprogfamily.gel and look at vars and notice there are things
with context > 0 on the toplevel context. It's strange. And I can't
repro it now
* Native polynomial operation
* Add continued fraction type of a loop
* Add user argument checking functions for parameters (to make calling GEL
functions that check their arguments faster)
* fix matrix exp function and add matrix ln function
* matrix powers for rational numbers, and scalar^matrix (as matlab does it)
* Graph of 1/x or atan must not have vertical lines. Futhermore maybe we
should perhaps think about removing the vertical line if two consecutive
points are much further from each other than the previous two points on the
graph. This would graph the step function correctly.
* Implement max_nodes in the command line version
* Implement MaxNodes parameter
* Kill plugin interface maybe? It is just a pain to maintain and no one uses
AFAIK. It was originally done to make Dr.Genius possible, but that's long
over.
Possibly old
------------
This is somewhat out of date, though some of these may be fine ideas still.
---------------
* Make mod arithmetic propagation into user functions possible
* Check this strange thing of locals living on the global context somehow,
try the testprogfamily.gel and look at vars and notice there are things
with context > 0 on the toplevel context. It's strange. And I can't
repro it now
* Gauss needs to be mod aware
This is out of date
-------------------
* Add flags to arguments to function to not-mod them where appropriate
(for example I(n))
* Gauss needs to be mod aware (isn't it now?)
* Check variable substitution of references, that could refer
to freed data I think
* Add continued fraction type of a loop
* Check rational powers in mod mode to work correctly
* Check modular arithmetic to be correct (such as: "expr mod n"),
that is, when do we mod is the question.
* Add extended gcd
* Perhaps latex and troff mode should not be used on error output,
only on toplevel. Alternantively everything should be latex/troffized
I suppose. I like the first alternative more though.
* Native polynomial operation
* Add user argument checking functions for parameters
* fix matrix exp function and add matrix ln function
* matrix powers for rational numbers, and scalar^matrix (as matlab
does it)
* add try/catch operator for exceptions (need special exception
variable like return_val)
* interrupt internal mpwrap calculation (need new error type)
* result display (optional) ... for matrix display and normal
numbers ...
* cleanup engine
* make one line expression output more sane and make it work right
......
This diff is collapsed.
This diff is collapsed.
AC_INIT(src/calc.c)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(genius,1.0.6)
AM_INIT_AUTOMAKE(genius,1.0.7)
dnl make sure we keep ACLOCAL_FLAGS around for maintainer builds to work
AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS")
......@@ -14,8 +14,8 @@ dnl ================= Requirements =============================================
VTE_REQUIRED=0.8.19
LIBGNOMEVFS_REQUIRED=2.0.0
GTK_REQUIRED=2.6.0
GLIB_REQUIRED=2.6.0
GTK_REQUIRED=2.10.0
GLIB_REQUIRED=2.10.0
GTKSOURCEVIEW_REQUIRED=0.3.0
GTKSOURCEVIEW2_REQUIRED=2.0.2
......
%define ver 1.0.6
%define ver 1.0.7
%define rel 1
%define prefix /usr
......
......@@ -194,6 +194,7 @@ MSGFMT_OPTS = @MSGFMT_OPTS@
MSGMERGE = @MSGMERGE@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
......
......@@ -226,6 +226,7 @@ MSGFMT_OPTS = @MSGFMT_OPTS@
MSGMERGE = @MSGMERGE@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
......
help/C/figures/genius_window.png

29.1 KB | W: | H:

help/C/figures/genius_window.png

26 KB | W: | H:

help/C/figures/genius_window.png
help/C/figures/genius_window.png
help/C/figures/genius_window.png
help/C/figures/genius_window.png
  • 2-up
  • Swipe
  • Onion skin
help/C/figures/line_plot.png

29.4 KB | W: | H:

help/C/figures/line_plot.png

25.9 KB | W: | H:

help/C/figures/line_plot.png
help/C/figures/line_plot.png
help/C/figures/line_plot.png
help/C/figures/line_plot.png
  • 2-up
  • Swipe
  • Onion skin
help/C/figures/line_plot_graph.png

37.1 KB | W: | H:

help/C/figures/line_plot_graph.png

29.7 KB | W: | H:

help/C/figures/line_plot_graph.png
help/C/figures/line_plot_graph.png
help/C/figures/line_plot_graph.png
help/C/figures/line_plot_graph.png
  • 2-up
  • Swipe
  • Onion skin
help/C/figures/parametric.png

44 KB | W: | H:

help/C/figures/parametric.png

38.6 KB | W: | H:

help/C/figures/parametric.png
help/C/figures/parametric.png
help/C/figures/parametric.png
help/C/figures/parametric.png
  • 2-up
  • Swipe
  • Onion skin
help/C/figures/parametric_graph.png

35 KB | W: | H:

help/C/figures/parametric_graph.png

27.3 KB | W: | H:

help/C/figures/parametric_graph.png
help/C/figures/parametric_graph.png
help/C/figures/parametric_graph.png
help/C/figures/parametric_graph.png
  • 2-up
  • Swipe
  • Onion skin
help/C/figures/surface_graph.png

116 KB | W: | H:

help/C/figures/surface_graph.png

93.1 KB | W: | H:

help/C/figures/surface_graph.png
help/C/figures/surface_graph.png
help/C/figures/surface_graph.png
help/C/figures/surface_graph.png
  • 2-up
  • Swipe
  • Onion skin
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -162,6 +162,7 @@ MSGFMT_OPTS = @MSGFMT_OPTS@
MSGMERGE = @MSGMERGE@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -172,6 +172,7 @@ MSGFMT_OPTS = @MSGFMT_OPTS@
MSGMERGE = @MSGMERGE@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
......
Librarydir = $(datadir)/genius/gel/calculus
SUBDIRS =
GELFILES = differentiation.gel integration.gel limits.gel sums_products.gel
GELFILES = differentiation.gel integration.gel limits.gel sums_products.gel fourier.gel
EXTRA_DIST = $(GELFILES)
......
......@@ -172,6 +172,7 @@ MSGFMT_OPTS = @MSGFMT_OPTS@
MSGMERGE = @MSGMERGE@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
......@@ -251,7 +252,7 @@ sysconfdir = @sysconfdir@
target_alias = @target_alias@
Librarydir = $(datadir)/genius/gel/calculus
SUBDIRS =
GELFILES = differentiation.gel integration.gel limits.gel sums_products.gel
GELFILES = differentiation.gel integration.gel limits.gel sums_products.gel fourier.gel
EXTRA_DIST = $(GELFILES)
Library_DATA = $(GELFILES) loader.gel
MOSTLYCLEANFILES = loader.gel
......
......@@ -30,6 +30,7 @@
function OneSidedThreePointFormula(f,x0,h) =
# This has error term max(f''')h^2/3
(
local *;
# check arguments
## check types
if not IsFunctionOrIdentifier(f) then
......@@ -44,12 +45,12 @@ function OneSidedThreePointFormula(f,x0,h) =
(-3*f(x0)+4*(f call (x0+h))-(f call (x0+2*h)))/(2*h)
)
SetHelp("OneSidedThreePointFormula","calculus","Compute one-sided derivative using three-point formula");
protect("OneSidedThreePointFormula");
# Two-sided three-point formula, Section 4.1, Formula 4.5, p. 161
function TwoSidedThreePointFormula(f,x0,h) =
# This has error term max(f''')h^2/6
(
local *;
# check arguments
## check types
if not IsFunctionOrIdentifier(f) then
......@@ -63,12 +64,12 @@ function TwoSidedThreePointFormula(f,x0,h) =
((f call (x0+h))-(f call (x0-h)))/(2*h)
)
SetHelp("TwoSidedThreePointFormula","calculus","Compute two-sided derivative using three-point formula");
protect("TwoSidedThreePointFormula");
# One-sided five-point formula, Section 4.1, Formula 4.7, p. 161
function OneSidedFivePointFormula(f,x0,h) =
# This has error term max(f''''')h^4/5
(
local *;
# check arguments
## check types
if not IsFunctionOrIdentifier(f) then
......@@ -82,12 +83,12 @@ function OneSidedFivePointFormula(f,x0,h) =
(-25*(f call (x0))+48*(f call (x0+h))-36*(f call (x0+2*h))+16*(f call (x0+3*h))-3*(f call (x0+4*h)))/(12*h)
)
SetHelp("OneSidedFivePointFormula","calculus","Compute one-sided derivative using five point formula");
protect("OneSidedFivePointFormula");
# Two-sided five-point formula, Section 4.1, Formula 4.6, p. 161
function TwoSidedFivePointFormula(f,x0,h) =
# This has error term max(f''''')h^4/30
(
local *;
# check arguments
## check types
if(not IsFunctionOrIdentifier(f)) then
......@@ -101,7 +102,6 @@ function TwoSidedFivePointFormula(f,x0,h) =
((f call (x0-2*h))-8*(f call (x0-h))+8*(f call (x0+h))-(f call (x0+2*h)))/(12*h)
)
SetHelp("TwoSidedFivePointFormula","calculus","Compute two-sided derivative using five-point formula");
protect("TwoSidedFivePointFormula");
SetHelp ("DerivativeTolerance", "parameters", "Tolerance for calculating the derivatives of functions")
parameter DerivativeTolerance=10.0^(-5);
......@@ -113,56 +113,56 @@ parameter DerivativeNumberOfTries=100;
# Simple test for differentiability
function IsDifferentiable(f,x0) =
(
local *;
# differentiable functions have to be continuous and left and right derivatives must
# be equal
IsContinuous (f, x0) and
| NumericalLeftDerivative (f,x0) - NumericalRightDerivative (f,x0) | < 2*DerivativeTolerance
)
SetHelp("IsDifferentiable","calculus","Test for differentiability by approximating the left and right limits and comparing");
protect("IsDifferentiable");
# Simple derivative function
#FIXME!!!! BROKEN!!!! ???
function NumericalDerivative(f,x0) =
# returns f'(x0)
(
local *;
# FIXME: perhaps check differentiability first, but then we're doing so many limits already
NumericalLimitAtInfinity (`(n)=(TwoSidedFivePointFormula(f,x0,2.0^(-n))),
NumericalLimitAtInfinity (`(n)[f,x0]=(TwoSidedFivePointFormula(f,x0,2.0^(-n))),
Identity,
DerivativeTolerance,
DerivativeSFS,
DerivativeNumberOfTries)
)
SetHelp("NumericalDerivative","calculus","Attempt to calculate numerical derivative");
protect("NumericalDerivative");
SetHelpAlias ("NumericalDerivative", "NDerivative");
NDerivative = NumericalDerivative
protect("NDerivative");
function NumericalLeftDerivative(f,x0) =
(
NumericalLimitAtInfinity (`(n)=(OneSidedFivePointFormula(f,x0,-(2.0^(-n)))),
local *;
NumericalLimitAtInfinity (`(n)[f,x0]=(OneSidedFivePointFormula(f,x0,-(2.0^(-n)))),
Identity,
DerivativeTolerance,
DerivativeSFS,
DerivativeNumberOfTries)
)
SetHelp("NumericalLeftDerivative","calculus","Attempt to calculate numerical left derivative");
protect("NumericalLeftDerivative");
function NumericalRightDerivative(f,x0) =
(
NumericalLimitAtInfinity (`(n)=(OneSidedFivePointFormula(f,x0,2.0^(-n))),
local *;
NumericalLimitAtInfinity (`(n)[f,x0]=(OneSidedFivePointFormula(f,x0,2.0^(-n))),
Identity,
DerivativeTolerance,
DerivativeSFS,
DerivativeNumberOfTries)
)
SetHelp("NumericalRightDerivative","calculus","Attempt to calculate numerical right derivative");
protect("NumericalRightDerivative");
function Derivative(f,x0) =
(
local *;
df = SymbolicDerivativeTry (f);
if IsNull(df) then
NumericalDerivative (f, x0)
......@@ -170,4 +170,3 @@ function Derivative(f,x0) =
df(x0)
)
SetHelp("Derivative","calculus","Attempt to calculate derivative by trying first symbolically and then numerically");
protect("Derivative");
This diff is collapsed.
......@@ -26,6 +26,7 @@
SetHelp ("CompositeSimpsonsRuleTolerance", "calculus", "Integration of f by Composite Simpson's Rule on the interval [a,b] with the number of steps calculated by the fourth derivative bound and the desired tolerance")
function CompositeSimpsonsRuleTolerance(f,a,b,FourthDerivativeBound,Tolerance) =
(
local *;
# Error term = max(f'''')*h^4*(b-a)/180,
# where h=(b-a)/n
n = ceil(|FourthDerivativeBound*(b-a)^5 / (180*Tolerance)|^(1/4));
......@@ -36,12 +37,12 @@ function CompositeSimpsonsRuleTolerance(f,a,b,FourthDerivativeBound,Tolerance) =
CompositeSimpsonsRule (f, a, b, n)
)
protect ("CompositeSimpsonsRuleTolerance")
# FIXME: reference, though this is really stupid
SetHelp ("MidpointRule", "calculus", "Integration by midpoint rule")
function MidpointRule(f,a,b,n) =
(
local *;
if(not IsFunction(f)) then
(error("MidpointRule: argument 1 must be a function");bailout)
else if(not IsReal(a) or not IsReal(b)) then
......@@ -56,7 +57,6 @@ function MidpointRule(f,a,b,n) =
s = sum i=1 to n do float(f(a+(len*(i-0.5))/n));
(s*len)/n
)
protect ("MidpointRule")
SetHelp ("NumericalIntegralSteps", "parameters", "Steps to perform in NumericalIntegral")
parameter NumericalIntegralSteps = 1000
......@@ -65,5 +65,7 @@ SetHelp ("NumericalIntegralFunction", "parameters", "The function used for numer
parameter NumericalIntegralFunction = `CompositeSimpsonsRule
SetHelp ("NumericalIntegral", "calculus", "Integration by rule set in NumericalIntegralFunction of f from a to b using NumericalIntegralSteps steps")
function NumericalIntegral(f,a,b) = (NumericalIntegralFunction call (f,a,b,NumericalIntegralSteps))
protect ("NumericalIntegral")
function NumericalIntegral(f,a,b) = (
local *;
NumericalIntegralFunction call (f,a,b,NumericalIntegralSteps)
)
......@@ -21,18 +21,19 @@
# Limits:
SetHelp ("NumericalLimitAtInfinity", "calculus", "Attempt to calculate the limit of f(step_fun(i)) as i goes from 1 to N")
function NumericalLimitAtInfinity(_f,step_fun,tolerance,successive_for_success,N) =
# this evaluates _f(step_fun(i)) as i goes from 1 to N.
function NumericalLimitAtInfinity(f,step_fun,tolerance,successive_for_success,N) =
# this evaluates f(step_fun(i)) as i goes from 1 to N.
# If s_f_s of the pairwise successive differences are less than tolerance, then
# it returns the last value; if this doesn't happen, it returns Null.
# INPUT: N had better be at least 1
#FIXME: should have a way of dealing with +infinity, -infinity, and
# bounded oscillation (like sin(x))
(
current_limit = _f(step_fun(1));
local *;
current_limit = f(step_fun(1));
number_of_consecutive_differences_within_tolerance = 0;
for i = 2 to N do (
new_limit = _f(step_fun(i));
new_limit = f(step_fun(i));
if (|new_limit-current_limit| < tolerance) then (
number_of_consecutive_differences_within_tolerance = number_of_consecutive_differences_within_tolerance+1
) else (
......@@ -44,7 +45,6 @@ function NumericalLimitAtInfinity(_f,step_fun,tolerance,successive_for_success,N
);
null
)
protect ("NumericalLimitAtInfinity")
# The following are simple functions to find
......@@ -63,28 +63,29 @@ parameter ContinuousNumberOfTries=100;
SetHelp ("LeftLimit", "calculus", "Calculate the left limit of a real-valued function at x0")
function LeftLimit(f,x0) =
(
local *;
NumericalLimitAtInfinity (f,
`(n)=(x0-2.0^(-n)),
`(n)[x0]=(x0-2.0^(-n)),
ContinuousTolerance,
ContinuousSFS,
ContinuousNumberOfTries)
)
protect ("LeftLimit")
SetHelp ("RightLimit", "calculus", "Calculate the right limit of a real-valued function at x0")
function RightLimit(f,x0) =
(
local *;
NumericalLimitAtInfinity (f,
`(n)=(x0+2.0^(-n)),
`(n)[x0]=(x0+2.0^(-n)),
ContinuousTolerance,
ContinuousSFS,
ContinuousNumberOfTries)
)
protect ("RightLimit")
SetHelp ("Limit", "calculus", "Calculate the limit of a real-valued function at x0. Tries to calculate both left and right limits.")
function Limit(f,x0) =
(
local *;
LeftLim = LeftLimit(f,x0);
RightLim = RightLimit(f,x0);
if ( not IsNull(LeftLim) and
......@@ -92,12 +93,11 @@ function Limit(f,x0) =
|LeftLim-RightLim| < 2*ContinuousTolerance ) then
(LeftLim+RightLim)/2
)
protect ("Limit")
SetHelp ("IsContinuous", "calculus", "Try and see if a real-valued function is continuous at x0 by calculating the limit there")
function IsContinuous(f,x0) =
(
local *;
l = Limit(f,x0);
not IsNull(l) and |l-f(x0)| < ContinuousTolerance
)
protect ("IsContinuous")
This diff is collapsed.
......@@ -172,6 +172,7 @@ MSGFMT_OPTS = @MSGFMT_OPTS@
MSGMERGE = @MSGMERGE@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
......
This diff is collapsed.
This diff is collapsed.
......@@ -9,7 +9,6 @@ SetHelp ("GaloisMatrix", "combinatorics", "Galois matrix given a linear combinin
function GaloisMatrix(combining_rule) = (
[[0;I(columns(combining_rule)-1)],combining_rule.']
)
protect ("GaloisMatrix")
# Linear recursive sequence
SetHelp ("LinearRecursiveSequence", "combinatorics", "Compute linear recursive sequence using galois stepping")
......@@ -28,4 +27,3 @@ function LinearRecursiveSequence(seed_values,combining_rule,n) =
else null # (if sequence is reversible)
)
)
protect ("LinearRecursiveSequence")
......@@ -172,6 +172,7 @@ MSGFMT_OPTS = @MSGFMT_OPTS@
MSGMERGE = @MSGMERGE@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
......
This diff is collapsed.