473,722 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Beginner question: Logs?

Hey everyone! I'm a math student working on a short script involving
logs. I have a function on my scientific calculator, and was wondering
if there was a similar funtion in python.

For example:

(log65536)/(log4)= 8

I've searched around a bit and haven't been able to find anything.

Thanks!

-Christian

Jul 19 '05 #1
11 2557
Svens wrote:
Hey everyone! I'm a math student working on a short script involving
logs. I have a function on my scientific calculator, and was wondering
if there was a similar funtion in python.

For example:

(log65536)/(log4)= 8

I've searched around a bit and haven't been able to find anything.


import math

--
Robert Kern
rk***@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter

Jul 19 '05 #2
Hey thanks...

Still getting an error message though. Here's what i'm doing:
------
import math
log10(15625)
------
-It says that log10 is not defined, but it is since the module is
imported, right?

Jul 19 '05 #3
Svens wrote:
Hey thanks...

Still getting an error message though. Here's what i'm doing:
------
import math
log10(15625)
------
-It says that log10 is not defined, but it is since the module is
imported, right?


No, read the tutorial.

import math
math.log10(1562 5)

--
Robert Kern
rk***@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter

Jul 19 '05 #4
Svens wrote:
Hey thanks...

Still getting an error message though. Here's what i'm doing:
------
import math
log10(15625)
------
-It says that log10 is not defined, but it is since the module is
imported, right?


try this:

import math
math.log10(1562 5)
Jul 19 '05 #5

On Jun 1, 2005, at 9:04 PM, Svens wrote:
Hey thanks...

Still getting an error message though. Here's what i'm doing:
------
import math
log10(15625)
------
-It says that log10 is not defined, but it is since the module is
imported, right?


do either

import math
math.log10(1562 5)
from math import *
log10(15625)

from math import log10
log10(15625)


-- Elliot Temple
http://www.curi.us/
---
[This E-mail scanned for viruses by Declude Virus]

Jul 19 '05 #6
Elliot Temple wrote:
from math import *
log10(15625)


It's always a good idea, especially when answering a beginner's
question, to add the caution that this form ("from xxx import *") has
certain dangers** associated with it, and is widely considered poor
style, and should really only rarely be used. (The math module is
probably one of the few places where some people make an exception,
however, but it's still not a good habit to get into.)

-Peter
Jul 19 '05 #7
> import math
math.log10(1562 5)


To find out the names of function in the math module without checking the
docs, do
dir(math) #same for any other module
To get more info, do
help(math) # same for any other module with a doc string


Terry J. Reedy

Jul 19 '05 #8

"Peter Hansen" <pe***@engcorp. com> wrote in message
news:Q7******** ************@po wergate.ca...
Elliot Temple wrote:
from math import *
log10(15625)


It's always a good idea, especially when answering a beginner's
question, to add the caution that this form ("from xxx import *") has
certain dangers** associated with it, and is widely considered poor
style, and should really only rarely be used.


Which is why I often do things like
import math as m
m.log...



Jul 19 '05 #9
Peter Hansen wrote:
It's always a good idea, especially when answering a beginner's
question, to add the caution that this form ("from xxx import *") has
certain dangers** associated with it, and is widely considered poor
style, and should really only rarely be used.


Better still, don't even *mention* it to a beginner.
They don't need to know about it. At all. Really.

--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
Jul 19 '05 #10

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

Similar topics

46
3512
by: J.R. | last post by:
Hi folks, The python can only support passing value in function call (right?), I'm wondering how to effectively pass a large parameter, such as a large list or dictionary? It could achieved by pointer in C++, is there such way in Python? Thansk in advance. J.R.
1
2625
by: Mike Malter | last post by:
I am just starting to work with reflection and I want to create a log that saves relevant information if a method call fails so I can call that method again later using reflection. I am experimenting a bit with what I need to do this and have the following code snippet. But first if I pass the assembly name and type to Activator.CreateInstance() it always fails. However if I walk my assembly and get a type value, the call to...
3
2644
by: Neal | last post by:
managed C++ VS 2003 I have a beginner question about windows forms.... I need to call a function when a certain limit has been reached, now with the way VS sets up the .NET windows Form I get confused. When I was using Directx everything was being run from a while loop, so that was no problem for me in seeing where to place conditional statements and other functions. With windows forms do I need to have an event and eventhandler? it...
8
3000
by: ^MisterJingo^ | last post by:
Hi all, I'm attempting to create a login/role system for an application i'm building. My idea is to store an instance of a 'webapp' object in global.asax. This object stores login (username, ID) and role information (user, admin etc) which is set on a successful login. Would it be ok to put this object in the global.asax file and initiate it on Session_start? I'm unsure of any potential security implications of doing this.
6
5392
by: Andy Leese | last post by:
Beginner Question: ASCII Symbols I am using Borland C++ and programming under DOS. I wish to display the symbols of the early ASCII character set... For example: cout << char(7); Obviously this is assigned to the BELL signal and therefore sounds the beep
4
1554
by: a | last post by:
Dear all vb.net developer I want to know the time I need to master vb.net? I'm beginner
0
1333
by: Daniel T. | last post by:
Carter <cartercheng@gmail.comwrote: When you see "discards qualifiers", more often than not, it means that a const object is begin asked to do something that only non-const objects can do. I.E., the operation discards the const qualifier.
2
201
by: Daniel | last post by:
Looking for a good resource for beginners? books, online anything that will get me started.. what im trying to focus on is building a small program in c# to look thru a few files in a folder that contain certain words / messages ( i know that is probably more than a beginner can do right off the bat ) but i have other programmers available that can help, but rather try myself before i get them involved.. example of what i mean
2
1848
by: roanhn | last post by:
Hello. I've to to write a master's thesis. Currently I deal with php, mysql, ajax. Fate decreed that I've to choose one of this subjects: 1.gdi+ library in .net technology 2.ado.net technology in VS 2008. I didn't have contact with Visual Studio, .NET. I only know some basics of c++. My question is what subject of your point of view will be easier for absolute beginner in .net domain. From writing which subject I gain more knowledge...
0
8863
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8739
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9238
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4502
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.