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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

How to assign the coefficients from a symbolic polynomial to a vector?

ptc-2849140
1-Newbie

How to assign the coefficients from a symbolic polynomial to a vector?

Hello,

In the attached Mathcad 2000 worksheet, I am trying to reproduce an example of a filter polynomial synthesis from a book on microwave filters. In Step 3 at the end of the worksheet, I construct the polynomial P(s) = i*s^2 + 3.1299*s - 2.3899*i using symbolic math. If I use the symbolic processor to evaluate the function P(s) coeffs, s -->, I obtain a vector containing the coefficients of the powers of s: ( -2.3899i, 3.1299, i). I would like to assign this vector of coefficients to a variable p for later use with the numeric processor. But the statement p := P(s) coeffs, s doesn't work. I realize that I could manually copy and paste the symbolic evaluation result ( -2.3899i, 3.1299, i) into an assignment statement for the variable p, but I need a solution that does not require manual operations so that I can eventually these equations in an optimization loop.

Sincerely,

Ralph Giffone

Bloomfield, NJ

1 ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:ptc-2849140)

I vaguely recall that there were issues typing such expressions back in MC2000. Try typing p: on a separate line. Then select the entire symbolic expression (including the rhs), copy it , and paste it into the placeholder to the right of the assigment operator in the new p: expression.

If that doesn't work, post a copy of the worksheet with the full "p:=P(s) coeffs" expression in it. Also, as Werner requested, tell us exactly what error message you are getting.

It's also possible that MC2000 did not allow such a construct. It's been a long time!

View solution in original post

5 REPLIES 5

Ralph Giffone wrote:

Hello,

But the statement p := P(s) coeffs, s doesn't work.

It works in Mathcad 15:

coeff.png

Unfortunately I don't have version 2000, which is rather old, installed and can't try. As Valery already wrote it works with version 15 - that is: clicking somewhere inside the last math region of your worksheet and typing

:p[enter]

You wrote that the statement does't work. What was the problem? I assume an error message. Which one?

I know that I myself very often had problems assigning symbolical evaluations to variables, too (mostly inside of programs though). Copy and paste usually helps.

In your case try to mark your math region as it is now including the arrow and result and cut or copy it. Then type p: and paste to the placeholder you just got.

RichardJ
19-Tanzanite
(To:ptc-2849140)

I vaguely recall that there were issues typing such expressions back in MC2000. Try typing p: on a separate line. Then select the entire symbolic expression (including the rhs), copy it , and paste it into the placeholder to the right of the assigment operator in the new p: expression.

If that doesn't work, post a copy of the worksheet with the full "p:=P(s) coeffs" expression in it. Also, as Werner requested, tell us exactly what error message you are getting.

It's also possible that MC2000 did not allow such a construct. It's been a long time!

Many thanks to all of you who replied!

The error message was: "The units in this expression do not match."

Perhaps you were all trying to explain the same thing to me, but Mr. Jackson's answer was the one that "clicked" for me and worked. The solution is:

"Try typing p: on a separate line. Then select the entire symbolic expression (including the rhs), copy it , and paste it into the placeholder to the right of the assigment operator in the new p: expression."

I would never have thought of this, since there are two assignment statements (one numeric and one symbolic).

A simple procedure which does exactly the same thing is to type "p :" and then click on the "coeffs" button on the Symbolic toolbar.

The revised worksheet is attached.

Ralph Giffone

RichardJ
19-Tanzanite
(To:ptc-2849140)

nice to knowI haven't gone senile yet

Top Tags