2016-08-17 17:20:13 -0600 | received badge | ● Favorite Question (source) |

2015-06-15 22:12:29 -0600 | received badge | ● Famous Question (source) |

2015-03-26 11:39:04 -0600 | received badge | ● Famous Question (source) |

2014-08-20 08:21:47 -0600 | received badge | ● Great Question (source) |

2014-06-28 20:12:45 -0600 | marked best answer | summing over a list of variables? Hi all, I'm new to SAGE (I'm trying to move over from Mathematica), and I was wondering if someone could help me define the following function: $$ r_k(x_1, x_2, x_3, x_4) = \left( \sum_{i=k+1}^{4} x_i^2 \right)^{1/2} $$ I figured I could do something like: But this returns the error:
Worse yet, when I enter sage:x, it returns x, and forgets x was a list of variables. And to complicate things, when I try I get the error
even after I do "clear_vars()" and try everything all over again. Can anyone tell me what's going on? |

2014-06-26 12:25:58 -0600 | received badge | ● Famous Question (source) |

2014-05-04 01:47:13 -0600 | received badge | ● Famous Question (source) |

2013-08-03 09:15:17 -0600 | received badge | ● Famous Question (source) |

2013-07-22 07:31:33 -0600 | received badge | ● Notable Question (source) |

2013-02-04 03:36:54 -0600 | received badge | ● Notable Question (source) |

2012-12-22 16:44:33 -0600 | received badge | ● Notable Question (source) |

2012-11-28 18:52:46 -0600 | received badge | ● Notable Question (source) |

2012-11-19 22:18:43 -0600 | received badge | ● Popular Question (source) |

2012-09-07 21:20:33 -0600 | received badge | ● Great Question (source) |

2012-09-01 10:30:27 -0600 | received badge | ● Taxonomist |

2012-08-21 00:07:21 -0600 | received badge | ● Notable Question (source) |

2012-06-26 18:34:26 -0600 | received badge | ● Popular Question (source) |

2012-06-20 06:17:40 -0600 | received badge | ● Popular Question (source) |

2012-03-19 06:19:23 -0600 | received badge | ● Popular Question (source) |

2012-03-07 04:57:15 -0600 | received badge | ● Popular Question (source) |

2011-08-22 08:57:51 -0600 | commented question | Using Pydev (eclipse) and Sage? Just type "sage -python" in your terminal, and it will open up the sage_python interpreter. |

2011-08-22 05:08:04 -0600 | received badge | ● Nice Question (source) |

2011-08-14 14:43:14 -0600 | received badge | ● Good Question (source) |

2011-08-14 02:37:33 -0600 | commented answer | when/how to use parallel? Right. I'm not sure I know what a "linear algorithm" is. Let me edit my question, so I can be more specific. |

2011-08-14 02:37:33 -0600 | received badge | ● Commentator |

2011-08-13 23:34:14 -0600 | received badge | ● Nice Question (source) |

2011-08-13 18:17:47 -0600 | asked a question | when/how to use parallel? So I've scouted around some of the questions posed here that involve the terms parallel or the decorator @parallel and I want to know: is there any documentation out there that introduces novices to parallel computing (in sage)? At present (i.e. with the parallel? documentation being what it is), I don't really know how (or even when) to take advantage of @parallel. If I have a dual-core CPU, should I be trying to decorate every function with @parallel? Can someone educate this fool? Thanks, Steven ## EDIT:I suppose the best answer here would give an example of situations where @parallel can be of use, and where it cannot. I'm going to throw two examples out there, someone let me know if this is correct. Feel free to add you own, if my examples are two superficial. *Computing arc-length of a (smooth) curve parametrized by*$t \in [0,2\pi]$`var('t') def calcArcLength(gamma): speed_gamma = sqrt( sum( [ component.diff(t)^2 for component in gamma ])) return numerical_integral(speed_gamma, 0, 2*pi)[0]` *Calculating the arc-lengths of a list of smooth curves*`@parallel def makeList(length=1): li = [] for i in range(length-1): li.append(generateRandomCurve()) return li @parallel def processList(list_of_curves): arclength_of_curve = [] for curve in list_of_curves: arclength_of_curve.append(calcArcLength(curve)) return arclength_of_curve`
Is it fair to say that @parallel should speed up the time to make and process list_of_curves? Where as it won't speed up the function numerical_integral?
2 |

2011-08-13 18:02:18 -0600 | commented answer | Why does @parallel change my outputs? Thanks. I wish the documentation for @parallel was more clear. |

2011-08-13 14:59:33 -0600 | commented answer | Why does @parallel change my outputs? Sorry, why are you printing x[0][0][0], why doesn't x[0] suffice? |

2011-08-13 14:57:01 -0600 | commented answer | A way to rotate a tachyon plot While this isn't my thread, I'd like to thank the poster: this totally answers a question I was wondering about. |

2011-08-13 10:54:33 -0600 | commented answer | problem computing a numeric double integral So I looked at the link and converted my code to http://sagenb.org/home/TeamSkynet/6/cells/1/__sagenb_servers_sage_notebook_sagenb_sagenb_home_TeamSkynet_6_code_sage112_spyx.html however when I run calcMobiusEnergy, I now get the error "Exception TypeError: 'unable to simplify to float approximation' in '_sagenb_servers_sage_notebook_sagenb_sagenb_home_TeamSkynet_6_code_sage\ 112_spyx_0.arcLength' ignored"... What gives? |

2011-08-13 06:38:16 -0600 | commented answer | problem computing a numeric double integral So, I just finished running calcMobiusEnergy on (cos(t), sin(t), 0), and found an energy equal to 400.8287... The number is a bit unsettling (it should probably be less that 6*pi + 4), but what's more troublesome is the speed in which the calculation is completed. Running sage from my computer (not the notebook) it took well over 10 minutes to calculate this. Any way to speed this up? |

2011-08-13 05:21:44 -0600 | commented answer | problem computing a numeric double integral Thanks for the reply. I'll have to play around with your code. As far as I can tell, the circle cannot have mobius energy = 0, since you're summing non-negative quantities, and this would suggest that the integrand is constantly zero (something we know isn't true). P.S. how to do I do that %cython thing when not using the notebook? / Is there any documentation on that I could see? P.P.S. ed should be raised to the -2 inside your final return statement in mobiusEnergyIntegrand. |

2011-08-12 14:51:54 -0600 | answered a question | How do do more complex shell commands in Sage? This may be entirely newbish, but I was under the impression any terminal command can be run inside the sage console. For example: I don't really know how echo works, so I can't really help you there. Does this help/address your question? |

2011-08-12 14:42:58 -0600 | asked a question | problem computing a numeric double integral So, I'd like to compute $$ \int_{0}^{2\pi} \int_{0}^{2\pi} \left( \frac{1}{\left| \gamma(u) - \gamma(v)\right|^2} - \frac{1}{D(\gamma(u), \gamma(v))^2}\right) \left| \gamma'(u) \right| \left| \gamma'(v)\right| du dv $$ where $\gamma : [0,2\pi] \to \mathbb{R}^3$ is a curve, and $D(\gamma(u), \gamma(v))$ is the length of the shortest path (on the curve) between $\gamma(u)$ and $\gamma(v)$ (the geodesic arclength). Here's my code: However, when I try and test this on something simple like I get Is my entire strategy just not right? Does anyone have any ideas on how to make this work? I used the response to this old question as a model for the function "calcMobiusEnergy". Thanks, Steven |

2011-08-03 11:52:12 -0600 | commented answer | Knot Theory and Sage? I've checked out the Knot Atlas, but the fact that I needed to use mathematica to harness their software kept me from seriously considering anything over there. I'm surprised that no one has tried contacting the Knot Atlas people regarding a Sage port. As far as I know the two admin's are U of Toronto professors, right? So they shouldn't be that opposed to an open-source frame-work to their project... Thanks for the reply, by the way. |

2011-08-03 10:31:02 -0600 | received badge | ● Good Question (source) |

2011-08-03 05:10:27 -0600 | received badge | ● Nice Question (source) |

2011-08-02 09:24:37 -0600 | asked a question | Knot Theory and Sage? I was wondering what kind of Knot Theory tools Sage has? I've done a couple google searches, as well as a doc search in the Sage reference manual; everything's turned up bunk. Does anyone know of any Knot Theory tools in sage? In particular, knot tables? Thanks, Steven |

2011-07-20 09:02:11 -0600 | marked best answer | summing over a list of variables? There are two unrelated problems here. One - assigning a function also reassigns the variables used to define it: This causes your x to dissapear. You just need to give r's variables a different name. Second - y[j] cannot function as a symbolic expression - I believe unlike Mathematica sage does not implement "indexing" as a symbolic expression (see also here). So 'sum( y[j], j, 0, 1)' cannot work. The way to sum over a list y is simply sum(y), but this still won't solve your first problem. You can do something like But r(k) will not work for k a variable. |

2011-07-20 09:02:11 -0600 | received badge | ● Scholar (source) |

2011-07-20 08:36:31 -0600 | edited question | Using Pydev (eclipse) and Sage? Hi, I've been googling around to find a way to set up pydev and sage, and have had nothing but the worst of luck. sage 4.7 is located in /home/steven/sage-4.7, and I've created a "sage_python" python interpreter who's location is "/home/steven/sage-4.7/local/bin/python". I've set the following environment variables: Now, when I run the following script (test.py): When I run the script with sage_python as the interpreter I get the following error:
Can anyone help me out with this? Thanks, Steven p.s. I've noticed this post on the sage support google groups, but even when I open eclipse via I get the same error. |

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.