# Items tagged with coeffcoeff Tagged Items Feed

### Coefficients in differential expression...

January 19 2016
0 3

Dear Friends

In differential expressions(See Maple file) how to find coefficiets of dependent variable "u(x,t)" and "v(x,t)" and of their differentials ? There is command "dcoeffs(function)", but that work for single dependent variable only but in our case there are two dependent variables in consideration. There are other options like "indets", "specindex" but those do not work.

 >
 >
 (1)
 >
 (2)
 >
 (3)

In above differential expressions how to find coefficiets of dependent variable "u(x,t)" and "v(x,t)" and of their differentials ? There is command "dcoeffs(expr,u(x,t))", but that work for single dependent variable only but in our case there are two dependent variables in consideration. There are other options like "indets", "specindex" but those do not work.

 >

### Coefficients of differential polynomial. 2...

January 06 2016
1 2

Hello everyone!

Suppose, we have a differential polynomial

P := u(x) + (D@@2)(u)(x)

Given this, I am looking for a procedure which gives coefficients depending on the order given as input, for example, lets say, procedure name is fun_coeff which depends on two parameters, original polynomial P and the order n, then

fun_coeff(P, 3) should give [1, 0, 1, 0]

where each entry corresponds to the coeff of

[u(x), (D@@1)(u)(x), (D@@2)(u)(x), (D@@3)(u)(x)]

in the polynomial, similarly

fun_coeff(P,4) should give [1, 0, 1, 0, 0]

corresponding to

[u(x), (D@@1)(u)(x), (D@@2)(u)(x), (D@@3)(u)(x), (D@@4)(u)(x) ]

Thank you all for your time :)

### Error when fitting function to data...

November 28 2015
0 2

Dear Maple users

Physical experiment: I dropped a ball with low mass from a height of approximately 7 meters and wanted to test if the air resistance was proportional to the square of the velocity. I filmed the fall and used the program Logger Pro to collect data: a number of datapoints (time,height) was collected. I copy/pasted the datapoints into MS Excel, from where I could import data into Maple via Tools > Assistants > Import Data ... Then I wanted to make a fit with the theoretical solution, given by a function having just one parameter: the Drag coefficient. Unfortunately I received an error "complex values encountered" (see below). I can solve the problem manual by making a number of guesses for the drag coefficient, until the theoretical curve approximates the data points well. I wanted to make Maple do the fitting job, though. I will appreciate if someone could give an idea how to fit the data properly.

NB! Mass m and g is defined above in the Maple document. The Statistics and plots package is called too.

### Coefficients of differential polynomial...

November 27 2015
2 9

Hello everyone,

I am trying to extract the coefficients from a differential poynomial. In general, this poynomial is in two variables, say u and v along with their differentials, i.e D(u) or D@@2(u) or so on.

Coefficients of this polynomials are rational funcitons.

For instance- consider the following example:

a(x)*v*u+v*D(u)-D(v)*u

then output should be [a(x), 1, -1].

### problem in procedure...

November 25 2015
0 8

hello all!

Pascal := proc (n::posint)

local x, y, i;

for i from 0 to n do print(coeffs(expand((x+y)^i)))

end do end proc;
Pascal(4);

1
1, 1
1, 2, 1
1, 3, 3, 1
1, 4, 6, 4, 1

How to create

1
1  1
1  2  1
1  3  3  1
1  4  6  4  1

### How to find linear combination? ...

November 20 2015
0 1

assume there is vector a,b,c and d which are real number or floating number

how to express a in linear combination of b ,c and d

in another words, how to find coefficient m1, m2, m3

in a = m1*b + m2*c + m3*d

can LinearSolve do this?

November 12 2015
0 1

Assume that I have r:= -6x+3y+23x2-4xyz+7z. By using coeffs(r,x,'k') I can find the coefficients of 1, x, and x2

What should I write to get the conditions that make the coefficient of x zero? How can I just pick the coefficient of x, and solve it.

I have several coefficients but the answer of this question will help me.

### Homotopy perturbation methods...

September 13 2015
0 4

HPM_4.mwhi, I am using homotopy perturbation technique but there is arising an error in comaring coeffecient of p^0, p^1,.... plz help me

June 21 2015
1 6

Thanks.

### Maple does not print in order for some reason......

May 20 2015
0 2

Problem: I have two polynomials with arbitrary coefficients. I set them both to 0 and I used the 'map' , as well as 'coeffs' command to make the coefficients equal to 0.

Now for some reason, Maple does not print in order for one of the polynomials and it does for the other.

Note that 'order' refers to the coefficients attached to the powers of the variable.

Quick example: (this one actually works on Maple, but just not the one I have)

e1:= ax + (b + c)x^2 = 0

e2:= (c + d)x + (a + c)x^3 = 0

After applying map and coeff, one expects it to output

a = 0, (c + d) = 0, (b + c)=0, (a + c) = 0

a = 0, (c + d) = 0, (a + c) = 0,(b + c)=0

Here is the problematic file

OutOfOrder.mw

### unable to compute coeff...

May 12 2015
1 5

Why the command

coeff(sum(x^i,i=0..999)^500,x,2) prints

Error, unable to compute coeff??

I believe, that memory/cpu issues are not a relevant answer here.

coeff(sum(x^i,i=0..998)^500,x,2) gives the correct result.

Even

coeff(sum(x^i,i=0..998)^500,x,200) is ok.

How do I compute coeffs of longer sums?Or why this limitation is imposed by Maple Server?

### Extracting coefficient in Taylor and Laurent expan...

December 10 2014
1 2

Hi,

Excuse me, I tried to substract in a series expansion. It works for Taylor-type expansion, but not Laurent-type ones

*********

ffff:=1/(t-3);
ggg:=taylor(ffff,t=infinity,3);
coeff(ggg,t,-1);

ffff:=exp(t);
ggg:=taylor(ffff,t=0,3);
coeff(ggg,t,1);

*********

Maple gives me

Error, unable to compute coeff

1

. My question is, why "coeff" does not work in the first case? how to make it work? Though I can copy the expansion part, assign it to another variable, and "coeff" will work

### Extracting coefficients from system of equations ...

November 19 2014
1 1

Hi,

I have a system of equations containing curls, divergence and gradients of variables.

How can I extract the coefficients of the equations (i.e. coefficients of d/dt rho, d/dx p) and form a matrix?

thanks.

### Dos and don'ts of Maple programming w.r.t. the phy...

October 27 2014
2 5

EDIT 2: Ok, here is what I am trying to do with Maple.

I have the following expression:

with

and

(j times)

Now the above expression should be zero. I get a set of equations in orders of lambda. The H matrices are known. I only need to find the S matrices.

Anyways, the HOffDiag is the sum above and the GetAdvCommutator0 is this nested commutator. And I need this sum evaluated up to order n (n is a given input-number) in lambda. The rest is really not that performance hungry.

EDIT: Ok, it realy seems that this sum of commutators is something that takes Maple forever. I have written a new MWE. Is it possible to speed things up? Maybe using assumptions or so?

 > restart;with(Physics):with(LinearAlgebra): Setup(mathematicalnotation=true):Setup(noncommutativeprefix={M,H,S});
 (1)
 > GetAdvCommutator0:=proc(power::integer,order::integer,M)     if power <= 0 then return M fi:     if power = 1 then         return mtaylor(Commutator(M,add(lambda^l*S[l],l=1..order)),lambda, order+1) fi:          return mtaylor(Commutator(GetAdvCommutator0(power-1,order,M),add(lambda^l*S[l],l=1..order)),lambda,order+1): end proc:
 > HOffDiag(3); # still fast
 (2)
 > HOffDiag(6); # takes a very long time, I didn't even try entering higher numbers
 >

Hi,

I know this question is really unspecific. However, since I am still new to Maple, and since you don't program with Maple as you would do with c++, I would appreciate some advise. I have written a program in Maple and I don't know if it works correctly. All I know is, it is pretty slow :(.

So if anyone of you could just have a short look at my attached worksheet and could tell me, if I at some point used an obvious "don't", I would greatly appreciate it.

Cheers

NOh

A Maple worksheet

Setup Maple

 > restart;with(Physics):with(LinearAlgebra):Setup(mathematicalnotation=true):Setup(noncommutativeprefix={MA,MB,H,S});
 (1.1)

Input parameter

 > H0:=Matrix([[ 0 , 0 , 0 , 0 ],             [ 0 , 0 , 0 , 0 ],             [ 0 , 0 , U , 0 ],             [ 0 , 0 , 0 , U ]]);
 (2.1)
 > H1:=Matrix([[ 0 , 0 , 0 , 0 ],             [ 0 , 0 , 0 , 0 ],             [ 0 , 0 , 0 , 0 ],             [ 0 , 0 , 0 , 0 ]]);
 (2.2)
 > H2:=Matrix([[  0 , 0 , -t , -t ],             [  0 , 0 ,  t ,  t ],             [ -t , t ,  0 ,  0 ],             [ -t , t ,  0 ,  0 ]]);
 (2.3)
 > orderNumber:= 4 ;
 (2.4)

Define all necessary functions

 > computeHBlockDiag:=proc( n::posint,firstBlockWidth::posint, H0::Matrix, H1::Matrix, H2::Matrix )     local expr, Orders, i, eq, j, eq2, orders,smatrices,rows::posint,evallist,m,l,cols,Hdiag,ff;               expr:=HOffDiag(n);       # !!!!! this one is one of the slowest parts I think                                          Orders:=[\$1..n];                                                   for i from 1 to n do                                                   eq:=add(coeff(expr,lambda,l)*lambda^l,l=0..i)=0;                for j from 1 to i-1 do             eq:=eval(eq,Commutator(H[0],S[j])=Orders[j]);         od;         eq:=subs(Commutator(H[0],S[i])=MX,eq);         eq2:=solve(eq,MX);         Orders[i]:=eq2;     od;          rows,cols:=Dimension(H0);                                         smatrices:=[seq(H0,i=1..n)];     for i from 1 to n do         evallist:=[`*`=`.`,H[1]=H1,H[2]=H2];         for j from 1 to i-1 do             evallist:=[op(evallist),S[j]=smatrices[j]];                 od;         smatrices[i]:=eval(Orders[i],evallist);         for m from 1 to firstBlockWidth do             for l from firstBlockWidth+1 to rows do                 smatrices[i][m,l]:=smatrices[i][m,l]*1/(H0[m][m]-H0[l][l]);                 smatrices[i][l,m]:=smatrices[i][l,m]*1/(H0[m][m]-H0[l][l]);             od;         od;     od;     expr:=HOnDiag(n);            # !!!!! and this one of course (almost identical to the one above)                                            Hdiag:=eval(add(coeff(expr,lambda,l)*lambda^l,l=0..n),lambda=1);     evallist:= [op(evallist), H[0]=H0,S[n]=smatrices[n]];     Hdiag:=eval(Hdiag,evallist);          return Hdiag; end proc:
 >

 > computeHBlockDiag(2,2,H0,H1,H2);
 (1)
 > Eigenvalues(%);
 (2)
 >

Testing

#Fast

 > computeHBlockDiag(2,2,H0,H1,H2);
 (4.1)

#Not so fast

 > computeHBlockDiag(4,2,H0,H1,H2);
 (4.2)

 > computeHBlockDiag(6,2,H0,H1,H2);
 >

### Short-code way to obtain the 5 lowest orders in pa...

October 23 2014
0 2

Hi all,

I have an expression of the form .

Is there a shorter way to obtain let's say the 5 lowest orders than  ?

Cheers

NOh

 1 2 Page 1 of 2
﻿