• Advertisement


  • Content count

  • Joined

  • Last visited

Everything posted by alvaro

  1. Mobile SFML in android

    SFML is a pleasure to work with, but their webpage has been saying "... and soon Android & iOS" for several years now. If you can get it to work on Android (you can find out with a simple test), I can't imagine why it would be slower than a Java app.
  2. Say there is a rare disease that affects 1 person in 100,000. We develop a test for it, but it's not perfect: It has no false negatives, but it has a 1% chance of testing positive on patients that don't have the disease. You can make a table like this: SICK HEALTHY POSITIVE 0.00001 0.0099999 NEGATIVE 0 0.9899901 The numbers in that table are joint probabilities (e.g., the probability that someone is healthy and gets a negative result in the test). Now, if you test positive and want to know what's the probability that you are sick, the number you are looking for is called the conditional probability of being sick given that you tested positive. That number is 0.00001/(0.00001+0.0099999) = 0.00099901...
  3. Have you found the definitions? They are certainly not the same thing.
  4. Generate a random 128-bit integer in some way. As iedoc said, you can do that by computing the md5sum of some machine-specific details, but you can also throw the timestamp of when the program was started in there, or some hardware-generated random numbers. You can also ask the user to take a picture (do you need a profile picture?) and take the md5sum of the image. If you do a decent job of making the numbers random, 128 bits is enough to not expect any collisions ever. For instance, if you have 26 billion users, the probability of a collision is 10^-18. If for some reason you want to use 64 bits only, it might be OK, depending on how many users you expect: With 6 million users, the probability of a collision would be about 10^-6. I wouldn't go lower than 64 bits. See https://en.wikipedia.org/wiki/Birthday_problem
  5. Why A.I is impossible

    The argument in this thread assumes some form of vitalism. I don't understand the appeal of this way of thinking. All the evidence we have is that there is nothing special about living organisms: They follow the same laws of Physics as everything else. If we reject vitalism --as we should--, the existence of human beings is proof that intelligence can be achieved by physical means, so there is no a priori reason why a machine couldn't be intelligent. EDIT: I found a Wikipedia page about the subject: https://en.wikipedia.org/wiki/Hard_problem_of_consciousness. The last paragraph quotes Stanislas Dehaene drawing a parallel to vitalism. I wholeheartedly agree with him.
  6. What problem is he trying to solve, precisely? Predict the quality of the food given the other three variables?
  7. Voronoi Shatters results

    I don't understand the question.
  8. Mie Scattering

    I have a hard time reading the type on that article. I can't tell if it says "1.5" or "1.6", for instance. Is there a more modern reference?
  9. Mie Scattering

    A few things that might help: "My implementation is not accurate" doesn't give me any hints of where to start exploring your code. Explain what evidence you have that the code doesn't do the right thing. Something like "If I plug in these inputs, I get these outputs, while I expected to get these other outputs." You are using way too many parentheses. You could use std::complex<double> instead of defining your own type. That way you can be pretty sure that any mistakes are not in your implementation of complex numbers.
  10. You may want to finish implementing the diamond-square algorithm, since you have started it. But you should also consider using Perlin noise instead.
  11. I'm interested in item 4. We would have to build a parametric model of the speaker so we can then tweak the parameters to generate many new speakers. One way to make it happen would be to train something like WaveNet on multiple speakers, conditioning on a small vector that encodes information about the speaker. Part of that vector could describe gender and age, part of the vector could be a learned embedding of the accent (so we can label the speaker as having "British English accent", or "Southern American accent", etc.) and the rest of the vector would be a learned embedding of the speaker. We could then generate new speakers by specifying gender, age and accent, and then generating some random numbers for the specific speaker. While we are at it, the same conditioning mechanism could be used to indicate some rough emotion of the utterance, addressing item 3 to some extent. Does this sound feasible?
  12. Rotation in a sphere

    I'll make the sphere centered at the origin and with radius 1, for simplicity. Your position on the sphere is a unit-length vector, and your forward direction is another unit-length vector which is perpendicular to the position vector. That's the whole state. It's also handy to have a side direction, which can be computed as the cross-product of the other two vectors. You can move by adding a small multiple of the forward direction or the side direction to the current position. You can then renormalize the position (project back to the surface of the sphere, so you don't walk on a tangent) and use the Gram-Schmidt process to adjust the forward and side vectors. From the position, forward and side vectors, you should have all you need to set up the camera.
  13. C++ precision

    That's simple, but also unsafe. How large is the buffer `headingn'? At the very least, you should use snprintf instead. If you can avoid using C-style string manipulation, you are much less likely to introduce a buffer overflow in your program.
  14. C++ precision

    Or, if you don't mind using Boost, this: #include <iostream> #include <boost/format.hpp> #include <string> int main() { double x = 12.3524423; std::string s = boost::str(boost::format("%.2f") % x); std::cout << s << '\n'; }
  15. Gaussian based Weights

    Here's a short C++11 program that roughly produces the same numbers: #include <cmath> #include <iostream> int main() { double sigma = 1.75; int N = 4; double total = std::erf((N+.5) / (std::sqrt(2.0) * sigma)) - std::erf((-N-.5) / (std::sqrt(2.0) * sigma)); for (int i = -N; i <= +N; ++i) { std::cout << (std::erf((i+.5) / (std::sqrt(2.0) * sigma)) - std::erf((i-.5) / (std::sqrt(2.0) * sigma))) / total << '\n'; } }
  16. Simulated annealing is an easy way to find approximate solutions: Define a function that takes an assignment of people to rooms and returns a real number that indicates how unhappy we are with the assignment. This is probably just a weighted sum of penalties. We'll call this function "energy", following some analogy with Physics that I don't quite understand. Start with any assignment (everyone in the same room would do; or everyone unassigned, if you have a way to represent that). Set a temperature parameter T to some high initial value. Try a random perturbation (for instance, move one person to another room, or swap two people). If the energy goes down, accept it. If the energy goes up, accept it with probability exp((E_new - E_old) / T). Keep trying random perturbations and slowly decreasing the temperature parameter T. If you decrease the temperature slowly enough, this will find a low-energy solution. It's surprising how well that simple algorithm works for many discrete optimization problems. Sometimes you can easily compute the effect of a change on the energy, without computing it from scratch. Perhaps you have penalties per room and penalties per person, and you only need to reevaluate the room and people involved in the change. That can make the algorithm much faster.
  17. I see. So you think of the image as providing you with a probability distribution over colors: pick a random pixel in the image and check its color. Then the entropy of that probability distribution is well defined.
  18. I have spent many years writing engines that play games like checkers, chess and go. One thing that we learned as far back as the 80s is that hard-coded rules are fragile and have endless exceptions and unintended consequences. I wouldn't be surprised if we end up imbuing our agents with a sense of morality through examples, the way we do with children.
  19. This question is entirely unrelated with the topic of the forum (i.e., how to make the bad guys move in a video game). Please, feel free to post this kind of question in the lounge.
  20. No, I don't think energy is proportional to frequency. If you want a physical model to think about, think of the power dissipated by a resistor when alternating current is applied to it. You'll see that the power is proportional to the squared amplitude (I^2*R or V^2/R) and independent of the frequency. It is true that "entropy" is not quite the right word for the quantity -log(probability). The correct term is something like "information content", while "entropy" could be defined as "expected information content". But the notion of entropy only makes sense when applied to a probability distribution, not an individual image. Again, I would need to know where you picked up this term or what you want to use it for in order to give you a better answer.
  21. Energy is usually defined as the integral of the squared amplitude. Parseval's theorem says that you can compute this on the Fourier transform of the signal and you'll get the same answer. Entropy critically depends on having a probability distribution over images, and then it's simply defined as -log(probability).
  22. This is not how you use a forum. You can enter the question on Google and see what comes out. If that doesn't give you the results you want, you can try to use this forum. For us to be able to give you better answers than Google, you need to give us the appropriate context: What are you trying to do? What have you tried? What problems did you encounter? Where did you read about these concepts? I bet we can give you decent answers if you pose the question properly.
  23. Boids, a way not to check flock every update?

    You can use a spatial-partitioning method (e.g. quadtrees or kd-trees) to quickly discard most of the N^2 possible interactions. "Broad phase collision detection" could be a useful thing to search the web for.
  24. C++ 2D Math Problem

    If you know how to rotate around the origin, you can rotate around any point P like this: translate the whole picture so P becomes the origin, rotate around the origin, translate back so the origin becomes P Does that help?
  25. Controlling a Very Intelligent AI

    Yeah. That game sounds like no fun.
  • Advertisement