## Rendevouz Calculations

Say you have two objects in a vacuum with no forces acting on them.

The objects may or may not be moving.

Object A’s acceleration is not equal in all directions, and object B may change its acceleration over time.

``````Knowns:
A position
A velocity
A acceleration
A max acceleration for a given vector
B position
B velocity
B acceleration
``````

So for object A, how can I iteratively calculate the the direction of thrust needed to go to B’s position and match B’s velocity in the smallest amount of time?

## approximation theory – Examples of Back of Envelope Calculations Leading to Good Intuition in Mathematics?

Some time ago, I read about an “approximate approach” to the Stirling’s formula in M.Sanjoy’s Street Fighting Mathematics. In summary, the book used a integral estimation heuristic from spectroscopy

$$int_{mathbb{R_{ge 0}}} f(x) dx approx max(f) * (text{point where} frac{1}{2} max(f) text{is achieved})$$

to estimate the Gamma function with $$f(x) = f_t(x) = x^{t}e^{-x}$$. This leads to the estimate

$$Gamma(n) = int_{mathbb{R}_{ge 0}} x^{n}e^{-x} dx approx sqrt{8 n} left(frac{n}{e}right)^n$$

which is an extremely good estimate (the “proportionality constant” $$sqrt{8}$$ is correct to within 10% with correct order of growth.) This heuristic was very helpful in understanding the growth of the actual formula $$Gamma(n) approx sqrt{2pi n} left(frac{n}{e}right)^n$$.

I think approximations of this sort is useful because

• It gives a sense of what the answer “ought” to be.
• When the approximation deviates from the actual answer, it’s interesting to think about which part of the approximation failed.

Another “back-of-envelope calculation” is the calculation for the Prime Number Theorem in Courant and Robbins, What is Mathematics?

My Question. I am looking for similar instances in mathematics where “back-of-envelope calculations” such as the above leading to good intuition in mathematics.

For the purpose of my question, let’s require that the calculation:

1. Does not require anything beyond, say undergraduate mathematics
2. Addresses questions in pure mathematics (so, no physics, engineering, etc. since there seems to already be plenty of literature on this)
3. Does not formalize into a rigorous proof

I am adding the last condition to distinguish my question from questions such as “what are nice theorems with intuitive/clever/short/elementary proofs”? (Both examples above satisfy criteria 1~3, to the best of my knowledge.)

## differential equations – recursive time dependent NDSolve calculations but full kernel

I would like to make a very long time dependent NDSolve calculation, but the program indicates a full kernel after a while. How can I make the calculations by steps, saving the results at a time and restart the recursive calculations from the preceding calculations ?

## How to finish the last calculations in the problem?

Solve the system of equations

where a = 6, b = 11

evaluate the value of the expression

for every solution

system and find the minimum among them. In the answer, indicate the minimum value found, if necessary, round it to two decimal places

my solution:

The second equation of the system:

x ^ 2 + y ^ 2 + 2a (y-x) + 2a ^ 2 = 0

(x-a) ^ 2 + (y + a) ^ 2 = 0

x = a; y = -a; if a = 6, then x = 6, y = -6.

Then the 1st equation:

z ^ 4 + 6z-6z-11 = 0

z ^ 4-11 = 0

z = ± ∜ 11.

We got two solutions: (6; -6; ∜ 11) and (6; -6; -∜ 11).

## python – How can the game graphics be stabilised when after each frame hundreds of calculations are taking place?

I am building a very basic 2D game purely using pygame library in Python 3x. The “game object” is blit(ed) onto the screen using a loop and after each pass, there are calculations taking place in the background for example, to test for collision. Now as the game get’s more complex with more features, the calculations take longer and hence the “game object” is put onto the screen once, but disappears for a split second when the calculations are taking place and appears again during the second pass, meaning it flickers. How can I tackle this problem? I cannot move ahead with more complex calculations for other features without avoiding the flickering due to more time required for the calculations.

## equation solving – How can conditional expressions be used in calculations?

I have a fairly simple system whose solution involves conditional expressions. The system is

``````A = {{3, 1}, {2, 3}, {1, 5}};
qVec = Array(q, 3);
needs = (qVec^2).A;
k = {2, 3};
Solve(Flatten({needs == k, Thread(qVec >= 0)}), qVec)
``````

and I get the following output

``````{{q(2) -> ConditionalExpression(Sqrt(1 - 2 q(1)^2), 0 < q(1) < 1/Sqrt(2)),
q(3) -> ConditionalExpression(Sqrt(3 - q(1)^2 - 3 (1 - 2 q(1)^2))/
Sqrt(5), 0 < q(1) < 1/Sqrt(2))}, {q(1) -> 0, q(2) -> 1,
q(3) -> 0}, {q(1) -> 1/Sqrt(2), q(2) -> 0, q(3) -> 1/Sqrt(2)}}
``````

I have two questions:

• Why do I get three solutions when inequality signs in the first would include the last two?
• How can I use the ConditionalExpression to obtain a Table of the points solving these equations? I want to do this automatically as A or k change.

## performance – How can I speed up my calculations with loops? Python

I wrote this code. But it works very slowly.

I’m figuring out how many times I have to run the case generator to find numbers less than or equal to inv, in this case six. I count the number of attempts until a digit <= 6 is generated. I find inv equal to 1 and repeat the loop. Until inv is 0. I will keep trying to generate six digits <= 6.

And I will repeat all this 10 ** 4 degrees again to find the arithmetic mean.

Help me speed up this code. Works extremely slowly. The solution should be without third-party modules. I would be immensely grateful. Thank!

``````import random

inv = 6

def math_count(inv):
n = 10**4
counter = 0
while n != 0:
invers = inv
count = 0
while invers > 0:
count += 1
random_digit = random.randint(1, 45)
if random_digit <= invers:
invers -= 1
counter += count
count = 0

if invers == 0:
n -= 1
invers = inv

return print(counter/10**4)

math_count(inv)
``````

## ruby on rails – Nested attributes, column calculations, and where statement

I am not getting the output I am looking for seems like I might be calling my variable incorrectly

Here is my controller variable for @vendor
`@vendors = User.inlcudes(line_items: ({ sale: :skiswap})).where(sales: {skiswap_id: @skiswap.id})`

then have

``````      <% @vendors.each do |vendor| %>
<tr class="group border-t border-gray-400 hover:bg-gray-100">
<td class="p-3"><%= vendor.company %></td>
<td class="p-3"><%= vendor.name  %></td>
<td class="p-3"><%= vendor.email%></td>
<td class="p-3"><%= number_to_phone(vendor.phone_number, area_code: true)%></td>
<td class="p-3"><%= vendor.line_items.sum(:total_price)%></td>
<% end %>
``````

The line
`<td class="p-3"><%= vendor.line_items.sum(:total_price)%></td>`
is not using the original where statement, so my total is incorrect.

the server output lines shows this

``````  SQL (1.7ms)  SELECT "users"."id" AS t0_r0, "users"."email" AS t0_r1, "users"."encrypted_password" AS t0_r2, "users"."reset_password_token" AS t0_r3, "users"."reset_password_sent_at" AS t0_r4, "users"."remember_created_at" AS t0_r5, "users"."confirmation_token" AS t0_r6, "users"."confirmed_at" AS t0_r7, "users"."confirmation_sent_at" AS t0_r8, "users"."unconfirmed_email" AS t0_r9, "users"."first_name" AS t0_r10, "users"."last_name" AS t0_r11, "users"."time_zone" AS t0_r12, "users"."accepted_terms_at" AS t0_r13, "users"."accepted_privacy_at" AS t0_r14, "users"."announcements_read_at" AS t0_r15, "users"."admin" AS t0_r16, "users"."created_at" AS t0_r17, "users"."updated_at" AS t0_r18, "users"."invitation_token" AS t0_r19, "users"."invitation_created_at" AS t0_r20, "users"."invitation_sent_at" AS t0_r21, "users"."invitation_accepted_at" AS t0_r22, "users"."invitation_limit" AS t0_r23, "users"."invited_by_type" AS t0_r24, "users"."invited_by_id" AS t0_r25, "users"."invitations_count" AS t0_r26, "users"."company" AS t0_r27, "users"."phone_number" AS t0_r28, "line_items"."id" AS t1_r0, "line_items"."quantity" AS t1_r1, "line_items"."price" AS t1_r2, "line_items"."total_price" AS t1_r3, "line_items"."created_at" AS t1_r4, "line_items"."updated_at" AS t1_r5, "line_items"."consigner_type" AS t1_r6, "line_items"."consigner_amount" AS t1_r7, "line_items"."skiswap_take" AS t1_r8, "line_items"."sale_id" AS t1_r9, "line_items"."tag" AS t1_r10, "line_items"."inventory_id" AS t1_r11, "sales"."id" AS t2_r0, "sales"."amount" AS t2_r1, "sales"."total_amount" AS t2_r2, "sales"."tax" AS t2_r3, "sales"."vendor_payout" AS t2_r4, "sales"."public_payout" AS t2_r5, "sales"."comments" AS t2_r6, "sales"."skiswap_id" AS t2_r7, "sales"."created_at" AS t2_r8, "sales"."updated_at" AS t2_r9, "sales"."remaining_balance" AS t2_r10, "sales"."complete" AS t2_r11, "sales"."void" AS t2_r12, "skiswaps"."id" AS t3_r0, "skiswaps"."swap_name" AS t3_r1, "skiswaps"."user_id" AS t3_r2, "skiswaps"."description" AS t3_r3, "skiswaps"."vendor_precentage" AS t3_r4, "skiswaps"."website" AS t3_r5, "skiswaps"."contact_name" AS t3_r6, "skiswaps"."contact_email" AS t3_r7, "skiswaps"."contact_number" AS t3_r8, "skiswaps"."created_at" AS t3_r9, "skiswaps"."updated_at" AS t3_r10, "skiswaps"."event_address" AS t3_r11, "skiswaps"."state" AS t3_r12, "skiswaps"."city" AS t3_r13, "skiswaps"."zip" AS t3_r14, "skiswaps"."public_precentage" AS t3_r15, "skiswaps"."tax" AS t3_r16 FROM "users" LEFT OUTER JOIN "inventories" ON "inventories"."user_id" = "users"."id" LEFT OUTER JOIN "line_items" ON "line_items"."inventory_id" = "inventories"."id" LEFT OUTER JOIN "sales" ON "sales"."id" = "line_items"."sale_id" LEFT OUTER JOIN "skiswaps" ON "skiswaps"."id" = "sales"."skiswap_id" WHERE "sales"."skiswap_id" = \$1  (("skiswap_id", 3))
↳ app/views/pos_dashboard/index.html.erb:40
(0.6ms)  SELECT SUM("line_items"."total_price") FROM "line_items" INNER JOIN "inventories" ON "line_items"."inventory_id" = "inventories"."id" WHERE "inventories"."user_id" = \$1  (("user_id", 3))
↳ app/views/pos_dashboard/index.html.erb:46
CACHE  (0.0ms)  SELECT SUM("line_items"."total_price") FROM "line_items" INNER JOIN "inventories" ON "line_items"."inventory_id" = "inventories"."id" WHERE "inventories"."user_id" = \$1  (("user_id", 1))
``````

The total amount is accurate for the Users total_price but not for total_price within that swap…

Any help would be great

## calculations – Holga 120 WPC exposure times

Why would you commit any more film until you have had the first roll from any film camera developed? Get the first roll developed and see what it looks like.

If it’s massively over or under exposed, then dedicate the next roll to test shots where you systematically start at a longer exposure and then decrease the exposure time about one-half stop each frame or two. Don’t forget to write down the exposure times for each frame so you’ll know what you did for the frames that come out properly exposed.

Doing it systematically for one roll will almost certainly get you where you want to be with less “wasted” film that trying to hit the nail on the head haphazardly for several rolls before you get lucky and hit it.

EV15 at ISO 100 and f/133 is around 1/2 second. This should be proper exposure for a brightly sunlit scene. The problem with calculating an f-number from the absolute size of a physical aperture to determine exposure with a pinhole camera is that “focal length” isn’t exactly defined in the same way as it is with refractive lenses.

Having said that, most 120 cameras have more than 39.9mm between the lens board and the film plane. Does your Holga only have about 40mm (1.6 inches) between the pinhole and the film plane? That’s the focal length that figures to f/133 with a 0.3mm entrance pupil (aperture).

Another consideration is that with an aperture that narrow, an appreciable amount of the light going through it will be scattered due to the effects of diffraction. Much of that scattered light will fall outside the area of your negative.

Don’t forget that with film, any exposure longer than about one second or so will be subject to the Schwarzschild effect.

Most film manufacturers publish data sheets for each of their films that outline development times for shooting the film at different speeds as well as for developing the film when it is shot at the advertised sensitivity. They also include data regarding exposures longer than about one second (for most films) that are affected by the Schwarzschild effect, also known as reciprocity failure. Each film has different characteristics, and how much compensation must be made for long exposures can vary significantly from one film to the next.