Page 87 of 284 FirstFirst ... 37 77 85 86 87 88 89 97 137 ... LastLast
Results 1721 to 1740 of 5661

Thread: Large Hardon Collider     submit to reddit submit to twitter

  1. #1721
    Banned.

    Join Date
    Jul 2005
    Posts
    17,471
    BG Level
    9
    FFXI Server
    Ifrit
    WoW Realm
    Area 52

    Quote Originally Posted by Woozie View Post
    My bad, I knew I was misunderstanding something x_x
    It's not "your" bad, it's mine. I should have realized the proof was working for complex number, I just ignored it and tried to find a more...complex derivation.


    Life on Mars Theory Boosted by New Methane Study
    I definitively like where it is going. It's really hard to not get your hope up with study like this, even if it could very well be something else.

  2. #1722
    Puppetmaster
    Join Date
    Aug 2009
    Posts
    71
    BG Level
    2

    Quote Originally Posted by Mizango View Post
    Scientists analysing data from telescopic observations and unmanned space missions have discovered that methane on Mars is being constantly replenished by an unknown source and they are keen to uncover how the levels of methane are being topped up.
    The mystery deepens...2018 is pretty far off though, but I'm guessing the extraterrestial enthusiasts will be kept happy with theory number one until then. Well, with only two plausible options left, little wonder I suppose.

  3. #1723
    assburgers
    Join Date
    Mar 2007
    Posts
    10,925
    BG Level
    9

    Quote Originally Posted by Kaylia View Post
    It's not "your" bad, it's mine. I should have realized the proof was working for complex number, I just ignored it and tried to find a more...complex derivation.

    "The use of words expressing something other than their literal in~ten~tion!
    Now, THAT... IS... I~ron~y!" ~ Bender



    I definitively like where it is going. It's really hard to not get your hope up with study like this, even if it could very well be something else.
    I farted on the meteorite, sorry to get your hopes up.

  4. #1724
    Title: "HUBBLE GOTCHU!" (without the quotes, of course [and without "(without the quotes, of course)", of course], etc)
    Join Date
    Jul 2006
    Posts
    3,141
    BG Level
    7

    Kaylia/Eliseos, how do I use exponents in java? I don't mean like e^5, I mean like 3^5.

  5. #1725
    Banned.

    Join Date
    Jul 2005
    Posts
    17,471
    BG Level
    9
    FFXI Server
    Ifrit
    WoW Realm
    Area 52

    Quote Originally Posted by Woozie View Post
    Kaylia/Eliseos, how do I use exponents in java? I don't mean like e^5, I mean like 3^5.
    int x = java.lang.Math.pow ( 2, 3); // 2^3


    Might need to import maths in the header of your program

  6. #1726
    Title: "HUBBLE GOTCHU!" (without the quotes, of course [and without "(without the quotes, of course)", of course], etc)
    Join Date
    Jul 2006
    Posts
    3,141
    BG Level
    7

    Thanks. I looked for it on the java website thingy but somehow I missed that method.

  7. #1727
    Title: "HUBBLE GOTCHU!" (without the quotes, of course [and without "(without the quotes, of course)", of course], etc)
    Join Date
    Jul 2006
    Posts
    3,141
    BG Level
    7

    Now I need to make a matrix with 3 columns and k rows.

    I'm used to matlab, where everything is already a matrix. Here I'll have to use arrays since it's java.

    So would I say

    double[][] coil = new double[3][k];

    or

    double[][] coil = new double[k][3];

    ?

  8. #1728
    E. Body
    Join Date
    Jan 2007
    Posts
    2,103
    BG Level
    7

    I think the dimensions go from left to right for arrays, so the first brackets would be rows, second is columns. Let me look up the documentation to be sure.

    EDIT: I was wrong, it's the other way around. http://leepoint.net/notes-java/data/...rays-2D-2.html Also, I hate how they teach arrays and vectors, but they don't do much with maps or lists unless you take a data structures course. I've never once used an array or vector in my internship, it's all about the google collections API.

    EDIT: I wasn't actually wrong, I just can't read. Rows first, then columns.

  9. #1729
    Banned.

    Join Date
    Jul 2005
    Posts
    17,471
    BG Level
    9
    FFXI Server
    Ifrit
    WoW Realm
    Area 52

    Quote Originally Posted by Woozie View Post
    Now I need to make a matrix with 3 columns and k rows.

    I'm used to matlab, where everything is already a matrix. Here I'll have to use arrays since it's java.

    So would I say

    double[][] coil = new double[3][k];

    or

    double[][] coil = new double[k][3];

    ?
    It doesn't matter, as long you are coherant with the rest of your algorithm. So, just go for the usual line/column to avoid confusion.

    When you use [][], you basically create an array inside every array elements. As long you understand what you're doing, and read it correctly, it doesnt matter.

    That said, certain function from Math. might ask for a specific format, but I don't remember using any.

  10. #1730
    Banned.

    Join Date
    Jul 2005
    Posts
    17,471
    BG Level
    9
    FFXI Server
    Ifrit
    WoW Realm
    Area 52

    Actually, if you care about performance, you need to know which one come first (it doesnt matter for small matrice though).


    For a 2-d array M[m][n], M[i] would return a single array, M[i][j] would return an element. M[nothing][j] would crash (you won't get a collumn)


    If you were scanning a large matrice for example, you would need to retrieve a M[i] array first, then read every element in it.

  11. #1731
    Title: "HUBBLE GOTCHU!" (without the quotes, of course [and without "(without the quotes, of course)", of course], etc)
    Join Date
    Jul 2006
    Posts
    3,141
    BG Level
    7

    So since I need column matrices, I should use M[3][k] so that I can get column matrices returned to me when I need them by using M[0][i] to get the 0th column, for example?

  12. #1732
    Banned.

    Join Date
    Jul 2005
    Posts
    17,471
    BG Level
    9
    FFXI Server
    Ifrit
    WoW Realm
    Area 52

    Quote Originally Posted by Woozie View Post
    So since I need column matrices, I should use M[3][k] so that I can get column matrices returned to me when I need them by using M[0][i] to get the 0th column, for example?
    Well, java is starting to be far behind, and I don't have anything on this pc to test quickly. I'm not exactly sure how it would react, and your guess is probably as good as mine.


    Normally, the first time you make a program that read/use array, you should use 2 "for" loop to read your matrice

    For example, if you want to read the 3rd column (don't forget index start at 0)


    j = 2;
    double[] column = new double[n];

    for ( int i=0; i<m; i++ ) // For every row from 0 to m-1
    column= M[i,j];
    // read the value in the big matrice and asign it to the array



    [edit]
    Took out the [code], since it's being homo and limit it to a tiny window

  13. #1733
    Banned.

    Join Date
    Jul 2005
    Posts
    17,471
    BG Level
    9
    FFXI Server
    Ifrit
    WoW Realm
    Area 52

    Simlarly, if you want to read the whole matrice



    for ( int i=0; i<m; i++ )
    for ( int j=0; i<n; i++ )
    System.out.println(M[i,j]);



    Your loop will read every j for a given row, then move to the next row.

  14. #1734
    Title: "HUBBLE GOTCHU!" (without the quotes, of course [and without "(without the quotes, of course)", of course], etc)
    Join Date
    Jul 2006
    Posts
    3,141
    BG Level
    7

    One more question. In matlab, I have something in place that tells me how long my program took to finish. My very fist line of code is:

    ttt0 = clock;

    and my very last line of code is

    etime(clock, ttt0)

    (the semicolon is omitted from the second one on purpose).

    Is there anything similar in java?

  15. #1735
    Banned.

    Join Date
    Jul 2005
    Posts
    17,471
    BG Level
    9
    FFXI Server
    Ifrit
    WoW Realm
    Area 52

    Quote Originally Posted by Woozie View Post
    One more question. In matlab, I have something in place that tells me how long my program took to finish. My very fist line of code is:

    ttt0 = clock;

    and my very last line of code is

    etime(clock, ttt0)

    (the semicolon is omitted from the second one on purpose).

    Is there anything similar in java?
    Yes, I'm pretty certain there is a way to clock the time it takes. I've no clue how to do it though, I will check online and try to find a way.

  16. #1736
    Banned.

    Join Date
    Jul 2005
    Posts
    17,471
    BG Level
    9
    FFXI Server
    Ifrit
    WoW Realm
    Area 52

    Meh, I couldnt find a simple solution using default java classes. I really hate how java is documented, I always have harder time finding what im looking for. Anyway, easiest way I found is to download their package, import it

    http://www.koders.com/java/fid8EE455...67F0C44E4.aspx


    package opale.tools;

    msBegin = System.currentTimeMillis(); //start the time
    //insert your code here//
    msEnd = System.currentTimeMillis(); // end timer


    System.out.println(msEnd-msBegin);


    [edit]
    I'm sure you could do it as easily using the default class, but i can't find how to get the time in millisecond using the clock function.

    [edit2]
    nvm, it's with timer

  17. #1737
    E. Body
    Join Date
    Jan 2007
    Posts
    2,103
    BG Level
    7

    At work we use Joda Time, its relatively easy to use. http://joda-time.sourceforge.net/

    A solution similar to Kaylia is to use miliseconds. It looks like the entire standard Java date class is deprecated, and they use the Calendar class. The Joda API has a lot of comparison functions to automatically convert from one type to another, like seconds to days, etc.

  18. #1738
    Title: "HUBBLE GOTCHU!" (without the quotes, of course [and without "(without the quotes, of course)", of course], etc)
    Join Date
    Jul 2006
    Posts
    3,141
    BG Level
    7

    Wow, Java is definitely faster than matlab for this. I thought it would be the other way around.

    Edit: Crap, my results slightly contradict each other. Both graphs are shaped how they're supposed to be shaped so I can't even tell which one is wrong.

  19. #1739
    Banned.

    Join Date
    Jul 2005
    Posts
    17,471
    BG Level
    9
    FFXI Server
    Ifrit
    WoW Realm
    Area 52

    Quote Originally Posted by Woozie View Post
    Wow, Java is definitely faster than matlab for this. I thought it would be the other way around.

    Edit: Crap, my results slightly contradict each other. Both graphs are shaped how they're supposed to be shaped so I can't even tell which one is wrong.
    You're probably reading your matrice in the wrong direction or something stupid like that. Iterator are a pain.


    If you want to post your code, I can look at it (assuming i understand the maths behind it in the first place)

  20. #1740
    Title: "HUBBLE GOTCHU!" (without the quotes, of course [and without "(without the quotes, of course)", of course], etc)
    Join Date
    Jul 2006
    Posts
    3,141
    BG Level
    7

    I figured it out. It's because Java passes arrays by reference. I was doing a calculation that used the values of an array, but I wanted the original array to not be changed due to the calculation. So what I ended up doing was copying the array after passing it, and then only manipulating the copy.

    Also, there was a discrepancy due to the fact that matlab goes from 1 to k, whereas java goes from 0 to k-1. So I went changed my matlab file so that the calculations use the index -1, instead of just the index. For example, my first calculation has cos in it. So matlab was giving me 1.86 something, because it was evaluating r*cos(n*1) + x0, whereas java would give r*cos(n*0) + x0 = 2. My entire calculation depends on where it starts, so starting at 1.86 and at 2 makes a noticeable difference.

Page 87 of 284 FirstFirst ... 37 77 85 86 87 88 89 97 137 ... LastLast

Similar Threads

  1. Two Nuclear Submarines Collide in Atlantic Ocean
    By Firedemon in forum General Discussion
    Replies: 33
    Last Post: 2009-02-18, 06:38
  2. The Large Hadron Collider goes online tonight...
    By alt in forum General Discussion
    Replies: 8
    Last Post: 2008-09-10, 00:50
  3. Large Hadron Collider...
    By Jotaru in forum General Discussion
    Replies: 71
    Last Post: 2007-11-05, 22:42