RohanKarthik

25 Reputation

3 Badges

4 years, 318 days

MaplePrimes Activity


These are questions asked by RohanKarthik

Hello everyone. I want to know how I can extract terms from a multivariate polynomial with the following 2 conditions:

  1. It should have the lowest sum of the degree of x and of y; and
  2. deg(x) - deg(y) should be either 0 or -1.

For instance, if I've f(x) = 100x^2y^2 + 35yx + 45x, I want an output of 35yx (not 45x; even though degree sum is 1, less than 2).

On the other hand, if I've g(x) = 13x^2y^2 + xy^2 + 2yx^2, I want an output of xy^2 (not yx^2 also).

Hello everyone. I want to know how I can extract terms with the lowest sum of the degree of x and of y in a multivariate polynomial (in x and y)?

For instance, if I've f(x) = 100x^2y^2 + 35x^2y + 45y, I want an output of 45y.

On the other hand, if I've g(x) = 13x^2y^2 + xy^2 + 2yx^2, I want an output of xy^2 + yx^2.

 

"with(LinearAlgebra):  T := proc(n::integer)  local t0, tn, i, t, t1;  if (n>0) then t0 := Matrix(1, 1, 1); tn := Matrix(1,1,0);  for i from 1 to n do local z := 2^i;  t := Matrix([[Add(t0, tn), x .~ t0], [t0, ZeroMatrix(z/(2))]]);  t1 := Matrix([[y .~ t0, ZeroMatrix(z/(2))], [ZeroMatrix(z/(2)), ZeroMatrix(z/(2))]]);  t0 := t; tn := t1;  end do;  else 'T'(n) end if; t0; end proc;"

Error, unterminated loop

"with(LinearAlgebra):  T := proc(n::integer)  local t0, tn, i, t, t1;  if (n>0) then t0 := Matrix(1, 1, 1); tn := Matrix(1,1,0);  for i from 1 to n do local z := 2^i;  t := Matrix([[Add(t0, tn), x .~ t0], [t0, ZeroMatrix(z/2)]]);  t1 := Matrix([[y .~ t0, ZeroMatrix(z/2)], [ZeroMatrix(z/2), ZeroMatrix(z/2)]]);  t0 := t; tn := t1;  end do;  else 'T'(n) end if; t0; end proc;"

 

T(2)

T(2)

(1)

``

 

Download G2.mw

Hello everyone. I was trying to code the recurrence relation given in the image below (without taking the mth power):

 

But, as I run the program, I am getting an "unterminated loop" error. Can someone please point out the mistake(s)?

rfin := proc(m::integer) 
local c, i, flg := 0;
for i from 0 to m do
	local b := i;
	do 
		c := b mod 3;
		if (c <> 2) then next else flg := 1; 
		end if;
		b := 1/3*b - 1/3*c;
	until b = 0;
	if evalb(flg = 0) then print(i); 
	end if; 
end do;
end proc;

Hello everyone. I've written a procedure that outputs all numbers <= a given user I/P whose ternary representation has no 2.

However, I get an "Error, unterminated loop" message. Can someone please out the mistake(s)?

Page 1 of 1