I meant compxb, not compbx.
The following should be faster, but it is trickier code:
simpbetween(x,a,b,[option]) :=
block([prederror:false,
leftopen,rightopen,compxa:false,compxb:false],
if option=[] then leftopen:rightopen:false
else ( leftopen: member(option[1],[lopen,open]),
rightopen: member(option[1],[ropen,open])),
if
(a=minf or x=inf or member(compxa: sign(x-a),if leftopen then '[pos]
else '[pos,pz,zero]))
and
(b=inf or x=minf or member(compxb: sign(x-b),if rightopen then '[neg]
else '[neg,nz,zero]))
then 1
elseif
(((x # inf) and (a=inf))
or member(if compxa=false then compxa:sign(x-a) else compxa,if
leftopen then '[neg,nz,zero] else '[neg]))
or
(((x # minf) and (b=minf))
or member(if compxb=false then compxb:sign(x-a) else compxb,if
rightopen then '[pos,pz,zero] else '[pos]))
then 0
else apply('simpfuncall,append(['between,x,a,b],option))
)$
On Tue, Apr 6, 2010 at 00:31, Richard Hennessy <rich.hennessy at verizon.net>wrote:
> I am computing repeated convolutions of piecewise functions like:
>
> p(x):=((3*b*x^2+3*c)*between(x,-a,a))/(6*a*c+2*a^3*b)$
> define(dc(x), pwdefint(p(p)*p(x-p),p,minf,inf))$
> for i : 1 thru 10 do define(dc(x), pwdefint(dc(p)*p(x-p),p,minf,inf))$
>
> What is compbx?
>
> Rich
>
>
> --------------------------------------------------
> From: "Stavros Macrakis" <macrakis at alum.mit.edu>
> Sent: Monday, April 05, 2010 11:13 PM
> To: "Richard Hennessy" <rich.hennessy at verizon.net>; "Barton Willis" <
> willisb at unk.edu>; "Maxima List" <maxima at math.utexas.edu>
>
> Subject: Re: [Maxima] How do you write this in lisp
>
> Well, it will depend on how often the conditions are true or false. If
>> that's the issue, you can set compbx only on demand.
>>
>> How are you measuring speed?
>>
>> -s
>>
>> On 2010-04-05, Richard Hennessy <rich.hennessy at verizon.net> wrote:
>>
>>> Hi,
>>>
>>> Actually this was a bad idea. I tried making between a regular function
>>> and
>>> it breaks a lot of code that I have
>>> written. It has to be a simplifying function or I can't integrate
>>> expressions that contain it.
>>>
>>> I have posted the newest pw.mac at my site. It can use between or
>>> signum.
>>> I have to update the help now. You can get
>>> it here. http://mysite.verizon.net/res11w2yb/pw.mac.txt BTW I have
>>> tried
>>> using sign() in the definition of simpbetween
>>> but it is slower that using the relational operators. Maybe I am going
>>> about it the right way.
>>>
>>> Rich
>>>
>>>
>>> --------------------------------------------------
>>> From: "Richard Hennessy" <rich.hennessy at verizon.net>
>>> Sent: Monday, April 05, 2010 10:05 PM
>>> To: "Barton Willis" <willisb at unk.edu>; <macrakis at alum.mit.edu>
>>> Cc: "Maxima List" <maxima at math.utexas.edu>
>>> Subject: Re: [Maxima] How do you write this in lisp
>>>
>>> "simplification--how much is too much".
>>>>
>>>> Maybe between should not be a simplifying function at all. I could make
>>>> the body of simpbetween with some possibly
>>>> necessary changes the body of a regular user function called between. I
>>>> am not sure I like simplifying functions that
>>>> much. Maybe that would work out better. I can't make up my mind on
>>>> this
>>>> yet. I am going to try experimenting with
>>>> both ways
>>>> of doing it.
>>>>
>>>> Rich
>>>>
>>>>
>>>> --------------------------------------------------
>>>> From: "Barton Willis" <willisb at unk.edu>
>>>> Sent: Monday, April 05, 2010 9:17 PM
>>>> To: <macrakis at alum.mit.edu>
>>>> Cc: "Richard Hennessy" <rich.hennessy at verizon.net>; "Maxima List"
>>>> <maxima at math.utexas.edu>
>>>> Subject: Re: [Maxima] How do you write this in lisp
>>>>
>>>> It would be great if there was a definitive guide to writing
>>>>> simplifying
>>>>> functions.
>>>>> There are plenty of examples, but no how-to manual that I know of; some
>>>>> topics
>>>>> that come to mind:
>>>>>
>>>>> (1) nouns and verbs,
>>>>> (2) autoloading simplifying functions,
>>>>> (3) simplification--how much is too much,
>>>>> (4) reflection rules,
>>>>> (5) binary64 & bigfloat evaluation,
>>>>> (6) extras: gradef, conjugates, limits, TeX properties,
>>>>> antiderivatives,
>>>>> (7) declaring function properties (complex, ...),
>>>>> (8) domain and wrong number of argument errors,
>>>>>
>>>>> --Barton
>>>>>
>>>>>
>>>>>
>>>> _______________________________________________
>>>> Maxima mailing list
>>>> Maxima at math.utexas.edu
>>>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>>>
>>>>
>>>
>>>
>>
>