Warnings compiling



Most programming languages require explicit declaration of local variables
(other than function arguments), including all varieties of Lisp I'm aware
of.  A few do this implicitly for variables which are assigned to, e.g.
Python and R.  Maxima does not.  See block([...],...) for Maxima.

I will repeat my advice of trying some smaller "finger exercises" before
trying something big and ambitious like your ODE solver.  Also, when you
report problems, it is almost impossible for us to provide useful advice if
all we have to go on is "Compiling I get many warnings about undefined
variables" or a pointer to a multi-hundred line automatically generated
code fragment without context (how is it run, how is it compiled, etc.).

Much more useful to provide a *small and reproducible* example of your
problem.  "Small" typically means 1-3 lines of code or at least some
indication that you've made an effort to find the 'core' problem.
 "Reproducible" means that we can run your example and run into the
problem; in particular, this means that the example should be *
self-contained*, including any auxiliary functions (also reduced to a
minimum) or data needed; it also means that you should *report the
version* reported
by *bug_report*. (We should probably put together a posting guide along the
lines of the R-help posting
guide<http://www.r-project.org/posting-guide.html>; --
though I don't aspire to R-help's tradition of viciously attacking clueless
newbies.)

           -s


On Fri, Aug 10, 2012 at 3:03 AM, Dennis Darland <dennis.darland at yahoo.com>wrote:

> I had just supposed variables which were not global (from define variable)
> or function arguments were local. Maybe I should look into block. My lisp
> is very rusty. I mainly used xlisp some with an amiga many years ago.
>
> Dennis J. Darland
> dennis.darland at yahoo.com
> http://dennisdarland.com/
> http://dennisdarland.com/dennisdaze/
> http://dennisdarland.com/philosophy/
> http://sode.sourceforge.net/
> "According to the World Health Organization, the warming of the planet
> caused an additional 140,000 deaths in 2004, as compared with the number of
> deaths there would have been had average global temperatures remained as
> they were during the period 1961 to 1990. This means that climate change is
> already causing, every week, as many deaths as occurred in the terrorist
> attacks on September 11, 2001"
> -- Peter Singer _Practical Ethics, Third Edition_, p. 216.
>
>
> --- On Fri, 8/10/12, Robert Dodier <robert.dodier at gmail.com> wrote:
>
> > From: Robert Dodier <robert.dodier at gmail.com>
> > Subject: Re: [Maxima] Warnings compiling
> > To: maxima at math.utexas.edu
> > Date: Friday, August 10, 2012, 12:16 AM
> > On 2012-08-10, Dennis Darland <dennis.darland at yahoo.com>
> > wrote:
> >
> > > Compiling I get many warnings about undefined
> > variables. As I
> > > understand it 'define variable' defines global
> > variables. Many of the
> > > variables I got warnings for I would not want to be
> > global. Is there
> > > a way to define local variables?
> >
> > Well, as far as I know, the Maxima to Lisp translator
> > complains about
> > variables which are neither function arguments nor local
> > variables (as
> > in block([a, b, c], ...)). If you are getting complaints
> > about such
> > variables, that seems like a bug. If you would provide
> > examples it would
> > be helpful.
> >
> > > Others are arrays. The arrays worked as global OK when
> > the code was
> > > being interpreted. I could not figure how to define
> > arrays in
> > > define_variable either.
> >
> > There is something about arrays in the mode_declare
> > documentation, but I
> > don't know to what extent the translator actually exploits
> > that
> > information.
> >
> > > Also, the code ran even with the warnings, but was no
> > faster.
> >
> > Not too surprising.
> >
> > The long and the short of it is that Maxima is something of
> > a mess as a
> > programming language. You will probably be less frustrated
> > if you think
> > of programming in Maxima as more of an empirical exercise
> > than logical.
> >
> > FWIW
> >
> > Robert Dodier
> >
> > _______________________________________________
> > Maxima mailing list
> > Maxima at math.utexas.edu
> > http://www.math.utexas.edu/mailman/listinfo/maxima
> >
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>