Dieter Kaiser | 1 Feb 19:26 2009
Picon

Mirror symmetry and realpart/imagpart of functions

We know that realpart/imagpart do not work correctly for most functions with
complex arguments.

An example is:

(%i1) realpart(gamma(1+%i));
(%o1) gamma(1+%i)
(%i2) imagpart(gamma(1+%i));
(%o2) 0

Maxima assumes a function always to be real valued. This can be changed by
declaring the symbol gamma to be complex. Then we get the noun form for the
realpart and the imagpart.

For functions which have mirror symmetry we can do more. In general we have

realpart(f(x+%i*y)) = 1/2*   (conjugate(f(x+%i)) + f(x+%i*y))
imagpart(f(x+%i*y)) = 1/2*%i*(conjugate(f(x+%i)) - f(x+%i*y))

If the function has mirror symmetry this simplifies to:

realpart(f(x+%i*y)) = 1/2*   (f(x-%i) + f(x+%i*y))
imagpart(f(x+%i*y)) = 1/2*%i*(f(x-%i) - f(x+%i*y))

This is implemented directly into the routine risplit for the Erf function.

It is possible to support this simplification in general for function which are
declared to have mirror symmetry (or partially). We have to add the following
code to the routine risplit:

(Continue reading)

Rupert Swarbrick | 2 Feb 02:21 2009

(Minor) Documentation Fix


Hi,

I was confused by the behaviour of keepfloat this afternoon and found
bug 752417 and then the email conversation explaining it from 2003.

I've uploaded a proposed docs fix for this. I think that this sort of
fix to documentation is probably a good idea, and I'm happy to spend
some more time cleaning up other 'documentation' tracker items, but I
thought I'd check that this would be useful before spending any more
time on it.

Er, due to my extreme incompetence, I failed to attach the patch to
752417 and somehow managed to create item 2556130. Sorry! Will try not
to do this in future...

Rupert
_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
Robert Dodier | 2 Feb 07:59 2009
Picon

Fwd: [Maxima-lang-fr] Trouver les extrema de sin(x)

Forwarding this message from the French-language mailing list.

Laurent: maybe "find_root" (numerical approximation) is helpful.

best

Robert Dodier

---------- Forwarded message ----------
From: moky <moky.math <at> gmail.com>
Date: Feb 1, 2009 6:53 AM
Subject: [Maxima-lang-fr] Trouver les extrema de sin(x)
To: maxima-lang-fr <at> lists.sourceforge.net

Bonjour à toutes et à tous

 Affin de trouver les extrema d'une fonction, je cherche l'annulation de
 la dérivée. Par exemple pour la fonction sinus :

 f(x):=sin(x);
 solve( [diff(f(x),x)=0],[x] )

 Ceci me donne correctement la valeur pi/2, mais hélas :

 `solve' is using arc-trig functions to get a solution.Some solutions
 will be lost.

 La solution -pi/2 a été perdue. Or j'aurais bien aimé l'avoir parce
 qu'elle est un minimum.

(Continue reading)

Barton Willis | 2 Feb 14:42 2009

question / comments about sublis


I was looking at the source code for sublis (defined in
src/sublis.lisp). It seems that much of the complexity of this code
could be eliminated by using the CL function sublis. Does the Maxima
sublis function predate the Common Lisp function sublis?

 (1) sublis ignores opsubst, subst doesn't; sublis obeys the
sublis_apply_lambda option variable, subst ignores it,

 (2) sublis requires a list of substitutions, subst doesn't,

 (3) subst allows for substitutions of subscripted variables, sublis
doesn't,

 (4) subst allows for substitutions of nonatoms, sublis doesn't (OK,
parallel substitution of say sublis([x*y=1, x = 7], x * y) is somewhat
problematic.)

In part, I was looking at all this because I was thinking about
substitutions into Maxima conditionals:

 (%i6) '(if x < 1 then 5 else 1/x)$
 (%i7) subst(x=0,%); Division by 0

In the new to_poly_solver (CVS only), there is a simplifying
conditional %if. I started thinking about squeezing some code into
sublis to make sublis work for conditionals, but the source for sublis is
recondite. Of course, it's tempting to take the easy path: ditch the
complexity (and the oddball option variable sublis_apply_lambda) and
start from scratch and use the CL function sublis. Already, subst and
(Continue reading)

Luigi Marino | 1 Feb 19:05 2009
Picon

find minima and maxima points of a function

Last my work for Maxima, the block
find minima and maxima points of a function.
The block use solve of Maxima and points are
discovered if solve works.
 
load(descriptive);
 
stud_funz(f):=block([p,fs,fp],
p:solve(diff(f,x,1),x),
fs:diff(f,x,2),
fp:ev(fs,x:p),
for i:1 thru length(float(p)) do
if rhs(fp[i])>0 then print("minimo",[p[i],rhs(ev(f,x:p[i]))])
else print("massimo",[p[i],rhs(ev(f,x:p[i]))]))$
 
Example:
 
f:x^3/(1-x^2);
stud_funz(f);
minimo[x=-sqrt(3),(3*sqrt(3))/2]
massimo[x=sqrt(3),-(3*sqrt(3))/2]
massimo[x=0,0]
 
f:x*sqrt(1-x^2);
stud_funz(f);
minimo[x=-1/sqrt(2),-1/2]
massimo[x=1/sqrt(2),1/2]
 
f:trigexpand(cos(2*x)+2*sin(x));
stud_funz(f);
`solve' is using arc-trig functions to get a solution.
Some solutions will be lost.
massimo[x=%pi/6,0]
massimo[x=%pi/2,0]
 
Best wishes.
Luigi Marino
_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
Richard Fateman | 2 Feb 16:15 2009
Picon

Re: Configuring Maxima output as an improper fraction?

Why not multiply your result by 1.0, and use decimal.  It seems to me 
that you probably don't want improper fractions that are smaller than 
1/16 or 1/32.  You can buy a ruler that has a decimal to fraction table 
engraved on the back.
RJF
Barton Willis | 2 Feb 19:18 2009

Re: question / comments about sublis

Not that it matters all that much, but  sublis is potentially faster than 
subst:

sublis makes 2 calls to simplus & 12 to great:

(%i37) (untimer(), timer(?simplus,?great))$
(%i38) sublis([w=a, x=b,y=c,z=d], w + x + y + z)$

(%i39) timer_info();
(%o39) 
matrix([function,time//call,calls,runtime,gctime],[great,0,12,0,0],[simplus,0,2,0,0],[total,0,14,0,0])

subst makes 5 calls to simplus and 30 to great:

(%i41) (untimer(), timer(?simplus, ?great))$
(%i42) subst([w=a, x=b,y=c,z=d], w + x + y + z)$

(%i43) timer_info();
(%o43) 
matrix([function,time//call,calls,runtime,gctime],[great,0,30,0,0],[simplus,0,5,0,0],[total,0,35,0,0])

(1) When speed matters, I'd guess that ratsubst is faster than both,
(2) subst allows substitution of nonatoms, sublist doesn't --- so we're 
not comparing equals.

Barton
Robert Dodier | 2 Feb 19:47 2009
Picon

Re: question / comments about sublis

On 2/2/09, Barton Willis <willisb <at> unk.edu> wrote:

>  In part, I was looking at all this because I was thinking about
>  substitutions into Maxima conditionals:
>
>   (%i6) '(if x < 1 then 5 else 1/x)$
>   (%i7) subst(x=0,%); Division by 0
>
>  In the new to_poly_solver (CVS only), there is a simplifying
>  conditional %if. I started thinking about squeezing some code into
>  sublis to make sublis work for conditionals, but the source for sublis is
>  recondite. Of course, it's tempting to take the easy path: ditch the
>  complexity (and the oddball option variable sublis_apply_lambda) and
>  start from scratch and use the CL function sublis. Already, subst and
>  sublis have too many differences...

Barton, although it is tempting to just punt to SUBLIS, I think
the differences between subst and sublis are confusing, and just
calling SUBLIS wouldn't change that.

I think the only useful difference between subst and sublis is that
subst substitutes iteratively while sublis substitutes in parallel.
The name sublis doesn't suggest that, I think subst_parallel is better.
I'll suggest at this point to rename sublis to subst_parallel and aside
from parallel substitution to make it work like subst as much as possible.

About substitution into conditional expressions, I don't recommend
modifiying subst or sublis to handle them. A new function specifically
to substitute into such expressions would be OK I guess. But maybe
evaluating the expression with the variables of interest bound to
specific values would have the desired effect (because the code
for evaluating conditionals already ignores branches not taken).

e.g. foo : if x > 0 then 1/x else foo0; ev(foo, x = 0);
or: ev(foo, x = 1);

There may be some opposition to using ev in this way, but I don't
see how to get the desired effect with subst or sublis.

best

Robert Dodier
Robert Dodier | 2 Feb 19:56 2009
Picon

Re: Mirror symmetry and realpart/imagpart of functions

On 2/1/09, Dieter Kaiser <drdieterkaiser <at> web.de> wrote:

>  So what do you think. Should we extend Maxima to handle the
>  realpart/imagpart of functions with mirror symmetry more correctly.

OK by me. Thanks for working on this problem.

I hope at some point we will be able to state in the
documentation the identities which are known for each function.

>  If the function has in addition reflection symmetry and this is implemented too
>  we can get further simplifications.
>
>  With this extension we get more simple expressions for the abs and the carg
>  functions too, because the realpart/imagpart are needed.

Terrific, please go ahead.

best

Robert Dodier
Stavros Macrakis | 2 Feb 20:00 2009
Picon

Re: Mirror symmetry and realpart/imagpart of functions

On Sun, Feb 1, 2009 at 1:26 PM, Dieter Kaiser <drdieterkaiser <at> web.de> wrote:
> ...If the function has mirror symmetry this simplifies to:
>
> realpart(f(x+%i*y)) = 1/2*   (f(x-%i) + f(x+%i*y))
> imagpart(f(x+%i*y)) = 1/2*%i*(f(x-%i) - f(x+%i*y))
>
> This is implemented directly into the routine risplit for the Erf function.
>
> It is possible to support this simplification in general for function which are
> declared to have mirror symmetry (or partially)....

These are nice transformations, which have the good property of
eliminating realpart/imagpart/abs/carg nouns, which means further
simplifications are possible.  However, I am not sure that a user
would always prefer to see

         sqrt(gamma(1-%i))*sqrt(gamma(%i+1))

than

         abs(gamma(1+%i))

I do not actually have an opinion on this, but I think the question is
worth thinking about....

              -s

Gmane