Message Boards Message Boards

0
|
3750 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Get the right values using Numerator[k] and Denominator[k]?

Posted 5 years ago

Hi friends,

Please check these lines:

In[1076]:= Clear[k]
e = 11/3
{Head[e], Numerator[e], Denominator[e]}
X^e //. X^(k_) -> {Head[k], Numerator[k], Denominator[k]}

Out[1077]= 11/3

Out[1078]= {Rational, 11, 3}

Out[1079]= {Symbol, 11/3, 1}

Why cannot get the right values of Numerator[k] and Denominator[k]?

Any way to transform from Symbol to Rational?

Thanks in advance,

César Lozada

POSTED BY: Cesar Lozada
2 Replies
Posted 5 years ago

Hi Ian,

Perfect!

Thank you very much César Lozada

POSTED BY: Cesar Lozada

Try this...

Clear[k];
e = 11/3;
X^e /. X^k_ :> {Head[k], Numerator[k], Denominator[k]}
POSTED BY: Ian Williams
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract