cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

extracting coefficients of e^ix from polynomial

ptc-5044909
1-Newbie

extracting coefficients of e^ix from polynomial

Hi everyone,

I am trying to extract the coefficients of e^ix from a polynomial. My attempts using the coeffs, e^ix command have been unsuccessfull and I am wondering if anyone has another solution.

So, i have a function like: y= (2+5k)e^ix + 7e^2ix + (2+9a)e^-ix

and want MathCAD to give me: coeffs(y) = ( 2+9a; 2+5k; 7).

Another example is in the attached file

Thanks for your replies!

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:AlanStevens)

There is a problem with your sheet as the three Vector functions at the top won't consider their argument. If you look at the coefficients at the end you will notice there is no "b0" or "b1" showing up as it should. You have to follow the definition of those functions immedeatly by a symbolic evaluation to make it work. You may then omit that symbolic eval at the definition of Phi, as it would not be necessary there anymore.

View solution in original post

13 REPLIES 13
Werner_E
25-Diamond I
(To:ptc-5044909)

Haven't tried it, but couldn't you substitute e^i*theta for a variable X and search the coeefs of X? Even better replace the e^i*thata in BClefthand for X to do so.

I noticed that your functions a0vector() etc. are simply transposing its argument vector. Os ther a reason for doing it that elaborate way?

Hi Werner,

I did try to substitute for a variable X and search coefficients but MathCAD doesn't replace it. So, I think it is unable to recognise e^i*theta as a function, no idea. (my knowledg about MathCAD is minimal).

About the a0vector, etc... what do you mean with transposing the argument vector? The purpose of a0vector, a1vectore, b0vector etc... is that these are unknown coefficients to be determined in a next step by solving the system against some other function. Don't exactly know what you mean with this.

How about the attached?

Alan

Werner_E
25-Diamond I
(To:ptc-5044909)

The question concerning the the coefficients seems to be answered thanks to Alan.

I was about to post a more compact way to create your various symbolic vetcors and to explain what i meant with the transposed vectors when i ran into what I think is a mathcad bug with symbolic stitute.

I attch the file nevertheles for whatever its worth. Maybe you can use parts of it anyway.

The bug is shown in the following screenshots. Don't think there would be a rational explanation for that behaviour and at the moment I see no convenient workaround.

Subst_Bug.png

Don't know if this helps or even if it's right.

Werner_E
25-Diamond I
(To:ptc-5044909)

As I found the easy way to avoid that Mathcad bug find attached a more streamlined way to deal with your symbolic vectors. Hope you find it useful.

extracting.png

Werner_E
25-Diamond I
(To:ptc-5044909)

OK, the last one. This shows how to get around the limitation of the last one of not being able to evaluate numerically.

I've had a go at simplifying the worksheet also (I need to get a life!) - see attached.

Alan

Werner_E
25-Diamond I
(To:AlanStevens)

Hmmm. looks like part of my worksheet from another thread

http://communities.ptc.com/message/201711#201711

Think you have attached the wrong sheet

Werner Exinger wrote:

...

Think you have attached the wrong sheet

You are right! Correct worksheet attached here (I hope!).

Alan

Werner_E
25-Diamond I
(To:AlanStevens)

There is a problem with your sheet as the three Vector functions at the top won't consider their argument. If you look at the coefficients at the end you will notice there is no "b0" or "b1" showing up as it should. You have to follow the definition of those functions immedeatly by a symbolic evaluation to make it work. You may then omit that symbolic eval at the definition of Phi, as it would not be necessary there anymore.

Werner Exinger wrote:

There is a problem with your sheet ...

Doesn't surprise me. It's what I get for doing things quickly late at night! Thanks for implementing the correction.

Alan

Werner_E
25-Diamond I
(To:AlanStevens)

AlanStevens wrote:

... It's what I get for doing things quickly late at night!

I know exactly what you ar talking about 😉

Announcements

Top Tags