473,387 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Re: get number that is raised to the power of


On 2 mei 2008, at 11:19, Astan Chee wrote:
Hi,
Im not sure if this is more of a math question or a python question.
I have a variable in python:
>v = 10.0**n
is there a way to find the value of n if i know only v aside from
str(v).split('+')[1] ? that seems like too much of a hack and I was
wondering if there was a faster way of doing it?
Thanks for any pointers
Astan
>
the "reverse" of a power to is logarithm
so v = 10**n <= math.log(v,10) = n

Arno
Jun 27 '08 #1
0 940

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

37
by: Protoman | last post by:
Hi!!! Protoman here, I need to write an infinite precision number class b/c I want to compute pi. Give me some sample code. Also, when I run my program and it computes pi, will my computer freeze...
17
by: Matt | last post by:
Give a one-line C expression to test whether a number is a power of 2. No loops allowed.
13
by: Kishor | last post by:
Hi Friends Please help me to write a C program to find the 5th (fifth) root of a given number. Ex:(1) Input : 32 Output : 5th root of 32 is 2 Ex:(1) Input : 243 Output : 5th root of 243 is...
22
by: MLH | last post by:
If 3 things can be in one of 2 states, the number of possible combinations is equal to 2^3. But if I have 3 things, 2 of which can be in 2 states and the other in 3 states, what's the simplest...
2
by: ashu | last post by:
an armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. for example, 171 is an armstrong number since 3**3+7**7+1**1=371. i...
20
by: ravi | last post by:
Give a one-line C expression to test whether a number is a power of 2.
6
by: TDBNDVVDSC | last post by:
Hi all, I am programing for my project which include calculating the power function and get stuck there. The problem is, when number x raised to the power y with x, and y too large (i tested...
2
by: Astan Chee | last post by:
Hi, Im not sure if this is more of a math question or a python question. I have a variable in python: is there a way to find the value of n if i know only v aside from str(v).split('+') ? that...
0
by: Astan Chee | last post by:
Python.Arno wrote: Im so ashamed of myself for not thinking in logs. I must be dreaming again. Thanks for the help. -- "Formulations of number theory: Complete, Consistent, Non-trivial. Choose...
2
by: alishaikhji | last post by:
I am working on a program which will need several different integer and float random numbers at different stages, for example: - At one point, I need a random number (float) in the range 0.1 to 10.0...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.