On Thursday, February 11, 2016 at 9:04:16 PM UTC-2, Nils Bruin wrote:
>
> On Thursday, February 11, 2016 at 11:32:45 AM UTC-8, João Alberto Ferreira 
> wrote:
>>
>> 1) Isn't there a way to pass to the Piecewise function if the intervals 
>> are open or closed at its borders, so as, in the example above, g(x) could 
>> be evaluated to 25 instead of 35/2?
>>
>
> It doesn't seem to be possible at the moment. The averaging behaviour is 
> hard-coded.
>  
>
It's a pity.
 

> 2) Cant't I plot a Piecewise function with intervals extending to 
>> infinity, as the example above, by just indicating (maybe in the plot 
>> method) the definite interval that I wish to be used to evaluate and plot 
>> the function? For the graph of a Piecewise function, I would expect 
>> something like the examples in 
>> http://www.sagemath.org/calctut/continuity.html, with the hollow and 
>> filled circles indicating if the intervals are open or closed at its 
>> borders.
>>
>
> You can use
> plot(lambda x: g(x), 0, 10)
> or
> plot(g.__call__, 0, 10)
>
> Thank you for the sugestions but, unfortunatelly, the options above plot 
the function as it was a continuous function. The only way I could find to 
plot the function correctly is as in 
http://www.sagemath.org/calctut/continuity.html. But it ignores the created 
piecewise function.

g1(x) = x**2
g2(x) = 2*x
g = Piecewise([[(-Infinity,5),g2],[(5,Infinity),g1]])
P1 = plot(g2, 0, 5)
pt1 = point((5, g2(5)), rgbcolor='white', faceted=True, pointsize=30)
pt2 = point((5, g1(5)), rgbcolor='black', pointsize=30)
P2 = plot(g1, 5, 10)
P1 + pt1 + pt2 + P2 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to