On Wed, Jun 15, 2011 at 4:06 PM, Michael Orlitzky <[email protected]> wrote:
> Is there a way to define an "empty" piecewise function? I'd like to do
> the following (I've defined my own piecewise_append):
>
>  result = <empty piecewise>
>
>  for i in range(0,n):
>    result = piecewise_append(result, some_functions[i])


Not that I know of. You can build the list of (interval,function) pairs
iteratively and then redefine the function.


>
>
> In reality, I wind up unrolling the first iteration of the loop, so it
> looks something like this:
>
>  result = some_functions[0]
>
>  for i in range(1,n):
>    result = piecewise_append(result, some_functions[i])
>
>
> That's not so bad, but it gets ugly with doubly- or triply-nested loops.
> Someday I'll have to write a generic piecewise_add that works over
> non-uniform intervals, but for now I'd just like to avoid copy/pasting
> the first iteration of my loops everywhere.
>
> --
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to 
> [email protected]
> For more options, visit this group at 
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to