[sage-support] substitution in list

2021-12-28 Thread cyrille piatecki
First I have seen that perhaps my question has an answer in AskSagemath but currently it doesn't answer. Suppose I have a list of variables x_1, x_2, x_3,...x_n I have some sub-list of variables say [x_4, x_1, x_6...]. But whenever x_4, x_5,x_6 belong to this list I want the substitution x_4

[sage-support] substitution into a rational function

2016-08-19 Thread John Cremona
Am I missing something here? sage: F. = FunctionField(QQ) sage: f = F.random_element() sage: f (-p^2 + 5*p)/(-2/9*p^2 + 54) sage: f.subs({p:3}) (-p^2 + 5*p)/(-2/9*p^2 + 54) I have an element f of a rational function field F in one variable and want to "evaluate" it at a value of the variable

[sage-support] substitution in exterioralgebra

2015-01-15 Thread Daniele Angella
hi, i've encountered a problem in performing substitution in ExteriorAlgebra. i have E.x,y=ExteriorAlgebra(QQ) and i'd like to perform the substitution, e.g., {x:y} on any expression representing an element in E: for example, x.subs({x:y}) but it returns x, meaning the substitution is not

[sage-support] Substitution in infinite polynomial rings

2014-04-17 Thread BJ
I have the following code, which produces a list of polynomials in the infinite number of variables e_0, e_1, ... M.e = InfinitePolynomialRing(QQ, implementation=sparse) S.z = LaurentSeriesRing(M) Qxy.X,Y = PolynomialRing(QQ) a=var('a') b=var('b') k=var('k') L=[] n=6 x = 1/z^2 +

[sage-support] substitution

2013-01-08 Thread Michael Beeson
sage: K.d,e,p,g,m,f,u,v,j,N = FractionField(PolynomialRing(QQ,10,'depgmfuvjN')) sage: R.s = K[] sage: w=u sage: u=0 sage: w u Why doesn't Sage answer 0 for the value of w here? More generally, if I have some complicated expression and I assign a value to one of its variables, Sage knows

Re: [sage-support] substitution in sums and multiplications

2010-01-26 Thread Stan Schymanski
Is there a reason why integers are treated so differently to variables? If, for example, 2 is replaced by a variable, everything works as expected: h = (k1 + k2)*x h.subs_expr(k1 + k2 == k3) k3*x I don't understand why g is expanded to 2*k1 + 2*k2 but h not to x*k1 + x*k2 Is there no way

[sage-support] substitution in sums and multiplications

2010-01-25 Thread Ichnich
Hello everyone, there seems to be a bug in substitute: var('k1 k2 k3') f = (k1+k2)^2 f.substitute(k1+k2==k3) gives k3^2 as expected. var('k1 k2 k3') f = (k1+k2)*2 f.substitute(k1+k2==k3) gives 2*k1 + 2*k2. The same happens for +2 instead of *2. Is there an alternative to do a substitution?

Re: [sage-support] substitution in sums and multiplications

2010-01-25 Thread Burcin Erocal
Hi Stefan, On Mon, 25 Jan 2010 06:49:55 -0800 (PST) Ichnich warm...@web.de wrote: there seems to be a bug in substitute: var('k1 k2 k3') f = (k1+k2)^2 f.substitute(k1+k2==k3) gives k3^2 as expected. var('k1 k2 k3') f = (k1+k2)*2 f.substitute(k1+k2==k3) gives 2*k1 + 2*k2. The

[sage-support] Substitution

2010-01-20 Thread Stochastix
I have the following problem : I have two nested functions a=lambda x: 2*x b=lambda x: a(x)^2 Everything goes well as long as I want to compute the derivative of b but how can I evaluate this derivative at x=2. I tried g=lambda x: diff(b(x),x) g(x) returns 8*x as expected but g(2)=0. In other

Re: [sage-support] Substitution

2010-01-20 Thread Minh Nguyen
Hi, On Thu, Jan 21, 2010 at 2:14 AM, Stochastix laurent.decreusef...@gmail.com wrote: SNIP In other words, how can we substitute x=2 to the expression 8*x ? I guess this is somewhere in the docs but I didn't find where. Is the following what you want? [mv...@mod primroots]$ sage

[sage-support] substitution

2009-10-07 Thread Ranjit
I'm trying to figure out how to do a simple substitution. I've the following code: var('r beta beta_0 R a h') psi=function('psi',r) sigma=function('sigma',r) H_0=function('H_0',r) H_grad = lambda psi : (1/2)*(beta/beta_0)*R^2*(psi.diff(r))^2 H_0(psi) = -(1/2)*(beta/beta_0-1)*psi^2 +

[sage-support] substitution of lambda variable

2009-05-28 Thread Paul Sargent
Hi, I have some equations that use the Greek letter lambda in them, but I'm having problems because lambda is a keyword in python, and at some points the two collide. For example: sage: l = var(lambda) sage: t = var(theta) sage: e1 = t == l^2 sage: e2 = e1.solve(l) sage: e1 theta == lambda^2

[sage-support] Substitution with symbolic equations

2009-05-15 Thread Paul Sargent
Hi, I keep running into a road block which I think means either I'm missing something simple, or I'm thinking about things the wrong way. I'm fairly new to sage, and CAS in general, so either is possible. Here's a simple example of what I'm doing. Lets give ourselves two symbolic equations:

[sage-support] substitution problem

2009-03-30 Thread V
Hi, I'm fairly new to sage with some background in maxima. My workbook is shared at http://www.sagenb.org/home/pub/410/ the last three lines show the error I get. Basically, I derive an equilibrium condition that I would like to use in the previous stage of my game (solving by backwards

[sage-support] Substitution

2009-03-13 Thread hpon
Hi, What is the easiest way to make a mathematical substitution in Sage? For example: We have eqn1 = F == a + b and would like to use a = 0 and b = 3 to calculate F. Should I use solve and treat the problem like a system of equations, or is there a substitute-like command? Regards, hpon

[sage-support] substitution with callable symbolic functions

2008-09-18 Thread Alex Raichev
Hey all: I'm back with a follow up question on the topic of substitution in Sage. How can i work the following example? I have an expression that involves the derivative of a function, and into that expression i want to substitute the value of the derivative. Simple, eh? I tried Mike's **

[sage-support] substitution in a matrix (newby)

2007-07-24 Thread Roger Mason
Hello, Suppose I have a symbolic matrix: sage: m = matrix([[a,b],[d,e]]) and I wish to substitute some or all elements of m with numbers. The obvious sage: m.substitute(a=1) returns [a b] [d e] so the substitution (which works fine on a list) does not work on a matrix. How do I do such