Fred Senese | 30 Oct 22:59 2014

compilation of physical_constants

Every time I load the physical_constants package it compiles first (with 
a lot of output I can't suppress). How can I fix this?

(%i1) load(physical_constants)$
Compiling C:/Users/FREDER~1/AppData/Local/Temp/gazonk_9640_0.lsp.
End of Pass 1.  
End of Pass 2.  
OPTIMIZE levels: Safety=2, Space=3, Speed=3
Finished compiling 
C:/Users/FREDER~1/AppData/Local/Temp/gazonk_9640_0.lsp.
Compiling C:/Users/FREDER~1/AppData/Local/Temp/gazonk_9640_0.lsp.
End of Pass 1.  
End of Pass 2.  
OPTIMIZE levels: Safety=2, Space=3, Speed=3
Finished compiling 
C:/Users/FREDER~1/AppData/Local/Temp/gazonk_9640_0.lsp.
Compiling C:/Users/FREDER~1/AppData/Local/Temp/gazonk_9640_0.lsp.
End of Pass 1.  
End of Pass 2.  
OPTIMIZE levels: Safety=2, Space=3, Speed=3
Finished compiling 
C:/Users/FREDER~1/AppData/Local/Temp/gazonk_9640_0.lsp.
Compiling C:/Users/FREDER~1/AppData/Local/Temp/gazonk_9640_0.lsp.
End of Pass 1.  
End of Pass 2.  
OPTIMIZE levels: Safety=2, Space=3, Speed=3
Finished compiling 
C:/Users/FREDER~1/AppData/Local/Temp/gazonk_9640_0.lsp.
Compiling C:/Users/FREDER~1/AppData/Local/Temp/gazonk_9640_0.lsp.
End of Pass 1.  
(Continue reading)

Barton Willis | 27 Oct 13:35 2014

question about supcontext

Consider:


    (%i1) assume(x > 0)$


Create a supcontext, retract x>0, kill the new context, and return:


    (%i2) george() := block([g : gensym(), l : []],
       g : supcontext(g),
       l : cons(is(x >0),l),
       forget(x >0),
       l : cons(is(x >0),l),
       killcontext(g), l)$


All is well:


    (%i3) george();
    (%o3) [unknown,true]


At least facts() reports that the fact x > 0 still exists:


    (%i4) facts();
    (%o4) [x>0]


 That's what I wanted (expected), but  is(x>0) --> unknown. I expected is(x > 0) --> true:


    (%i5) is(x>0);
    (%o5) unknown    


I looked for a cure using activate, but failed. Is this a bug? Is there a workaround?


--Barton
------------------------------------------------------------------------------
_______________________________________________
Maxima-discuss mailing list
Maxima-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/maxima-discuss
Pankaj Sejwal | 26 Oct 09:14 2014
Picon

Actual meaning of design problem

My question is not related to any one particular CAS. I was reading archived mails on Axiom vs Maxima and RJF referred to some design problems that prevent maxima from doing somethings that axiom can do regarding types and modes.
Similarly, in recent mails here there was discussion on how to handle infinite limits for integration, there also there was reference to making drastic changes to architecture of maxima to introduce new ways to handle infinity.

It is an abstract statement but can someone suggest scenarios where I can actually see it affecting the problem's solution and how that architecture change will help.

To make my question more clear, for example what change in architecture will help in dealing with infinite integration problems ?

--
Regards,
Pankaj Sejwal
____________________________________________________
"The more I read, the more I acquire, the more certain I am that I know nothing.” -
Voltaire
------------------------------------------------------------------------------
_______________________________________________
Maxima-discuss mailing list
Maxima-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/maxima-discuss
Andrzej | 25 Oct 00:28 2014

Simplification of complex rational expressions

Hi,

Maxima does not seem to work very well with following expressions:

(%i11) declare(V_in, complex)$
(%i12) declare(s, complex)$
(%i13) tf0:
-(s^2*('realpart(V_in)+%i*'imagpart(V_in))*C^2*R^2+s*((2*%i+1)*'realpart(V_in)+(%i-2)*'imagpart(V_in))*C*R+%i*'realpart(V_in)-'imagpart(V_in))/(s^4*V_in*C^4*R^4+2*s^3*V_in*C^3*R^3+5*s^2*V_in*C^2*R^2+4*s*V_in*C*R+V_in)$
(%i13) fullratsimp(tf0);
            2                      2                  2  2
(%o13) - ((s  realpart(V_in) + %i s  imagpart(V_in)) C  R
 + ((2 %i + 1) s realpart(V_in) + (%i - 2) s imagpart(V_in)) C R
                                         4       4  4      3       3  3
 + %i realpart(V_in) - imagpart(V_in))/(s  V_in C  R  + 2 s  V_in C  R
      2       2  2
 + 5 s  V_in C  R  + 4 s V_in C R + V_in)

(note the mixture of V_in, realpart(V_in) and imagpart(V_in))

This may be a bug/omission in the simplification algorithm as Maxima can
successfully factor out "realpart(V_in)+%i*imagpart(V_in)" when
explicitly asked to do it:

(%i14) tf1:gfactor(tf0, realpart(V_in)+%i*imagpart(V_in));
                       realpart(V_in) + %i imagpart(V_in)
(%o14)            - -----------------------------------------
                           2  2  2
                    V_in (s  C  R  - 2 %i s C R + s C R - %i)
(%i15) tf:ratexpand(tf1, s), realpart(V_in)+%i*imagpart(V_in)=V_in;
                                       1
(%o15)               - ----------------------------------
                        2  2  2
                       s  C  R  - 2 %i s C R + s C R - %i

Maxima version 5.32.1, GCL 2.6.10.

Thanks,
Andrzej

------------------------------------------------------------------------------
Andrzej | 25 Oct 00:36 2014

Simplification of complex rational expressions

Hi,

Maxima does not seem to work very well with following expressions:

(%i11) declare(V_in, complex)$
(%i12) declare(s, complex)$
(%i13) tf0:
-(s^2*('realpart(V_in)+%i*'imagpart(V_in))*C^2*R^2+s*((2*%i+1)*'realpart(V_in)+(%i-2)*'imagpart(V_in))*C*R+%i*'realpart(V_in)-'imagpart(V_in))/(s^4*V_in*C^4*R^4+2*s^3*V_in*C^3*R^3+5*s^2*V_in*C^2*R^2+4*s*V_in*C*R+V_in)$
(%i13) fullratsimp(tf0);
            2                      2                  2  2
(%o13) - ((s  realpart(V_in) + %i s  imagpart(V_in)) C  R
 + ((2 %i + 1) s realpart(V_in) + (%i - 2) s imagpart(V_in)) C R
                                         4       4  4      3       3  3
 + %i realpart(V_in) - imagpart(V_in))/(s  V_in C  R  + 2 s  V_in C  R
      2       2  2
 + 5 s  V_in C  R  + 4 s V_in C R + V_in)

(note the mixture of V_in, realpart(V_in) and imagpart(V_in))

This may be a bug/omission in the simplification algorithm as Maxima can
successfully factor out "realpart(V_in)+%i*imagpart(V_in)" when
explicitly asked to do it:

(%i14) tf1:gfactor(tf0, realpart(V_in)+%i*imagpart(V_in));
                       realpart(V_in) + %i imagpart(V_in)
(%o14)            - -----------------------------------------
                           2  2  2
                    V_in (s  C  R  - 2 %i s C R + s C R - %i)
(%i15) tf:ratexpand(tf1, s), realpart(V_in)+%i*imagpart(V_in)=V_in;
                                       1
(%o15)               - ----------------------------------
                        2  2  2
                       s  C  R  - 2 %i s C R + s C R - %i

Maxima version 5.32.1, GCL 2.6.10.

Thanks,
Andrzej

------------------------------------------------------------------------------
Richard Fateman | 24 Oct 20:44 2014
Picon

more on pattern transforms / mathematica into maxima

If you don't care about Mathematica, skip the rest of this message.

I figured out that by declaring "/;" to the Maxima parser syntax via
infix("/;", 50, 50) ;
"/;"(x,y):=Condition(x,y)

it is possible to add another piece of Mathematica pattern syntax 
literally unchanged.

That is
pt(f(x_Rational,y_Rational)/;x>y);

becomes
Condition(f(Pattern(X,Blank(Rational)),Pattern(Y,Blank(Rational))),x>y)

whereas in mathematica..

FullForm[f[x_Rational, y_Rational] /; x > y]
becomes

Condition[f[Pattern[x,Blank[Rational]],Pattern[y,Blank[Rational]]],Greater[x,y]]

Even more..
  infix("->", 49,49); "->" (a,b):=Rule(a,b)
allows us to say something like

pt( f(x_,y_)/;x>y->g(x+y)    );

  which becomes

Rule(Condition(f(Pattern(x,Blank()),Pattern(y,Blank())),x>y),g(y+x))

The principal glitch is that we can't write a_?predicate in Maxima.
We have to write  a_\?predicate  with a backslash.

It should be straightforward to teach the display program to reverse
the operation of pt(), putting back _, __, ___, etc.  Any volunteers?
RJF

------------------------------------------------------------------------------
Barton Willis | 24 Oct 18:50 2014

sumhack redux

In doing sumhack redux, I noticed that simpsum1 uses subst in several places. In general that's a lousy thing
to do,  but in simpsum1 all the applications of subst are substitutions for a gensym sum index, so nothing nefarious
results, I think.

In particular, there is the code

((and (integerp n) (eq sgn '$pos) $simpsum)
         (unwind-protect
              (dotimes (j n acc)
            (setq acc (add acc (resimplify (subst (add j lo) i ex)))))

Wouldn't $substitute be better than subst followed by resimplify?  I thought resimplify ignores all simp flags, so
the code is potentially simplifying expressions that don't need simplification. If  ex has not yet been simplified
in the current environment, wouldn't it be better resimplify ex before the loop and use $substitute in the inner loop?

Maybe the better approach is to practice self-control and LIB (let it be) and only re-paste the sumhack (renamed to
sum_reversed_bounds) code? The file rtestsum has about 300 tests, I think...

--Barton
     
------------------------------------------------------------------------------
_______________________________________________
Maxima-discuss mailing list
Maxima-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/maxima-discuss
Richard Fateman | 24 Oct 06:06 2014
Picon

the pattern transformer..


Again, this may not be of much interest except for the Mathematica-literate.
And even among those, only the ones who are keen on using their knowledge in
Maxima..

Example:

pt(f_(x_sin,y_\?oddp));

produces ...

Pattern(f,Blank())(Pattern(x,Blank(sin)),PatternTest(Pattern(y,Blank(integer)),oddp))

which is a pattern that can then be used by the Maxima/MMA matching program.

pt is the name of a program -- the pattern transformer.

f_(x_sin,y_\?oddp)    will match any function of exactly two arguments
whose first argument is sin of something and whose second argument
is an integer and which is also odd.  If it succeeds,
there will be 3 names bound as a result
of the match. f, x, y.   f is bound to some function name, x to 
sin(something),
and y to some odd integer.

The syntax is almost the same as mathematica's except that we use () 
instead of [],
and I could not use ?, but had to use \? instead.  This one pattern 
illustrates most of our
acceptable syntax; we can handle one, two, or three underscores in pt. 
Other stuff
like Condition[ ]  has to be written that way, and not with /;.

In internal form, the pattern above is  (in GCL's standard upper-case mode)

((MQAPPLY SIMP) ((|$Pattern|) $F ((|$Blank|)))
  ((|$Pattern|) $X ((|$Blank|) $SIN))
  ((|$PatternTest|) ((|$Pattern|) $Y ((|$Blank|) $INTEGER)) $ODDP))

I haven't yet altered the matching program to handle mqapply this way.
Exactly how best to use this from Maxima ... I dunno.  maybe like 
defrule and
apply1,  maybe like tellsimp.

RJF

------------------------------------------------------------------------------
Richard Fateman | 24 Oct 00:57 2014
Picon

pattern matching ala Mathematica in Maxima .. a puzzle..

I've implemented a mathematica matcher (most of it, anyway) in Lisp, and am
trying to make it more or less seamless to use in Maxima.
For those unacquainted with Mathematica, the rest of this message may
be meaningless.

Mathematica allows patterns of the form

F[x_,y_]   to match F[3,4]   with x=3,y=4.

we can use the syntax f(x_,y_) in maxima to produce a  pattern expression

  f( Pattern(x,Blank()), Pattern(y,Blank()))  which can then be matched,
no problem,  with f(3,4).

Mathematica allows lots of other pattern forms and we also support some
of that syntax when it doesn't conflict with usage of characters, and
we even allow  the use of _.  The transformation of patterns only happens
on calling pt()    pt  means Pattern Transformation.

so really we did pt(f(x_,y_))  above.

Now here's the puzzle.  Mathematica allows

F_[x]  as a pattern.  This will match, say,  Sin[x] with F=Sin.

If we try the same thing in Maxima, we produce, from pt(f_(x)), an
expression that has too complicated an operator for the evaluator or the
display.  We allow operators in lisp that are symbols like f, sin,  or
that are lambda expressions .. e.g.
lambda([x,y],x+y)(a,3);    returns a+3.

We don't allow

Pattern(f,Blank()) (x).

So what should we do?  Change the display to let this sneak through?  In 
lisp it would
look like this..

(  ((Pattern simp) $f ((Blank simp) ))   simp)   $x)

and change the meval and simplifya program to allow "other stuff"
in the CAAR of the expression to just pass through unchanged.
Sort of like insoluble fiber through your [semi]colon...

Thoughts?

------------------------------------------------------------------------------
Nijso Beishuizen | 23 Oct 15:49 2014
Picon

sparse matrices in maxima?

Dear all,

Does maxima have support for sparse matrices (put matrix in sparse form,
perform matrix multiplication with sparse matrices, etc)?

Best,
Nijso

------------------------------------------------------------------------------
Nijso Beishuizen | 23 Oct 11:35 2014
Picon

secondary tic marks in draw2d

Dear all,

With draw2d, I couldn't remove the tic marks on the top axis, even when
I remove the entire top axis.
If I do this below, the tic marks of the top axis remain. 

load(draw);
draw2d(explicit(y^2,y,-3,3),axis_top=false,xtics_secondary=false);

I could only fix this by adding in gnuplot.lisp a new command:

           (if (null (get-option '$xtics_nomirror))
               (format nil "set xtics nomirror~%"
                       (get-option '$xtics_nomirror)))

and add the command xtics_nomirror in grcommon.lisp.

If there is no other way to do this, maybe a similar fix could be added
permanently, or maybe nomirror should be set when you remove the top
axis?

Best regards,
Nijso Beishuizen

------------------------------------------------------------------------------

Gmane