Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Lv 2394 points

Mike

Favorite Answers16%
Answers81
  • Finding a function for a binary string of length n with x bits set to 1 where the position of the bits matters?

    So basically There's a binary string of length n where the leftmost (or rightmost it doesn't matter) position is given the value of 1 and the next is 2 and so on all the way to n. Let's say that x bits are going to be set to 1 whereas the rest remain at 0. Imagine that g(x) gives the product of the positions that are set to 1 for some x arbitrary positions being chosen. Is there a function f(x) that would return the sum of all possible g(x)? For example if x were 1 then there would be a g(x)=1 where the first position is set and a g(x)=n where the nth position is set and for x=2 there would be g(x)=2 for positions 1 and 2 or g(x)=5n for positions n and 5 being set and so on so forth.

    1 AnswerMathematics4 years ago
  • Find number of even numbers in a non linear set?

    Given a set of integers greater than 0 which do not follow a linear progression and may not be sorted from least to greatest or greatest to least is it possible to determine the number of even integers in the set?

    1 AnswerMathematics5 years ago
  • Java Screens?

    I am creating a game in which someone is able to move from the main menu to the game screen by clicking a button. I understand how to implement the listener for the button press and everything, but here is my question. Say I call the main menu jpanel1 (each screen is its own jpanel) and the game screen jpanel2 then how would I go about hiding and disabling the main menu when the button is pressed and enabling and showing the game screen along with all the components in both. Is there a way to do it with jpanels or do I need to do something else? Also the jpanels are contained within a jframe.

    1 AnswerProgramming & Design5 years ago
  • Is there any better method?

    I'm implementing a game. For example let's use tic tac toe. Now I have a function that will return a 0 if the move is allowed, a 1 if it is not and a 2 if the move ends the game and you have to supply the player that made the move as well as the position they move at. Now I want to simulate every possible tic tac toe game so I can figure out the best strategies. My current idea is to create an array that will hold every move. It will first fill the first position in the array with the top left corner of the board and if that is allowed it will move to the second position in the array and attempt to move to the top left corner again. Since that obviously isn't allowed it will then increment the second position in the array to where it points to the top middle position and as long as that is allowed it will move to the next move or next cell in the array. It will continue to do this until the returned result is a 2 meaning the game ended. It will then save that set of moves and then try to change the final move that won the game into something else. If it can then it will continue with that game and eventually save it as a second game from the original and also try to make a third game at the end of it. If at any point it find that it cannot make a legal move then it will back up one position in the array and attempt to change that move instead and if it still can't it will back up again and so on until the very first move cannot be changed. Is there a better method?

    2 AnswersProgramming & Design6 years ago
  • How do I get this java code right?

    for(int i = 0; i < mapSize; i++) {

    for(int j = 0; j < mapSize; j++) {

    temps[i][j] = max - ((Math.abs(max - min) / ((mapSize - 1) / 2)) * j);

    if(heightMapArray[i][j] >= midHeight) temps[i][j] -= (Math.abs(heightMapArray[i][j] - midHeight) / (midHeight - minHeight)) * (max - temps[i][j]);

    if(heightMapArray[i][j] < midHeight) temps[i][j] -= (Math.abs(heightMapArray[i][j] - midHeight) / (maxHeight - midHeight)) * (temps[i][j] - min);

    }

    }

    That is my current code. mapSize is the size of the map (which is in the form 2^n+1) and I am creating a temperature map that is first based on the middle of the map being the equator (thus the further from the equator the lower the temperature) and then based off of the height/depth of the terrain. maxHeight is the maximum height of the map and minHeight is the minimum height of the map. midHeight is (maxHeight + minHeight) / 2. I set max as the maximum temperature that is allowed and min as the minimum temperature that is allowed. For some reason I am still receiving values outside of the max and min boundaries so what am I doing wrong and how can I fix it?

    2 AnswersProgramming & Design6 years ago
  • How to reverse exponentiate?

    If I have a number z that is equal to x^y and the only things I know about x and y is that they are whole numbers in the set [0,9] then what can I do to z in order to find the values of both x and y? Would there also be a method to find x and y if they were in a set [0,A] where A is a whole number greater than 9?

    3 AnswersMathematics6 years ago
  • Are photons "observers"?

    I had a previous question /question/index?qid=20150... which was answered quite well, however it brought up a new question for me. "Chris Pitchr" brought up the fact that photons do not have a point of view or a point of reference. Now I know that the basis of Einstein's theory of relativity is that most every aspect of a "thing" is dependent upon the observer observing this "thing" (such as changes in the size, speed and so on with the exception of the speed of light and most likely a few other universal constants). Of course an observer doesn't have to mean a human or any kind of sentient being. It could be a block of wood given the right circumstances. My questions is the following: if any "real" thing is capable of being an observer then why are photons not observers? Or was "Chris Pitchr" incorrect and they are observers in which case how does their observation of the universe compare to ours?

    1 AnswerPhysics6 years ago
  • What happens to a photon that lives for an infinite amount of time?

    Let us assume that the universe is going to end in a heat death (if I recall correctly that is the ending where all energy is evenly distributed throughout the universe). Now let's say that I am a photon that was shot out at the Big Bang. I travel through the universe and I manage to escape any early stuff that might absorb me so that I can just keep chugging along ahead of everything else towards the ever expanding edge of the universe (or if you think the universe is a big 4D sphere then I am slowly moving less and less distance as the universe expands faster and faster). Now because of this I don't have to worry about my little life ending or anything by being absorbed or transformed and so I get to keep moving at the universal speed limit. Again let's assume that I make it to the end of the universe without ever being absorbed and that I just keep chugging along in this heat death without being absorbed. According to relativity, time slows down the closer to c you get and thus at c time would "stop". According to this a photon experiences its entire journey all at once. My question is: what would happen to me? Since I'm a photon whose existence begins at the Big Bang and lasts through infinity then I should experience all of it at the same time, but it never ends. Obviously I doubt anyone can truly answer this, but I want to at least know what the prevailing theory on such an occurrence.

    7 AnswersAstronomy & Space6 years ago
  • Long Excel question?

    Basically I have a list of items and each item has a certain amount of time required to create it as well as a certain number of that item that are created each time a cycle finishes and a certain number of other items it requires. The other items required by each item in this list are kept in a column where there names are comma separated and in the next column contains the number of each required item that is required and is also comma separated. In the first column I have the name of each item which will be exactly the same as the name in the required column strings. I have a formula that determines how many machines for creating a given item are required in order to adequately supply all items that require it M=mTn/tk where M=the total number of machines required to adequately supply the higher tier item, m=the total number of machines the higher tier item requires to adequately supply even higher tier items, T=the total time it takes for the current item to finish a cycle, n=the number of the current item required by the higher tier item per cycle, t=the time it takes for the higher tier item to complete a cycle and k=the number of current items created each cycle. If more than one higher tier item requires the current item then you just add mTn/tk for each higher tier item. I need help with a formula that can find every higher tier item that requires the current item and then do the formula and produce M for every item on this list.

    2 AnswersSoftware6 years ago
  • Are there infinite points inside a point?

    Imagine a circle. Obviously we know that this circle s circumference is made of an infinite number of points. If we were to look down at the level of these points (I know they are infinitely small but let s pretend) then I would assume we would see that they each have a degree by which they arc from each other. The reason for this is because that given enough of these points they will create an arc thus at the smallest level they must arc. Now since these points are infinitely small we can conclude that their degree of arcing must be infinitely small, because if it had any finite measurement it would be impossible to create the circle. Now we also know that these principles hold true for any size circle. If we had a circle with radius 1 it would have an infinite number of points along its circumference with each point have a degree of arcing from the previous point that is infinitely small. Given this idea we could continually make the radius smaller and have the same result of the circle being made up of an infinite number of points. If we were to scale the size of this circle down to the size of a point would it still hold true? Would there still be an infinite number of points and thus an infinite number of points inside of the single point?

    5 AnswersMathematics6 years ago