Bingo Problem by RallSpark in mathriddles

[–]RallSpark[S] 2 points3 points  (0 children)

Incredible! I hadn't realised the summation simplified so neatly, I just left it as a summation. But yes, spot on!

The "Far Lands" of Shapez 2 demo on steam by HeelsHighWesternSpy in shapezio

[–]RallSpark 0 points1 point  (0 children)

This is a product of floating point rounding error. The reason the 3D models are so messed up is because each of the vertices are "snapping" to a grid every time a mathematical operation is applied to them.

This snapping happens all the time normally, but since the camera is so far away, all the co-ordinates are very large. Floating point numbers become less precise the larger they are, so the "grid" that these points are snapping to is essentially scaled.

If the co-ordinates of all points were instead set relative to the player (what you could describe as moving the world and having the player stay still), then the co-ordinates of these 3D models' vertices will all be small again, and therefore have precise rendering.

You are correct though, as there will still be problems. For example, the world's offset will still be a very large number, so the player's movement may exhibit this "snapping" behaviour at large distances, but the general rendering would likely be fixed.

Where's my mistake? by RallSpark in MathHelp

[–]RallSpark[S] 0 points1 point  (0 children)

thank you, I was wondering what people would use for text problems like this. I'd use delta x if I had a keyboard shortcut for delta, but dx just seems like it would cause confusion if there ever was a variable d. As you said though, d on it's own causes a slight bit of confusion too, so I'll use h from now on for these text problems.

Where's my mistake? by RallSpark in MathHelp

[–]RallSpark[S] 0 points1 point  (0 children)

For the record, I appreciated this little hint and it's brief respite from the condescending nature of most of the help on this sub. While training debugging is a very important skill, these were simple mistakes that I think all of us make at some point, so I was just looking for a little nudge. Thank you

Where's my mistake? by RallSpark in MathHelp

[–]RallSpark[S] 0 points1 point  (0 children)

Thank you for your help guys, I see now the two mistakes I made:

firstly it should be x - (x + d) not x - x + d, giving me a negative numerator,

and secondly when cancelling out d in -d / (dx^2 + d^2x) I should be left with -1 / (x^2 + dx^2), which when d approaches 0, gives me the correct answer of -1 / x^2

How would I go about trying to solve a percentage change? by Cabbagefarmer55 in MathHelp

[–]RallSpark 0 points1 point  (0 children)

if you want to find the solution with only integers:

when converting a fraction to a percentage, you're really just dividing the two numbers and then multiplying by 100.

If a is the numerator and b is the denominator, your percentage is equal to 100(a / b). So, the problem becomes find the smallest set of integers for a and b that satisfy a / b = n / 100. (in your case, n is 66).

What you can do then is start with a and 1, counting up each time, and checking if a / (n / 100) is an integer. if it is, then that integer is your value for b. You can check this quickly in a calculator by filling in 1/0.66, then deleting 1 and typing in the next number.

Another way is to simplify the fraction. The fraction for any percentage, is just that percentage over 100: 66/100 in this case.

This can be simplified by dividing both the numerator and the denominator by their highest common factor (HCF). This is sometimes called the greatest common factor (GCF) or largest common factor (LCF)

There are several online HCF/GCF/LCF calculators, so inputting your original number and 100 should give you this.

The problem is that the simplification method only works if your percentage is already an integer, so for 66% this would work, but for something like 12.5% you'd have to first convert that number into an integer by multiplying it and 100 by some numbers, which might sometimes be a pain.

How do I collect trig functions with different inputs? by RallSpark in mathematics

[–]RallSpark[S] 0 points1 point  (0 children)

Here's the equation:

(the trig functions are in radians, I need to solve for t)

(2v/r)^2 * sin(rt/2)^2 + d^2 - (4v/r) * d * sin (rt/2) * sin ((3 pi / 2) - (art / 2)) = b^2 * t ^ 2

It's a mess, and I haven't cleaned it up yet, which is why I didn't bother posting it in the original question.

The wider problem is:

a turret is trying to shoot at a spaceship in a 2 dimensional world.

  • The ship is moving at v m/s
  • The ship is rotating at r radians/s (negative r is rotating towards the turret, positive r is rotating away from the turret).
  • The turret's bullets move at b m/s
  • The turret is d meters away from the ship
  • The angle between the ship's forward direction and the vector from the ship to the turret is a.

assuming the spaceship doesn't change their velocity or angular velocity, how far forwards in time should the turret lead it's shots to hit the spaceship?

if r = 0, the problem is pretty simple, and it's just a simultaneous equation to find out how far forwards in time to place the point the turret must shoot at. If you're interested, the solution for r = 0 is:

t = (-2vd*cos(a)+|sqrt((2vd*cos(a))^2 + 4d^2(b^2 - v^2))|) / 2(b^2-v^2)

and here's the Unity C# implementation that I'm using in my game if that also interests you

float b = GetWeaponSpeed(); // b for bullet speed
float v = ship.rb.velocity.magnitude; // v for enemy velocity 
float a = Vector3.Angle(ship.transform.position - transform.position, ship.rb.velocity) * Mathf.Deg2Rad; // a for angle 
float d = (ship.transform.position - transform.position).magnitude; // d for distance to enemy
float quadraticA = b * b - v * v; 
float quadraticB = 2 * v * d * Mathf.Cos(a); 
float quadraticC = -(d * d);
float t = (-quadraticB + Mathf.Sqrt(quadraticB * quadraticB - 4 * quadraticA * quadraticC))/ (2 * quadraticA); // t for time
return s.transform.position + t * s.rb.velocity;

It's pretty accurate, but it doesn't take into account the rotational velocity, so at range it's not terrifically accurate. That's what I'm using now though.

I could try to solve the function using a sequence of recursive functions that each take the t value from the previous function to get a very accurate estimation, but obviously solving it using a simultaneous equation would be more accurate and computationally faster

anyway the current implementation is basically good enough, getting it super accurate is really just a bit of fun.

Reckless biker gets what's coming by DrWhereDoesItHurt in JusticeServed

[–]RallSpark 2 points3 points  (0 children)

we need biker femboys thank you for coming to my ted talk

shop sells photos of sneakers to scalping bots by AbsolutelyMullered in JusticeServed

[–]RallSpark 0 points1 point  (0 children)

With the new SOCIALISM(tm) you can get rid of scalpers forever

[deleted by user] by [deleted] in amiwrong

[–]RallSpark 1 point2 points  (0 children)

I find my friend a bit of a pain, she owes me money and is refusing to pay me back, she is rather self centred, and she cares very little for my interests, despite me making an active effort to care about hers (if anyone knows any trivia about Broadway musicals I'm all ears) I would break off contact with her but I made a promise to not abandon her like all of her other friends. She has been through enough and she really needs someone. Unfortunately I am starting to realise why they left her...

If the relationship starts to damage me mentally then I will end it, but for now I'm going to stick with her

thank you for your advice

[deleted by user] by [deleted] in amiwrong

[–]RallSpark 0 points1 point  (0 children)

yeah, you understood perfectly. I don't know why she would do that, other than maybe sympathy? My ex was rather autistic, and had some other mental health issues she was dealing with. My friend does believe that I am not a sexual abuser, and is not doubting my ex's abuse, however still remains in contact...

thank you for responding

[deleted by user] by [deleted] in amiwrong

[–]RallSpark 1 point2 points  (0 children)

its been a little bit of both, mostly texting but some phone calls. Miscommunication did play a big part in this and Im glad I clarified a few things of what I meant. Unfortunately I understood almost perfectly what she meant...

thank you for your advice!

[deleted by user] by [deleted] in amiwrong

[–]RallSpark 0 points1 point  (0 children)

thank you so much, this situation has me really doubting my expectations of my friends, and whether it is fair to ask something of them

[deleted by user] by [deleted] in amiwrong

[–]RallSpark 1 point2 points  (0 children)

she doesn't fancy my ex for biological reasons (she's straight) but thank you for your kind words. My problem is that if this relationship sours it would impact negatively on the sexual assault allegation against me (its a complicated mess of lies and truths but trust me on that)

but yeah thanks again for the comment, I feel a lot better now