Ask Your Question

brenogil's profile - activity

2018-06-08 17:32:08 +0200 received badge  Good Question (source)
2017-12-10 01:29:35 +0200 received badge  Notable Question (source)
2017-01-31 18:49:32 +0200 received badge  Popular Question (source)
2016-05-22 15:30:01 +0200 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 18:03:55 +0200 received badge  Famous Question (source)
2016-04-18 18:03:55 +0200 received badge  Notable Question (source)
2016-04-08 12:34:25 +0200 received badge  Nice Question (source)
2016-03-25 02:58:28 +0200 received badge  Popular Question (source)
2014-01-15 13:39:23 +0200 received badge  Popular Question (source)
2013-09-12 10:08:36 +0200 received badge  Famous Question (source)
2013-04-29 22:12:56 +0200 received badge  Notable Question (source)
2013-03-01 17:23:34 +0200 received badge  Popular Question (source)
2012-08-17 06:15:41 +0200 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-17 05:51:04 +0200 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-15 03:29:10 +0200 commented answer 2d plot axes labels

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

2012-08-15 03:28:00 +0200 commented answer 2d plot axes labels

Thank you very much!

2012-08-15 03:27:42 +0200 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-15 03:27:39 +0200 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-15 03:27:39 +0200 received badge  Scholar (source)
2012-08-14 15:21:01 +0200 received badge  Editor (source)
2012-08-14 15:20:31 +0200 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-08 04:06:45 +0200 commented answer Graph matrix into network flow

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

2012-08-07 03:13:29 +0200 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 10:19:34 +0200 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-04 00:19:50 +0200 received badge  Nice Question (source)
2012-07-30 15:11:47 +0200 received badge  Student (source)
2012-07-30 12:00:21 +0200 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 11:37:45 +0200 commented question Is it possible to define (or assume) a general positive function?

I also have this doubt

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

I also have this doubt