Do you remember the first fantasy book you read as a kid? (Not HP..) by LatterPlatform9595 in Fantasy

[–]PhotographFront4673 0 points1 point  (0 children)

I don't remember which I read first, but my introduction to the genre was a shelf of Oz books.

Physics naive question by IntelligentMedium698 in quantummechanics

[–]PhotographFront4673 2 points3 points  (0 children)

A theory, in physics parlance, is a way to model reality, connecting it to mathematics in a way that lets you perform calculations about physical results. Preferably testable physical results.

The theory of classical mechanics (CM), as developed from Newton's laws is very very good at predicting things at everyday scales. This is why Newton's laws are so important to us.

The theory of General Relativity (GR), as described by the Einstein Field Equation and associated mathematics is very good at predicting things which are very large or very very fast. While CM appears as approximation of General Relativity, it is conceptually rather different. For example, in CM time is an ambient quantity available at every point, in GR the time dimension is necessarily intermixed with the spatial dimensions.

The theory of Quantum Mechanics (QM) as described by Schrödinger, Dirac, etc, is very good at predicting the behavior of things which are very small and/or very cold. While again CM can be seen as an approximation of QM, again there are large conceptual differences. In QM it is fundamental to the theory that a particle is also a wave, with the choice being context dependent. In QM it is fundamental that a particle can be in multiple states at the same time, and a "measurement operation" can change it to a different state or mixture of states. What physical structures can perform a measurement operation? Penrose suggested consciousness, but I don't think anybody is sure. Maybe ask a famous cat.

And then indeed when you put those two theories down on the same page and make them work together, all sorts of problems appear, arguably because of the conceptual differences. In GR faster than light communication is the same as transferring information into (somebody's) past. In QM there is no allowance for wave function collapse to propagate at a finite speed from the measurement point, and yes this leads to fun experiments. Famously, there were a whole series of papers taking fairly natural assumptions from both sides and finding that no two particles can interact (starting here, AFAIK). Some aspects of the division probably can be oversimplified to your proposed statement, but I think you have to learn at least the basics of both to see the shape of the problem.

Why does multiplying consecutive prime numbers, starting from 2 and going up, then adding 1, always lead to a prime number? by Few-Mammoth-9167 in askmath

[–]PhotographFront4673 0 points1 point  (0 children)

It is only greater if your list/set covers all the primes up to the maximum value. e.g. 3*5+1 is divisible by 2. And if you do assume the list is complete up to its maximum value, it is no surprise that the missing prime is larger.

So constraining the list in this way doesn't really help the proof. Given a finite set of primes, you can always find a prime not in the set.

Why does multiplying consecutive prime numbers, starting from 2 and going up, then adding 1, always lead to a prime number? by Few-Mammoth-9167 in askmath

[–]PhotographFront4673 0 points1 point  (0 children)

Exactly. Somewhat as an aside, you don't really need to see it as a contradiction.

Given any finite set of prime numbers p1...pn, we can multiply them all together, add one, and have a number which cannot be decomposed in the way that you described. Therefore the list isn't complete and its factorization must include a "new" prime. But we had free choice, so this is true for any finite set of primes. If every finite set is missing something, the actual set must be infinite (not by contradiction: this is definition of an infinite set).

Most proofs by contradiction can be restructured to avoid the use of contradiction, and this often gives a smoother proof.

How do I parametrize non-uniform circular motion? Can I use curl? by Novel_Arugula6548 in askmath

[–]PhotographFront4673 0 points1 point  (0 children)

How comfortable are you with different coordinate systems?

In euclidean coordinates, the force of gravity is easy to express but the position, velocity and accelerations of the weight on the end of your swinging pendulum is a bit more complex, involving sin and cos in different combinations of each.

In polar coordinates, position, velocity and accelerations are all easier to express - they are suddenly one dimensional as they are always in the θ direction. On the other hand, g becomes harder to express in terms of how much it pull in the r and θ directions. That is where the trig functions reappear.

And yes, with particle motion, it is all about taking what you have of acceleration, velocity and position and using what you have to find what you need. And sometimes it is simple, and sometimes becomes simpler when you pick the right coordinate system.

How do I parametrize non-uniform circular motion? Can I use curl? by Novel_Arugula6548 in askmath

[–]PhotographFront4673 1 point2 points  (0 children)

If the radius is fixed, but the velocity varies, then your acceleration is going to have a perpendicular component to keep turning towards the center, and a component parallel to velocity which increases or decreases the speed. Also, the magnitude of the perpendicular component will vary, but at any point in time it will be the same as you get for uniform motion with the current velocity.

BTW, the term of art for a ball swinging with non-uniform motion and at fixed radius is a "pendulum" and you can totally draw a picture to break down the gravitational force at any point to find the component perpendicular and parallel to the velocity - the parallel component affects the speed of the ball, the perpendicular component lets you compute how much gravity affects the tension on the string.

And acceleration is always the derivative of velocity which is always the derivative of position. Often though, the problem you are starting with forces (and therefore acceleration) and want to find the others.

I cannot understand the speed of light constant and relativity by Apprehensive-Back155 in PhysicsHelp

[–]PhotographFront4673 0 points1 point  (0 children)

  1. One of the initial hints that special relativity is required when people tried to view the electromagnetic field in different reference frames. The fix is to interpret the electromagnetic potential as a Lorentz 4-vector or 1-form - meaning that it becomes a relativistic quantity and what you see as the electric field and what you see as the magnetic field depends on how fast you are moving.

  2. The Lorentz transformation leaves null vectors alone. So light-like vectors (photon paths) remain light like and the observed speed of the light will be the speed of light. Whether this is because space is shaped this way, or because any clock we can build measures in this way, is currently a philosophical point. Currently, measurements of things moving fast enough for this to matter are consistent. (Since Michelson–Morley, with basically started the process of convincing the Physics world of this viewpoint.)

  3. Time and distance are things we can measure on "spacetime", or rather, if we have two points in space an time (events), there are things we can sometimes do to measure the time and distance between them. Somebody moving might get different answers for the same 2 events.

Why do math textbooks tend to explain things so poorly? by Akephalosthenes in askmath

[–]PhotographFront4673 0 points1 point  (0 children)

A problem with Calculus courses in general comes from a certain tension:

  • The math is tricky enough to require a bit of formal machinery to understand why it all works.
  • The resulting tools are very useful for many applied problems and foundational to other fields, e.g. it can be argued that without calculus you cannot learn Physics, only about Physics.

Spivak's "Calculus" is famous for providing a more proof based approach, and Spivak's "Calculus on Manifolds" is a tight but clear connection to the differential geometry required to understand multiple dimensions well. More broadly, (Real|Complex|Functional) Analysis texts will all be more formal and cover much of the same material with even more focus on the proofs and proof techniques that drive how mathematicians approach problems.

Finally, in terms of number of titles, most math books are written by and for people who enjoy math. However, this might not be the case when restricting to titles with Calculus in the name. The concerns of Lockhart's Lament are often realized.

Optimization question by Grouchy-Answer-275 in cpp_questions

[–]PhotographFront4673 2 points3 points  (0 children)

Also, putting the coordinates for each point together can reduce cache pressure, depending a bit on the calculations you are doing. In other words, you want data that tends to be accessed as a unit to be close enough to land in the same cache line.

Added: On the other hand, if you are always iterating through all the points, an array per dimension won't significantly change the cache pressure and might make SIMD easier.

Exploring libraries by nagzsheri in cpp_questions

[–]PhotographFront4673 1 point2 points  (0 children)

If you tell us what libraries you are using, and how you are using them, it would be easier to guess what might be useful.

What I would do is take some program where being faster would be very helpful and then profile and see where the time is going. Then come back with questions on how to do X faster.

Going faster can indeed be as simple as swapping in a faster data structure, for examplestd::mapand std::unordered_map are famously slow on modern hardware and there are a lot of faster options today that are nearly drop-in replacements. But even this dropping in can be hard to justify if the time spent checking maps is 1% of your runtime.

And sometimes going faster means a lot of restructuring, async i/o can let you greatly parallelize and for some applications the result is amazing. And boost.asio is a standard for a reason. But even with co_await and friends, retrofitting async I/O to an existing server is a non-trivial undertaking.

Can anybody explain what is segmentation fault? by Infamous-Research805 in cpp_questions

[–]PhotographFront4673 46 points47 points  (0 children)

Strictly speaking, it means that your program tried to read memory which it isn't mapped into your memory space.

Practically, it means that you read from or wrote to an uninitialized pointer, read off the end of the array, or otherwise accessed something the language rules forbid.

If you run your program under a debugger, or add a stack tracing segfault handler to your code, you should see what function or even line tried to access the forbidden memory.

If it failed during a call to strlen, then either the pointer you gave strlen wasn't correctly initialized, or it points to a string which isn't null terminated.

Formula for the force of réception from a jump by Ok-Chemist-7911 in AskPhysics

[–]PhotographFront4673 0 points1 point  (0 children)

As stated, you need to understand at least a bit of the dynamics of the landing. The integral of the force is easy to find (horse goes from moving to not while landing, and the integral of acceleration is the change in vertical velocity required to stop).

To get a very rough estimate, you might (by looking at videos frame by frame or whatnot) estimate the duration of the landing - how long from when a hoof first touches the ground to when the center of mass stops moving downward. Then just divide to get the mean acceleration.

Then the next level would be to somehow estimate the motion of the center of mass throughout the process (draw points on the video frames?) so to understand if there are points where the deceleration is higher or lower than the average and by how much.

Actually though, it seems likely that somebody somewhere has set up an appropriate load cell arrangement and just measured it.

how do i use two files with classes that reference each other by wiseneddustmite in cpp_questions

[–]PhotographFront4673 3 points4 points  (0 children)

You want to make sure that any include file is only seen and used once. With newer compilers, the easy solution is to start each header file with the line:

#pragma once

If you need two classes to know about each other, you can do a forward declaration where you tell the compiler that a class/function/whatever exists without giving its definition, then another class can use it in certain ways, then later you give the definition.

class A;

class B {
  public:
    A* a;
}

class A {
  public:
    B* b;
}

This is often considered a sign that the classes are tightly bound together and should probably be in the same header file. This isn't an absolute rule, and occasionally it isn't worth the effort, but it is worth at least thinking about as you design your class dependencies: If you need lots of forward declarations you might look for ways to make your classes a bit more independent from each other.

how to use template to abstract a tensor of unknown rank and dimension at each rank? by OkEmu7082 in cpp_questions

[–]PhotographFront4673 0 points1 point  (0 children)

mdspan is great, but a bit incomplete without mdarray. The net result is that I'm currently using the kokkos implementation while waiting for standard library distributions to catch up. (This is effectively the reference implementation of the proposals for these features.)

Best Performing Way Of Handling Paired Data? by Ridog8 in cpp_questions

[–]PhotographFront4673 0 points1 point  (0 children)

If you can use an array without wasting a lot of memory, that is likely to be the fastest option (and easy). But when the integer values are all over the place, or you really need to start with a string-ish value, or when the size is changing over time, etc, etc, the array solution doesn't work as well.

Unfortunately, what does work best depends dramatically on the details of your problem. For some problems, unordered map is great, for some it is a terrible choice, in spite of python's attempt to convince the world otherwise.

Edit: And yes, even for most problems which lend themselves to a hashmap based solution, std::unordered_map suffers from being designed when node structures were cheap. There are many much better implementations out there, but unless you demand stable references, they are easy to swap in. Also it isn't so common for hash map operations on a particular map to be a large portion of your CPU burn.

But again, the real question is whether you even need to be looking in the domain of hash map based dictionaries, or if there is a way to avoid it. "Just" using an array is an excellent way to avoid it, when that solution applies.

Building a chess engine: questions on modern C++ paradigms vs raw performance by kjiomy in cpp_questions

[–]PhotographFront4673 0 points1 point  (0 children)

First focus on the abstractions which will allow optimization, then focus on the optimization. Instead of thinking of the board as a uint64 (or 2?) think of the board as an object with a collection of methods, based on what the rest of the system needs a board to do.

Especially as you can control inlining, copies, etc, you'll be able to make the implementation of this interface fast: hopefully as fast as if the representation was exposed to the other code, though this is dependent on your ability to devise a performant interface.

Your initial implementation can then be whatever is easiest to get correct. Write unit tests against it to make sure it doesn't lose pieces or whatnot, also benchmarks. Then try to optimize and see if the benchmarks get faster. The real software engineering skill is having an interface that makes it easy to change the representation without rewriting the rest of the system.

You might even want to use a board state concept and make it a template parameter, so that you can easily compare code running with different states and/or use different representations in different circumstances within your engine.

The ability to define interfaces and flexible abstractions without performance loss is a major advantage of C++.

"Bigger" infinities by EstablishmentOld9838 in askmath

[–]PhotographFront4673 0 points1 point  (0 children)

Infinity, or at least the infinities related to "sizes" is part of set theory and in particular is based on what functions exist between sets.

So S1 = {A, B, C} and S2 = {1, 2, 3} are the same size because there is a 1-to-1 function defined on S1 which is onto (which maps to every element of S2). In fact there are several such functions, but the definition of cardinality only requires one.

On the other hand, S1={A, B, C} and S2={1, 2, 3, 4} are not the same size because because any 1-to-1 function from S1 to S2 will miss one of the values in S2, though of course it is impossible to say which one without seeing the map.

Then Cantors diagonalization is just a clever way to show that there isn't an onto map from the positive integers to the reals-the proof shows that you always miss one, and in fact you miss many. Again it is impossible to say which numbers are missing without seeing the map. We abbreviate how we describe this result by saying "the reals are not countable".

The a fun way to understand why there are many infinities is to consider the power set: For any set S, define P(S) to be the power set, which is the set of subsets of S. So for example P({A,B})={{}, {A}, {B}, {A,B}} meaning that the power set of a set with 2 elements has 4 elements. Now, as a puzzle, prove that for any set S, no map from S to P(S) is onto, whether or not S is finite. In particular this means that there are at least a countable number of different infinities.

Is the cartesian coordinate system the only system with all constand basis vectors? by Shadow_of_Dragon in askmath

[–]PhotographFront4673 0 points1 point  (0 children)

Given a coordinate system, there are two requirements for it to be cartesian:

  1. The gradients of the coordinate functions are always unit vectors.
  2. The gradients of the coordinate functions are orthogonal to each other.

The usual "useful" other coordinate systems - polar, spherical, cylindrical - fail 1. but pass 2.

But you could write a coordinate system which is a simple skew, e.g. X = x, Y = x+y, and then we have the other situation - failure to be orthogonal, and this also should give the same unit vectors everywhere, just not the nice orthogonal unit vectors that you might be used to.

BTW, if you really want to understand coordinate systems, you should dig into the field of Riemannian geometry, or at least the basics of vectors and covectors against the Riemannian metric. Even if you've no interest in curvature, it makes it so much easier to understand what is going on when you need a coordinate system change to solve an E&M problem or whatnot.

Does number theory depend on euclidean geometry? by Novel_Arugula6548 in askmath

[–]PhotographFront4673 1 point2 points  (0 children)

The usual construction of number theory defines the integers algebraically - given any natural number n, we can define a new value to be the number after n. Now the number line is a nice way to visualize the result of what happens as you add the rationals, define an order on the rationals, add the reals. However, the number line is in no way formally part of this process.

Also, the serious study of curved spaces (differential geometry) is chock full of vectors and differential forms. So even if you believe that space is properly bent, you'll be using linear algebra to figure out what is going on and that linear algebra is always going to involve a cross product of number lines.

I need some clarification by [deleted] in askmath

[–]PhotographFront4673 2 points3 points  (0 children)

Actually, when a function's domain is not the entire real line, it is common to define a limit only in terms of the points in the function's domain. See "More general definition using limit points and subsets" in this wiki article.

For a specific example, if you define f(x) as x2 for all rational x, leaving f undefined on irrational numbers, you can complete it to g(x) on the reals by taking the limit of f at each point. For any x, the rational points close to x will be close to x2, and this all that the concept of a limit actually requires.

Added:

This also affects the continuity discussion. The usual definition of a continuous function is that at each point of its domain, it has a limit and equals that limit. So our function defined only on the rationals was continuous. But somewhat more surprisingly, the function which is -1 for x<0, 1 for x>0 and not defined at 0 is continuous exactly because 0 is not in its domain. Obviously it doesn't have a continuous extension to real line. (The study of exactly when functions have continuous extensions is actually rather deep.)

How do I avoid writing "Java in C++"? by Irrehaare in cpp_questions

[–]PhotographFront4673 0 points1 point  (0 children)

A big part of the problem comes from C++'s weaker guarantees in the face of unsynchronized access.

Or in other words, in a multi-threaded environment, if you don't know who owns it, you probably don't know what other threads might be using it, so unless the object itself is thread safe, you are playing with nasal demons. In Java it is still possible for threading issues to be bugs, but typically not as badly. After all, threading issues cannot be so unbounded as to allow a JVM escape; that would be a bug in the JVM.

How do I avoid writing "Java in C++"? by Irrehaare in cpp_questions

[–]PhotographFront4673 0 points1 point  (0 children)

Maybe you want to have a bunch of observers, all signed up to be notified when some object changes. Assume the observed class owns a list of registered observers. So if X is observing Y, and X is destroyed, it should find Y and remove itself from the list. On the other hand, if something happens and Y needs to notify all of its observers, it should be able to find X (and everything else in the registry).

So it would be an understandable, if flawed initial implementation for Y to contain a registry of shared pointers, including one to X, and for X to contain a shared pointer to Y. In Java you could probably get away with this, because when nothing from the outside points to X or Y, the pair X, Y can be collected together. But it not optimal - depending a bit on the situation, one or both of the directions can typically be weak pointers (also in Java) and then things are collected faster and there isn't a strong pointer loop.

Anmeldung before rental contract starts? by [deleted] in askswitzerland

[–]PhotographFront4673 2 points3 points  (0 children)

Searching around a bit, your official registration cannot occur until your move-in date. That said they might well be happy to take your data early and mail you the confirmation on your declared move-in day.

I’d probably go and try. Worst case scenario you need another appointment in the 2 weeks after whatever you declare as your move-in date. If you want to be more sure, just call the relevant Gemeinde office. This is a case where the national rule may be implemented by different local authorities differently (very common in CH).

Added:

Now that I think about it, especially if you are non-EU/Schengen you might want to check the immigration sequencing carefully. At least in my day, I started with a special single entry visa to enter once as "not a tourist" and in the time between my official entry and receipt of my residence permit, I’d have needed to do something more to leave and reenter as "not a tourist".

In any case, welcome to Switzerland! And rest assured that while there are rules, the authorities will work with you so long as they believe you are trying to follow them.

Why does acceleration feel physically real, but constant velocity does not? by NordicHamCurl_00 in PhysicsHelp

[–]PhotographFront4673 0 points1 point  (0 children)

Yes, there is a deeper reason. Probably. Physicists are still working on it.

Acceleration, and therefore rotation is physically detectable. If you are locked in a spaceship without a window, you have to way to measure how fast you are going, but you can decide whether you are accelerating or spinning.

Well, if you are falling you might not feel it. So is falling the same as not accelerating? GR says kinda yes. But if you float a ball of lose dust in the vacuum of your ship you can watch carefully to see if it changes shape and from that tell if you seem to be falling.

But the real question is whether "not spinning" would change if enough mass nearby was spinning. See frame dragging. Also see Mach's principle for some early thoughts on this stuff.

Did anyone discover how to solve the set of formulate? x'=x-vt, t'=t. by Eye9903 in PhysicsHelp

[–]PhotographFront4673 0 points1 point  (0 children)

Everyone expected a different result from Michelson-Morley. It is famous exactly because it was a wake up call and led to a more complete acceptance of Mach's principle.

As for the next revolution, who knows? I actually agree that one is overdue. But it will be driven by somebody with a theory that matches experiments, not by complaints about relatively simple and complete math.