Ask Your Question

dr's profile - activity

2015-10-08 10:32:08 -0600 commented answer scalar^[vector]?

Actually, it still doesn't work right.

from numpy import array as npvec
N = 100
angs = -i*2*pi/N*npvec(range(1,N+1))
e.^angs

gives an error. In fact, putting anything in place of e except an integer fails. Even a variable that has an integer value gives an error.

2015-10-08 10:14:13 -0600 commented answer scalar^[vector]?

Can't upvote yet, so thanks!

2015-10-08 09:42:54 -0600 commented answer scalar^[vector]?

Right, I know what numpy is. I just assumed the default python-like interaction I'm doing in a sagecell WAS numpy. Instead it's another language? Or something?

2015-10-08 09:18:52 -0600 commented answer scalar^[vector]?

2.^x

works.

I guess I don't understand the relationship between sage and numpy or scipy or really any of the packages. Why is numpy not the default. What are the implications of doing the import? Are numpy vectors going to interact with the plotting correctly? Etc.

Ugh, I didn't even notice the difference between "through sage" and "with python". .^ works in one and errors in the other, while ^ is the reverse. I don't understand. What document gives a map for how all these things interact?

2015-10-08 04:22:26 -0600 commented answer scalar^[vector]?

That makes writing the function easier, but for readability in the middle of an equation it leaves a lot to be desired.

2015-10-08 04:21:46 -0600 received badge  Scholar (source)
2015-10-07 20:00:55 -0600 received badge  Editor (source)
2015-10-07 20:00:40 -0600 asked a question scalar^[vector]?

I feel really stupid like this should be obvious, but I can't figure out how to do it.

v = vector([1,2,3])
2^v

should give me

[2, 4, 8]

I can't find any other way to do this without writing a function.

2015-03-02 20:25:59 -0600 answered a question Is there a way to get embedded sagecells to autoeval?

nm, I figured it out from the code. is there any documentation of this?

 <script>
  // div.compute turns all "compute" divs into sagecells
  // minimal template means there's no cell editing for the user
  // autoeval means there's no stupid "click here to activate me!" necessary
  // hide: evalButton means the stupid button itself is gone
  $(function() {
     sagecell.makeSagecell({inputLocation: 'div.compute', template: sagecell.templates.minimal, autoeval: true, hide: ['evalButton']});
  });
  </script>
2015-03-02 20:15:17 -0600 received badge  Student (source)
2015-03-02 19:07:07 -0600 asked a question Is there a way to get embedded sagecells to autoeval?

I don't want to have a big "press this button to see the thing" on my page. I just want the interact to be there. I see the javascript has an "autoeval" setting, but I can't figure out how to activate it.