Sheldon Newhouse | 1 Oct 2009 02:24
Picon

Re: orbits broken--fixed

Sheldon Newhouse wrote:

Sorry, it was an 'alias' problem loaded at the start.

-sen
> Hello,
>  I tried the 'orbits' program.  Here is what happened.
>
> (%i5) loa(%i1) build_info();
> Maxima version: 5.19.2
> Maxima build date: 13:10 9/20/2009
> host type: i686-pc-linux-gnu
> lisp-implementation-type: CMU Common Lisp
> lisp-implementation-version: 19d Fedora release 5.fc8 (19D)
>
> (%o1)
> (%i2) load(dynamics);
> (%o2)     /usr/local/share/maxima/5.19.2/share/dynamics/dynamics.mac
> (%i3) display2d: false;
> (%o3) false
> (%i4) orbits(x*y*(1-y),.2,100,200,[x,3,4,.01]);
> Graph passed to plot2d...
> Improper name or value in functional position:
> errexp1
> #0: 
> orbits(f=x*(1-y)*y,y0=0.2,n1=100,n2=200,domain=[x,3,4,0.01],options=[])(dynamics.mac 
> line 367)
>  -- an error.  To debug this try debugmode(true);
>
>
(Continue reading)

Leo Butler | 1 Oct 2009 09:15
Picon
Picon

Re: Is %i an integer?


On Wed, 30 Sep 2009, Dieter Kaiser wrote:

< Am Mittwoch, den 30.09.2009, 07:42 +0100 schrieb Leo Butler: 
< > 
< > This exact bug has been reported:
< > 
< > http://www.math.utexas.edu/pipermail/maxima/2009/017646.html
< > 
< > Perhaps Dieter could comment.
< 
< I have suggested an extension to include facts like %i or %pi is a
< noninteger on the assumption that we do not change the implemented
< behavior of declare and featurep.
< 
< Now a symbol declared to be an integer is a real and complex too (This
< is a bit strange from a mathematically viewpoint). If we implemented a
< fact like %pi is a noninteger, we can not declare it at the same time as
< a real. The assume database will enter an endless loop. Therefore I have
< changed the routine nonintegerp to get the behavior that real and
< complex symbols are a noninteger too. This was necessary to avoid
< endless loops in the assume database.
< 
< I have posted a table which shows the actual behavior of featurep and
< declare:
< 
< http://www.math.utexas.edu/pipermail/maxima/2009/016938.html
< 
< The discussion on this list which followed shows to me that we have
< different viewpoints what declare and featurep should do.
(Continue reading)

Jaime Villate | 1 Oct 2009 09:56
Picon
Favicon
Gravatar

Re: orbits broken

Hi Sheldon,

On Qua, 2009-09-30 at 15:42 -0400, Sheldon Newhouse wrote:
> %i2) load(dynamics);
Notice that since version 5.18 you no longer need to load the dynamics
package. It will be loaded automatically when you call any of its
functions.

> (%i4) orbits(x*y*(1-y),.2,100,200,[x,3,4,.01]); 
Try this instead, which will give you a nicer plot of the bifurcations
diagram for the logistic map:
   orbits(x*y*(1-y),.2,100,200,[x,3,4],[style,[dots]],[nticks,600]); 

Cheers,
Jaime
Nathaniel Virgo | 1 Oct 2009 16:18
Picon
Gravatar

Pattern matching - new user question

Hi

I'm a new user of Maxima and I'm interested in using it for calculations in Bayesian probability theory and information theory.  I'm trying to get my head around how to implement new simplifier rules, in order to be able to manipulate probability expressions.

I'm sort-of getting there, but the rules I've defined don't seem to match subexpressions in the way I expect them to.  Presumably I'm missing something.  Here is an example showing the sort of thing I'm trying to do, and the way in which it isn't working:

(%i1) infix("|",50,50);
(%o1) |

 "(a|b)" is to be read as P(a|b), or the probability of a given b.  This is my preferred notation for Bayesian probability theory.

Since we're talking about Bayesian probability theory, a and b stand for statements of logic that may or may not be true.

(%i2) matchdeclare([AA,BB,CC],all);
(%o2) done

(%i3) defrule(bayes, (AA|BB and CC), (BB|AA and CC)*(AA|CC)/(BB|CC));
(%o3) bayes:AA | BB and CC->((AA | CC)*(BB | AA and CC))/BB | CC

 The above is Bayes' theorem as a maxima rule.  The following works fine:

(%i4) bayes( a | b and c);
(%o4) ((a | c)*(b | a and c))/b | c

 ...but it doesn't want to match subexpressions:

(%i5) bayes( (a | b and c) * x);
(%o5) false

 this doesn't work either:

(%i6) apply1( (a|b and c)*x, bayes);
(%o6) (a | b and c)*x

Can anybody point out what I'm doing wrong?

Thanks in advance,
Nathaniel

_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
Robert Dodier | 1 Oct 2009 17:15
Picon

Re: Pattern matching - new user question

On 10/1/09, Nathaniel Virgo <nathanielvirgo <at> gmail.com> wrote:

> I'm a new user of Maxima and I'm interested in using it for calculations in
> Bayesian probability theory and information theory.  I'm trying to get my
> head around how to implement new simplifier rules, in order to be able to
> manipulate probability expressions.

Well, this is a topic near & dear to my heart, so I am glad to try to help ....

> (%i1) infix("|",50,50);
> (%o1) |
>
>  "(a|b)" is to be read as P(a|b), or the probability of a given b.  This is
> my preferred notation for Bayesian probability theory.
> Since we're talking about Bayesian probability theory, a and b stand for
> statements of logic that may or may not be true.
>
> (%i2) matchdeclare([AA,BB,CC],all);
> (%o2) done
>
> (%i3) defrule(bayes, (AA|BB and CC), (BB|AA and CC)*(AA|CC)/(BB|CC));
> (%o3) bayes:AA | BB and CC->((AA | CC)*(BB | AA and CC))/BB | CC
>
>  The above is Bayes' theorem as a maxima rule.  The following works fine:

Well, you can also define "|" as an ordinary function, which
might have more easily predictable consequences.
e.g. "|"(ll, rr) := <stuff involving args(rr) and args(ll) ...>

> (%i4) bayes( a | b and c);
> (%o4) ((a | c)*(b | a and c))/b | c
>
>  ...but it doesn't want to match subexpressions:
>
> (%i5) bayes( (a | b and c) * x);
> (%o5) false

Right --- the rule function itself matches only an exact match.
I suppose this isn't clearly documented; sorry about that.

>  this doesn't work either:
>
> (%i6) apply1( (a|b and c)*x, bayes);
> (%o6) (a | b and c)*x

I get a stack overflow or endless loop for this one.
Pretty sure the rule is applied to a|b and c, then b|a and c,
then a|b and c, ad infinitum. That's inherent in your definition,
right? As it's defined, the rule doesn't show a preference for
one form or another. There may be a way to tell Maxima to
apply the rule just once, I don't know at the moment.

best,

Robert Dodier
Robert Dodier | 1 Oct 2009 17:21
Picon

Re: Pattern matching - new user question

On 10/1/09, Nathaniel Virgo <nathanielvirgo <at> gmail.com> wrote:

> (%i6) apply1( (a|b and c)*x, bayes);
> (%o6) (a | b and c)*x

applyb1 (bottom-up) works for me here instead of apply1 (top-down).
That's helpful, but not very satisfying; I can see why one
works and the other doesn't, but it's far from obvious.

best

Robert Dodier
Nathaniel Virgo | 1 Oct 2009 17:42
Picon
Gravatar

Re: Pattern matching - new user question

Hi Robert

Thanks for your helpful comments.  It's odd that using apply1 gives an infinite loop for you but just fails for me.

However, applyb1 does work for me in this case (I thought I'd already tried it, but apparently not).  It doesn't work in all cases though.  Specifically, if I try to apply Bayes' rule twice (which should give the original expression) it doesn't match:

(%i21) expr: bayes(a | b and c);
(%o21) ((a | c)*(b | a and c))/b | c

(%i23) applyb1(expr);
(%o23) ((a | c)*(b | a and c))/b | c

Surely "(b | a and c)" is a subexpression of "((a | c)*(b | a and c))/b | c", so why doesn't applyb1 find it and apply the rule?

Best regards,
Nathaniel


2009/10/1 Robert Dodier <robert.dodier <at> gmail.com>
On 10/1/09, Nathaniel Virgo <nathanielvirgo <at> gmail.com> wrote:

> (%i6) apply1( (a|b and c)*x, bayes);
> (%o6) (a | b and c)*x

applyb1 (bottom-up) works for me here instead of apply1 (top-down).
That's helpful, but not very satisfying; I can see why one
works and the other doesn't, but it's far from obvious.

best

Robert Dodier

_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
Nathaniel Virgo | 1 Oct 2009 17:45
Picon
Gravatar

Re: Pattern matching - new user question

Oops - where I wrote

applyb1(expr)

It should say

applyb1(expr, bayes)

that was just a typo in my mail - the result is the same - it fails to apply Bayes' rule to the subexpression.

Nathaniel


2009/10/1 Nathaniel Virgo <nathanielvirgo <at> gmail.com>
Hi Robert

Thanks for your helpful comments.  It's odd that using apply1 gives an infinite loop for you but just fails for me.

However, applyb1 does work for me in this case (I thought I'd already tried it, but apparently not).  It doesn't work in all cases though.  Specifically, if I try to apply Bayes' rule twice (which should give the original expression) it doesn't match:

(%i21) expr: bayes(a | b and c);
(%o21) ((a | c)*(b | a and c))/b | c

(%i23) applyb1(expr);
(%o23) ((a | c)*(b | a and c))/b | c

Surely "(b | a and c)" is a subexpression of "((a | c)*(b | a and c))/b | c", so why doesn't applyb1 find it and apply the rule?

Best regards,
Nathaniel


2009/10/1 Robert Dodier <robert.dodier <at> gmail.com>

On 10/1/09, Nathaniel Virgo <nathanielvirgo <at> gmail.com> wrote:

> (%i6) apply1( (a|b and c)*x, bayes);
> (%o6) (a | b and c)*x

applyb1 (bottom-up) works for me here instead of apply1 (top-down).
That's helpful, but not very satisfying; I can see why one
works and the other doesn't, but it's far from obvious.

best

Robert Dodier


_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
Richard Fateman | 1 Oct 2009 17:48
Picon
Favicon

Re: Pattern matching - new user question

Robert Dodier wrote:
>
> I get a stack overflow or endless loop for this one.
> Pretty sure the rule is applied to a|b and c, then b|a and c,
> then a|b and c, ad infinitum.

Try something like this..

defmatch(b1,(AA|BB and CC));

brule(p):=block([AA,BB,CC],if (b1(p)=false or ordergreatp(BB,AA)) then 
false
                  else (BB|AA and CC)*(AA|CC)/(BB|CC));

RJF
deltaquattro | 1 Oct 2009 17:52
Picon

Problem with "is"

Hi,

I got the following in Maxima:

(%i1)  declare(a,real,b,real);
(%o1)                                done
(%i2) c:a+b;
(%o2)                                b + a
(%i3) is(c^2>0);
(%o3)                               unknown

I know that "is" in Maxima is not very strong, but this is really
trivial. Is there something I'm doing wrong? Thanks,

Best Regards

Sergio

Gmane