Ask Your Question

brenogil's profile - activity

2018-06-08 10:32:08 -0600 received badge  Good Question (source)
2017-12-09 18:29:35 -0600 received badge  Notable Question (source)
2017-01-31 11:49:32 -0600 received badge  Popular Question (source)
2016-05-22 08:30:01 -0600 asked a question Plot shared axis

I was trying to convert this into sage. Basically print function, first derivative, second derivative all sharing the x axis. Instead of scipy.misc.derivative I'd like to use sage derivative(). I have tries for hours an got several different errors. Any ideas?

d={}
with open(source) as f:
    for line in f:
       (key, val) = line.split()
       d[str(key)] = val
       print key
       f = lambda t : eval(val)
       x = np.arange(1,20,0.01)
       first = derivative(f,x,dx=1,n=1)
       second = derivative(f,x,dx=1,n=2)
       fig,ax = plt.subplots(3,1,sharex=True)
       #plt.suptitle("\n".join(wrap(str(key + " - \n" + val), 50)))
       ax[0].plot(x,f(x))
       ax[0].set_ylabel(r'$f(x)$')
       ax[1].plot(x,first)
       ax[1].set_ylabel(r'$f\/\prime(x)$')
       ax[2].plot(x,second)
       ax[2].set_ylabel(r'$f\/\prime\prime(x)$')
       ax[2].set_xlabel(r'$x$')
       plt.savefig()
       plt.close()

The results should be something like this (i would upload my own image but I realized I cannot): http://matplotlib.org/_images/subplot...

2016-04-18 11:03:55 -0600 received badge  Famous Question (source)
2016-04-18 11:03:55 -0600 received badge  Notable Question (source)
2016-04-08 05:34:25 -0600 received badge  Nice Question (source)
2016-03-24 20:58:28 -0600 received badge  Popular Question (source)
2014-01-15 06:39:23 -0600 received badge  Popular Question (source)
2013-09-12 03:08:36 -0600 received badge  Famous Question (source)
2013-04-29 15:12:56 -0600 received badge  Notable Question (source)
2013-03-01 10:23:34 -0600 received badge  Popular Question (source)
2012-08-16 23:15:41 -0600 commented answer assume() command with functions

Deleted that because it was not really an answer. I just meant that even facing similar results, sage does seem to behave differently when trying to solve our problems.

2012-08-16 22:51:04 -0600 answered a question assume() command with functions

I guess your case is a bit different because even p0 and p2 being sage.symbolic.expression.Expression

bool(p0+p2-1<0)still yields a True

2012-08-14 20:29:10 -0600 commented answer 2d plot axes labels

This is quite close to what I was expecting. Thank you!

2012-08-14 20:28:00 -0600 commented answer 2d plot axes labels

Thank you very much!

2012-08-14 20:27:42 -0600 marked best answer 2d plot axes labels

The following positions the labels at the ends of the axes.

plot(E,t,(x,0,15),axes_labels=['$t$ axis','$E$ axis'])

You could use the text command to position a label.

t = var('t')
E(t)=(10.40*(1-exp(-0.25*t)))^2.81    
p=plot(E,t,(x,0,15),axes_labels=['','$E$ axis'])
p+=text('$t$ axis',(8,-30),color='black')
show(p)

You may also be able to use matplotlib to get what you want.

2012-08-14 20:27:39 -0600 marked best answer 2d plot axes labels

Or this may be what you want:

t = var('t')
E(t)=(10.40*(1-exp(-0.25*t)))^2.81    
plot(E,t,(x,0,15),frame=True,axes_labels=['$t$ axis','$E$ axis'],axes=False)
2012-08-14 20:27:39 -0600 received badge  Scholar (source)
2012-08-14 08:21:01 -0600 received badge  Editor (source)
2012-08-14 08:20:31 -0600 asked a question 2d plot axes labels

Hello,

How do I add labels (names) to my axes when doing a simple 2d plot such as:

t = var('t')
E(t)=(10.40*(1-exp(-0.25*t)))^2.81    
plot(E,t,(x,0,15))

I would like to do so the labels are aligned directly under the x axis and vertically over the y axis. Is there a way?

2012-08-07 21:06:45 -0600 commented answer Graph matrix into network flow

Thanks for the hand! I'll pay you a beer whenever I am in Canada!

2012-08-06 20:13:29 -0600 commented answer Graph matrix into network flow

Thank you! I do no know if I am missing some package or something but I cannot make the graph 'behave' like the picture above.

2012-08-06 03:19:34 -0600 asked a question Graph matrix into network flow

Hello,

I have this marix:

M=matrix(ZZ,6,9,[[1,1,1,0,0,0,0,0,0],[0,0,0,1,1,1,0,0,0],[0,0,0,0,0,0,1,1,1],[-1,0,0,-1,0,0,-1,0,0],[0,-1,0,0,-1,0,0,-1,0],[0,0,-1,0,0,-1,0,0,-1]])

and I am looking to get something like this:

image description

How can I do it?

2012-08-03 17:19:50 -0600 received badge  Nice Question (source)
2012-07-30 08:11:47 -0600 received badge  Student (source)
2012-07-30 05:00:21 -0600 asked a question assume() command with functions

How can this be?

sage: x = var('x')
sage: Q = function('Q', x)
sage: assume(x>0)
sage: assume(Q>0)
sage: bool(Q>0)
False

And even

sage: bool(abs(Q)>0)
False

Am I forgetting or neglecting something? Thank you

2012-07-30 04:37:45 -0600 commented question Is it possible to define (or assume) a general positive function?

I also have this doubt

2012-07-30 04:36:41 -0600 received badge  Supporter (source)
2012-07-30 04:36:33 -0600 answered a question Is it possible to define (or assume) a general positive function?

I also have this doubt