Search Results

Search found 3365 results on 135 pages for 'math'.

Page 1/135 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Recommended books on math for programmers

    - by Anto
    Some programmers do, besides programming, like math (others don't). What books on math do you recommend programmers who like math to read? There are books which present concepts which are applicable in programming and/or computer science, other books about things which will fascinate programmers etc. Books on applying math to programming are okey, but they should be mainly about math (and not programming). Motivate your answers, with focus on why programmers should read the book(s).

    Read the article

  • Math questions at a programmer interview?

    - by anon
    So I went to an interview at Samsung here in Dallas, Texas. The way the recruiter described the job, he didn't make it sound like it was too math-oriented. The job basically involved graphics programming and C++. Yes, math is implied in graphics programming, especially shaders, but I still wasn't expecting this... The whole interview lasted about an hour and a half and they asked me nothing but math-related questions. They didn't ask me a single programming question, which I found odd. About all they did was ask me how to write certain math routines as a C++ function, but that's about it. What about programming philosophy questions? Design patterns? Code-correctness? Constness? Exception safety? Thread safety? There are a zillion topics that they could have covered. But they didn't. The main concern I have is that they didn't ask any programming questions. This basically implies to me that any programmer who is good at math can get a job here, but they might put out terrible code. Of course, I think I bombed the interview because I haven't used any sort of linear algebra in about a year and I forget math easily if I haven't used it in practice for a while. Are any of my other fellow programmers out there this way? I'm a game programmer too, so this seems especially odd. The more I learn, the more old knowledge that gets "popped" out of my "stack" (memory). My question is: Does this interview seem suspicious? Is this a typical interview that large corporations have? During the interview they told me that Google's interview process is similar. They have multiple, consecutive interviews where the math problems get more advanced.

    Read the article

  • Math questions at a programmer interview?

    - by anon
    So I went to an interview at Samsung here in Dallas, Texas. The way the recruiter described the job, he didn't make it sound like it was too math-oriented. The job basically involved graphics programming and C++. Yes, math is implied in graphics programming, especially shaders, but I still wasn't expecting this... The whole interview lasted about an hour and a half and they asked me nothing but math-related questions. They didn't ask me a single programming question, which I found odd. About all they did was ask me how to write certain math routines as a C++ function, but that's about it. What about programming philosophy questions? Design patterns? Code-correctness? Constness? Exception safety? Thread safety? There are a zillion topics that they could have covered. But they didn't. The main concern I have is that they didn't ask any programming questions. This basically implies to me that any programmer who is good at math can get a job here, but they might put out terrible code. Of course, I think I bombed the interview because I haven't used any sort of linear algebra in about a year and I forget math easily if I haven't used it in practice for a while. Are any of my other fellow programmers out there this way? I'm a game programmer too, so this seems especially odd. The more I learn, the more old knowledge that gets "popped" out of my "stack" (memory). My question is: Does this interview seem suspicious? Is this a typical interview that large corporations have? During the interview they told me that Google's interview process is similar. They have multiple, consecutive interviews where the math problems get more advanced.

    Read the article

  • CPU Architecture and floating-point math

    - by Jo-Herman Haugholt
    I'm trying to wrap my head around some details about how floating point math is performed on the CPU, trying to better understand what data types to use etc. I think I have a fairly good understanding of how integer math is performed. If I've understood correctly, and disregarding SIMD, a 32-bit CPU will generally perform integer math at at least 32-bit precision etc. Is it correct that floating-point math is dependent on the presence of a FPU? And that the FPU on the x86 is 80-bit, so floating point math is performed at this precision unless using SIMD? What about ARM?

    Read the article

  • Math major as a viable degree

    - by Zak O'Keefe
    While I realize there are many topics about CS vs software engineering vs game school programs, I haven't found anything relating to whether pure math degrees (with CS minor and electives) would also be a viable program. By this I mean: Would having a math major, CS minor put one at competitive disadvantage as compared to a pure CS program? This relates specifically to game engine programming, more on the graphics side. Background (for those who care): Currently a math major, CS minor at school and looking to land a career doing graphics engine programming. Admittedly, I love math and if at all possible would like to stay my current program as long as it doesn't put me at a competitive disadvantage trying to land a job post-graduation. That being said, I'm strong in the traditional C/C++ languages, strong concurrent programming skills, and currently produce self-made games for iOS. As an employer, how badly is the math major hurting me? Just want to get some advice from people already in the field!

    Read the article

  • Bad at math, feeling limited

    - by Peter Stain
    Currently I'm a java developer, making websites. I'm really bad at math, in high school I got suspened because of it once. I didn't program then and had no interest in math. I started programming after high school and started feeling that my poor math skills are limiting me. I feel like the programming's not that hard for me. Though web development in general is not that hard, i guess. I've been doing Spring and Hibernate a lot. What i'm trying to ask is : if I understand and can manage these technologies and programming overall, would it mean that I have some higher than average prerequisite for math and details? Would there be any point or would it be easy for me to take some courses in high school math and get a BSc in math maybe? This web development is really starting to feel like not my cup of tea anymore, i would like to do something more interesting. I'm 25 now and feel like stuck. Any help appreciated.

    Read the article

  • What math should all game programmers know?

    - by Tetrad
    Simple enough question: What math should all game programmers have a firm grasp of in order to be successful? I'm not specifically talking about rendering math or anything in the niche areas of game programming, more specifically just things that even game programmers should know about, and if they don't they'll probably find it useful. Note: as there is no one correct answer, this question (and its answers) is a community wiki. Also, if you would like fancy latex math equations, feel free to use http://mathurl.com/.

    Read the article

  • Game Institute Math Courses

    - by W3Geek
    I'm 21 years old and I suck at math, I mean really bad. I don't have the necessary logic to apply it towards programming. I would like to learn the math and logic of applying it. I found Game Institute (http://www.gameinstitute.com) awhile back and heard a lot of praise about them. Are there Math courses any good? Thank you. Edit: My high school was terrible and did not prepare me for any math. I am fairly decent at programming, I just don't have the logic to apply any mathematics to programming, as an example I don't understand the algorithm of finding the size of a user's screen. Yes I have heard of KhanAcademy (http://www.khanacademy.org/) and I have completed a lot of maths on his website but I still don't have the logic to apply any of it to programming.

    Read the article

  • Long term plan of attack to learn math?

    - by zhenka
    I am a web-developer with a desire to expand my skill-set to mathematics relevant to programming. As 2nd career, I am stuck in college doing some of the requirements while working. I was hoping the my education will teach me the needed skills to apply math, however I am quickly finding it to be too much easily-testable breadth-based approach very inefficient for the time invested. For example in my calculus 2 class, the only remotely useful mind expanding experience I had was volumes and areas under the curve. The rest was just monotonous glorified algebra, which while comes easy to me, could be done by software like wolfram alpha within seconds. This is not my idea of learning math. So here I am a frustrated student looking for a way to improve my understanding of math in a way that focuses on application, understanding and maximally removed needless tedium. However I cannot find a good long term study strategy with this approach in mind. So for those of like mind, how would you go about learning the necessary math without worrying too much about stuff a computer can do much better?

    Read the article

  • (int) Math.floor(x / TILESIZE) or just (int) (x / TILESIZE)

    - by Aidan Mueller
    I have a Array that stores my map data and my Tiles are 64X64. Sometimes I need to convert from pixels to units of tiles. So I was doing: int x int y public void myFunction() { getTile((int) Math.floor(x / 64), (int) Math.floor(y / 64)).doOperation(); } But I discovered by using (I'm using java BTW) System.out.println((int) (1 / 1.5)) that converting to an int automatically rounds down. This means that I can replace the (int) Math.floor with just x / 64. But if I run this on a different OS do you think it might give a different result? I'm just afraid there might be some case where this would round up and not down. Should I keep doing it the way I was and maybe make a function like convert(int i) to make it easier? Or is it OK to just do x / 64?

    Read the article

  • Simple Math Multiplayer game - is Ajax sufficient?

    - by Christian Strang
    I'm planning to create a simple math multiplayer game and I plan to just use Ajax for the server/client communication but I'm not sure if this is sufficient or if I need a socket server. The game will look like this: 2-4 users all get a simple math task (like: "37 + 14") they have to solve it as fast as possible first user who solves it is the winner I will track the time for each user, since the game started, on the client side and everytime a user gives an answer, the answer and the passed time will be send to the server. Additionally I'll add a function which will check every 3 seconds if the other users finished, how much time they needed and who won. Do you think this is possible just using Ajax? What alternatives are there?

    Read the article

  • Is there an easy way to type in common math symbols?

    - by srcspider
    Disclaimer: I'm sure someone is going to moan about easy-of-use, for the purpose of this question consider readability to be the only factor that matters So I found this site that converts to easting northing, it's not really important what that even means but here's how the piece of javascript looks. /** * Convert Ordnance Survey grid reference easting/northing coordinate to (OSGB36) latitude/longitude * * @param {OsGridRef} gridref - easting/northing to be converted to latitude/longitude * @returns {LatLonE} latitude/longitude (in OSGB36) of supplied grid reference */ OsGridRef.osGridToLatLong = function(gridref) { var E = gridref.easting; var N = gridref.northing; var a = 6377563.396, b = 6356256.909; // Airy 1830 major & minor semi-axes var F0 = 0.9996012717; // NatGrid scale factor on central meridian var f0 = 49*Math.PI/180, ?0 = -2*Math.PI/180; // NatGrid true origin var N0 = -100000, E0 = 400000; // northing & easting of true origin, metres var e2 = 1 - (b*b)/(a*a); // eccentricity squared var n = (a-b)/(a+b), n2 = n*n, n3 = n*n*n; // n, n², n³ var f=f0, M=0; do { f = (N-N0-M)/(a*F0) + f; var Ma = (1 + n + (5/4)*n2 + (5/4)*n3) * (f-f0); var Mb = (3*n + 3*n*n + (21/8)*n3) * Math.sin(f-f0) * Math.cos(f+f0); var Mc = ((15/8)*n2 + (15/8)*n3) * Math.sin(2*(f-f0)) * Math.cos(2*(f+f0)); var Md = (35/24)*n3 * Math.sin(3*(f-f0)) * Math.cos(3*(f+f0)); M = b * F0 * (Ma - Mb + Mc - Md); // meridional arc } while (N-N0-M >= 0.00001); // ie until < 0.01mm var cosf = Math.cos(f), sinf = Math.sin(f); var ? = a*F0/Math.sqrt(1-e2*sinf*sinf); // nu = transverse radius of curvature var ? = a*F0*(1-e2)/Math.pow(1-e2*sinf*sinf, 1.5); // rho = meridional radius of curvature var ?2 = ?/?-1; // eta = ? var tanf = Math.tan(f); var tan2f = tanf*tanf, tan4f = tan2f*tan2f, tan6f = tan4f*tan2f; var secf = 1/cosf; var ?3 = ?*?*?, ?5 = ?3*?*?, ?7 = ?5*?*?; var VII = tanf/(2*?*?); var VIII = tanf/(24*?*?3)*(5+3*tan2f+?2-9*tan2f*?2); var IX = tanf/(720*?*?5)*(61+90*tan2f+45*tan4f); var X = secf/?; var XI = secf/(6*?3)*(?/?+2*tan2f); var XII = secf/(120*?5)*(5+28*tan2f+24*tan4f); var XIIA = secf/(5040*?7)*(61+662*tan2f+1320*tan4f+720*tan6f); var dE = (E-E0), dE2 = dE*dE, dE3 = dE2*dE, dE4 = dE2*dE2, dE5 = dE3*dE2, dE6 = dE4*dE2, dE7 = dE5*dE2; f = f - VII*dE2 + VIII*dE4 - IX*dE6; var ? = ?0 + X*dE - XI*dE3 + XII*dE5 - XIIA*dE7; return new LatLonE(f.toDegrees(), ?.toDegrees(), GeoParams.datum.OSGB36); } I found that to be a really nice way of writing an algorythm, at least as far as redability is concerned. Is there any way to easily write the special symbols. And by easily write I mean NOT copy/paste them.

    Read the article

  • how to make a function recursive

    - by tom smith
    i have this huge function and i am wondering how to make it recursive. i have the base case which should never come true, so it should always go to else and keep calling itself with the variable t increases. any help would be great thanks def draw(x, y, t, planets): if 'Satellites' in planets["Moon"]: print ("fillcircle", x, y, planets["Moon"]['Radius']*scale) else: while True: print("refresh") print("colour 0 0 0") print("clear") print("colour 255 255 255") print("fillcircle",x,y,planets['Sun']['Radius']*scale) print("text ", "\"Sun\"",x+planets['Sun']['Radius']*scale,y) if "Mercury" in planets: r_Mercury=planets['Mercury']['Orbital Radius']*scale; print("circle",x,y,r_Mercury) r_Xmer=x+math.sin(t*2*math.pi/planets['Mercury']['Period'])*r_Mercury r_Ymer=y+math.cos(t*2*math.pi/planets['Mercury']['Period'])*r_Mercury print("fillcircle",r_Xmer,r_Ymer,3) print("text ", "\"Mercury\"",r_Xmer+planets['Mercury']['Radius']*scale,r_Ymer) if "Venus" in planets: r_Venus=planets['Venus']['Orbital Radius']*scale; print("circle",x,y,r_Venus) r_Xven=x+math.sin(t*2*math.pi/planets['Venus']['Period'])*r_Venus r_Yven=y+math.cos(t*2*math.pi/planets['Venus']['Period'])*r_Venus print("fillcircle",r_Xven,r_Yven,3) print("text ", "\"Venus\"",r_Xven+planets['Venus']['Radius']*scale,r_Yven) if "Earth" in planets: r_Earth=planets['Earth']['Orbital Radius']*scale; print("circle",x,y,r_Earth) r_Xe=x+math.sin(t*2*math.pi/planets['Earth']['Period'])*r_Earth r_Ye=y+math.cos(t*2*math.pi/planets['Earth']['Period'])*r_Earth print("fillcircle",r_Xe,r_Ye,3) print("text ", "\"Earth\"",r_Xe+planets['Earth']['Radius']*scale,r_Ye) if "Moon" in planets: r_Moon=planets['Moon']['Orbital Radius']*scale; print("circle",r_Xe,r_Ye,r_Moon) r_Xm=r_Xe+math.sin(t*2*math.pi/planets['Moon']['Period'])*r_Moon r_Ym=r_Ye+math.cos(t*2*math.pi/planets['Moon']['Period'])*r_Moon print("fillcircle",r_Xm,r_Ym,3) print("text ", "\"Moon\"",r_Xm+planets['Moon']['Radius']*scale,r_Ym) if "Mars" in planets: r_Mars=planets['Mars']['Orbital Radius']*scale; print("circle",x,y,r_Mars) r_Xmar=x+math.sin(t*2*math.pi/planets['Mars']['Period'])*r_Mars r_Ymar=y+math.cos(t*2*math.pi/planets['Mars']['Period'])*r_Mars print("fillcircle",r_Xmar,r_Ymar,3) print("text ", "\"Mars\"",r_Xmar+planets['Mars']['Radius']*scale,r_Ymar) if "Phobos" in planets: r_Phobos=planets['Phobos']['Orbital Radius']*scale; print("circle",r_Xmar,r_Ymar,r_Phobos) r_Xpho=r_Xmar+math.sin(t*2*math.pi/planets['Phobos']['Period'])*r_Phobos r_Ypho=r_Ymar+math.cos(t*2*math.pi/planets['Phobos']['Period'])*r_Phobos print("fillcircle",r_Xpho,r_Ypho,3) print("text ", "\"Phobos\"",r_Xpho+planets['Phobos']['Radius']*scale,r_Ypho) if "Deimos" in planets: r_Deimos=planets['Deimos']['Orbital Radius']*scale; print("circle",r_Xmar,r_Ymar,r_Deimos) r_Xdei=r_Xmar+math.sin(t*2*math.pi/planets['Deimos']['Period'])*r_Deimos r_Ydei=r_Ymar+math.cos(t*2*math.pi/planets['Deimos']['Period'])*r_Deimos print("fillcircle",r_Xdei,r_Ydei,3) print("text ", "\"Deimos\"",r_Xpho+planets['Deimos']['Radius']*scale,r_Ydei) if "Ceres" in planets: r_Ceres=planets['Ceres']['Orbital Radius']*scale; print("circle",x,y,r_Ceres) r_Xcer=x+math.sin(t*2*math.pi/planets['Ceres']['Period'])*r_Ceres r_Ycer=y+math.cos(t*2*math.pi/planets['Ceres']['Period'])*r_Ceres print("fillcircle",r_Xcer,r_Ycer,3) print("text ", "\"Ceres\"",r_Xcer+planets['Ceres']['Radius']*scale,r_Ycer) if "Jupiter" in planets: r_Jupiter=planets['Jupiter']['Orbital Radius']*scale; print("circle",x,y,r_Jupiter) r_Xjup=x+math.sin(t*2*math.pi/planets['Jupiter']['Period'])*r_Jupiter r_Yjup=y+math.cos(t*2*math.pi/planets['Jupiter']['Period'])*r_Jupiter print("fillcircle",r_Xjup,r_Yjup,3) print("text ", "\"Jupiter\"",r_Xjup+planets['Jupiter']['Radius']*scale,r_Yjup) if "Io" in planets: r_Io=planets['Io']['Orbital Radius']*scale; print("circle",r_Xjup,r_Yjup,r_Io) r_Xio=r_Xjup+math.sin(t*2*math.pi/planets['Io']['Period'])*r_Io r_Yio=r_Yjup+math.cos(t*2*math.pi/planets['Io']['Period'])*r_Io print("fillcircle",r_Xio,r_Yio,3) print("text ", "\"Io\"",r_Xio+planets['Io']['Radius']*scale,r_Yio) if "Europa" in planets: r_Europa=planets['Europa']['Orbital Radius']*scale; print("circle",r_Xjup,r_Yjup,r_Europa) r_Xeur=r_Xjup+math.sin(t*2*math.pi/planets['Europa']['Period'])*r_Europa r_Yeur=r_Yjup+math.cos(t*2*math.pi/planets['Europa']['Period'])*r_Europa print("fillcircle",r_Xeur,r_Yeur,3) print("text ", "\"Europa\"",r_Xeur+planets['Europa']['Radius']*scale,r_Yeur) if "Ganymede" in planets: r_Ganymede=planets['Ganymede']['Orbital Radius']*scale; print("circle",r_Xjup,r_Yjup,r_Ganymede) r_Xgan=r_Xjup+math.sin(t*2*math.pi/planets['Ganymede']['Period'])*r_Ganymede r_Ygan=r_Yjup+math.cos(t*2*math.pi/planets['Ganymede']['Period'])*r_Ganymede print("fillcircle",r_Xgan,r_Ygan,3) print("text ", "\"Ganymede\"",r_Xgan+planets['Ganymede']['Radius']*scale,r_Ygan) if "Callisto" in planets: r_Callisto=planets['Callisto']['Orbital Radius']*scale; print("circle",r_Xjup,r_Yjup,r_Callisto) r_Xcal=r_Xjup+math.sin(t*2*math.pi/planets['Callisto']['Period'])*r_Callisto r_Ycal=r_Yjup+math.cos(t*2*math.pi/planets['Callisto']['Period'])*r_Callisto print("fillcircle",r_Xcal,r_Ycal,3) print("text ", "\"Callisto\"",r_Xcal+planets['Callisto']['Radius']*scale,r_Ycal) if "Saturn" in planets: r_Saturn=planets['Saturn']['Orbital Radius']*scale; print("circle",x,y,r_Saturn) r_Xsat=x+math.sin(t*2*math.pi/planets['Saturn']['Period'])*r_Saturn r_Ysat=y+math.cos(t*2*math.pi/planets['Saturn']['Period'])*r_Saturn print("fillcircle",r_Xsat,r_Ysat,3) print("text ", "\"Saturn\"",r_Xsat+planets['Saturn']['Radius']*scale,r_Ysat) if "Mimas" in planets: r_Mimas=planets['Mimas']['Orbital Radius']*scale; print("circle",r_Xsat,r_Ysat,r_Mimas) r_Xmim=r_Xsat+math.sin(t*2*math.pi/planets['Mimas']['Period'])*r_Mimas r_Ymim=r_Ysat+math.cos(t*2*math.pi/planets['Mimas']['Period'])*r_Mimas print("fillcircle",r_Xmim,r_Ymim,3) print("text ", "\"Mimas\"",r_Xmim+planets['Mimas']['Radius']*scale,r_Ymim) if "Enceladus" in planets: r_Enceladus=planets['Enceladus']['Orbital Radius']*scale; print("circle",r_Xsat,r_Ysat,r_Enceladus) r_Xenc=r_Xsat+math.sin(t*2*math.pi/planets['Enceladus']['Period'])*r_Enceladus r_Yenc=r_Ysat+math.cos(t*2*math.pi/planets['Enceladus']['Period'])*r_Enceladus print("fillcircle",r_Xenc,r_Yenc,3) print("text ", "\"Enceladus\"",r_Xenc+planets['Enceladus']['Radius']*scale,r_Yenc) if "Tethys" in planets: r_Tethys=planets['Tethys']['Orbital Radius']*scale; print("circle",r_Xsat,r_Ysat,r_Tethys) r_Xtet=r_Xsat+math.sin(t*2*math.pi/planets['Tethys']['Period'])*r_Tethys r_Ytet=r_Ysat+math.cos(t*2*math.pi/planets['Tethys']['Period'])*r_Tethys print("fillcircle",r_Xtet,r_Ytet,3) print("text ", "\"Tethys\"",r_Xtet+planets['Tethys']['Radius']*scale,r_Ytet) if "Dione" in planets: r_Dione=planets['Dione']['Orbital Radius']*scale; print("circle",r_Xsat,r_Ysat,r_Dione) r_Xdio=r_Xsat+math.sin(t*2*math.pi/planets['Dione']['Period'])*r_Dione r_Ydio=r_Ysat+math.cos(t*2*math.pi/planets['Dione']['Period'])*r_Dione print("fillcircle",r_Xdio,r_Ydio,3) print("text ", "\"Dione\"",r_Xdio+planets['Dione']['Radius']*scale,r_Ydio) if "Rhea" in planets: r_Rhea=planets['Rhea']['Orbital Radius']*scale; print("circle",r_Xsat,r_Ysat,r_Rhea) r_Xrhe=r_Xsat+math.sin(t*2*math.pi/planets['Rhea']['Period'])*r_Rhea r_Yrhe=r_Ysat+math.cos(t*2*math.pi/planets['Rhea']['Period'])*r_Rhea print("fillcircle",r_Xrhe,r_Yrhe,3) print("text ", "\"Rhea\"",r_Xrhe+planets['Rhea']['Radius']*scale,r_Yrhe) if "Titan" in planets: r_Titan=planets['Titan']['Orbital Radius']*scale; print("circle",r_Xsat,r_Ysat,r_Titan) r_Xtit=r_Xsat+math.sin(t*2*math.pi/planets['Titan']['Period'])*r_Titan r_Ytit=r_Ysat+math.cos(t*2*math.pi/planets['Titan']['Period'])*r_Titan print("fillcircle",r_Xtit,r_Ytit,3) print("text ", "\"Titan\"",r_Xtit+planets['Titan']['Radius']*scale,r_Ytit) if "Iapetus" in planets: r_Iapetus=planets['Iapetus']['Orbital Radius']*scale; print("circle",r_Xsat,r_Ysat,r_Iapetus) r_Xiap=r_Xsat+math.sin(t*2*math.pi/planets['Iapetus']['Period'])*r_Iapetus r_Yiap=r_Ysat+math.cos(t*2*math.pi/planets['Iapetus']['Period'])*r_Iapetus print("fillcircle",r_Xiap,r_Yiap,3) print("text ", "\"Iapetus\"",r_Xiap+planets['Iapetus']['Radius']*scale,r_Yiap) if "Uranus" in planets: r_Uranus=planets['Uranus']['Orbital Radius']*scale; print("circle",x,y,r_Uranus) r_Xura=x+math.sin(t*2*math.pi/planets['Uranus']['Period'])*r_Uranus r_Yura=y+math.cos(t*2*math.pi/planets['Uranus']['Period'])*r_Uranus print("fillcircle",r_Xura,r_Yura,3) print("text ", "\"Uranus\"",r_Xura+planets['Uranus']['Radius']*scale,r_Yura) if "Puck" in planets: r_Puck=planets['Puck']['Orbital Radius']*scale; print("circle",r_Xura,r_Yura,r_Puck) r_Xpuc=r_Xura+math.sin(t*2*math.pi/planets['Puck']['Period'])*r_Puck r_Ypuc=r_Yura+math.cos(t*2*math.pi/planets['Puck']['Period'])*r_Puck print("fillcircle",r_Xpuc,r_Ypuc,3) print("text ", "\"Puck\"",r_Xpuc+planets['Puck']['Radius']*scale,r_Ypuc) if "Miranda" in planets: r_Miranda=planets['Miranda']['Orbital Radius']*scale; print("circle",r_Xura,r_Yura,r_Miranda) r_Xmira=r_Xura+math.sin(t*2*math.pi/planets['Miranda']['Period'])*r_Miranda r_Ymira=r_Yura+math.cos(t*2*math.pi/planets['Miranda']['Period'])*r_Miranda print("fillcircle",r_Xmira,r_Ymira,3) print("text ", "\"Miranda\"",r_Xmira+planets['Miranda']['Radius']*scale,r_Ymira) if "Ariel" in planets: r_Ariel=planets['Ariel']['Orbital Radius']*scale; print("circle",r_Xura,r_Yura,r_Ariel) r_Xari=r_Xura+math.sin(t*2*math.pi/planets['Ariel']['Period'])*r_Ariel r_Yari=r_Yura+math.cos(t*2*math.pi/planets['Ariel']['Period'])*r_Ariel print("fillcircle",r_Xari,r_Yari,3) print("text ", "\"Ariel\"",r_Xari+planets['Ariel']['Radius']*scale,r_Yari) if "Umbriel" in planets: r_Umbriel=planets['Umbriel']['Orbital Radius']*scale; print("circle",r_Xura,r_Yura,r_Umbriel) r_Xumb=r_Xura+math.sin(t*2*math.pi/planets['Umbriel']['Period'])*r_Umbriel r_Yumb=r_Yura+math.cos(t*2*math.pi/planets['Umbriel']['Period'])*r_Umbriel print("fillcircle",r_Xumb,r_Yumb,3) print("text ", "\"Umbriel\"",r_Xumb+planets['Umbriel']['Radius']*scale,r_Yumb) if "Titania" in planets: r_Titania=planets['Titania']['Orbital Radius']*scale; print("circle",r_Xura,r_Yura,r_Titania) r_Xtita=r_Xura+math.sin(t*2*math.pi/planets['Titania']['Period'])*r_Titania r_Ytita=r_Yura+math.cos(t*2*math.pi/planets['Titania']['Period'])*r_Titania print("fillcircle",r_Xtita,r_Ytita,3) print("text ", "\"Titania\"",r_Xtita+planets['Titania']['Radius']*scale,r_Ytita) if "Oberon" in planets: r_Oberon=planets['Oberon']['Orbital Radius']*scale; print("circle",r_Xura,r_Yura,r_Oberon) r_Xober=r_Xura+math.sin(t*2*math.pi/planets['Oberon']['Period'])*r_Oberon r_Yober=r_Yura+math.cos(t*2*math.pi/planets['Oberon']['Period'])*r_Oberon print("fillcircle",r_Xober,r_Yober,3) print("text ", "\"Oberon\"",r_Xober+planets['Oberon']['Radius']*scale,r_Yober) if "Neptune" in planets: r_Neptune=planets['Neptune']['Orbital Radius']*scale; print("circle",x,y,r_Neptune) r_Xnep=x+math.sin(t*2*math.pi/planets['Neptune']['Period'])*r_Neptune r_Ynep=y+math.cos(t*2*math.pi/planets['Neptune']['Period'])*r_Neptune print("fillcircle",r_Xnep,r_Ynep,3) print("text ", "\"Neptune\"",r_Xnep+planets['Neptune']['Radius']*scale,r_Ynep) if "Titan" in planets: r_Titan=planets['Titan']['Orbital Radius']*scale; print("circle",r_Xnep,r_Ynep,r_Titan) r_Xtita=r_Xnep+math.sin(t*2*math.pi/planets['Titan']['Period'])*r_Titan r_Ytita=r_Ynep+math.cos(t*2*math.pi/planets['Titan']['Period'])*r_Titan print("fillcircle",r_Xtita,r_Ytita,3) print("text ", "\"Titan\"",r_Xtita+planets['Titan']['Radius']*scale,r_Ytita) t += 0.003 print(draw(x, y, t, planets))

    Read the article

  • How to learn the math behind the code?

    - by Solomon Wise
    I am a 12 year old who has recently gotten into programming. (Although I know that the number of books you have read does not determine your programming competency or ability, just to paint a "map" of where I am in terms of the content I know...) I've finished the books: Python 3 For Absolute Beginners Pro Python Python Standard Library by Example Beautiful Code Agile Web Development With Rails and am about halfway into Programming Ruby. I have written many small programs (One that finds which files have been updated and deleted in a directory, one that compares multiple players' fantasy baseball value, and some text based games, and many more). Obviously, as I'm not some sort of child prodigy, I can't take a formal Computer Science course until high school. I really want to learn computer science to increase my knowledge about the code, and the how the code runs. I've really become interested in the math part after reading the source code for Python's random module. Is there a place where I can learn CS, or programming math online for free, at a level that would be at least partially understandable to a person my age?

    Read the article

  • Java Math.cos() Method Does Not Return 0 When Expected

    - by dimo414
    Using Java on a Windows 7 PC (not sure if that matters) and calling Math.cos() on values that should return 0 (like pi/2) instead returns small values, but small values that, unless I'm misunderstanding, are much greater than 1 ulp off from zero. Math.cos(Math.PI/2) = 6.123233995736766E-17 Math.ulp(Math.cos(Math.PI/2)) = 1.232595164407831E-32 Is this in fact within 1 ulp and I'm simply confused? And would this be an acceptable wrapper method to resolve this minor inaccuracy? public static double cos(double a){ double temp = Math.abs(a % Math.PI); if(temp == Math.PI/2) return 0; return Math.cos(a); }

    Read the article

  • MathType and LibreOffice Math comparison

    - by Agmenor
    In my office my team and I are going to type texts in the future which will include mathematical signs. Two programs are being proposed: LibreOffice Writer + Math or Microsoft Office + MathType. I would like to advocate for the first solution, but I need to know what technical advantages and disadvantages each program has. Compatibility with Ubuntu is an evident and important characteristic for LibreOffice, but could you give some other aspects? As a side question, do you advice any other program, even if not WYSIWYG and thus not my preference in this case?

    Read the article

  • Getting to math applications gradually

    - by den-javamaniac
    I'm currently getting a formal degree related to computation, in particular my current focus is numerical programming, scientific computing and machine learning. I'd love to apply that knowledge in game dev and expand it with statistics, probability theory, and graph theory (probably even linear algebra). The question is: which spheres of gamedev are filled with such math stuff, is it possible to advance in those without being a part of a group of people and how to get to it gradually? P.S.: I've got experience with commercial java dev and am getting my hands on C/C++ at the moment, however, I'm opened to go ahead and try Unity3D and etc.

    Read the article

  • Understanding math used to determine if vector is clockwise / counterclockwise from your vector

    - by MTLPhil
    I'm reading Programming Game AI by Example by Mat Buckland. In the Math & Physics primer chapter there's a listing of the declaration of a class used to represent 2D vectors. This class contains a method called Sign. It's implementation is as follows //------------------------ Sign ------------------------------------------ // // returns positive if v2 is clockwise of this vector, // minus if anticlockwise (Y axis pointing down, X axis to right) //------------------------------------------------------------------------ enum {clockwise = 1, anticlockwise = -1}; inline int Vector2D::Sign(const Vector2D& v2)const { if (y*v2.x > x*v2.y) { return anticlockwise; } else { return clockwise; } } Can someone explain the vector rules that make this hold true? What do the values of y*v2.x and x*v2.y that are being compared actually represent? I'd like to have a solid understanding of why this works rather than just accepting that it does without figuring it out. I feel like it's something really obvious that I'm just not catching on to. Thanks for your help.

    Read the article

  • Math-font from the ubuntu font family?

    - by Wauzl
    Does anyone know if there will be (or already are) any possibilities to use the ubuntu font family for mathematical typesetting in LaTeX? It says “Dalton Maag, a London-based studio, has laid the foundations for the Ubuntu font project with a beautiful design that aims to produce every character to support every language and interest in the world.” on the project web site of ubuntu. So I would expect something like this because maths is an interest.

    Read the article

  • PCF shadow shader math causing artifacts

    - by user2971069
    For a while now I used PCSS for my shadow technique of choice until I discovered a type of percentage closer filtering. This method creates really smooth shadows and with hopes of improving performance, with only a fraction of texture samples, I tried to implement PCF into my shader. This is the relevant code: float c0, c1, c2, c3; float f = blurFactor; float2 coord = ProjectedTexCoords; if (receiverDistance - tex2D(lightSampler, coord + float2(0, 0)).x > 0.0007) c0 = 1; if (receiverDistance - tex2D(lightSampler, coord + float2(f, 0)).x > 0.0007) c1 = 1; if (receiverDistance - tex2D(lightSampler, coord + float2(0, f)).x > 0.0007) c2 = 1; if (receiverDistance - tex2D(lightSampler, coord + float2(f, f)).x > 0.0007) c3 = 1; coord = (coord % f) / f; return 1 - (c0 * (1 - coord.x) * (1 - coord.y) + c1 * coord.x * (1 - coord.y) + c2 * (1 - coord.x) * coord.y + c3 * coord.x * coord.y); This is a very basic implementation. blurFactor is initialized with 1 / LightTextureSize. So the if statements fetch the occlusion values for the four adjacent texels. I now want to weight each value based on the actual position of the texture coordinate. If it's near the bottom-right pixel, that occlusion value should be preferred. The weighting itself is done with a simple bilinear interpolation function, however this function takes a 2d vector in the range [0..1] so I have to convert my texture coordinate to get the distance from my first pixel to the second one in range [0..1]. For that I used the mod operator to get it into [0..f] range and then divided by f. This code makes sense to me, and for specific blurFactors it works, producing really smooth one pixel wide shadows, but not for all blurFactors. Initially blurFactor is (1 / LightTextureSize) to sample the 4 adjacent texels. I now want to increase the blurFactor by factor x to get a smooth interpolation across maybe 4 or so pixels. But that is when weird artifacts show up. Here is an image: Using a 1x on blurFactor produces a good result, 0.5 is as expected not so smooth. 2x however doesn't work at all. I found that only a factor of 1/2^n produces an good result, every other factor produces artifacts. I'm pretty sure the error lies here: coord = (coord % f) / f; Maybe the modulo is not calculated correctly? I have no idea how to fix that. Is it even possible for pixel that are further than 1 pixel away?

    Read the article

  • Math > Logic for a Logarithmic Score Meter

    - by oodavid
    I'm trying to implement a score meter whereby I specify a maximum value (say 15,000) and I can render values on it in a logarithmic manner ie: +------+---+--+-++ +------+---+--+-++ |== | |====== | +------+---+--+-++ +------+---+--+-++ 200 pts 1,000 pts +------+---+--+-++ +------+---+--+-++ |============= | |================| +------+---+--+-++ +------+---+--+-++ 5,000 pts 15,000 pts + The upper bound needs to be variable, and need to be able to convert a score to a percentage, using the above mockup as an example: score2pct(15000, 200) = 0.2 score2pct(15000, 1000) = 0.4 score2pct(15000, 5000) = 0.8 score2pct(15000, 15000) = 1 Does anyone have any pointers for me?

    Read the article

  • Why is math taught "backwards"? [closed]

    - by Yorirou
    A friend of mine showed me a pretty practical Java example. It was a riddle. I got excited and quickly solved the problem. After it, he showed me the mathematical explanation of my solution (he proved why is it good), and it was completely clear for me. This seems like natural approach for me: solve problems, and generalize. This is very familiar to me, I do it all the time when I am programming: I write a function. When I have to write a similar function, I generalize the problem, grab the generic parts, and refactor them to a function, and solve the original problems as a specialization of the general function. At the university (or at least where I study), things work backwards. The professors shows just the highest possible level of the solutions ("cryptic" mathematical formulas). My problem is that this is too abstract for me. There is no connection of my previous knowledge (== reality in my sense), so even if I can understand it, I can't really learn it properly. Others are learning these formulas word-by-word, and get good grades, since they can write exactly the same to the test, but this is not an option for me. I am a curious person, I can learn interesting things, but I can't learn just text. My brain is for storing toughts, not strings. There are proofs for the theories, but they are also really hard to understand because of this, and in most of the cases they are omitted. What is the reason for this? I don't understand why is it a good idea to show the really high level of abstraction and then leave the practical connections (or some important ideas / practical motivations) out?

    Read the article

  • Sunrise / set calculations

    - by dassouki
    I'm trying to calculate the sunset / rise times using python based on the link provided below. My results done through excel and python do not match the real values. Any ideas on what I could be doing wrong? My Excel sheet can be found under .. http://transpotools.com/sun_time.xls # Created on 2010-03-28 # @author: dassouki # @source: [http://williams.best.vwh.net/sunrise_sunset_algorithm.htm][2] # @summary: this is based on the Nautical Almanac Office, United States Naval # Observatory. import math, sys class TimeOfDay(object): def calculate_time(self, in_day, in_month, in_year, lat, long, is_rise, utc_time_zone): # is_rise is a bool when it's true it indicates rise, # and if it's false it indicates setting time #set Zenith zenith = 96 # offical = 90 degrees 50' # civil = 96 degrees # nautical = 102 degrees # astronomical = 108 degrees #1- calculate the day of year n1 = math.floor( 275 * in_month / 9 ) n2 = math.floor( ( in_month + 9 ) / 12 ) n3 = ( 1 + math.floor( in_year - 4 * math.floor( in_year / 4 ) + 2 ) / 3 ) new_day = n1 - ( n2 * n3 ) + in_day - 30 print "new_day ", new_day #2- calculate rising / setting time if is_rise: rise_or_set_time = new_day + ( ( 6 - ( long / 15 ) ) / 24 ) else: rise_or_set_time = new_day + ( ( 18 - ( long/ 15 ) ) / 24 ) print "rise / set", rise_or_set_time #3- calculate sun mean anamoly sun_mean_anomaly = ( 0.9856 * rise_or_set_time ) - 3.289 print "sun mean anomaly", sun_mean_anomaly #4 calculate true longitude true_long = ( sun_mean_anomaly + ( 1.916 * math.sin( math.radians( sun_mean_anomaly ) ) ) + ( 0.020 * math.sin( 2 * math.radians( sun_mean_anomaly ) ) ) + 282.634 ) print "true long ", true_long # make sure true_long is within 0, 360 if true_long < 0: true_long = true_long + 360 elif true_long > 360: true_long = true_long - 360 else: true_long print "true long (360 if) ", true_long #5 calculate s_r_a (sun_right_ascenstion) s_r_a = math.degrees( math.atan( 0.91764 * math.tan( math.radians( true_long ) ) ) ) print "s_r_a is ", s_r_a #make sure it's between 0 and 360 if s_r_a < 0: s_r_a = s_r_a + 360 elif true_long > 360: s_r_a = s_r_a - 360 else: s_r_a print "s_r_a (modified) is ", s_r_a # s_r_a has to be in the same Quadrant as true_long true_long_quad = ( math.floor( true_long / 90 ) ) * 90 s_r_a_quad = ( math.floor( s_r_a / 90 ) ) * 90 s_r_a = s_r_a + ( true_long_quad - s_r_a_quad ) print "s_r_a (quadrant) is ", s_r_a # convert s_r_a to hours s_r_a = s_r_a / 15 print "s_r_a (to hours) is ", s_r_a #6- calculate sun diclanation in terms of cos and sin sin_declanation = 0.39782 * math.sin( math.radians ( true_long ) ) cos_declanation = math.cos( math.asin( sin_declanation ) ) print " sin/cos declanations ", sin_declanation, ", ", cos_declanation # sun local hour cos_hour = ( math.cos( math.radians( zenith ) ) - ( sin_declanation * math.sin( math.radians ( lat ) ) ) / ( cos_declanation * math.cos( math.radians ( lat ) ) ) ) print "cos_hour ", cos_hour # extreme north / south if cos_hour > 1: print "Sun Never Rises at this location on this date, exiting" # sys.exit() elif cos_hour < -1: print "Sun Never Sets at this location on this date, exiting" # sys.exit() print "cos_hour (2)", cos_hour #7- sun/set local time calculations if is_rise: sun_local_hour = ( 360 - math.degrees(math.acos( cos_hour ) ) ) / 15 else: sun_local_hour = math.degrees( math.acos( cos_hour ) ) / 15 print "sun local hour ", sun_local_hour sun_event_time = sun_local_hour + s_r_a - ( 0.06571 * rise_or_set_time ) - 6.622 print "sun event time ", sun_event_time #final result time_in_utc = sun_event_time - ( long / 15 ) + utc_time_zone return time_in_utc #test through main def main(): print "Time of day App " # test: fredericton, NB # answer: 7:34 am long = 66.6 lat = -45.9 utc_time = -4 d = 3 m = 3 y = 2010 is_rise = True tod = TimeOfDay() print "TOD is ", tod.calculate_time(d, m, y, lat, long, is_rise, utc_time) if __name__ == "__main__": main()

    Read the article

  • Do you have to be good at math to be a good programmer?

    - by Charles Roper
    It seems that conventional wisdom suggests that good programmers are also good at math. Or that the two are somehow intrinsically linked. Many programming books I have read provide many examples that are solutions to math problems, or are somehow related to math as if these examples are what make sense to most people. So the question I would like to float is: do you have to be good at math to be a good programmer?

    Read the article

  • Should certain math classes be required for a Computer Science degree?

    - by sunpech
    For a Computer Science (CS) degree at many colleges and universities, certain math courses are required: Calculus, Linear Algebra, and Discrete Mathematics are few examples. However, since I've started working in the real world as a software developer, I have yet to truly use some the knowledge I had at once acquired from taking those classes. Discrete Math might be the only exception. My questions: Should these math classes be required to obtain a computer science degree? Or would they be better served as electives? I'm challenging even that the certain math classes even help with required CS classes. For example, I never used linear algebra outside of the math class itself. I hear it's used in Computer Graphics, but I never took those classes-- yet linear algebra was required for a CS degree. I personally think it could be better served as an elective rather than requirement because it's more specific to a branch of CS rather than general CS. From a Slashdot post CS Profs Debate Role of Math In CS Education: 'For too long, we have taught computer science as an academic discipline (as though all of our students will go on to get PhDs and then become CS faculty members) even though for most of us, our students are overwhelmingly seeking careers in which they apply computer science.'

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >