Search Results

Search found 3425 results on 137 pages for 'polynomial math'.

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

  • Polynomial division overloading operator (solved)

    - by Vlad
    Ok. here's the operations i successfully code so far thank's to your help: Adittion: polinom operator+(const polinom& P) const { polinom Result; constIter i = poly.begin(), j = P.poly.begin(); while (i != poly.end() && j != P.poly.end()) { //logic while both iterators are valid if (i->pow > j->pow) { //if the current term's degree of the first polynomial is bigger Result.insert(i->coef, i->pow); i++; } else if (j->pow > i->pow) { // if the other polynomial's term degree is bigger Result.insert(j->coef, j->pow); j++; } else { // if both are equal Result.insert(i->coef + j->coef, i->pow); i++; j++; } } //handle the remaining items in each list //note: at least one will be equal to end(), but that loop will simply be skipped while (i != poly.end()) { Result.insert(i->coef, i->pow); ++i; } while (j != P.poly.end()) { Result.insert(j->coef, j->pow); ++j; } return Result; } Subtraction: polinom operator-(const polinom& P) const //fixed prototype re. const-correctness { polinom Result; constIter i = poly.begin(), j = P.poly.begin(); while (i != poly.end() && j != P.poly.end()) { //logic while both iterators are valid if (i->pow > j->pow) { //if the current term's degree of the first polynomial is bigger Result.insert(-(i->coef), i->pow); i++; } else if (j->pow > i->pow) { // if the other polynomial's term degree is bigger Result.insert(-(j->coef), j->pow); j++; } else { // if both are equal Result.insert(i->coef - j->coef, i->pow); i++; j++; } } //handle the remaining items in each list //note: at least one will be equal to end(), but that loop will simply be skipped while (i != poly.end()) { Result.insert(i->coef, i->pow); ++i; } while (j != P.poly.end()) { Result.insert(j->coef, j->pow); ++j; } return Result; } Multiplication: polinom operator*(const polinom& P) const { polinom Result; constIter i, j, lastItem = Result.poly.end(); Iter it1, it2, first, last; int nr_matches; for (i = poly.begin() ; i != poly.end(); i++) { for (j = P.poly.begin(); j != P.poly.end(); j++) Result.insert(i->coef * j->coef, i->pow + j->pow); } Result.poly.sort(SortDescending()); lastItem--; while (true) { nr_matches = 0; for (it1 = Result.poly.begin(); it1 != lastItem; it1++) { first = it1; last = it1; first++; for (it2 = first; it2 != Result.poly.end(); it2++) { if (it2->pow == it1->pow) { it1->coef += it2->coef; nr_matches++; } } nr_matches++; do { last++; nr_matches--; } while (nr_matches != 0); Result.poly.erase(first, last); } if (nr_matches == 0) break; } return Result; } Division(Edited): polinom operator/(const polinom& P) const { polinom Result, temp2; polinom temp = *this; Iter i = temp.poly.begin(); constIter j = P.poly.begin(); int resultSize = 0; if (temp.poly.size() < 2) { if (i->pow >= j->pow) { Result.insert(i->coef / j->coef, i->pow - j->pow); temp = temp - Result * P; } else { Result.insert(0, 0); } } else { while (true) { if (i->pow >= j->pow) { Result.insert(i->coef / j->coef, i->pow - j->pow); if (Result.poly.size() < 2) temp2 = Result; else { temp2 = Result; resultSize = Result.poly.size(); for (int k = 1 ; k != resultSize; k++) temp2.poly.pop_front(); } temp = temp - temp2 * P; } else break; } } return Result; } }; The first three are working correctly but division doesn't as it seems the program is in a infinite loop. Final Update After listening to Dave, I finally made it by overloading both / and & to return the quotient and the remainder so thanks a lot everyone for your help and especially you Dave for your great idea! P.S. If anyone wants for me to post these 2 overloaded operator please ask it by commenting on my post (and maybe give a vote up for everyone involved).

    Read the article

  • Polynomial operations using operator overloading

    - by Vlad
    I'm trying to use operator overloading to define the basic operations (+,-,*,/) for my polynomial class but when i run the program it crashes and my computer frozes. Update3 Ok i successfully done the first two operations(+,-). Now at multiplication, after multiplying each term of the first polynomial with each of the second i want to sort the poly list descending and then if there are more than one term with the same power to merge them in only one term, but for some reason it doesn't compile because of the sort function which doesn't work. Here's what I got: polinom operator*(const polinom& P) const { polinom Result; constIter i, j, lastItem = Result.poly.end(); Iter it1, it2; int nr_matches; for (i = poly.begin() ; i != poly.end(); i++) { for (j = P.poly.begin(); j != P.poly.end(); j++) Result.insert(i->coef * j->coef, i->pow + j->pow); } sort(Result.poly.begin(), Result.poly.end(), SortDescending()); lastItem--; while (true) { nr_matches = 0; for (it1 = Result.poly.begin(); it < lastItem; it1++) { for (it2 = it1 + 1;; it2 <= lastItem; it2++){ if (it2->pow == it1->pow) { it1->coef += it2->coef; nr_matches++; } } Result.poly.erase(it1 + 1, it1 + (nr_matches + 1)); } return Result; } Also here's SortDescending: struct SortDescending { bool operator()(const term& t1, const term& t2) { return t2.pow < t1.pow; } }; What did i do wrong? Thanks!

    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

  • Octave / Matlab: How to plot the roots of a polynomial

    - by Tom
    Hi everyone, Im trying to plot the roots of a polynomial, and i just cant get it. First i create my polynomial p5 = [1 0 0 0 0 -1] %x^5 - 1 r5 = roots(p5) stem (p5) Im using the stem function, but I would like to remove the stems, and just get the circle around the roots. Is this possible, is stem the right command? Thanks in advance, PS: This is not homework, but very close, will tag it if requested.

    Read the article

  • Orcad / Matlab: How to plot the roots of a polynomial

    - by Tom
    Hi everyone, Im trying to plot the roots of a polynomial, and i just cant get it. First i create my polynomial p5 = [1 0 0 0 0 -1] %x^5 - 1 r5 = roots(p5) stem (p5) Im using the stem function, but I would like to remove the stems, and just get the circle around the roots. Is this possible, is stem the right command? Thanks in advance, PS: This is not homework, but very close, will tag it if requested.

    Read the article

  • Java Polynomial Multiplication with ArrayList

    - by user1506919
    I am having a problem with one of my methods in my program. The method is designed to take 2 arraylists and the perform multiplication between the two like a polynomial. For example, if I was to say list1={3,2,1} and list2={5,6,7}; I am trying to get a return value of 15,28,38,20,7. However, all I can get is an error message that says: Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0. I have provided the method below: private static ArrayList<Integer> multiply(ArrayList<Integer> list1,ArrayList<Integer> list2) { ArrayList<Integer> array =new ArrayList<Integer>(list1.size()+list2.size()); for (int i=0;i<array.size();i++) array.add(i, 0); for (int i = 0; i < list1.size(); i++) for (int j = 0; j < list2.size(); j++) array.set(i+j, ((list1.get(i) * list2.get(j))+array.get(i+j))); return array; } Any help with solving this problem is greatly appreciated.

    Read the article

  • Java and junit: derivative of polynomial method testing issue

    - by Curtis
    Hello all, im trying to finish up my junit testing for finding the derivative of a polynomial method and im having some trouble making it work. here is the method: public Polynomial derivative() { MyDouble a = new MyDouble(0); MyDouble b = this.a.add(this.a); MyDouble c = this.b; Polynomial poly = new Polynomial (a, b, c); return poly; } and here is the junit test: public void testDerivative() { MyDouble a = new MyDouble(2), b = new MyDouble(4), c = new MyDouble(8); MyDouble d = new MyDouble(0), e = new MyDouble(4), f = new MyDouble(4); Polynomial p1 = new Polynomial(a, b, c); Polynomial p2 = new Polynomial(d,e,f); assertTrue(p1.derivative().equals(p2)); } im not too sure why it isnt working...ive gone over it again and again and i know im missing something. thank you all for any help given, appreciate it

    Read the article

  • efficiently determining if a polynomial has a root in the interval [0,T]

    - by user168715
    I have polynomials of nontrivial degree (4+) and need to robustly and efficiently determine whether or not they have a root in the interval [0,T]. The precise location or number of roots don't concern me, I just need to know if there is at least one. Right now I'm using interval arithmetic as a quick check to see if I can prove that no roots can exist. If I can't, I'm using Jenkins-Traub to solve for all of the polynomial roots. This is obviously inefficient since it's checking for all real roots and finding their exact positions, information I don't end up needing. Is there a standard algorithm I should be using? If not, are there any other efficient checks I could do before doing a full Jenkins-Traub solve for all roots? For example, one optimization I could do is to check if my polynomial f(t) has the same sign at 0 and T. If not, there is obviously a root in the interval. If so, I can solve for the roots of f'(t) and evaluate f at all roots of f' in the interval [0,T]. f(t) has no root in that interval if and only if all of these evaluations have the same sign as f(0) and f(T). This reduces the degree of the polynomial I have to root-find by one. Not a huge optimization, but perhaps better than nothing.

    Read the article

  • What Precalculus knowledge is required before learning Discrete Math Computer Science topics?

    - by Ein Doofus
    Below I've listed the chapters from a Precalculus book as well as the author recommended Computer Science chapters from a Discrete Mathematics book. Although these chapters are from two specific books on these subjects I believe the topics are generally the same between any Precalc or Discrete Math book. What Precalculus topics should one know before starting these Discrete Math Computer Science topics?: Discrete Mathematics CS Chapters 1.1 Propositional Logic 1.2 Propositional Equivalences 1.3 Predicates and Quantifiers 1.4 Nested Quantifiers 1.5 Rules of Inference 1.6 Introduction to Proofs 1.7 Proof Methods and Strategy 2.1 Sets 2.2 Set Operations 2.3 Functions 2.4 Sequences and Summations 3.1 Algorithms 3.2 The Growths of Functions 3.3 Complexity of Algorithms 3.4 The Integers and Division 3.5 Primes and Greatest Common Divisors 3.6 Integers and Algorithms 3.8 Matrices 4.1 Mathematical Induction 4.2 Strong Induction and Well-Ordering 4.3 Recursive Definitions and Structural Induction 4.4 Recursive Algorithms 4.5 Program Correctness 5.1 The Basics of Counting 5.2 The Pigeonhole Principle 5.3 Permutations and Combinations 5.6 Generating Permutations and Combinations 6.1 An Introduction to Discrete Probability 6.4 Expected Value and Variance 7.1 Recurrence Relations 7.3 Divide-and-Conquer Algorithms and Recurrence Relations 7.5 Inclusion-Exclusion 8.1 Relations and Their Properties 8.2 n-ary Relations and Their Applications 8.3 Representing Relations 8.5 Equivalence Relations 9.1 Graphs and Graph Models 9.2 Graph Terminology and Special Types of Graphs 9.3 Representing Graphs and Graph Isomorphism 9.4 Connectivity 9.5 Euler and Hamilton Ptahs 10.1 Introduction to Trees 10.2 Application of Trees 10.3 Tree Traversal 11.1 Boolean Functions 11.2 Representing Boolean Functions 11.3 Logic Gates 11.4 Minimization of Circuits 12.1 Language and Grammars 12.2 Finite-State Machines with Output 12.3 Finite-State Machines with No Output 12.4 Language Recognition 12.5 Turing Machines Precalculus Chapters R.1 The Real-Number System R.2 Integer Exponents, Scientific Notation, and Order of Operations R.3 Addition, Subtraction, and Multiplication of Polynomials R.4 Factoring R.5 Rational Expressions R.6 Radical Notation and Rational Exponents R.7 The Basics of Equation Solving 1.1 Functions, Graphs, Graphers 1.2 Linear Functions, Slope, and Applications 1.3 Modeling: Data Analysis, Curve Fitting, and Linear Regression 1.4 More on Functions 1.5 Symmetry and Transformations 1.6 Variation and Applications 1.7 Distance, Midpoints, and Circles 2.1 Zeros of Linear Functions and Models 2.2 The Complex Numbers 2.3 Zeros of Quadratic Functions and Models 2.4 Analyzing Graphs of Quadratic Functions 2.5 Modeling: Data Analysis, Curve Fitting, and Quadratic Regression 2.6 Zeros and More Equation Solving 2.7 Solving Inequalities 3.1 Polynomial Functions and Modeling 3.2 Polynomial Division; The Remainder and Factor Theorems 3.3 Theorems about Zeros of Polynomial Functions 3.4 Rational Functions 3.5 Polynomial and Rational Inequalities 4.1 Composite and Inverse Functions 4.2 Exponential Functions and Graphs 4.3 Logarithmic Functions and Graphs 4.4 Properties of Logarithmic Functions 4.5 Solving Exponential and Logarithmic Equations 4.6 Applications and Models: Growth and Decay 5.1 Systems of Equations in Two Variables 5.2 System of Equations in Three Variables 5.3 Matrices and Systems of Equations 5.4 Matrix Operations 5.5 Inverses of Matrices 5.6 System of Inequalities and Linear Programming 5.7 Partial Fractions 6.1 The Parabola 6.2 The Circle and Ellipse 6.3 The Hyperbola 6.4 Nonlinear Systems of Equations

    Read the article

  • 3D rotation matrices deform object while rotating

    - by Kevin
    I'm writing a small 3D renderer (using an orthographic projection right now). I've run into some trouble with my 3D rotation matrices. They seem to squeeze my 3D object (a box primitive) at certain angles. Here's a live demo (only tested in Google Chrome): http://dl.dropbox.com/u/109400107/3D/index.html The box is viewed from the top along the Y axis and is rotating around the X and Z axis. These are my 3 rotation matrices (Only rX and rZ are being used): var rX = new Matrix([ [1, 0, 0], [0, Math.cos(radiants), -Math.sin(radiants)], [0, Math.sin(radiants), Math.cos(radiants)] ]); var rY = new Matrix([ [Math.cos(radiants), 0, Math.sin(radiants)], [0, 1, 0], [-Math.sin(radiants), 0, Math.cos(radiants)] ]); var rZ = new Matrix([ [Math.cos(radiants), -Math.sin(radiants), 0], [Math.sin(radiants), Math.cos(radiants), 0], [0, 0, 1] ]); Before projecting the verticies I multiply them by rZ and rX like so: vert1.multiply(rZ); vert1.multiply(rX); vert2.multiply(rZ); vert2.multiply(rX); vert3.multiply(rZ); vert3.multiply(rX); The projection itself looks like this: bX = (pos.x + (vert1.x*scale)); bY = (pos.y + (vert1.z*scale)); Where "pos.x" and "pos.y" is an offset for centering the box on the screen. I just can't seem to find a solution to this and I'm still relativly new to working with Matricies. You can view the source-code of the demo page if you want to see the whole thing.

    Read the article

  • Do game studios hire people based on their math knowledge alone?

    - by Brent Horvath
    I have very little programming skills outside of very basic levels of Java, but I have excellent math and science knowledge. I was wondering what I could offer any potential team if I were to go into video game development? Do people hire people based on their math knowledge alone? I like to do other things such as writing or drawing, but math and science are the only skills in which I really excel in.

    Read the article

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

    - by sunpech
    For a Computer Science 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 the knowledge I had at once acquired from taking those classes. My question is: Should these math classes be required to obtain a computer science degree? Or would they better served as electives? A Slashdot post: CS Profs Debate Role of Math In CS Education

    Read the article

  • Complete Math Library for use in OpenGL ES 2.0 Game?

    - by Bunkai.Satori
    Are you aware of a complete (or almost complete) cross platform math library for use in OpenGL ES 2.0 games? The library should contain: Matrix2x2, Matrix 3x3, Matrix4x4 classes Quaternions Vector2, Vector3, Vector4 Classes Euler Angle Class Operations amongh the above mentioned classes, conversions, etc.. Standardly used math operations in 3D graphics (Dot Product, Cross Product, SLERP, etc...) Is there such Math API available either standalone or as a part of any package? Programming Language: Visual C++ but planned to be ported to OS X and Android OS.

    Read the article

  • What kind of math should I be expecting in advanced programming?

    - by I_Question_Things_Deeply
    And I don't mean just space shooters and such, because in non-3D environments it's obvious that not much beyond elementary math is needed to implement. Most of the programming in 2D games is mostly going to involve basic arithmetic, algorithms for enemy AI and dimensional worlds, rotation, and maybe some Algebra as well depending on how you want to design. But I ask because I'm not really gifted with math at all. I get frustrated and worn out just by doing Pre-Algebra, so Algebra 2 and Calculus would likely be futile for me. I guess I'm not so "right-brained" when it comes down to pure numbers and math formulas, but the bad part is that I'm no art-expert either. What do you people here suppose I should do? Go along avoiding as much of the extremely difficult maths I can't fathom, or try to ease into more complex math as I excel at programming?

    Read the article

  • Braces (syntax) highlighting in OpenOffice Math formula text editor

    - by Oleksandr Bolotov
    When you use OpenOffice Math, in upper part you see formula and formula text editor in lower part. Almost like this: %sigma = 2 %mu %epsilon + %lambda Tr(%epsilon)I So my questions are: How to replace OpenOffice Math's formula text editor with own text editor? ... or how to enable braces (syntax) highlighting in embedded editor? ... are there any extensions for anything like this? I need this because sometimes it's too much braces and stuff and it's hard to distinguish which braces match each other. Please do not suggest me to use MathType Mathematica (or anything) instead of OpenOffice Math (because I'm almost happy with it:)

    Read the article

  • Modular Reduction of Polynomials in NTRUEncrypt

    - by Neville
    Hello everyone. I'm implementing the NTRUEncrypt algorithm, according to an NTRU tutorial, a polynomial f has an inverse g such that f*g=1 mod x, basically the polynomial multiplied by its inverse reduced modulo x gives 1. I get the concept but in an example they provide, a polynomial f = -1 + X + X^2 - X4 + X6 + X9 - X10 which we will represent as the array [-1,1,1,0,-1,0,1,0,0,1,-1] has an inverse g of [1,2,0,2,2,1,0,2,1,2,0], so that when we multiply them and reduce the result modulo 3 we get 1, however when I use the NTRU algorithm for multiplying and reducing them I get -2. Here is my algorithm for multiplying them written in Java: public static int[] PolMulFun(int a[],int b[],int c[],int N,int M) { for(int k=N-1;k>=0;k--) { c[k]=0; int j=k+1; for(int i=N-1;i>=0;i--) { if(j==N) { j=0; } if(a[i]!=0 && b[j]!=0) { c[k]=(c[k]+(a[i]*b[j]))%M; } j=j+1; } } return c; } It basicall taken in polynomial a and multiplies it b, resturns teh result in c, N specifies the degree of the polynomials+1, in teh example above N=11; and M is the reuction modulo, in teh exampel above 3. Why am I getting -2 and not 1?

    Read the article

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