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

Topaz I

## Polynomial, yes or not?

Hello everyone,

I would like to create a Mathcad program that distinguishes whether the denominator of a given fraction is a polynomial or not, returning 0 or 1 for example. How do I do this?

Thank you.

14 REPLIES 14

## Re: Polynomial, yes or not?

Note sin (x) generally isn't viewed as a polynomial in x. But it can be written as such.

Luc

## Re: Polynomial, yes or not?

Hi,

The function of the program should be something like this:

once the type has been identified, we pass to the transformation into a polynomial, if possible.

## Re: Polynomial, yes or not?

I got this far, so far:

I doubt whether this will (rather sure that this will not) work in Mathcad 15, but it does work in Mathcad 11.

Success!
Luc

## Re: Polynomial, yes or not?

I am tempted to say that what you demand can't be done in Mathcad in a reasonable way as Mathcad does not provide the necessary tools.

Nonetheless here is a first attempt which may serve as a starting point for your own experiments.

There are a lot of drawbacks so far - you can only evaluate the function symbolically, its only working for functions in one variable and otherwise constants, ...

A few of the adverse effects could probably be corrected by some further investigations, but presumably not all. And I guess it will remain an uncertain, unreliable thing.

## Re: Polynomial, yes or not?

it would be better if the circled functions are not considered an error by mathcad. How to do?

## Re: Polynomial, yes or not?

I don't think there is a way.

You can switch off signalling of certain (types of) warnings.

You cannot switch off errors.

Luc

## Re: Polynomial, yes or not?

We could at least avoid the error(s) in "IsPoly2" by adding additional arguments and providing an alternative result in case the equality condition is not met. The value does not matter as we never arrive at the last line - if the equality condition is not met an error is thrown.

You may add two additional dummy arguments when you call "IsPoly2" from within "IsDenomPoly", but its not necessary to do so.

Not sure if we also could avoid the error in "IsDenomPoly" - in fact I don't understand the reason for the error message "This value must be a scalar".

## Re: Polynomial, yes or not?

Werner,

I'd expect an error message "This function needs more arguments." for your call of IsPoly2(v)  inside the function IsDenomPoly(f).

IsPoly2 requires 3 parameters, you call it with only 1...

Or have you found a way to define functions with optional parameters?

Luc

Announcements