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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

passing functions as arguments

p6majo
1-Newbie

passing functions as arguments

Hello,

I'm a newbie to this forum, if I ask a well discussed question, please don't blame me, just send the corresponding link.

I want to perform some symbolic calculations to Rings of Polynomials. Therefore, it would be rather useful to be able to write programs that receive functions or polynomials as arguments.

I don't see a straightforward way to do this. Does someone know a work around?

Using the correspondence between polynomials and the number sequence of the coefficients is helpful but doesn't do the full job. For instance, I don't see a way to convert the number sequence back into a polynomial that I can work with.

Thank you,
JOhannes.
4 REPLIES 4
StuartBruff
23-Emerald II
(To:p6majo)

On 2/8/2009 9:47:04 AM, p6majo wrote:
== Therefore, it would be rather useful to be able to write programs that receive functions or polynomials as arguments.

The usual method is to pass the function name. See attached.

Stuart

This is helpful, thank you,
Johannes.

You may be newbie in Mathcad but maybe not so much in what you are after. For God sake what is it you want to do ? "I want to perform some symbolic calculations to Rings of Polynomials".

Polynomials forms and coefficients don't come out of the blue . Assuming you have a collection of coefficients, and out of that large collection each smaller collection belongs to a particular "polynomial" . Then easy and the only mathematical way is the "Lagrange iterated product". It is instantly operational, and if you want to see it in full expansion, then ask the symbolic to do it for you, at this point of the expansion, you have an executable form for lower level software like Excel...etc.
The attached is typical of some conversational difficulty between symbolic that extracts the Cheby coeffs and that it can't read back as the Maple symbolic iterated product will trace back to far up the source. Often then the user must isolate, here the isolation is done by storing in file.

If you can manage with more suggestions that will drop down the collab; fine. But posting the actual piece of example you have could eventually conclude your project in few hours or even less. That means: "Save as" for a greater audience ... save as 11 the "Mathcad fleuron" version,,, save lower version if you wish.

Ring ?... polynomials ?
Does it have to do with "cyclotomic polynomials" ? with other "basis polynomials" ???

jmG

Functions in Mathcad are values, just like numbers and arrays. They do not have inherent names. What we commonly think of as function names are really just ordinary variables whose values happen to be functions. Function values can be assigned to variables and passed as parameters like any other values.

If you are going to be working with polynomials the attached polynomials work sheet may be of interest. It provides a variety of operations on polynomials, expressed either as coefficients of powers of x or as coefficients of Chebyshev polynomials. It included the multiplication of polynomials, but you will probably have to add polynomial division and GCD yourself.

Conversion from a vector of coefficients to a polynomial expression can be easily done by symbolically evaluating the polynomial for a symbolic (undefined name) value. The extraction of the coefficients from a polynomial expression is done with the symbolic coeffs keyword.

In the attached worksheet the polynomials area contains the various polynomial related functions. The documentation area contains descriptions of these functions and how to use them. The chicken scratches area contains a collection of examples and test cases, mostly without explanation.
__________________
� � � � Tom Gutman
Top Tags