# Search the Community

Showing results for tags 'math'.

• ### Search By Tags

Type tags separated by commas.

### Forums

• General
• Announcements
• The Daily Kerbal
• Kerbal Space Program 2
• KSP 2 Discussion
• General KSP
• KSP Discussion
• Suggestions & Development Discussion
• Challenges & Mission ideas
• The Spacecraft Exchange
• KSP Fan Works
• Gameplay and Technical Support
• Gameplay Questions and Tutorials
• Technical Support (PC, unmodded installs)
• Technical Support (PC, modded installs)
• Technical Support (PlayStation 4, XBox One)
• Community
• Welcome Aboard
• Science & Spaceflight
• Kerbal Network
• The Lounge
• Making History Expansion
• Making History Missions
• Making History Discussion
• Making History Support
• Breaking Ground Expansion
• Breaking Ground Discussion
• Breaking Ground Support
• International
• International
• KerbalEDU Forums
• KerbalEDU
• KerbalEDU Website

### Categories

• Developer Articles

• 0 Replies

• 0 Reviews

• 0 Views

### Interests

Found 56 results

1. Hi everyone. I'm not an engineer, so maybe this is common knowledge already, but during TCA development I've encountered a problem with numerical instability of Vector3[d].Angle methods at small angles. Both methods use the same straightforward implementation: public static double Angle(Vector3d from, Vector3d to) { return Math.Acos(Math.Min(Math.Max(Vector3d.Dot(from.normalized, to.normalized), -1), 1)) * 57.2957795130823; } Which is fine, unless rounding errors start producing cosine values > 1 that get clamped, which results in angle "measurements" like this: *this, of course, depends on the vectors themselves, as most of the error comes from normalization. So I've started looking and, soon enough, found a paper reciting a much more numerically stable approach: https://people.eecs.berkeley.edu/~wkahan/Mindless.pdf (page 47, top, don't mind the title ) What's more, as it uses arctangent of direct quotient of sine and cosine, we can use the standard atan2, which is robust at all angles: public static float Angle2(Vector3 a, Vector3 b) { var abm = a*b.magnitude; var bam = b*a.magnitude; return 2 * Mathf.Atan2((abm-bam).magnitude, (abm+bam).magnitude) * Mathf.Rad2Deg; } No normalization, no clamping, and much, much more reasonable results: So if you happen to have the need for accurate angle measurements in Unity, this is a cheap and effective solution.
2. Hello guys. I am an amateur Kerbonaut and I want to start to calculate dV by hand since it is so nice and fancy to do. When I looked up, I came across this formula: dV = Isp * gravity * ln(m0 - mf) Everything is fine, but when I utilize this equation and check the results with VAB, I get HUGE differences for other planets. Currently I am trying to visit Eve and comeback. My lander should have God knows how much dV. So, for a stage (mid), I put: Rockomax 32 (x1) FL-A215(x1) FL-A151S(x1) Skipper The upper payload is 4.090t. Therefore, according to the equation: Isp = 280 Gravity = 16.7 m0 = 32.740t mf = 9.940t and dV should be 280 * 16.7 * ln(32.74/9.94)= 5579.9 m/s but VAB says it is 666m/s. What I am doing wrong? Good luck in your space journeys
4. I'm trying to write a python script (using the kRPC mod) to do a suicide burn. However, so far I always reach a velocity of 0 a few hundred meters above the ground and then proceed to plummet to my death. My assumption is that the problem is a mathematical one, as the code is fairly simple. So I'd be very grateful if someone could check my math. Alternatively, if anyone has a different solution for what I'm trying to accomplish, I'd be happy to hear that to. For simplicity's sake I assume that my spacecraft is always pointing straight up and falling straight down. I also assume that there is no atmosphere and thus no drag. So here is what I have come up with: (Handwritten version of math) t: Time since start of the burn in seconds (s) Fe: Thrust of the spacecraft's engines in Newton (N) M0: Wet Mass of the spacecraft at the beginning of the burn in Kilogram (Kg) g: Surface gravity of the body I'm landing on in meters per second squared (m/s^2) W: Weight of the spacecraft in Newton (N) W = M0 * g F: Net thrust of the engine when decelerating the spacecraft in Newton (N) F = Fe - W K: Fuel consumption of the engine in Kilograms per second (Kg/s) a(t): Acceleration (or deceleration, depending how you look at it) of the spacecraft after t seconds, taking into account the decreased mass due to fuel being burned. In meters per second squared (m/s^2) a(t) = F / (M0 - K * t) Tb: Duration of engine burn in seconds (s) Dv(Tb): Speed change of spacecraft for a burn of Tb seconds in meters per second (m/s) Dv(Tb) = Integral from 0 to TB [a(t)] dt = Integral from 0 to Tb [F / (M0 - K * t)] dt = (F/K) * ln(1 + Tb * (K/M0)) Up until this point everything is based on this reddit comment. However, I am not sure if the integration for Dv(Tb) is correct. If I do it myself I get a different result, but the dimensional analysis for my result doesn't work out, so I've been sticking to this one. v0: velocity of spacecraft at the beginning of the suicide burn in meters per second (m/s) To calculate Tb, let Dv(Tb) = (F/K) * ln(1 + Tb * (K/M0)) = v0 and solve for Tb: Tb = (e^((v0 * K) / F) - 1) * (M0 / K) Da(Tb): Distance the spacecraft falls during burn of Tb seconds in meter (m) Da(Tb) = Integral from 0 to Tb [-v0 + Dv(Tb)] dt = Integral from 0 to Tb [-v0 + (F/K) * ln(1 + t * (K / M0))] dt Because I couldn't find an analytical solution for Da(Tb) I decided to solve it numerically every tick. I now run the above calculations every tick (multiple time per second) and then check if the resulting Da(Tb) is close to (within 10m) of the current altitude of my spacecraft. If it is I know I have to start the suicide burn. However, as mentioned above, it always starts a few hundred meters to early. It shouldn't be relevant, but this is the spacecraft I'm using to test my code. In case the above is to confusing to follow, here are my handwritten notes. They should contain the same information as above but more neatly formatted. Beware my handwriting though Also, is there a way to insert latex formulas in my post? I think that would have helped a lot. And this is a copy of my code so far, if anyone is interested: So, again, if anyone is willing to check my math, I'd be very grateful.
5. How do I calculate the surface longitude where I start my transfer burn to geostationary altitude, given the surface longitude where I want my satellite to end up, my current altitude and orbital period, and my current longitude? I'm trying to write a kOS program that puts a satellite into a precise-ish slot in geostationary orbit. My probe is powered by a single ion engine and has a wet mass of 1.726 tonnes.
6. Just a thread to discuss math things, I guess I havn't seen one so here.
• 35 replies
• 2
• 7. A while ago I had a question that went a little like this: "Planet Kerbin has a radius of r from its center and gravity of G. Two identical rockets launch from the equator at opposite sides, and start accelerating along the rotation of the planet with the velocity of V. At what time after they finished acceleration did they reach maximum distance from each other, and what was the distance?" It also said in its prefix that "people attempting this question might want to find out a little about Kepler's laws." I think I got the answer, but I am not sure if it is right, as I didn't know any good method of doing such a calculation. Could you please help me by telling me how do you find out these variables algebraicly? I also found the only picture that I had of this question, and here is a graph that went with it
8. Hi there, I'm an aerodynamics student and am looking to do the same kind of medium-fidelity aero modelling that's done with Ferram Aerospace - the calculation of aerodynamic coefficients, stability derivatives, and the like for some arbitrary body, and as functions of Mach number, AoA, etc. Does anyone know if the developers compiled a bibliography/list of references/papers for the algorithms they implemented? If not, is there any information on how their algorithms work, or could anyone recommend some papers I can look at to get started? (I'm familiar with basic flight dynamics theory already, and am more interested in the actual computational component.) Thanks!
9. Hi, I've made a quadcopter and found I cannot control it. If I attach rotors to yaw/pitch/roll and thrust I am able control thrust but yaw/pitch/roll override each other so only one is effective. Thrust works because it's incremental while yaw/pitch/roll are absolute. At first I wanted do demand multiple overlapping controls to work additively (and they should) but then I realized that won't be enough. The collective throttle must lift the craft while axes control should only modify torque to control its movement and may work much weaker. So the torque for single engine could be calculated by a formula T=(1 - 3k)t + ky + kp +kr, where T is torque, t is throttle, and y, p, r are yaw pitch and roll, respectively. k is axes to throttle coefficient, let it be 0.1, for example. Now, this cannot be done. So I think the formula controller should be available for our creations. Of course this will be usable not only in quadcopters. Why not control ailerons in function od speed? In supersonic flight they are too strong while in low speed maneuvering they could work stronger. We could also describe by formulas hinges' movements as a function of time or the controller's value (then a controller's path could be a variable, not necessarily bound to a part).
10. Is there an equation to calculate the heading I need to fly to reach an orbit of a certain inclination, based of the latitude of the launch site?
13. ## I wonder if the fact that as a child I had problems with multiplication, maybe some relationship with my Asperger Syndrome?

I have Asperger even if I was kid I was suspected (wrongly) that I have ADHD I could not learn the multiplication table, which was required in my country, Poland I can not do it until today, and I am almost 33 years old I often flunk math I could make calculations, but only with the help of a calculator. I remember once from boredom I started playing with a calculator and started to add numbers to each other. The teacher saw it and asked what I was doing? I apologized to him, and I said I was just having fun. This teacher said that I was just doing the Fibonacci sequence, do not even know it, and that I would not put crap on him, that I do not know mathematics, because from what I see it could be quite a good mathematician xD One of my friend who is also having Asperger advised me to learn to programming in Python, that is the easiest programming language to learn. I bought a course on Udemy and start to study, but I'm afraid that I'm too old https://answers.yahoo.com/question/index?qid=20190124084232AA3Yh98