On Wed, Apr 3, 2019 at 2:47 PM wrote:
> The simplest example:
>
> f = piecewise([[[-pi-1, -pi/2], 0], [(-pi/2,pi/2), 1], [[pi/2, pi+1], 0]])
> print(f(-pi))
>
>
I'm not sure why it isn't evaluating symbolic numbers like pi, but here's a
work-around:
sage: f = piecewise([((-pi-*1*, -pi/*2*), *0*)
The simplest example:
f = piecewise([[[-pi-1, -pi/2], 0], [(-pi/2,pi/2), 1], [[pi/2, pi+1], 0]])
print(f(-pi))
which gives the traceback:
TypeError Traceback (most recent call last)
in ()
> 1 f(-pi)
/Applications/SageMath-8.7.app/Contents/Resources/sage/loca
On Wed, Jan 24, 2018 at 8:13 PM, Anton Sherwood wrote:
> Speaking of piecewise functions, does anyone happen to know of a piecewise
> polynomial object for Python? I tried writing one (based on numpy.poly1d)
> but its integration method seems to have a bug. It surprises me that I
> haven't found
Speaking of piecewise functions, does anyone happen to know of a
piecewise polynomial object for Python? I tried writing one (based on
numpy.poly1d) but its integration method seems to have a bug. It
surprises me that I haven't found one on the fertile Web.
--
*\\* Anton Sherwood *\\* www
The easiest workaround is to switch to vector-graphics output:
%display graphics vector
r = var('r')
plot(2*r - r^2, r, 0, 1) + plot(1, r, 1, 2)
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving
On Monday, January 22, 2018 at 12:07:07 AM UTC, Simon Willerton wrote:
>
>
> On Sunday, January 21, 2018 at 7:02:24 PM UTC, William wrote:
>>
>>
>> On Sun, Jan 21, 2018 at 9:01 AM Simon Willerton
>> wrote:
>>
>>> Hi!
>>>
>>> There seems to be a bug in the plotting in the Jupyter notebook. The
On Sunday, January 21, 2018 at 7:02:24 PM UTC, William wrote:
>
>
> On Sun, Jan 21, 2018 at 9:01 AM Simon Willerton > wrote:
>
>> Hi!
>>
>> There seems to be a bug in the plotting in the Jupyter notebook. The
>> following piecewise defined function should be smooth at r=1 but the plot
>> is no
On Sun, Jan 21, 2018 at 9:01 AM Simon Willerton
wrote:
> Hi!
>
> There seems to be a bug in the plotting in the Jupyter notebook. The
> following piecewise defined function should be smooth at r=1 but the plot
> is not; the first part of the plot seems to be lifted slightly. I noticed
> this in
Hi!
There seems to be a bug in the plotting in the Jupyter notebook. The
following piecewise defined function should be smooth at r=1 but the plot
is not; the first part of the plot seems to be lifted slightly. I noticed
this in a more complicated example but this is a reasonably minimal case
For graphing strain load on a shaft in relation to coordinate x, I have
created a set of piecewise functions. Now I wanted to munge them into a
single parametrized vector to easily get the length via norm() at a
specified point.
M_Tx = piecewise([[[0, l1], M_t], [(l1, l1+l2), 0]])
M_by = piecew
I have a function g(x) equal to x^2 if x >= 5, and equal to 2*x if x < 5. I
constructed the piecewise function as follows:
g1(x) = x**2
g2(x) = 2*x
g = Piecewise([[(-Infinity,5),g2],[(5,Infinity),g1]])
When I evaluate f(5), it returns 35/2 because it evaluates g1(5), g2(5) and
returns the avera
On 12/01/2012 09:34 AM, kcrisman wrote:
>
>
> On Friday, November 30, 2012 11:16:48 PM UTC-5, Michael Orlitzky wrote:
>
> On 11/30/2012 10:12 PM, Jason Grout wrote:
> >
> > Is there something better? I tried to get piecewise to work, but I
> > couldn't plot, integrate, etc., the
On Friday, November 30, 2012 11:16:48 PM UTC-5, Michael Orlitzky wrote:
>
> On 11/30/2012 10:12 PM, Jason Grout wrote:
> >
> > Is there something better? I tried to get piecewise to work, but I
> > couldn't plot, integrate, etc., the function.
> >
>
> I've collected a lot of code over the y
On 11/30/2012 10:12 PM, Jason Grout wrote:
>
> Is there something better? I tried to get piecewise to work, but I
> couldn't plot, integrate, etc., the function.
>
I've collected a lot of code over the years for working with piecewise
functions, but most of it was written before I knew anythin
On Fri, Nov 30, 2012 at 10:12 PM, Jason Grout
wrote:
> A friend just asked me about piecewise functions in Sage (how to construct,
> plot, differentiate, integrate, etc., them). I came up with two answers for
> plotting:
>
> * use python functions:
>
> def f(t):
> return t^2*(0<=t<=1) + (t-1)
A friend just asked me about piecewise functions in Sage (how to
construct, plot, differentiate, integrate, etc., them). I came up with
two answers for plotting:
* use python functions:
def f(t):
return t^2*(0<=t<=1) + (t-1)*(1Is there something better? I tried to get piecewise to work,
Hello.
How do I define a piecewise function that are discontinuous in one point?
I mean, how do I define a piecewise function f(x) if it is like
xif 0 in ()
/opt/sage-4.6.2-linux-32bit-ubuntu_10.04_lts-i686-Linux-i686-Linux/local/lib/python2.6/site-packages/sage/functions/piecewise.pyc
Piecewise Function: endpoint gotcha - bug or feature?
It seems that the piecewise function (which requires overlapping
endpoints for the specified function intervals) does some unadvertised
averaging for results for values at the endpoints.
See the sage output from the input below.
Rather than p
I'm trying to do something that seems very simple but isn't working.
Hence the post here :)
I want to define a very simple piecewise linear function. It's linear
with slope alpha up to a knot at c and then it's linear with slope
beta. Here's what I thought might work:
f(x) = (x<=c)*alpha*x
Hello.
I'd like to have some simple piecewise defined function like:
f = Piecewise([[[0,1],1]])
and the composite it with some other function like
h = x - 1
I've tried somethine like this:
f1 = lambda x:1
f2 = lambda x:x+2
f = piecewise([[[0,1],f1]])
f(f2)
and it fails with:
Traceback (most r
20 matches
Mail list logo