Tellsimp and tellsimpafter



Many people do not use wxMaxima.  So I have copied out the inputs for the examples and pasted them into this email. 
Hopefully some of you will find this useful.  I have reattached the pw.mac file since I have modified it again.  I had a 
thought about a pwhelp() function.  Maybe there is something good about doing help for unsupported packages this way. 
Loading the package names all new functions defined including the name of the help function.  Type pwhelp() for help 
with this package.

The file pw.mac should be copied to a directory where Maxima can find it or you will have to type in the entire path in 
the load command otherwise.  I put it in the "share\contrib" directory.

Rich

Fourier Example 2.

kill(all);
load(pw);

pwhelp();
declare(n,integer);
assume(n>0);
f:[-10, -(x^2-25)/15, -5,  -15/3*sin(3*x), 0, x^2/6, 5, -(8*x-65)/6, 10];
pw(f,x);
load(draw);
a0 : radcan(integrate(pw(f,x), x)/20)$
a0: at(a0,[x=10])-at(a0,[x=-10])$
radcan(a0);
an : (s:(1/10)*integrate(pw(f,x)*cos(n*%pi*x/10), x, -10, 10), radcan(trigsimp(s)));
bn : (s:(1/10)*integrate(pw(f,x)*sin(n*%pi*x/10), x, -10, 10),radcan(trigsimp(s)));
define(a(n), an)$
define( b(n), bn)$
define(h(x), pw(f,x))$
g(x, terms) :=a0+sum(b(n)*sin(n*%pi*x/10)+a(n)*cos(n*%pi*x/10), n, 1, terms)$
terms:20;
draw2d(color =
black,explicit(h(x),x,-10,10),yrange=[-8,6],color=blue,explicit(g(x,terms),x,-10,10),label_alignment=right,
    label(["f(x) = pw([-10, -(x^2-25)/15, -5,  -15/3*sin(3*x), 0, x^2/6, 5, -(8*x-65)/6, 10],x)",9.5, -7]),
    label([concat("Fourier series for n = ", terms), 9.5, -7.5]))$

Fourier Examples 4.

kill(all);
load(pw);
declare(n,integer);
assume(n>0);
 f:[-10, (25-x^2)/5-4, -9,  6/5*-x^2/6, -7, x^2/6, 5, -(8*x-65)/6, 10];
load(draw);
a0 : radcan(trigsimp(integrate(pw(f,x), x,-10,10)/20));
an : (s:(1/10)*integrate(pw(f,x)*cos(n*%pi*x/10), x, -10, 10),radcan(trigsimp(s)));
bn : (s:(1/10)*integrate(pw(f,x)*sin(n*%pi*x/10), x, -10, 10), radcan(trigsimp(s)));
define( b(n), bn)$
define(a(n), an)$
g(x, terms) :=a0+sum(b(n)*sin(n*%pi*x/10)+a(n)*cos(n*%pi*x/10), n, 1, terms)$
terms:60;
draw2d(
label_alignment=right,
color = brown,
yrange=[-25,12],
explicit(pw(f,x),x,-45,45),
label(["pw([-10, (25-x^2)/5-4, -9,  6/5*-x^2/6, -7, x^2/6, 5, -(8*x-65)/6, 10],x)",44.5,-23]),
color=blue,
explicit(g(x,terms),x,-45,45),
label([concat("with Fourier series for ",terms, " terms"), 44.5, -24]))$


Basic Examples.

kill(all);
load(pw);
ratprint:false;
integrate((5/3-x^2/15)*unit_step(x-9),x);
unit_step(x-9)+7*unit_step(x-a), a=4;
integrate(%,x);
integrate(%,x),nouns,infeval;
factor(ev(integrate(%,x),nouns));
factor(ev(diff(%,x,2),nouns));
factor((x^2/2-6*x+11)*unit_step(x-9));
integrate(%, x);
radcan(%);
factor(x^2*unit_step(x-9));
integrate(%, x);
sin(x)*(unit_step(x-3)-unit_step(x-14));
integrate(%, x);
plot2d([%i14,%i15],[x,0,18.5],[y,-2.25,2.25]);
(1.2^((-.133)*x^2))*(unit_step(x-9)-unit_step(x-12));
integrate(%, x);
plot2d([%i17,%i18],[x,4,15],[y,-.5,.5]);
(((18/10)^((-133/100)*(x-9)^2)-1/2)*(unit_step(x-9)-unit_step(x-12)));
radcan(integrate(%, x));
plot2d([%i20,%i21],[x,8,13],[y,-1,1])$
(1.2^((-.133)*x^2))*sin(x)*unit_step(x-9);
factor(integrate(expr22, x));
1/(x^3+1)*unit_step(x-9);
integrate(%, x);
unit_step(x-9)/(x^3+1)-unit_step(x-5)/(x^3+1);
integrate(%,x);
integrate(x^3*unit_step(x-8)*x^2*unit_step(8-x), x);
factor(%);
diff(((x-8)*(3*x^3+20*x^2+160*x+1280)*unit_step(x-8))/12, x);

Rich


----- Original Message ----- 
From: "Edwin Woollett" <woollett at charter.net>
To: "Richard Hennessy" <rvh2007 at comcast.net>
Sent: Tuesday, October 21, 2008 2:24 PM
Subject: Re: [Maxima] Tellsimp and tellsimpafter



----- Original Message ----- 
From: "Richard Hennessy" <rvh2007 at comcast.net>
To: "Maxima List" <maxima at math.utexas.edu>; <fateman at cs.berkeley.edu>
Cc: "'Edwin Woollett'" <woollett at charter.net>; "Barton Willis"
<willisb at unk.edu>; "Raymond Toy" <raymond.toy at ericsson.com>; "Robert Dodier"
<robert.dodier at gmail.com>; "Stavros Macrakis" <macrakis at alum.mit.edu>
Sent: Monday, October 20, 2008 1:32 PM
Subject: Re: [Maxima] Tellsimp and tellsimpafter


> Hi list,
>
> I have worked out rules for integrating expressions that involve the
> unit_step function.  They all seem to work now
> because of your suggestion.  There are some restrictions on the unit_step
> argument, it has to be linear like
> unit_step(a*x+b), where a = 1 but as long as that is true a very large set
> of expressions can be integrated now with
> these rules.  Basically anything in the form of
>
> expr1*unit_step(x+b)+expr2*unit_step(x+c) + ... can be integrated as long
> as expr1, expr2 and ... exprn can be
> integrated.
>
> That means piecewise expressions or functions can be integrated now.  c
> and d have to be numbers (+ or -) or expressions
> that evaluate to a number.  With these rules would there be a chance that
> they could be added to the fourie.mac package?
> I would be adding two new functions too like pw(L,x) that return an
> expression involving unit_step.  I have done away
> with matrices in the output.
>
> I have not found anything wrong with putting declare (integrate, linear)
> but I have also considered that it may be
> better to do that to antidiff or a new function like pwintegrate.  I am
> not sure which way to do it and of course I am
> not a Maxima developer so I can't make changes except to my own copy of
> Maxima.  Is there any interest in this?  Are
> there known problems with declaring integrate to be linear?
>
> Rich
>
> I have attached the rules and two examples.  The examples work best in
> wxMaxima.
>
>
>
> ----- Original Message ----- 
> From: "Richard Fateman" <fateman at cs.berkeley.edu>
> To: "'Richard Hennessy'" <rvh2007 at comcast.net>; "'Maxima List'"
> <maxima at math.utexas.edu>
> Sent: Sunday, October 19, 2008 12:42 AM
> Subject: RE: [Maxima] Tellsimp and tellsimpafter
>
>
> I suggest you use some other function name, like myintegrate(...,..)
> and see if you can make your rules work.  integrate() has semantics
> associated with it that may be causing difficulty.
> read about declaring operators linear.
>
> in particular,  declare(myintegrate,linear)
>
> -->   myintegrate(a*x^2+b*x+c,x)   ==>
> a*myintegrate(x^2,x)+b*myintegrate(x,x)+c*myintegrate(1,x);
>
>
>
>
>
>> -----Original Message-----
>> From: maxima-bounces at math.utexas.edu
>> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Richard Hennessy
>> Sent: Saturday, October 18, 2008 9:16 PM
>> To: Maxima List
>> Subject: Tellsimp and tellsimpafter
>>
>> Hi List,
>>
>> I have been trying to get Maxima to change an integral of a
>> sum to the sum of integrals in cases where some of the
>> integrals in the sum can be done and some cannot and have had
>> no luck with it at all.  It seems like this cannot be done
>> with matchdeclare and tellsimp and tellsimpafter.  I can
>> write a program to do it but I would prefer to know for sure if
>> it cannot be done with tellsimp, tellsimpafter and
>> matchdeclare.  I always get a single integral sign of the entire sum.
>>
>> Example
>>
>> integrate(x^2*unit_step(x-5) + x,x)
>> ->  integrate(x^2*unit_step(x-5) + x,x)
>>
>> This form for the answer is of no help to me..
>>
>> Thanks,
>>
>> Rich
>>
>>
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pw.mac
Type: image/x-macpaint
Size: 3715 bytes
Desc: not available
Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20081022/3aa375c1/attachment.bin