# Items tagged with coefficientscoefficients Tagged Items Feed

### Extract values from expression...

March 18 2015
1 3

Hello dear forum,

I'm trying to create a function in maple, but I'm stuck at this problem:

I need to extract the values from an expression, for example I've got the expression:

544X-228412+1836Y-1296Z=0

I want to get/extract all the values from the expression, but ONLY the numerical values like "544", "228412", "1836", "1296" and "0". How would this be done?

My goal is to then insert these values in a igcd command and get a common divider for the function, so I'll be able to end up with something like 4(136X-57103+459Y-324Z)=0

Thank you in advance, and have a lovely day!
Best regards, Martin.

### on the frequent change of determinant in each run ...

March 14 2015
1 3

Hi,

Recently a a simple problem which i can not handle by myself, made me confused.

I have simple code of maple which is not stable at all. Everytime I run the code, the final result which is the determinant of a matrix, changes and I can not see the problem with the code. In fact i noticed that problem occures when the matrix is being build by culculating the coefficients of some constant values.  I have attached the code. Could you see what is wrong here?

Thanks by the way.

### Mixing computed values and "written math"...

January 31 2015
0 7

Dear Maple users

I have a question which is maybe easily solved, but I cannot seem to find the solution myself. A vector X of coefficients has been computed earlier in the Maple document and I want these coefficients placed in front of some written symbols in order to make Maple display the final result in a nice way. I made an attempt with the Vector command as shown in the image, but I cannot make the indices start at -2. In addition I want some written math placed in front of the expression. In fact I want it displayed like shown on the image marked with a red rectangle. I did write this manually, but want Maple to do it automatically when given the coefficients vector calculated earlier. I hope someone can help me here!

(It is about finite difference methods, by the way)

Regards,

Erik

### How to extract all coefficients of a multivariate ...

August 22 2014
0 7

I have a polynomial p in two variables x and y, and I want to extract all the coefficients of p. For example, let p:=x^3+2*x*y^2-2*y^2+x, and I want to obtain the coefficient vector [1,0,0,1,0,2,0,0,-2,0], where 1,0,0,1,0,2,0,0,-2,0 are respectively the coefficients of x^3, x^2, x^2*y,x,x*y,x*y^2,y^0,y,y^2,y^3. In general, let

p(x,y)=sum(sum(c_*{i, j}*x^(n-i)*y^j, j = 0 .. i), i = 0 .. n)

=c_{0,0}x^n

+c_{1,0}x^{n-1}+c_{1,1}x^{n-1}y

+c_{2.0}x^{n-2}+c_{2,1}x^{n-2}y+c_{2,2}x^{n-2}y^2

+\dots

+c_{n,0}+c_{n,1}y+c_{n,2}y^2+\dots+c_{n,n}y^{n}.

It is possible that some coefficients c_{i,j} are equal to 0. How to obtain the coefficient vector [c_{i,j},i=0..n,j=0..i] of p(x,y)?

Thanks a lot.

### How do I extract all the coefficients of a polynom...

August 02 2014
1 8

I want to extract all the coefficients of a polynomial. For example, let p:=x^5-8x^3+2, and the function coeffs(p) returns 1, -8, 2. In fact, I want to obtain 1, 0, -8, 0, 0, 2. Thanks to everyone.

### Find the coefficients..............................

June 27 2014
1 1

Hi:

how find the coefficients C1,C2?
q(0)=0,D(q)(0)=0

q(T) := sin(T)*_C2+cos(T)*_C1-(1/3000)*Pi*(4012562293500*Pi^3*cos(T)^3-32100498340000*Pi^3*cos(T)^2-3009421720125*Pi^3*cos(T)+16050249170000*Pi^3+435778855000*Pi*cos(T)^2-217889427500*Pi-3539762622):

### How can I find n so that maximum of all coefficie...

June 27 2014
2 21

Suppose (1 + 2x)^n = a0 + a1*x + a2*x^2+...+an*x^n.

I want to find value of n so that max(a0, a1, ..., an) is a8

I tried directly.

With n = 12

restart:
A:=expand((1+2*x)^12,x);
max(coeffs(A));

And with n = 11

B:=expand((1+2*x)^11,x);
max(coeffs(B));

Therefore,  n = 12 or  n = 11.

How can I solve the problem with Maple?

### extract coefficient in multivariate case...

June 18 2014
0 6

Hi,

I have an expression as p in the following. I would like to extract the coeffient with x^n*y^m and x^(n+2)*y^(m+2), however, coeff comand does not work...

***

p:=3*x^n*y^m+4*x^(n+2)*y^(m+2)+k*x^(n+2)*y^(m+2);
coeff(p,x,n);

***

gives me

***

n m (n + 2) (m + 2) (n + 2) (m + 2)
3 x y + 4 x y + k x y
/ n m (n + 2) (m + 2) (n + 2) (m + 2) \
coeff\3 x y + 4 x y + k x y , x, n/

***

What is the correct command to get the coefficients? Thank you very much

### comparison convolution and Serie Fourier coefficie...

April 18 2014
0 4

Hi,

I open a discussion about convolution and Fourier coefficients in Fourier series.

I have a function defined by f(x)=0 if x in [-Pi,0[ and 1 if x in [0,Pi[, of course f 2*Pi periodic function.

My goal is compare the Fourier coefficients of f*f ( * convolution ) and The Fourier Coefficient of f.

February 26 2014
0 1

Dear all,

here, I propose two methods for Adams Moulton Methos, but which one can I used.

The n-step Adams Moulton method to solve y'(x)=F(x,y(x)) is defined by the stencil

y(x+h)=y(x)+h *sum_{j=-1}^{n-1} beta_j F( x-j*h, y(x-j*h) ) + O(h^{n+2})

I want a procedure with single argument ''n'' that calculates and return the ''beta_i'' coefficients

I get two Methods. Which one correspond to my question please, and I don't understand the procedure proposed.

For me; the first give the iterative schemae used, but don't return the vector coefficients ( beta_i) and this methode method an interpolation of the function.

The second method, there is a function f, how this function is maded, and the same for the matrux A and the vector b...

the First Method:

local P, t, f, y, n;

P := interp([t[n]+h, seq(t[n]-j*h, j = 0 .. k-2)], [f[n+1], seq(f[n-j], j = 0 .. k-2)], x);

y[n+1] = y[n]+simplify(int(P, x = t[n] .. t[n]+h))

end proc;

Second Method:

f:=proc(x,y) if x =0 and y=0 then 1 else x**y fi end;

n:=3; A:=matrix(n,n,(i,j)->f(1-j,1-i));

b:=vector(n, i->1/i);

linsolve(A,b);

### Differential Equation with Homogeneous Coefficient...

January 26 2014
1 6

Can anyone tell me how to use dsolve to find the solution to the problem in the attachment.  It is faily easy to do using substitution for homogeneous coefficients, but dsolve seems to put out a very complicated solution to the problem.

 >
 >
 (1)
 >
 (2)
 >

### What's up with coeffs?...

October 28 2013
0 4

I have two equations:

and I need to extract the coefficients of x0 and xp0 (to build a matrix; but that is not the issue). So I use coeffs:

coeffs(op(2,X),x0);

coeffs(op(2,XP),x0);

xp0

While I can live with the first result (for X) (not that I like it), the fact that the 2nd one (for XP) has a completely different structure prevents any kind of algorithmic extraction of the coefficients (and the second one of course is 0) for further use. I tried the form of coeffs with a third argument (a name which gets the result assigned) but the same result. This example is a real case, obviously a trivial one and others will be much more involved so I really would like this to work. And yes, I did "collect" before using coeffs (not that it was needed here).

Any ideas out there?

Mac Dude.

### How to get coefficients from expressions...

July 24 2013
2 3

Hello, I'm a newbie in Maple. I just started learning maple and i'm using version 17. I want to know if there is a way in maple to get the coefficients of some variables maybe an example would explain me better. Lets say we have

23x^4 + (12*h)x^2

So my question is that is there a function/method that can allow me to strip the coefficients of x^4 and x^2. Because I have a very long expression and I need the coefficients of the variables therein to populate a matrix.

### Find the coefficients of a recurrence relation...

May 08 2013
1 1

I have a question:

let t(n)=sum( (binomial(n,j))^4, j=0..n )  , t(-1)=0, t(0)=1

and (n+1)^3 *t(n+1)=(2n+1)*(a*n^2+a*n+b)*t(n)+n*(c*n^2+d)*t(n-1)             (1)

I want to Print(a,b,c,d) so that t(n) satisfies the recurrence relation (1)  where a,b,c,d are integers and their ranges are from

-30 to 30.

### Using Maple to find Newman-Penrose equations with ...

April 10 2013
1 5

I just bought Maple 17 and tried to find a couple of Newman-Penrose spin coefficients.  I can do it by hand, but when I try to do the same thing using Maple I am stuck.  Maple lets me define an orthogonal tetrad, then I convert that to a null tetrad.  But how do I then fiind spin coefficients?  I know Maple has an entire list of metrics (385) already loaded, but I need to investigate different Petrov types to develop a metric.  Thanks.

 1 2 Page 1 of 2
﻿