User Profile

Collapse

Profile Sidebar

Collapse
ritesh247
ritesh247
Last Activity: May 1 '10, 01:44 AM
Joined: Mar 17 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • ritesh247
    started a topic Text file manipulation

    Text file manipulation

    I am using a text file in the form of 200 columns and 4 rows i.e

    4 5 6 7
    3 4 5 6
    an so on..

    i tried using:

    Code:
    openfile =open("variables.txt")
    for item in openfile:
        print item
    it prints the columns and the rows, but i don't know how to assign the values to my code.

    IS THERE ANY method of assigning each variable like lets say row 4 5...
    See more | Go to post

  • Array problem - trying to remove a value from each array and getting an answer

    I was wondering if anyone could help me out with this:

    lets say u have three arrays:
    A=[1,2,3,4]
    B=[2,3,4,5]
    C=[4,6,7,8]

    I want to use each column from each array to get an output, such that when the code runs it uses the first column, then on the second run uses the second column..e.t.c

    here is the code I have been trying to work on, I have tired different methods but none have worked...
    See more | Go to post

  • ritesh247
    replied to Coding problems
    I am wondering if anyone can help me fix the array problem out?? If someone can give me feedback on where I am going wrong??
    See more | Go to post

    Leave a comment:


  • ritesh247
    replied to Coding problems
    I tried using numpy arrays but i was getting this error

    Traceback (most recent call last):

    File "C:\Python25\GE M SA.py", line 74, in <module>
    A = matrix([[a11,a12],[a21,a22]])
    File "C:\Python25\Li b\site-packages\numpy\ core\defmatrix. py", line 217, in __new__
    arr = N.array(data, dtype=dtype, copy=copy)
    ValueError: setting an array element with a sequence.
    ...
    See more | Go to post

    Leave a comment:


  • ritesh247
    replied to Coding problems
    Is there any other way of doing this other than using enumerate

    lets say if the scenario was such that

    Code:
     A = [3.4, 5.6, 7.7, 9.7]
     B = [3.5, 4.7.-3.3, 8.7]
     C = [8.5, 6.7.-8.3, 4.7]
    
    f=2
    g=4
    
    z=A*B
    y=A*C*f
    u=C*g
    
    ww=z*y*u
    is there any possibility of obtaining four solutions for ww??

    and also lets say if you had to use each one of the...
    See more | Go to post
    Last edited by ritesh247; Apr 29 '10, 12:27 AM. Reason: forgot to add something

    Leave a comment:


  • ritesh247
    replied to Coding problems
    thank you very much for the reply,

    since am a beginner in python I also wanted ask you another question:

    let say if you got if you got a sequence of numbers lets say
    Code:
    A = [3.4, 5.6, 7.7, 9.7]
    B = [3.5, 4.7.-3.3, 8.7]
    C = [8.5, 6.7.-8.3, 4.7]
    
    Z = A*B*C
    the value of Z should have four answers


    I tried using for loops, lets say for

    Code:
    A = [3.4,
    ...
    See more | Go to post
    Last edited by ritesh247; Apr 28 '10, 08:56 PM. Reason: forgot to add something

    Leave a comment:


  • ritesh247
    started a topic Coding problems

    Coding problems

    I got a list of numbers lets say A = [0.456, 0.4344, 1, -1, 4, 5, 6,8]

    how can the function mentioned below be fixed in python using the list of numbers mentioned above and get the six different solutions of 'xf' for lets say the code mentioned below:
    Code:
    c=2
    xfmin = 0.432*c
    xfmax = 0.528*c
    def xf(a, b):                                           
        return a+(b-a)*A
    xfrn= xf(xfmin, xfmax)
    ...
    See more | Go to post
    Last edited by bvdet; Apr 28 '10, 01:47 PM. Reason: Add code tags

  • Got it working thanks :)

    but now when i try making a list for Vf_min anf Vf_max i get this error:
    Type Error: 'float' object is unsubscriptable

    why do i get such an error??
    See more | Go to post

    Leave a comment:


  • I will make sure I will use the code tags when posting code.
    I tried implementing the method you wrote down but it gives me the same results as before. I am trying to print out the mean velocity all its giving me is the velocity which is the last Vf it prints out. I am wondering if this problem can be solved. Really sorry for asking so many questions.
    See more | Go to post

    Leave a comment:


  • I am trying all those steps but am still not getting the required results, I am attaching my script code. Could you please have a look at it and tell me why am not being able to store the variables in a list. Since I want to calculate the mean of Vf. When i try getting the mean for Vf i gt the same value as Vf and thts not the correct answer:

    Code:
    for carlo in range (20): # Initially carrying out in the range from 0 to 20
        s = 7.5
    ...
    See more | Go to post
    Last edited by bvdet; Apr 12 '10, 01:05 AM. Reason: Add code tags

    Leave a comment:


  • how to capture variables and and store them in an array?

    Lets say for this function:
    x=5
    z=10
    for i in range (200):
    V= i*z*x

    how would i be able to capture all the values of V in the range 200 (make an array, as i have tried making it but i have gotten no where) and calculate its mean??

    2) If I am supposed to create a probability density function..how can I create one using python??
    See more | Go to post

  • ritesh247
    started a topic Python Uniform Random Variable function

    Python Uniform Random Variable function

    Hey,
    I am doing a project on one of my modules and I am supposed to build a function that gives uniform random variable between lets say Y and Z...I was wondering how this function can be built??

    Thanking you,
    Ritesh.
    See more | Go to post
No activity results to display
Show More
Working...