Clear Filters
Clear Filters

nthroot(X, N) when X is inf

3 views (last 30 days)
CapaB
CapaB on 23 Jun 2012
Id like to take the 4537-th root of a number X.
The number X is too large for matlab to handle so it says Inf.
The number X comes from a for-loop where i go from i=1:4537 and X gets larger and larger.
Can i somehow use the factors of 4537
factor(4537)
ans =
13 349
and take the roots of X in intervalls so it wont reach inf, or something?
  1 Comment
Star Strider
Star Strider on 23 Jun 2012
Please post the code of the 'for' loop so we can understand how you create X. What is X?

Sign in to comment.

Answers (2)

Walter Roberson
Walter Roberson on 23 Jun 2012
A real root of a number can only be larger than the number if the number is between -1 and +1, and in that range the root itself is limited to -1 to +1. The only way for the 4537'th root of a number to be infinity is if the number itself is infinity, and if that is the case then factoring for roots is not going to produce anything other than infinity.
Factoring can only help if you apply it at the stage of constructing the number whose root is being taken so that it does not reach overflow (represented by infinity.)
Factoring itself is probably not going to work because you are going to run into prime numbers. You should probably instead be looking at log representation.

CapaB
CapaB on 24 Jun 2012
It wasnt the 4537th root of the number that was inf, it was the number X itself.
But actually it was simple mathematical mistake and i managed to write the code without having to use nthroot at all.
But thank you for mentioning log representation. That should probably work. Good to know if i ran into that problem again..

Categories

Find more on Arithmetic Operations in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!