MaPal93

175 Reputation

5 Badges

2 years, 135 days

MaplePrimes Activity


These are questions asked by MaPal93

I have a system of 4 nonlinear equations in 4 lambda variables. I cannot obtain a solution using solve():

4_nonlinear_equations.mw

I can sometimes simplify similar systems by rescaling equations to reduce parameters. With only 3 parameters (sigma_v, sigma_d, sigma_d3) in this case, complexity arises from the interactions of the 4 lambdas in the 4 equations. Upon examining the equations (highlighted in yellow), I suspect hidden symmetries. Is it possible to solve the system by rewriting the equations in terms of each other to find an equivalent system? I am exploring if a smarter and simpler reformulation could lead to a solution. Thank you.

I have a 2-parameters quartic equation in n (where n>=2 and integer) and want to find for which parameter values it is zero, if any exists.

Here I am analyzing the signs of each coefficient, but is there a faster way to solve my problem?
Thanks.

quartic_equation_in_n.mw

I want to solve n nonlinear equations in n unknowns named lambda[1], lambda[2], ..., lambda[n]. For simplicity, I assume n=3. Each of the three equations includes matrices and dot products.

Running solve() takes forever...I assume this is because Maple is trying to find the explicit form. I am not sure, but I have reasons to believe that a solution exists.

Questions:

  1. Did I set up the three equations correctly? Is there a simpler or smarter way to set up my problem?
  2. Is it okay for Maple that lambda[i] sometimes appears isolated and sometimes as a component of a vector?  
  3. Is there a way to keep my quantities (except the lambda vector I guess, since it containts the lambda[i] component I need to solve for) undefined/implicit while making sure Maple correctly deals with matrices and dot products?
    e.g., the solution should display terms like p^%T.R.w as such, rather than the corresponding explicit computation...

Worksheet:

restart;

S:=Matrix([[Sigma[1,1],Sigma[1,2],Sigma[1,3]],[Sigma[2,1],Sigma[2,2],Sigma[2,3]],[Sigma[3,1],Sigma[3,2],Sigma[3,3]]]):

w:=Vector(3,symbol=omega):

r:=Vector([sqrt(S[1,1]/(w^%T.S.w)),sqrt(S[2,2]/(w^%T.S.w)),sqrt(S[3,3]/(w^%T.S.w))]):

R:=Matrix([[r[1],0,0],[0,r[2],0],[0,0,r[3]]]):

p:=Vector(3,symbol=rho):

l:=Vector(3,symbol=lambda):

e[1]:=Vector([1,0,0]):
e[2]:=Vector([0,1,0]):
e[3]:=Vector([0,0,1]):

f:=x->x^2:
w__sq:=f~(w):
l__sq:=f~(l):

 

eq1:='(w[1]*((p^%T.R.w)/(2*(l^%T.w__sq)))*(w^%T.S.e[1]))/(w[1]^2*((p^%T.R.w)^2/(4*(l^%T.w__sq)^2))*(w^%T.S.w)+sigma__delta^2*(w[1]^2*(((l__sq)^%T.w__sq)/(4*(l^%T.w__sq)^2)-lambda[1]/(l^%T.w__sq))+1))';

eq2:='(w[2]*((p^%T.R.w)/(2*(l^%T.w__sq)))*(w^%T.S.e[2]))/(w[2]^2*((p^%T.R.w)^2/(4*(l^%T.w__sq)^2))*(w^%T.S.w)+sigma__delta^2*(w[2]^2*(((l__sq)^%T.w__sq)/(4*(l^%T.w__sq)^2)-lambda[2]/(l^%T.w__sq))+1))';

eq3:='(w[3]*((p^%T.R.w)/(2*(l^%T.w__sq)))*(w^%T.S.e[3]))/(w[3]^2*((p^%T.R.w)^2/(4*(l^%T.w__sq)^2))*(w^%T.S.w)+sigma__delta^2*(w[3]^2*(((l__sq)^%T.w__sq)/(4*(l^%T.w__sq)^2)-lambda[3]/(l^%T.w__sq))+1))';

(1/2)*w[1]*(`.`(p^%T, R, w))*(`.`(w^%T, S, e[1]))/((l^%T.w__sq)*((1/4)*w[1]^2*(`.`(p^%T, R, w))^2*(`.`(w^%T, S, w))/(l^%T.w__sq)^2+sigma__delta^2*(w[1]^2*((1/4)*(l__sq^%T.w__sq)/(l^%T.w__sq)^2-lambda[1]/(l^%T.w__sq))+1)))

 

(1/2)*w[2]*(`.`(p^%T, R, w))*(`.`(w^%T, S, e[2]))/((l^%T.w__sq)*((1/4)*w[2]^2*(`.`(p^%T, R, w))^2*(`.`(w^%T, S, w))/(l^%T.w__sq)^2+sigma__delta^2*(w[2]^2*((1/4)*(l__sq^%T.w__sq)/(l^%T.w__sq)^2-lambda[2]/(l^%T.w__sq))+1)))

 

(1/2)*w[3]*(`.`(p^%T, R, w))*(`.`(w^%T, S, e[3]))/((l^%T.w__sq)*((1/4)*w[3]^2*(`.`(p^%T, R, w))^2*(`.`(w^%T, S, w))/(l^%T.w__sq)^2+sigma__delta^2*(w[3]^2*((1/4)*(l__sq^%T.w__sq)/(l^%T.w__sq)^2-lambda[3]/(l^%T.w__sq))+1)))

(1)

 

solve({eq1-lambda[1],eq2-lambda[2],eq3-lambda[3]},{lambda[1],lambda[2],lambda[3]});

Download dot_products.mw

I want to compute the limit for a parameter (gamma) to infinity of an expression which includes summations over indexes. Below are two approaches. I believe that both should produce the same output, however:

  1. Approach A generates a signum, but I don't understand where this is coming from
  2. Approach B works smoothly once I fix the final value n of the index to some number but runs very slow if I leave n undefined (I had to interrupt the execution)

Maybe approach B is not wrong, and I just need to wait longer...

Any thoughts? 

Approach A: Compute infinity limit while keeping X and lambda undefined (since they are independent of gamma, see below), then define X and lambda
 

problem: what generates signum?

restart;

local gamma;

gamma

(1)

assume(0 < gamma, 0 < n, 0 < w, 0 < Delta, 0 < vo[i], -1 < rho and rho < 1, 0 < sigma__v, 0 < sigma__d, 0 < sigma__dr, delta[i]::real, delta[j]::real, delta[k]::real, delta__r::real, X[i]::real, X[j]::real, X__r::real);
interface(showassumed=0);

1

(2)

W:=sum(X[i]*(-lambda*X[i]-lambda*delta[i]-vo[i]),i=1..n)+X__r*(-lambda__r*X__r-lambda__r*delta__r-w*sum(vo[i],i=1..n))+sum((X[i]+w*X__r)*(vo[i]+(1/(w*n))*(Delta)),i=1..n)-gamma/2*sigma__v^2*(1-(1+rho*(n-1))/(n))*sum((X[i]+w*X__r)^2,i=1..n)-gamma/2*sigma__v^2*(rho-(1+rho*(n-1))/(n))*sum(sum((X[i]+w*X__r)*(X[j]+w*X__r),j=1..i-1)+sum((X[i]+w*X__r)*(X[j]+w*X__r),j=i+1..n),i=1..n);
 

sum(X[i]*(-lambda*X[i]-lambda*delta[i]-vo[i]), i = 1 .. n)+X__r*(-lambda__r*X__r-lambda__r*delta__r-w*(sum(vo[i], i = 1 .. n)))+Delta*X__r+sum(Delta*X[i]/(w*n)+vo[i]*X__r*w+X[i]*vo[i], i = 1 .. n)-(1/2)*gamma*sigma__v^2*(1-(1+rho*(n-1))/n)*(n*X__r^2*w^2+sum(2*X__r*w*X[i]+X[i]^2, i = 1 .. n))-(1/2)*gamma*sigma__v^2*(rho-(1+rho*(n-1))/n)*(n^2*X__r^2*w^2-n*X__r^2*w^2+sum(sum(X__r*w*X[j]+X[i]*X[j], j = i+1 .. n)+sum(X__r*w*X[j]+X[i]*X[j], j = 1 .. i-1)+X__r*w*X[i]*n-X__r*w*X[i], i = 1 .. n))

(3)

limit(W,gamma=infinity);

-signum(-(sum(sum(X[j]*(X__r*w+X[i]), j = i+1 .. n)+sum(X[j]*(X__r*w+X[i]), j = 1 .. i-1)+X__r*w*(n-1)*X[i], i = 1 .. n))+(n-1)*(sum(X[i]*(2*X__r*w+X[i]), i = 1 .. n)))*infinity

(4)

#convert(%, piecewise);

Approach B: Define X and lambda first, then compute infinity limit

problem: why last execution so slow?

restart;

local gamma;

gamma

(5)

assume(0 < gamma, 0 < n, 0 < w, 0 < Delta, 0 < vo[i], -1 < rho and rho < 1, 0 < sigma__v, 0 < sigma__d, 0 < sigma__dr, delta[i]::real, delta[j]::real, delta[k]::real, delta__r::real, X[i]::real, X[j]::real, X__r::real);
interface(showassumed=0);

1

(6)

X[i] := (1/(2*n*w))*sqrt((4*n-3)/(1+rho*(n-1)))*(sigma__d/sigma__v)*Delta-(1/(2*n))*delta[i]-(1/(2*n))*(sum(delta[j],j=1..i-1)+sum(delta[j],j=i+1..n));
X[j] := (1/(2*n*w))*sqrt((4*n-3)/(1+rho*(n-1)))*(sigma__d/sigma__v)*Delta-(1/(2*n))*delta[j]-(1/(2*n))*(sum(delta[k],k=1..j-1)+sum(delta[k],k=j+1..n));
X__r := (1/(2*w*sqrt(n*(1+rho*(n-1)))))*(sigma__dr/sigma__v)*Delta-(1/2)*delta__r;

lambda := sqrt((1+rho*(n-1))/(4*n-3))*(sigma__v/sigma__d);
lambda__r := w*sqrt(n*(1+rho*(n-1)))*(sigma__v/sigma__dr);
 

(1/2)*((4*n-3)/(1+rho*(n-1)))^(1/2)*sigma__d*Delta/(n*w*sigma__v)-(1/2)*delta[i]/n-(1/2)*(sum(delta[j], j = 1 .. i-1)+sum(delta[j], j = i+1 .. n))/n

 

(1/2)*((4*n-3)/(1+rho*(n-1)))^(1/2)*sigma__d*Delta/(n*w*sigma__v)-(1/2)*delta[j]/n-(1/2)*(sum(delta[k], k = 1 .. j-1)+sum(delta[k], k = j+1 .. n))/n

 

(1/2)*sigma__dr*Delta/(w*(n*(1+rho*(n-1)))^(1/2)*sigma__v)-(1/2)*delta__r

 

((1+rho*(n-1))/(4*n-3))^(1/2)*sigma__v/sigma__d

 

w*(n*(1+rho*(n-1)))^(1/2)*sigma__v/sigma__dr

(7)

W:=sum(X[i]*(-lambda*X[i]-lambda*delta[i]-vo[i]),i=1..n)+X__r*(-lambda__r*X__r-lambda__r*delta__r-w*sum(vo[i],i=1..n))+sum((X[i]+w*X__r)*(vo[i]+(1/(w*n))*(Delta)),i=1..n)-gamma/2*sigma__v^2*(1-(1+rho*(n-1))/(n))*sum((X[i]+w*X__r)^2,i=1..n)-gamma/2*sigma__v^2*(rho-(1+rho*(n-1))/(n))*sum(sum((X[i]+w*X__r)*(X[j]+w*X__r),j=1..i-1)+sum((X[i]+w*X__r)*(X[j]+w*X__r),j=i+1..n),i=1..n):
 

W limit for n=3

Winf := collect(expand(simplify(limit(eval(W,n=3),gamma=infinity))),[Delta,Delta^2]):

quad_term := collect(expand(simplify(coeff(Winf,Delta^2))),[sigma__d,sigma__dr]);
linear_term := expand(simplify(coeff(Winf,Delta)));
coeff_term := collect(expand(simplify(eval(Winf,Delta=0))),delta__r^2);

(-(1/4)/(sigma__v*(1+2*rho)^(1/2)*w^2)+(1/2)*(1/(1+2*rho))^(1/2)/(w^2*sigma__v))*sigma__d+(1/12)*3^(1/2)*sigma__dr/((1+2*rho)^(1/2)*sigma__v*w)

 

-(1/2)*delta__r-(1/6)*delta[1]/w-(1/6)*delta[2]/w-(1/6)*delta[3]/w

 

((1/4)*3^(1/2)*sigma__v*w/((1+2*rho)^(1/2)*sigma__dr)+(1/2)*3^(1/2)*sigma__v*w*rho/((1+2*rho)^(1/2)*sigma__dr))*delta__r^2+(1/36)*sigma__v*delta[1]^2/((1+2*rho)^(1/2)*sigma__d)+(1/36)*sigma__v*delta[2]^2/((1+2*rho)^(1/2)*sigma__d)+(1/36)*sigma__v*delta[3]^2/((1+2*rho)^(1/2)*sigma__d)+(1/18)*sigma__v*delta[1]^2*rho/((1+2*rho)^(1/2)*sigma__d)+(1/18)*sigma__v*delta[2]^2*rho/((1+2*rho)^(1/2)*sigma__d)+(1/18)*sigma__v*delta[3]^2*rho/((1+2*rho)^(1/2)*sigma__d)+(1/18)*sigma__v*delta[2]*delta[1]/((1+2*rho)^(1/2)*sigma__d)+(1/18)*sigma__v*delta[1]*delta[3]/((1+2*rho)^(1/2)*sigma__d)+(1/18)*sigma__v*delta[2]*delta[3]/((1+2*rho)^(1/2)*sigma__d)+(1/9)*sigma__v*delta[2]*delta[1]*rho/((1+2*rho)^(1/2)*sigma__d)+(1/9)*sigma__v*delta[1]*delta[3]*rho/((1+2*rho)^(1/2)*sigma__d)+(1/9)*sigma__v*delta[2]*delta[3]*rho/((1+2*rho)^(1/2)*sigma__d)

(8)

W limit for generic n

Winf := collect(expand(simplify(limit(W,gamma=infinity))),[Delta,Delta^2]):

quad_term := collect(expand(simplify(coeff(Winf,Delta^2))),[sigma__d,sigma__dr]);
linear_term := expand(simplify(coeff(Winf,Delta)));
coeff_term := collect(expand(simplify(eval(Winf,Delta=0))),delta__r^2);

 

NULL

Download Infinity_limit_and_summations.mw

I am trying to compute partial derivatives of some complicated expression which include summations. First, I noticed that sum behaves differently if I use 1D vs. 2D math. Why?

Questions:
  1. Partial derivative of a summation: why is it not just 2*X[i]?
  2. Partial derivative of a double summation: how to define the nested structure of a double summation with j<>i?
  3. System of n+1 equations: how to define and solve for it?

For 3., each i equation is the partial derivative of my complicated expression with summations with respect to X[i], where i ranges from 1 to n. The last equation is the partial derivative with respect to X_r (a fixed variable).

Thanks.

restart

A := sum(X[i]^2, i = 1 .. n); eq[1] := diff(A, X[i]) = 0

sum(X[i]^2, i = 1 .. n)

 

sum(2*X[i], i = 1 .. n) = 0

(1)

B__wrong := sum(sum((X__r*w+X[i])*(X__r*w+X[j]), j = 1 .. n), i = 1 .. n); B__correct := 'sum(sum((X__r*w+X[i])*(X__r*w+X[j]), j = 1 .. n), i = 1 .. n)'

n^2*X__r^2*w^2+sum(sum(X__r*w*X[j]+X[i]*X[j], j = 1 .. n)+n*X__r*w*X[i], i = 1 .. n)

 

sum(sum((X__r*w+X[i])*(X__r*w+X[j]), j = 1 .. n), i = 1 .. n)

(2)

eqs := seq(eq[i], i = 1 .. n); vars := seq(X[i], i = 1 .. n)

Error, range bounds in seq must be numeric or character

 

Error, range bounds in seq must be numeric or character

 
 

NULL

Download equations_with_summations.mw

1 2 3 4 5 6 7 Last Page 1 of 9