Code covered by the BSD License  

Highlights from
RATPOW

Be the first to rate this file! 3 Downloads (last 30 days) File Size: 2.26 KB File ID: #6146

RATPOW

by Wathanyoo Khaisongkram

 

29 Oct 2004 (Updated 01 Nov 2004)

RATPOW Raises a real number to a rational power.

| Watch this File

File Information
Description

OUT = RATPOW(X,Y) computes X to the power of Y elementwisely. Both X and Y must be real and must have the same dimensions unless one is a scalar. Elements of Y should be rational numbers. If there is an irrational number, it will be approximated by a rational number with a pair of small numerator and denominator by means of function RAT. Element of Y is also reduced to the lowest terms fraction. The funtion return a single real solution OUT.

Specifically, suppose ABS(Y)=A./B where A and B are coprime (their corresponding elements have no common factor), then RATPOW performs X.^(1/B) first, and then raises it to the power of A. Hence, if an element of B is an odd number, the corresponding element of X must be non-negative. Otherwise, the error message is produced. Moreover, if an element of Y is negative, the function returns the inverse of the corresponding element of X^(A/B).

Acknowledgements
This submission has inspired the following:
RATPOW
MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
real rational power Wathanyoo Khaisongkram 22 Oct 2008 07:34:21

Contact us at files@mathworks.com