Ask Your Question

Torero's profile - activity

2018-08-30 09:27:31 +0200 received badge  Famous Question (source)
2018-08-30 09:27:31 +0200 received badge  Notable Question (source)
2016-12-05 10:20:10 +0200 received badge  Student (source)
2016-02-08 00:03:40 +0200 received badge  Popular Question (source)
2014-08-18 16:41:53 +0200 commented question Symbolic variables in loops

yeah. n = anything natural >= 2

2014-08-18 16:16:41 +0200 commented answer Symbolic variables in loops

1. P_k = P[k] doesn't work in loops with index k (because even if k = 2, P_k =! P_2) 2. When I got an equation using P_2 it will still have P_2 in it afterwards

2014-08-18 16:13:25 +0200 commented answer Symbolic variables in loops

I'm sorry. I hoped there is a direct way to get the variables and used print as a basic example. But this one is interesting. Unfortunately it substitutes x by P_k and not the other way around

2014-08-14 15:24:11 +0200 answered a question Symbolic variables in loops

@niles: P[k] works, but I need P_k in my loop. In fact I'm trying to substitute P_k by P[k]

@kcrisman: print(eval...) works fine, but N[k] = N[k].subs(eval('P_%s' %k = P[k])) doesn't (SyntaxError: keyword can't be an expression). But this is what I was aiming at.

One solution would be to redefine N[k] everytime any P_k changes. But that would kill my calculation period for bigger n, so that is my last resort

2014-08-14 13:43:42 +0200 asked a question Symbolic variables in loops

Hi, I got a list of symbolic variables defined like this: P = list(var('P_%d' % i) for i in range(2*n + 1))

But when I try to manipulate these Variables in a for-loop like: for k in range(2,n + 2,2): print(P_k)

I'll get an error "NameError: name 'P_k' is not defined" I'm guessing there is no k in P_k because its one entity 'P_k' :-D But I hope it's possible to fix this by using "%" like in the definition above. Anyone knows how to?

Thanks

2014-08-05 11:48:25 +0200 answered a question Problems with Var in Cloud.Sagemath

Yup that worked. So I have to be careful not to override given functions?

2014-07-30 18:23:23 +0200 asked a question Problems with Var in Cloud.Sagemath

Hi, got a problem defining variables in cloud.sagemath: http://www.directupload.net/file/d/36...

I just copied the code from http://www.sagemath.org/doc/reference... (the very first line) but I also tried it myself with different letters and '`´". None worked.