Oops, actually, the naive result of expand(expr^2) if each oneof is
independent is 4,6,7,9.
On Wed, Aug 19, 2009 at 2:56 PM, Stavros Macrakis<macrakis at alum.mit.edu> wrote:
> The problem here is with correlated expressions. Consider
>
> ? ? expr: oneof(1,2)+1
>
> Presumably expr^2 can take on the values 4 and 9. ?But what about
> expand(expr^2)? ?Surely that should also take on the values 4 and 9,
> and not 4, 6, and 9...
>
> ? ? ? ? ? ?-s
>
> On Wed, Aug 19, 2009 at 2:43 PM, Barton Willis<willisb at unk.edu> wrote:
>> Some time ago, I had the idea of a "one_of" object. Such an object
>> might be useful when an expression has multiple representations (say
>> the Gauss hypergeometric functions with all six linear
>> transformations). In the end, the user could choose the "best" of the
>> alternatives. I didn't pursue the idea, but to start it was something
>> like:
>>
>> ?(%i46) one_of_p(e) := not mapatom(e) and op(e) = 'one_of$
>>
>> ?(%i47) load("simplifying")$
>>
>> ?(%i48) simp_one_of([e]) := ?block([p : [], q : []],
>> ?e : listify(setify(e)),
>> ?if e # [] and rest(e) = [] then first(e)
>> ?else (
>> ?for ek in e do (
>> ? ? if one_of_p(ek) then p : append(p, args(ek)) else q : cons(ek,q)),
>> ?simpfunmake('one_of, listify(setify(append(p,q))))))$
>>
>> ?(%i49) simplifying('one_of,'simp_one_of)$
>>
>> ?(%i50) one_of(a,one_of(a,b,c));
>> ?(%o50) one_of(a,b,c)
>>
>> Doing arithmetic on one_of objects isn't particularly difficult, but
>> doing it automatically via tellsimpafter is out of my league. For such
>> tasks, I think it would be easier to have a automatically applied
>> optional post simplification function. Such a function could look for
>> and crunch sums / products / ... ?of 'one_of' expressions.
>>
>>
>> Barton
>>
>> -----maxima-bounces at math.utexas.edu wrote: -----
>>
>>>To:?Leo?Butler?<l.butler at ed.ac.uk>
>>>From:?Robert?Dodier?<robert.dodier at gmail.com>
>>>Sent?by:?maxima-bounces at math.utexas.edu
>>>Date:?08/19/2009?01:21PM
>>>cc:?maxima at math.utexas.edu,?"Grasemann, ?Karsten"
>>><karsten.grasemann at geagroup.com>
>>>Subject:?Re:?[Maxima]?display?all?results?of?sqrt()
>>>
>>>On?Wed,?Aug?19,?2009?at?7:50?AM,?Leo?Butler<l.butler at ed.ac.uk>?wrote:
>>>
>>>>?(%i2)?sqt(x)?:=?block([],?if?listp(x)?then?map(sqt,x)?else
>>>>?[-sqrt(x),sqrt(x)]);
>>>
>>>I?can't?really?do?justice?to?this?topic,?so?I'll?settle?for?quibbling
>>>today?...
>>>
>>>I?want?to?discourage?cruft.?The?"block"?construct?isn't?needed,?and
>>>even?if?there?were?multiple?expressions,?in?the?absence?of?local?variables
>>>you?can?write?just?(e1,?e2,?e3)?.?It's?hard?enough?to?understand
>>>what's?going?on?without?extra?clutter.
>>>
>>>Aside?from?that,?this?question?of?representing?multiple?values?is
>>>very?interesting?and?I'm?pretty?sure?we?could?figure?out?a?way?to
>>>handle?it?in?a?way?that?is?both?useful?and?well-founded.?It?seems?likely
>>>that?multiple?values?could?be?represented?as?sets.?We?probably
>>>have?to?strengthen?Maxima's?ability?to?handle?sets?to?make?it?work.
>>>
>>>FWIW
>>>
>>>Robert?Dodier
>>>_______________________________________________
>>>Maxima?mailing?list
>>>Maxima at math.utexas.edu
>>>http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>>
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>