Python
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Python

Hybrid View

  1. #1
    Senior Member IcSilk's Avatar
    Join Date
    Aug 2001
    Posts
    296

    Python

    Ok, through a vodka induced 'slowness' I've decided this was the proper spot for this question.
    I've started to learn PYTHON, at a very beginner stage, this is a completely self taught effort and I will be coming here alot for questions.

    this is where I am:
    Complex numbers are always represented as two floating point numbers, the real and imaginary part. To extract these parts from a complex number z, use z.real and z.imag.
    >>> a=1.5+0.5j
    >>> a.real
    1.5
    >>> a.imag
    0.5
    and I have to admit, Im so befuddled by this that Im not even sure of my exact question
    Really what I need is a complete breakdown of this whole component, if anyone is up for it.
    the .real command (is it considered a command or something else?) and the .imag 'command'.

    Any and all input is welcome here, as one's two cents might make perfect sense, and anothers
    might make just as much sense but the two together might make a
    revelation.

    And WTF is meant by 'floating point numbers'?

    thanx all

    Blessings
    F
    "In most gardens they make the beds too soft - so that the flowers are always asleep" - Tiger Lily

  2. #2
    Senior Member
    Join Date
    Apr 2005
    Location
    USA
    Posts
    422
    .real isn't really considered a command. More of an attribute of the variable that it is used with. When typing in a.real, python (which is a scripting language) outputs the real part of the number a.

    Do you have a full conceptual understanding of the imaginary number system?

    A floating point variable is one that contains a decimal point that can be anywhere within the variable, hence 'float'. They are usually 4 bytes of resolution, however different languages are different with variable sizes, so that's more of a reference to the classic C/C++ style. However even if your variable is more or less than 4 bytes, it is possible that it still only has 4 bytes of resolution (ie: Java; however in this case, variable are not actually variables and are treated as objects, so they'll take up much more than the 4 bytes of space).

  3. #3
    Just Another Geek
    Join Date
    Jul 2002
    Location
    Rotterdam, Netherlands
    Posts
    3,403
    Quote Originally Posted by IcSilk View Post
    Really what I need is a complete breakdown of this whole component, if anyone is up for it.
    the .real command (is it considered a command or something else?) and the .imag 'command'.
    You first need to know what complex numbers are.

    The basis is that j = sqrt ( -1 ) and j^2 = -1

    http://en.wikipedia.org/wiki/Complex_numbers
    Oliver's Law:
    Experience is something you don't get until just after you need it.

  4. #4
    Senior Member IcSilk's Avatar
    Join Date
    Aug 2001
    Posts
    296
    You first need to know what complex numbers are.
    lmao. yeah you're right..............got a looooong way to go
    "In most gardens they make the beds too soft - so that the flowers are always asleep" - Tiger Lily

  5. #5
    Senior Member IcSilk's Avatar
    Join Date
    Aug 2001
    Posts
    296
    OK, Im ready and willing to admit I have some studying to attend to:

    Complex numbers are also supported; imaginary numbers are written with a suffix of j or J. Complex numbers with a nonzero real component are written as (real+imagj), or can be created with the complex(real, imag) function.
    >>> 1j * 1J (-1+0j) >>> 1j * complex(0,1) (-1+0j) >>> 3+1j*3 (3+3j) >>> (3+1j)*3 (9+3j) >>> (1+2j)/(1+1j) (1.5+0.5j)
    Where do I start?? 'j'/'J' as an imaginary number is not a mathematical variable?

    Wow, I really need to go back and study number theory/algebra. Im astounded this makes so little sense to me right now.

    I did just get off your wiki link, sir dice, and my mind is just completely rejecting it all right now. Maybe I just gotta try again tomorrow.
    That wiki link isn't quite the novice level breakdown that I think I need though. DAMN I FEEL DUMB RIGHT NOW
    Last edited by IcSilk; August 14th, 2011 at 04:13 AM.
    "In most gardens they make the beds too soft - so that the flowers are always asleep" - Tiger Lily

  6. #6
    Senior Member
    Join Date
    Jul 2002
    Posts
    744
    I would say start with hashes?

    http://diveintopython.org/getting_to...tionaries.html

    scripting/programming is only easy because it's a completely man made thing that every person has agreed upon the concept of "this does this in my language"...once again, more personal information is needed to asses skill level...the hard part is all that time reading boring details. just guessing.
    Last edited by bludgeon; August 14th, 2011 at 04:24 AM. Reason: I'm from the ass on this one, I'm more bettah with perl...
    Every now and then, one of you won't annoy me.

  7. #7
    Senior Member IcSilk's Avatar
    Join Date
    Aug 2001
    Posts
    296
    Good site, thanks.

    ...the hard part is all that time reading boring details. just guessing.
    lmao, good guess! that type of reading is where my mind starts dumbing down.
    "In most gardens they make the beds too soft - so that the flowers are always asleep" - Tiger Lily

  8. #8
    Senior Member
    Join Date
    Apr 2005
    Location
    USA
    Posts
    422
    Does this make things any easier? http://simple.wikipedia.org/wiki/Complex_number
    Wikipedia has simplified articles under Simplified English. Sometimes makes technical articles easier to understand.

  9. #9
    Senior Member IcSilk's Avatar
    Join Date
    Aug 2001
    Posts
    296
    ^ Yes, thank you. I didn't have the time to read it all the way through right now but the skimming of it I did makes much more sense ....

    stayed tuned
    "In most gardens they make the beds too soft - so that the flowers are always asleep" - Tiger Lily

  10. #10
    Just Another Geek
    Join Date
    Jul 2002
    Location
    Rotterdam, Netherlands
    Posts
    3,403
    Yes, the basic idea is that i (or j) is a number, not a variable. It's a bit of a mathematical construct to help solve certain problems.

    It resolves around the rule that any number (positive or negative) multiplied by itself gives a positive result. To 'break' that rule they've come up with i. If you multiply i with itself the result is negative. Something that isn't possible with the 'old' rules.

    Complex numbers make certain mathematical problems easier to solve.
    Oliver's Law:
    Experience is something you don't get until just after you need it.

Similar Threads

  1. Python 2.5 Released
    By HTRegz in forum General Computer Discussions
    Replies: 0
    Last Post: September 19th, 2006, 07:28 PM
  2. Developing a Port Scanner in Python
    By HTRegz in forum The Security Tutorials Forum
    Replies: 12
    Last Post: January 28th, 2006, 07:02 PM
  3. Python Introduction
    By HTRegz in forum Other Tutorials Forum
    Replies: 20
    Last Post: September 10th, 2005, 07:28 AM
  4. Beginning Network Programming in Python
    By PacketThirst in forum Other Tutorials Forum
    Replies: 2
    Last Post: August 14th, 2005, 07:16 PM
  5. Basic Python Tutorial for Newbies
    By [pHA]XeNoCiDe in forum AntiOnline's General Chit Chat
    Replies: 11
    Last Post: July 8th, 2002, 07:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides