[sage-support] Evaluating a symbolic expression

2012-11-03 Thread Jotace
Hi all, I want to find the max/min of a function f =f(x,y,z) of three variables under two constraints g_1 = 0, g_2=0 using Lagrange multipliers. I am able to build and solve the system, even to form the list of values fox the critical points, say P1=[1,2,3], but then I am not able to cmpute

Re: [sage-support] Evaluating a symbolic expression

2012-11-03 Thread D. S. McNeil
I mean, I can of course do f(P1[0],P1[1],P1[2]), but this is highly non-elegant. You can use an asterisk: sage: f(x,y,z) = x+10*y+100*z sage: P1 = [2,3,4] sage: f(*P1) 432 Here, * behaves kind of like a dereferencing operator: f(*(x,y,z)) == f(x,y,z). See this StackOverflow question for a