Question: how to use structured type to make a rational and >1 type

I can't figure how to make my own type, which is rational and greater than one.

There are buildin types for postive and posint, and so on. But what if I want to make for rational and greater than some value, say 1?

This is easy to do using patmatch, using the conditional. But do not know how to do it to make my own type.

Here is a simple example. I want to check for sin(x)^n, where n is rational and must be >1.  Using pathmatch

restart;
patmatch(sin(x)^(1/2),conditional(sin(x)^a::rational,a>1),'la');la;

does it. Using structured type, the best I could do is this

restart;

TypeTools:-AddType('my_sin',specfunc(sin)^And(rational,positive));
type(sin(x)^(1/2),'my_sin');

But this does not check for >1, only positive.

Any suggestions? I know I could do this using other means, by direct parsing, using op, and so on. But I'd like to learn how to do it using structured type, just to learn the syntax if there is one.

is it possible to use conditional with structured types? But need  name to do that, like with patmatch, but there is no such syntax in structured types. 

ps. I think conditional does not make much sense with structured type. But I need to figure how to make my own type, which is rational and say >1, or integer and say >2 and so on. I just do not know how to do that yet. But I am sure there is a way. Will try to figure it out.

 

 

Please Wait...