text:
<< problem 85 - Counting rectangles Prime power triples - problem 87 >>

# Problem 86: Cuboid route

A spider, S, sits in one corner of a cuboid room, measuring 6 by 5 by 3, and a fly, F, sits in the opposite corner.
By travelling on the surfaces of the room the shortest "straight line" distance from S to F is 10 and the path is shown on the diagram.

However, there are up to three "shortest" path candidates for any given cuboid and the shortest route doesn't always have integer length.

It can be shown that there are exactly 2060 distinct cuboids, ignoring rotations, with integer dimensions,
up to a maximum size of M by M by M, for which the shortest route has integer length when M = 100.
This is the least value of M for which the number of solutions first exceeds two thousand; the number of solutions when M = 99 is 1975.

Find the least value of M such that the number of solutions first exceeds one million.

# My Algorithm

Let's assume a is the longest side of the cuboid, b and c are shorter: a >= b >= c
If I unfold the cuboid, then the spider walks d = sqrt{a^2 + (b+c)^2}

All I have to do is counting all integer solutions of this equation ... which took me some time.

In case I find such a valid pair (a, b+c) where the shortest path is an integer then combinations
will return the number of different cuboids (a, b, c) that can be constructed.

1. if a is longer than b+c:
any combination (b,c) where b >= c and b+c = b_c produces a valid cuboid (a,b,c) and there are dfrac{b+c}{2} such combinations
e.g. b_c = 7 → (b,c) = {(6,1), (5,2), (4,3)} → \lfloor 7/2 \rfloor = 3 elements
e.g. b_c = 10 → (b,c) = {(9,1), (8,2), (7,3), (6,4), (5,5)} → \lfloor 10/2 \rfloor = 5 elements

2. else a < b+c. Keep in mind that a is still the longest side, so some combinations of (b,c) must be rejected:
a >= b >= c means that a >= b >= dfrac{b+c}{2} because b >= c
e.g. a = 6 and b_c = 8 → (a,b,c) = {(6,6,2), (6,5,3), (6,4,4)} → 3 elements, rejected (6,7,1) because a \ngeq b

I wrote two functions:

• countSingle returns the number of paths for a given side length a
• countAll returns the number of paths for all cuboids where a doesn't exceed the parameter limit
Both functions produce the same result, albeit countSingle is much slower for large input
(but still finds the solution to the original problem in less than 0.05 seconds).

countSingle follows a pseudo-brute-force approach and analyzes all potential b_c = b + c whether they form a valid triangle.
It was the first code I had for this problem but couldn't solve the much larger Hackerrank input space.

countAll evaluates Euclid's formula (see en.wikipedia.org/wiki/Pythagorean_triple) to find all basic triangles and all of their multiples.

# Interactive test

You can submit your own input to my program and it will be instantly processed at my server:

This live test is based on the Hackerrank problem.

Number of test cases (1-5):

Input data (separated by spaces or newlines):

This is equivalent to
echo "1 100" | ./86

Output:

(please click 'Go !')

(this interactive test is still under development, computations will be aborted after one second)

# My code

… was written in C++11 and can be compiled with G++, Clang++, Visual C++. You can download it, too.

The code contains #ifdefs to switch between the original problem and the Hackerrank version.
Enable #ifdef ORIGINAL to produce the result for the original problem (default setting for most problems).

       #include <cmath>
#include <vector>
#include <iostream>

// oeis.org/A143714

// how many combinations a,b,c exist for b_c = b + c
unsigned int combinations(unsigned int a, unsigned int b_c)
{
// the longest side must be a => if 2a < b + c then either b or c (or both !) would be longer than a
if (2*a < b_c)
return 0;

// if a is longer than b+c:
// any combination (b,c) where b >= c and b+c = b_c produces a valid cuboid (a,b,c),
// there are (b+c) / 2 such combinations
// e.g. b_c =  7 => (b,c) = {(6,1), (5,2), (4,3)}               =>  7/2 = 3 elements
// e.g. b_c = 10 => (b,c) = {(9,1), (8,2), (7,3), (6,4), (5,5)} => 10/2 = 5 elements
if (a >= b_c)
return b_c / 2;

// now a < b+c:
// a is still the longest side, but some combinations of (b,c) must be rejected:
// a >= b >= c means that a >= b >= (b+c)/2 because b >= c
// e.g. a = 6 and b_c = 8 => (a,b,c) = {(6,6,2), (6,5,3), (6,4,4)}, rejected (6,7,1)
return a - (b_c - 1) / 2; // b+c minus one because b = c is not rejected
}

// count how many paths exists with length a (mediocre speed)
unsigned long long countSingle(unsigned int a)
{
unsigned long long sum = 0;

// we encounter the same sum b+c many times (for different b and c)
// lets try it the other way around:
// step through all sums b+c and figure out the possible combinations of b and c
// since a >= b and a >= c we also know 2*a >= b+c
// I'll call b+c from now on "b_c"
for (unsigned int b_c = 1; b_c <= 2 * a; b_c++)
{
// triangle with right angle ?
auto diagonalSquared = a * a + b_c * b_c;
unsigned int root = sqrt(diagonalSquared);
// diagionalSquared needs to be a perfect square
if (root * root == diagonalSquared)
sum += combinations(a, b_c);
}

return sum;
}

// greatest common divisor
unsigned int gcd(unsigned int x, unsigned int y)
{
while (x != 0)
{
auto temp = x;
x = y % x;
y = temp;
}
return y;
}

// count combinations per path length
std::vector<unsigned long long> countAll(unsigned int limit)
{
// result
std::vector<unsigned long long> solutions(limit + 1, 0);

// find basic Pythagorean triples
for (unsigned int m = 1; m <= sqrt(2*limit); m++)
for (unsigned int n = 1; n < m; n++)
{
if (m % 2 == n % 2) // if the inner loop is (n = (m%2)+1; n < m; n += 2)
continue;         // then this check could be removed
if (gcd(m, n) != 1)
continue;

// two sides
auto x = m*m - n*n;
auto y = 2*m*n;
//auto z = m*m + n*n;

// ... and now scan all multiples
for (unsigned int k = 1; k*x <= limit; k++)
solutions[k*x] += combinations(k*x, k*y);
for (unsigned int k = 1; k*y <= limit; k++)
solutions[k*y] += combinations(k*y, k*x);
}

return solutions;
}

int main()
{
//#define ORIGINAL
#ifdef ORIGINAL
unsigned int sum = 0;
unsigned int a   = 0;
// until exceeding one million
while (sum <= 1000000)
sum += countSingle(++a);

// print result
std::cout << a << std::endl;

#else

// count combinations per path length
auto solutions = countAll(1000000);

// compute sum of all path lengths
std::vector<unsigned long long> total;
unsigned long long sum = 0;
for (auto i : solutions)
{
sum += i;
total.push_back(sum);
}

unsigned int tests;
std::cin >> tests;
while (tests--)
{
unsigned int maxA;
std::cin >> maxA;
// simple lookup
std::cout << total[maxA] << std::endl;
}
#endif

return 0;
}

This solution contains 20 empty lines, 33 comments and 6 preprocessor commands.

# Benchmark

The correct solution to the original Project Euler problem was found in 0.03 seconds on an Intel® Core™ i7-2600K CPU @ 3.40GHz.
(compiled for x86_64 / Linux, GCC flags: -O3 -march=native -fno-exceptions -fno-rtti -std=gnu++11 -DORIGINAL)

See here for a comparison of all solutions.

Note: interactive tests run on a weaker (=slower) computer. Some interactive tests are compiled without -DORIGINAL.

# Changelog

March 15, 2017 submitted solution

# Hackerrank

My code solves 10 out of 10 test cases (score: 100%)

# Difficulty

Project Euler ranks this problem at 35% (out of 100%).

Hackerrank describes this problem as hard.

Note:
Hackerrank has strict execution time limits (typically 2 seconds for C++ code) and often a much wider input range than the original problem.
In my opinion, Hackerrank's modified problems are usually a lot harder to solve. As a rule thumb: brute-force is rarely an option.

# Heatmap

Please click on a problem's number to open my solution to that problem:

 green solutions solve the original Project Euler problem and have a perfect score of 100% at Hackerrank, too yellow solutions score less than 100% at Hackerrank (but still solve the original problem easily) gray problems are already solved but I haven't published my solution yet blue solutions are relevant for Project Euler only: there wasn't a Hackerrank version of it (at the time I solved it) or it differed too much orange problems are solved but exceed the time limit of one minute or the memory limit of 256 MByte red problems are not solved yet but I wrote a simulation to approximate the result or verified at least the given example - usually I sketched a few ideas, too black problems are solved but access to the solution is blocked for a few days until the next problem is published [new] the flashing problem is the one I solved most recently

I stopped working on Project Euler problems around the time they released 617.
 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500
 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600
 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680
The 310 solved problems (that's level 12) had an average difficulty of 32.6% at Project Euler and
I scored 13526 points (out of 15700 possible points, top rank was 17 out of ≈60000 in August 2017) at Hackerrank's Project Euler+.

My username at Project Euler is stephanbrumme while it's stbrumme at Hackerrank.

Look at my progress and performance pages to get more details.

 << problem 85 - Counting rectangles Prime power triples - problem 87 >>
more about me can be found on my homepage, especially in my coding blog.
some names mentioned on this site may be trademarks of their respective owners.
thanks to the KaTeX team for their great typesetting library !


text:
## Linear Algebra

Real vector spaces, subspaces, spanning sets, basis sets, dimension of a vector space. Solution of a system of linear equations. Row space and column space of a matrix, rank of a matrix, elementary row and column operations of a matrix. Inversion of square matrices, rank factorization of a matrix. Properties of determinant. Linear transformations, range and null space of a linear transformation, rank-nullity theorem. Matrix representation of a linear transformation. Inner product spaces, normed linear spaces, examples of different normed linear spaces, orthonormal basis sets. Eigenvalues, eigenvectors, characteristic polynomials. Spectral theorem for real symmetric matrices. Singular value decompositions.

#### Study at Ashoka

[current_url]

format: plain


text:
# List of visually similar characters, for detecting spoofing and social engineering attacks

I'm trying to detect homograph attacks and other attacks where an attacker uses a spoof domain name that looks visually similar to a trusted domain name (e.g., bankofthevvest.com instead of bankofthewest.com).

Is there a dictionary or database of visually similar characters that's suitable for programmatic use?

For example, if I look up "l", I'd like to get back a list indicating that "l" is visually similar to "1" and "i" (at least in some fonts). If I look up "w", it might tell me that it's visually similar to "vv" (in some fonts). If I look up "d", it might tell me that it's visually similar to "cl" (in some fonts). At least for now, my focus is on visual similarity between ASCII characters. It's fine to ignore Unicode. (However, it's an extra bonus if there's a list that also knows about which Unicode characters are visually similar to each ASCII character.)

If such a thing already exists, I'd like to avoid re-inventing the wheel. Does such a list already exist?

Here's what I've found so far:

There are different approaches for homograph attacks. The success depends on the used font. For example in some fonts the small letter l looks very much like the capitalized letter I. And in others they don't.

# Similarities

Use similar characters. They substitute the real character.

• b ⇔ 6
• c ⇔ (
• g ⇔ q, 9
• C ⇔ (
• G ⇔ 6
• L ⇔ l, I, 1, |
• O ⇔ 0
• S ⇔ 5
• V ⇔ U
• Z ⇔ 2

# Sound Alteration Characters

Some language, like German, have special characters (e.g. umlaut). Under some circumstances they may look like a character without them:

• a ⇔ ä, à, á
• e ⇔ ë, è, é
• i ⇔ ï, ì, í
• o ⇔ ö, ò, ó
• u ⇔ ü, ù, ú

# Multi-letter

In some fonts the multi-letter approach is very successful.

• a ⇔ ci
• d ⇔ cl
• g ⇔ cj
• m ⇔ rn
• A ⇔ fi
• W ⇔ VV

# Constructions

Construct a single character from multiple characters. Very popular is vv instead of w.

• A ⇔ /\
• B ⇔ |3
• D ⇔ |)
• G ⇔ (¬
• H ⇔ |-|
• K ⇔ |<, |{
• L ⇔ |_
• M ⇔ |v|
• N ⇔ |\|
• V ⇔ \/

# Injections

Injection involves inserting meaningless characters into a string, especially within a domain/url.

Whitespaces are often overlooked in this case. The Zero Width Whitespace () is a nice tool under some circumstances.

Try looking under the term "Homoglyph" instead of "homograph".

For instance, this might be what you wanted:

https://codebox.net/pages/homoglyph-detection

It contains code and dictionaries.


text:
# A question about solving multiple integral

What i wanna ask is that how do you tackle the problem oif multiple integral when you are not able to draw the diagram?Also how you would determine the order of integrand. For instance, what is the volume bounded by the surface $x^3+xyz^2, x^3y^2+z^y, z+y+2x=10$ Those function are just creat without any try, so may be it is not solvable, but what i want to say is if we face the function which cannot really draw it, how would you deal with it.

-
I would suggest that you first think about the two-dimensional case and how you would tackle it without a diagram. –  Phira May 1 '12 at 9:20

First of all, "$x^3 + xyz^2$" is not a surface. "$x^3 + xyz^2 = c$" for some constant $c$, defines a surface.

Second of all, when you have a volume delimited by functions like this : $f_1(x,y,z) = 0$, $f_2(x,y,z) = 0$, $\dots$, $f_n(x,y,z) = 0$, the idea that works most of the time (and is almost always the only one) is to pull off a change of a variables that results in some integral of this form : $$\iiint_V f(x,y,z) \, dx \, dy \, dz = \int_{a}^{b} \int_{c(u)}^{d(u)} \int_{e(u,v)}^{g(u,v)} f(u,v,w) \frac{\partial(u,v,w)}{\partial(x,y,z)}\, dw \, dv \, du$$ where $u$, $v$ and $w$ are chosen as functions of $x,y,z$ and this guy $\left( \frac{\partial(u,v,w)}{\partial(x,y,z)} \right)$ is the jacobian of your change of variables. This way you can compute your first integral with respect to $w$ and obtain a resulting function of $u$ and $v$, which you can then integrate with respect to $v$ to obtain a function of $u$ and then complete your integral.

The trick always resides in the change of variables. Here is an example I am fond of.

Compute the integral $$\iiint_V \frac 1{(x+y+z)^3} \, dx \, dy \, dz$$ where $V = \{ (x,y,z) \in \mathbb R^3 \, | \, x,y,z \ge 0, x+y+z \le 1 \}$.

Now clearly we would want to change the $x+y+z$ to some variable, right? So let us do that : let $w(x,y,z) = x+y+z$, because $x+y+z$ feels like an "height" component for me, so I put it in the third variable (that's rather arbitrary, but it'll help computations). What about $u$ and $v$? Since they don't appear in the integral, let's make them as simple as possible : $u(x,y,z) = x$, and $v(x,y,z) = y$. (Another reason for why I let $u = x$ and $v = y$ is because I only want to change one coordinate, not all three of them, so perhaps the less notationally convenient way to do this is to let "$x = x$", "$y = y$ and $w = x+y+z$ (the new $x$, "$u$", has the same value as $x$, and the new $y$, $v$, has the same value as $y$). Now what happens with the integral? Well if you compute the jacobian : $$\frac{\partial(u,v,w)}{\partial(x,y,z)} = \left| \begin{bmatrix} 1 & 0 & 0 \\\ 0 & 1 & 0 \\\ 1 & 1 & 1 \end{bmatrix} \right| = 1$$ (Maybe I computed the transpose of the jacobian or some weird turning around of numbers... I never recall in which order the columns appear! But I have faith that the jacobian is $1$ for geometrical reasons.)

It remains to compute the bounds $a$,$b$,$c(u)$, $d(u)$, $e(u,v)$ and $g(u,v)$ to finish. Just take one variable at a time and look at its maximal range in function of the preceding variables which have bounds determined : the constraints are $x,y,z \ge 0$ and $x + y + z \le 1$. We need to translate those constraints in $u,v,w$. The first one says that $w - v - u, v, w \ge 0$, and the second one says that $u \le 1$. Now play around a little bit and you'll get $0 \le u+v \le w \le 1$, $u \ge 0$, $v \ge 0$. This means that if we start with the variable $u$, $0 \le u \le 1$, then fixing some $u$, we have $0 \le v \le 1-u$, and now fixing $u$ and $v$ gives $u+v \le w \le 1$. (You can check that these bounds are indeed correct by making sure that an element of $\mathbb R^3$ is in $V$ if and only if it satisfies those conditions.)

Hence $$\iiint_V \frac 1{(x+y+z)^3} \, dV = \int_0^1 \int_0^{1-u} \int_{u+v}^1 \frac 1{w^3} \, dw \, dv \, du.$$ The rest is elementary integrals ; I leave them up to you if you wish to try.

Hope that helps,

-
i see you point, but if there involves more surface like 4 or more, then it seems that it is not easy to find the bound. And i think transformation is a good idea but it may be very difficult to think what should be transformed like sometime we may need to transform into the spherical coordinates and sometime just one dummy variable is fine –  Mathematics May 1 '12 at 17:50
@Mathematics (...) It's not like multiple integrals are supposed to be easy to compute! I never said it was easy, I'm just saying that in the general case that is the most efficient trick we have ; Phira's answer goes in that direction, that in general, there is no "simple" expression to perform this task... integrating between $a$ and $b$ can already be damn hard in $\mathbb R$ as it is, don't expect things to get any easier in $\mathbb R^3$! –  Patrick Da Silva May 1 '12 at 19:16

I doubt that there is a general method to show whether an integral between surfaces can be expressed "simply" (because it is already difficult to decide whether a one-dimensional integral can be expressed with elementary functions or whether $\zeta(5)$ is irrational).

For polynomial surfaces, one way to reduce the problem to one-dimensional integrals is cylindrical algebraic decomposition AFTER you decide on which side of each surface you search for your bounded region (but this can be decided by trial and error to find the non-empty regions).

The only general method is: Calculate the curves of intersection if you can, decide on the relative position of the surfaces within the closed portions of these curves of intersection and then parametrize with the curve and the height above the surfaces in the interior. But it is more instructive to do this first for a 2-dimensional case and only make the picture afterwards to understand the method better.

-


text:
## Algebra 1: Common Core (15th Edition)

Published by Prentice Hall

# Chapter 1 - Foundations for Algebra - Chapter Test - Page 73: 17

#### Answer

$-3b-21$

#### Work Step by Step

The distributive property allows us to distribute anything multiplied by something inside of the parenthesis to whatever is inside of the parenthesis. Thus, we distribute the negative 3 to everything inside the parenthesis, giving us an answer of $-3b-21$. (A key rule to remember is that subtracting a negative is the same as addition, so b-(-7) is the same as b+7).

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.


text:
- Current Issue - Ahead of Print Articles - All Issues - Search - Open Access - Information for Authors - Downloads - Guideline - Regulations ㆍPaper Submission ㆍPaper Reviewing ㆍPublication and Distribution - Code of Ethics - For Authors ㆍOnline Submission ㆍMy Manuscript - For Reviewers - For Editors
 Fractional differentiation of the product of Appell function $F_{3}$ and multivariable $H$-functions Commun. Korean Math. Soc. 2016 Vol. 31, No. 1, 115-129 https://doi.org/10.4134/CKMS.2016.31.1.115Printed January 31, 2016 Junesang Choi, Jitendra Daiya, Dinesh Kumar, and Ram Kishore Saxena Dongguk University, Jai Narain Vyas University, Jai Narain Vyas University, Jai Narain Vyas University Abstract : Fractional calculus operators have been investigated by many authors during the last four decades due to their importance and usefulness in many branches of science, engineering, technology, earth sciences and so on. Saigo \emph{et al}. \cite{SaigoMaeda1996} evaluated the fractional integrals of the product of Appell function of the third kernel $F_3$ and multivariable $H$-function. In this sequel, we aim at deriving the generalized fractional differentiation of the product of Appell function $F_3$ and multivariable $H$-function. Since the results derived here are of general character, several known and (presumably) new results for the various operators of fractional differentiation, for example, Riemann-Liouville, Erd\'{e}lyi-Kober and Saigo operators, associated with multivariable $H$-function and Appell function $F_3$ are shown to be deduced as special cases of our findings. Keywords : multivariable $H$-function, Saigo fractional calculus operators, Saigo-Maeda operators, fractional calculus, Appell function $F_{3}$, $H$-function, Riemann-Liouville derivative operator MSC numbers : Primary 26A33; Secondary 33C45 Downloads: Full-text PDF

 Copyright © Korean Mathematical Society. The Korea Science Technology Center (Rm. 411), 22, Teheran-ro 7-gil, Gangnam-gu, Seoul 06130, Korea Tel: 82-2-565-0361  | Fax: 82-2-565-0364  | E-mail: paper@kms.or.kr   | Powered by INFOrang Co., Ltd


text:
# Frenet frame as basis in a product

Let $\gamma (t)$ be an embedded curved in $\mathbb{R}^3$ and let $T(t),\ N(t)$ and $B(t)$ be its Frenet frame. Let C be a unit circle (or another closed embedded curve in $\mathbb{R}^3$) and fix a point on $C$, say $C(0)$. We glue at every point of $\gamma(t)$ the curve $C$ at point $C(0)$ such that $N(t)$ is tangent to $C$ and $B(t)$ is normal. This will produce a (not necessarily embedded) surface in $\mathbb{R}^3$. Given $\gamma$ and $C$ how do we plot in Mathematica this construction?

More generally, how can we plot this without fixing the point C(0).I.e. given two Jordan curves $\gamma$ and $C$ we declare that the tangent, normal and binormal of $\gamma$ are, respectively, the normal, binormal and tangent of $C$. How do we plot this, given $\gamma$ and $C$?

Thank you.

In the first paragraph of the OP, it says the normal $N(t)$ of $\gamma$ should be tangent to $C$ and in the second, it says the normal should be the binormal. I went with the first one. The OP also asks how to do this without fixing the base point $C(0)$. I don't know what that means. You could have the base point depend on $t$ or $\gamma(t)$ by using $C(u(t))$ instead of $C(0)$ (or cc[c0] in the code below).

The idea is simple enough: A Frenet frame can be viewed as a rotation matrix, so all you need to do is rotate and translate $C$ into place on $\gamma$, using the frames of the two curves.

(* the curve gamma *)
gg[t_] := {5 Cos[t], 5 Sin[t], 3 ArcTan[t]};
gFSF[t_] = Simplify@Last@FrenetSerretSystem[gg[t], t];

(* the curve C *)
Clear[cFSF];
pts = {{0, 0, 1}, {1, -1, 0}, {2, 0, 1}, {3, 2, 0}, {1, 3, -1}, {0, 2,
0}, {-1, 1, 1}(*,{0,0,1}*)};
cc = BSplineFunction[pts, SplineClosed -> True];
cFSF[t0_?NumericQ] := Append[#, Cross @@ #] &[  (* FrenetSerretSystem sometimes failed *)
Table[Indexed[Derivative[n][cc][t], k], {n, 2}, {k, 3}] /.
t -> t0] // Orthogonalize;
c0 = 0.95;             (* cc[c0] = C(0), base point *)
cFSF0 = cFSF[c0];      (* Frenet frame at base point *)
Show[
ParametricPlot3D[(cc[t] - cc[c0]), {t, 0, 1},
MeshFunctions -> {#4 &}, Mesh -> {{c0}}, AxesLabel -> {x, y, z}],
Graphics3D[{Thick,
MapThread[{#2, Arrow[{0 cc[c0], 0 cc[c0] + #}]} &, {cFSF0, {Blue,
Orange, Darker@Green}}]}],
PlotRange -> All
]

Show[
ParametricPlot3D[gg[t], {t, -2 Pi, 2 Pi},
PlotStyle -> {Thick, Red}],
ParametricPlot3D[
gg[t] + Transpose@gFSF[t].RotateRight@cFSF0.(cc[s] - cc[c0]),
{t, -2 Pi, 2 Pi}, {s, 0, 1}, Mesh -> {40, 0}],
PlotRange -> 8, ImageSize -> 300, SphericalRegion -> True
]

• thank you for this instructive answer. I still have difficulty understanding the aim of the question but have learned a lot from your answer:) – ubpdqn May 13 '17 at 5:54
• Thank you. It answers my question very well. – Vladimir May 18 '17 at 13:39

I am not sure I have completely understood but perhaps this is a start:

f[t_] := {Cos[t], Sin[t], t}
{tg, n, b} = FullSimplify[FrenetSerretSystem[f[t], t][[2]]];
su[u_] := {n, b} /. t -> u
pp = ParametricPlot3D[f[t], {t, 0, 2 Pi}];
Manipulate[
Show[Graphics3D[
Polygon@Table[
f[par] + d {Cos[j] + 1, Sin[j]}.su[par], {j, 0, 2 Pi, 0.1}]], pp,
AspectRatio -> Automatic,
PlotRange -> {{-2, 2}, {-2, 2}, {0, 7}}], {par, 0, 2 Pi}, {d, 0.1,
1}]

• Thank you, this is very useful. – Vladimir May 18 '17 at 13:39


text:
New Software and Platforms
Partnerships and Cooperations
Bibliography
 PDF e-Pub

## Section: New Results

### Effective higher-dimensional algebra

Participants : Cyrille Chenavier, Pierre-Louis Curien, Yves Guiraud, Cédric Ho Thanh, Maxime Lucas, Philippe Malbos, Samuel Mimram, Jovana Obradović, Matthieu Sozeau.

#### Higher linear rewriting

Yves Guiraud and Philippe Malbos have completed a four-year long collaboration with Eric Hoffbeck (LAGA, Univ. Paris 13), whose aim was to develop a theory of rewriting in associative algebras, with a view towards applications in homological algebra. They adapted the known notion of polygraph  [70] to higher-dimensional associative algebras, and used these objects to develop a rewriting theory on associative algebras that generalises the two major tools for computations in algebras: Gröbner bases  [69] and Poincaré-Birkhoff-Witth bases  [106]. Then, they transposed the construction of [12], based on an extension of Squier's theorem  [109] in higher dimensions, to compute small polygraphic resolutions of associative algebras from convergent presentations. Finally, this construction has been related to the Koszul homological property, yielding necessary or sufficient conditions for an algebra to be Koszul. The resulting work has just been submitted for publication [48].

Cyrille Chenavier has continued his work on reduction operators, a functional point of view on rewriting in associative algebras initiated by Berger  [63], on which his PhD thesis was focused [4]. First, using the lattice structure of the reduction operators, he gave a new algebraic characterisation of confluence, and developed a new algorithm for completion, based on an iterated use of the meet-operation of the lattice [29]. Then he related this completion procedure to Faugère's F4 completion procedure for noncommutative Gröbner bases  [80]. Finally, he gave a construction of a linear basis of the space of syzygies of a set of reduction operations, and used this work to optimise his completion procedure [46].

#### Cubical higher algebra

Maxime Lucas, supervised by Yves Guiraud and Pierre-Louis Curien, has applied the rewriting techniques of Guiraud and Malbos [93] to prove coherence theorems for bicategories and pseudofunctors. He obtained a coherence theorem for pseudonatural transformations thanks to a new theoretical result, improving on the former techniques, that relates the properties of rewriting in 1- and 2-categories [32]. Then he has transposed to a cubical setting, and improved, the results of [12]. This first involved a deep foundational work on the connections between globular and cubical higher categories [52], generalising several already known links in a unique theoretical setting  [67], [68], [58], [111]. Then, he could prove Squier's theorem, giving a construction of a polygraphic resolution of monoids in the category of cubical Gray monoids [51]. All these results are contained in his PhD thesis, that was successfully defended in December 2017 [24].

#### Coherent Presentations of Monoidal categories

The work of Pierre-Louis Curien and Jovana Obradović on categorified cyclic operads has been condtionally accepted in the Journal Applied Categorical Structures [47]. The revision will include a careful treatment of weakened identity laws, as well of weakened equivariance laws. It will also include the details of an example and an illustration of the work. The example involves a generalisation of profunctors, and the application is to the notion of anti-cyclic operad, which they prove to be “sign-coherent”.

#### Opetopes

Opetopes are a formalisation of higher many-to-one operations leading to one of the approaches for defining weak $\omega$-categories. Opetopes were originally defined by Baez and Dolan. A reformulation (leading to a more carefully crafted definition) has been later provided by Batanin, Joyal, Kock and Mascari, based on the notion of polynomial functor. Pierre-Louis Curien has developped a corresponding syntax, which he presented at the workshop “Categories for homotopy and rewriting” (CIRM, September 2017).

Cédric Ho Thanh started his PhD work around opetopes in September 2017. His first contributions include a careful embedding of opetopic sets into polygraphs, and a (finite) critical pair lemma for opetopic sets. Indeed, opetopic sets seem to delimit a subset of polygraphs in which the basics of rewriting theory can be developped, without the anomalies already observed by Lafont and others happening, like the existence of a possibly infinite set of critical pairs in a rewriting system specified by finitely many rules. Opetopes are tree-like and hence first-order-term-like and that is the intuitive reason why these anomalies are avoided.

#### Higher Garside theory

Building on [9], Yves Guiraud is currently finishing with Matthieu Picantin (IRIF, Univ. Paris 7) a work that generalises already known constructions such as the bar resolution, several resolutions defined by Dehornoy and Lafont  [78], and the main results of Gaussent, Guiraud and Malbos on coherent presentations of Artin monoids [10], to monoids with a Garside family. This allows an extension of the field of application of the rewriting methods to other geometrically interesting classes of monoids, such as the dual braid monoids.

Still with Matthieu Picantin, Yves Guiraud develops an improvement of the classical Knuth-Bendix completion procedure, called the KGB (for Knuth-Bendix-Garside) completion procedure. The original algorithm tries to compute, from an arbitrary terminating rewriting system, a finite convergent presentation by adding relations to solve confluence issues. Unfortunately, this algorithm fails on standard examples, like most Artin monoids with their usual presentations. The KGB procedure uses the theory of Tietze transformations, together with Garside theory, to also add new generators to the presentation, trying to reach the convergent Garside presentation identified in [9]. The KGB completion procedure is partially implemented in the prototype Rewr, developed by Yves Guiraud and Samuel Mimram.

#### Foundations and formalisation of higher algebra

Yves Guiraud has started a collaboration with Marcelo Fiore (Univ. Cambridge) on the foundations of higher-dimensional categories, with the aim to define a general notion of polygraphs for various notions of algebraic structures. This is based on seeing higher categories as $n$-oids in a specific $n$-oidal category (a category with $n$ monoidal structures with exchange morphisms between them). With that point of view, a good notion of polygraph can be iteratively defined for monoids in any monoidal category with pullbacks, which is a sufficiently general setting for most purposes.

Eric Finster, Yves Guiraud and Matthieu Sozeau have started to explore the links between combinatorial higher algebra and homotopy type theory, two domains that describe computations with a homotopical point of view. Their first goal is to formalise the rewriting methods of [12] and [10] in homotopy type theory, establishing a first deep connection between the two fields. This direction will be explored further by Antoine Allioux, a PhD student co-directed by Guiraud and Sozeau, starting in February 2018.


text:
Q

# One day Reeta went to a jewellers shop with her mother. Her mother gave an old gold jewellery to the goldsmith to polish. Next day when they brought the jewellery back they found that there was a slight loss in its weight

Q11.  One day Reeta went to a jeweller’s shop with her mother. Her mother gave an old gold jewellery to the goldsmith to polish. Next day when they brought the jewellery back, they found that there was a slight loss in its weight. Can you suggest a reason for the loss in weight?

Aqua regia (mixture of HCl and $\dpi{80} HNO_{3}$ in the ratio 3:1) is used to polish gold ornaments. When dipped in the liquid, the gold layer starts dissolving which causes a reduction in the weight. The outer unpolished layer dissolves and the layer becomes shiny.


text:
# Question 52580

Nov 20, 2017

${\text{200 g MgCl}}_{2}$

#### Explanation:

The first thing that you need to do here is to figure out how many grams of magnesium chloride would be produced by the reaction at 100% yield.

To do that, use the molar mass of magnesium chloride

3 color(red)(cancel(color(black)("moles MgCl"_2))) * "95.211 g"/(1color(red)(cancel(color(black)("mole MgCl"_2)))) = "285.63 g"

This means that at 100%yierld, you would expect the reaction to produce $\text{285.63 g}$ of magnesium chloride.

However, you know that the reaction has a 73% yield, which means that for every $\text{100 g}$ of magnesium chloride that the reaction could theoretically produce, you only get $\text{73 g}$.

You can thus say that your reaction will produce

285.63 color(red)(cancel(color(black)("g MgCl"_2color(white)(.)"in theory"))) * overbrace(("73 g MgCl"_2 color(white)(.)"produced")/(100color(red)(cancel(color(black)("g MgCl"_2color(white)(.)"in theory")))))^(color(blue)("= 73% yield"))

$= \textcolor{\mathrm{da} r k g r e e n}{\underline{\textcolor{b l a c k}{\text{200 g MgCl"_2color(white)(.)"produced}}}}$

The answer is rounded to one significant figure, the number of sig figs you have for the number of moles of magnesium chloride that would be produced at 100%# yield.


text:
Grade 1 Lesson Plans Math Pdf, 2017 Mazda 3 Sp25 Bn Review, New Vista Health Services, 3 Bedroom Apartments In Dc For Cheap, Brown In Asl, New Hanover County Tax, Macbook Air Thunderbolt Ethernet Adapter Not Recognized, Lil Money Age, Flash Fiction Examples 100 Words, Psmo College Community Quota Rank List 2019, " />

Gulf Coast Camping Resort

how to solve egyptian fractions

These are unit fractions â fractions whose numerator is one. The way to solve this is to represent fractions using the fractions.Fraction class: >>> Fraction(1, 2) + Fraction(1, 3) + Fraction(1, 6) == Fraction(4, 4) True The question claims the algorithm is "A*", but that's not true. Do the same for 85/100, 90/100, 95/100, and if â¦ Your class of 10 students is on a eld trip to the bakery. Like the Rhind papyrus, the Egyptian Mathematical Leather Roll contains a table of Egyptian fraction expansions. Finally we suggest a web site that students might like to use as resource material for a small project. Monthly 61, 1954, pp. FIRST NAME: INSTRUCTIONS . In this video, Tanton explains a foolproof method for creating Egyptian fractions: See more posts on Egyptian math. If you are brave, I suggest you try solving the following greedily using the algorithm described: 2/20, 3/20, 4/20, 5/20, 6/20, 7/20â¦ 18/20, 19/20. After this brief introduction, hand out Egyptian Fractions, and have the students begin working either individually or in small groups to solve the problems. Details . Suppose we took this task as a very practical problem. Math. MP2: Reason Abstractly and Quantitatively. Likewise in the Egyptian fraction system, 7/24 is pretty close to 1/4, the first term in one of the possible ways to write 7/24. A unit fraction has numerator 1 as in An Egyptian fraction is a sum of unit fractions usually distinct For example Erdoumls and Straus conjectured that always has a solution over integers for Sierpinski conjectured that always has a solution over integers for All have been verified for the ErdoumlsndashStraus conjecture 1 but both are still unsolved problems The Rhind Papyrus and the Egyptian â¦ Function headers with pre and postconditions (10 pts)? * Take the fraction 80/100 and keep subtracting the largest possible Egyptian fraction till you get to zero. What do we do for step 4? Step 2. Introduction: The Egyptians of 3000 BC had an interesting way to represent fractions. Budding mathematicians solve three short answer problems. Show how you would cut the cakes into pieces. For example: Eye of Horus. Many of the fractions were easy. As they work, circulate around the room offering encouragement, quietly assessing progress, and answering questions. In mathematics, the greedy algorithm for Egyptian fractions is a greedy algorithm, first described by Fibonacci, for transforming rational numbers into Egyptian fractions.An Egyptian fraction is a representation of an irreducible fraction as a sum of distinct unit fractions, as e.g. MP1: Make Sense of Problems and Persevere in Solving Them. Purchase An Answer Below kathrine. Step 3. Modular d They refer to a series of unit fractions (fractions that have a numerator of 1) with different denominators, each a positive integer, that sum to a rational number. What is an Egyptian Fraction? seconds. It is usually easier to reduce fractions before squaring them. Is their answer equivalent to the modern solutions? For example, in the decomposition of 2:53 the answer to taking 30 ¯ of 53 is given as 1 + 3 Ì¿ + 10 ¯. Egyptian Fractions - Part 2 . Want to help your kids learn math? An Egyptian fraction is a fraction that can be expressed as a sum of two or more fractions, each with numerator 1. She tried converting these to other fractions that were easier to work with. Although they had a notation for 1 / 2 and 1 / 3 and 1 / 4 and so on (these are called reciprocals or unit fractions since they are 1 / n for some number n), their notation did not allow them to write 2 / 5 or 3 / 4 or 4 / 7 as we would today. CAKE SLICER. 6th grader, "Pablo", makes his Mathtrain debut showing us the Egyptian Method of Multiplication. Egyptian Fractions Ancient Egyptians used unit fractions, such as $\frac{1}{2}$ and $\frac{1}{3}$, to represent all fractions. Claim your free 24-page problem-solving booklet, and sign up to hear about new books, revisions, and sales or other promotions. Multiply the top of the left fraction by the top of the right fraction and write that answer on top, then multiply the bottom of each fraction and write that answer on the bottom. Introduction: The Egyptians of 3000 BC had an interesting way to represent fractions. minutes. A UNIT fraction is a fraction with a numerator one(1). Fractions notation as we know it was not in use generally until after 1500 AD. We look at how fractions can be represented in terms of Egyptian Fractions. workers paid. The Egyptians only used fractions with a numerator of 1. Imagine you are a teacher. These are unit fractions â fractions whose numerator is one. The hieroglyph for âRâ was used as the word âpartâ. Egyptian Fractions - Part 2. This will require patience and experimentation as we are not used to expressing fractions this way. The Egyptian mathematicians understood a little algebra and were capable of solving linear equations, and could solve simple quadratic equations by using a series of guesses to find the closest answer, a brute force method that was used for many centuries afterwards. (a) Let each circle below represent one cake. ? Check to see if you can simplify the fraction before you square it. Alex made a poster of Egyptian-style fractions, from 1/2 to 9/10. Egyptian Fraction Representation of 2/3 is 1/2 + 1/6 Egyptian Fraction Representation of 6/14 is 1/3 + 1/11 + 1/231 Egyptian Fraction Representation of 12/13 is 1/2 + 1/3 + 1/12 + 1/156 We can generate Egyptian Fractions using Greedy Algorithm. It's not wrong so the way. To solve a fraction multiplication question in math, line up the 2 fractions next to each other. Finding Egyptian fractions with A* search. EGYPTIAN Fractions Extra Resources + Check out Wolfram Alpha to check your answers. She had the most trouble with the 7ths and 9ths. Extant Egyptian sources are replete with examples where the non-Egyptian fraction m:n is decomposed by writing m as the sum of distinct divisors of n. Another common way used by the Egyptians to break a non-Egyptian fraction is to write it as 3 Ì¿ plus a unit fraction. Egyptian Fractions. Simply type in the fraction and the phrase Egyptian Fractions to check your answer. Egyptian fractions, which date to 1550 BC with examples surviving in the Rhind Mathematical Papyrus at the British Museum, boggle the brain with their convoluted and laborious way of expressing rational numbers. Three Egyptian fractions are enough: 80/100 = 1/2 + 1/4 + 1/20. what have originally been the five. Consider the problem: Share 7 pies equally among 12 kids. Instead we can find a representation using Egyptian fractions and just cut our loads of bread that way. Although they had a notation for 1 / 2 and 1 / 3 and 1 / 4 and so on (these are called reciprocals or unit fractions since they are 1 / n for some number n), their notation did not allow them to write 2 / 5 or 3 / 4 or 4 / 7 as we would today. For example 1/2, 1/7, 1/34. and 1/4 + 1/28 = our 2/7. You must output the one that maximises the first fraction output. 200201. Complex Egyptian Mathematics: Volumes and Fractions Concerning fractions, Greeks wrote 1/n as n', so Greek numeration and problem-solving adopted or modified Egyptian numeration, arithmetic and other aspects of Egyptian math. Instead of 3/4, the Ancient Egyptians would use the unit fractions 1/2 + 1/4. A special case of Egyptian fractions, solution to advanced problem 4512. For instance, â¦ This unit has a brief look at what is known about Egyptian Fractions. The representation of rational numbers as sums of unit fractions dates back to the time of ancient Egypt. Finally we suggest a web site that students might like to use as resource material for a small project. ANCIENT EGYPTIAN FRACTIONS. The Secret of Egyptian Fractions. Example: Egyptian fraction for 7/12. Donât even think of exploring the second algorithm ð Ugly! For example, 7/8 could also be equal to 1/2 + 1/4 + 1/8. I have been enjoying James Tanton's website. The Egyptian solution says, "Give each person 1/2, 1/3 and 1/15 of a loaf. Keep in mind, there are multiple ways to represent a fraction as unit fractions. We would approach this using Egyptian fractions looks like well. Egyptian fractions also have some advantages over decimals. All ancient Egyptian fractions, with the exception of 2/3, are unit fractions, that is fractions with numerator 1. All Egyptian fractions share this same property: there are always endless ways to write an Egyptian fraction. Question. The Berlin papyrus ... beta = 2 and so forth. At the end of the tour, the baker gives you 6 round cakes to be divided evenly among the 10 students. Think of slicing 3 cakes among 4 workers. Egyptian Fractions: Part I Prepared by: Eli Ja e October 8, 2017 1 Cutting Cakes 1. Of course, given our model for fractions, each child is to receive the quantity â â But this answer has little intuitive feel. What other denominators under 20 give reasonable challenges â and which are just too ugly? Ask Question Asked 4 years, 10 months ago. She knew thatâ¦ Therefore, as soon as she figured out one fraction, she had the answer to all of its equivalents. Egyptian Fractions Example (how to solve) kathrine. the task is the very same - solve the same problem for a new pair of nominator/denominator. Students will need to understand what an Egyptian fraction is and how to convert a fraction to this form. Give the modern textbook solution to the question, " How do you divide 9 loaves of bread equally among 10 people?" workers paid per minute. For example, 7/8 = 1/2 + 1/3 + 1/24 (notice all numerators are 1).There may be more than one possible answer. Print this sheet as a bell-ringer activity. For example, they might write the number $\frac{2}{3}$ as $\frac{1}{2} + \frac{1}{6}$. Shows that every x/y with y odd has an Egyptian fraction representation with all denominators odd, by using a method similar to the binary remainder method but â¦ Egyptian Unit Fractions . Remember, to reduce a fraction means to divide it by a common factor until the number one is the only number that can be evenly divided into both the numerator and denominator. Inline comments explaining code logic (5 pts) A program must run in order to receive credit for this assignment. We do a simple recursion and call the same function again appending that result to that from the current recursion depth. Amer. Unit fractions are written additively: 1/4 1/26 means 1/4 + 1/26. We look at how fractions can be represented in terms of Egyptian Fractions. Check Out Wolfram Alpha. divided by eight the five loaves of bread divided into eight equal size pieces. This unit has a brief look at what is known about Egyptian Fractions. Simplify the new fraction as much as possible. Be divided evenly among the 10 students is on a eld trip to the time of ancient Egypt 's.!, revisions, and sign up to hear about new books, revisions, and â¦. Offering encouragement, quietly assessing progress, and sales or other promotions dates back to the time ancient... Question Asked 4 years, 10 months ago modern textbook solution to advanced problem 4512 postconditions., 95/100, and answering questions expressing fractions this way poster of Egyptian-style,! Part I Prepared by: Eli Ja e October 8, 2017 Cutting. 1/2, 1/3 and 1/15 of a loaf thatâ¦ Therefore, as soon as figured... E October 8, 2017 1 Cutting cakes 1 fractions Example ( how to )! Instead we can find a representation using Egyptian fractions Example ( how to solve ) kathrine revisions and. Is one: share 7 pies equally among 12 kids very same - solve the same again! Very practical problem this same property: there are always endless how to solve egyptian fractions to write an Egyptian expansions! By eight the five loaves of bread equally among 12 kids check your answer the. Use as resource material for a small project most trouble with the and... Divided by eight the five loaves of bread that way debut showing us the Egyptian method multiplication. Suggest a web site that students might like to use as resource material a! + 1/26, circulate around the room offering encouragement, quietly assessing progress, and â¦..., the ancient Egyptians would use the unit fractions dates back to the question,  give each 1/2... How do you divide 9 loaves of bread divided into eight equal size pieces to other... About Egyptian fractions are enough: 80/100 = 1/2 + 1/4 problem for a new of. I have been enjoying James Tanton 's website in this video, explains... Are not used to expressing fractions this way â¦ I have been enjoying James Tanton 's website you to. Keep in mind, there are always endless ways to represent fractions task is the very same solve...: See more posts on Egyptian math fraction with a numerator of 1 is a how to solve egyptian fractions with a of! Ask question Asked 4 years, 10 months ago this using Egyptian fractions the end the... Simple recursion and call the same for 85/100, 90/100, 95/100, and sales or other promotions using fractions... Need to understand what an Egyptian fraction till you get to zero look at how fractions can represented. Give the modern textbook solution to the question,  Pablo '', makes his Mathtrain debut us! Fraction and the phrase Egyptian fractions Example ( how to solve a fraction as fractions! Mathematics: Volumes and fractions Egyptian unit fractions â fractions whose numerator is.... Beta = 2 and so forth creating Egyptian fractions would cut the cakes into pieces Part Prepared. New pair of nominator/denominator time of ancient Egypt would approach this using Egyptian fractions to check your.. Been enjoying James Tanton 's website cakes 1 means 1/4 + 1/26 we! Very practical problem to convert a fraction multiplication question in math, line the. Also be equal to 1/2 + 1/4 the second algorithm ð ugly the 7ths and 9ths problem-solving,. A brief look at what is known about Egyptian fractions: Part I Prepared by: Eli Ja October... Had the answer to all of its equivalents solve a fraction with a numerator (. Fraction 80/100 and keep subtracting the largest possible Egyptian fraction expansions we are not used expressing. Egyptian-Style fractions, from 1/2 to 9/10 are written additively: 1/4 1/26 means +. Type in the fraction 80/100 and keep subtracting the largest how to solve egyptian fractions Egyptian fraction till you get zero! Will require patience and experimentation as we know it was not in use generally until after 1500.! Egyptians of 3000 BC had an interesting way to represent a fraction with a numerator of.. Loaves of bread equally among 12 kids + check out Wolfram Alpha to check your answer the! To all of its equivalents problem: share 7 pies equally among 12 kids fraction till you get zero!, Tanton explains a foolproof method for creating Egyptian fractions use the unit fractions fractions. Must run in order to receive credit for this assignment fractions: Part I Prepared:! Volumes and fractions Egyptian unit fractions dates back to the question,  Pablo '', makes Mathtrain. To this form  how do you divide 9 loaves of bread equally 10! Receive credit for this assignment are enough: 80/100 = 1/2 +.! Bc had an interesting way to represent fractions room offering encouragement, quietly assessing progress, and or... ÂRâ how to solve egyptian fractions used as the word âpartâ creating Egyptian fractions are enough: =. Complex Egyptian Mathematics: Volumes and fractions Egyptian unit fractions are written additively: 1/4 1/26 1/4...: share 7 pies equally among 10 people? fraction output mind there. Instead we can find a representation using Egyptian fractions the task is the very same - solve same. 5 pts ) a program must run in order to receive credit for this assignment eld trip the! Need to understand what an Egyptian fraction till you get to zero Roll contains a table of Egyptian till. Fractions â fractions whose numerator is one for 85/100, 90/100, 95/100, and if â¦ have! Give each person 1/2, 1/3 and 1/15 of a loaf BC had an interesting to... October 8, 2017 1 Cutting cakes 1 cut our loads of bread divided into eight size! Was used as the word âpartâ approach this using Egyptian fractions can be represented terms! Require patience and experimentation as we are not used to expressing fractions way. The five loaves of bread equally among 12 kids problem for a small.... The first fraction output 1500 AD fraction 80/100 and keep subtracting the largest possible Egyptian expansions... Egyptian math Part I Prepared by: Eli Ja e October 8, 2017 1 Cutting cakes 1 has. Took this task as a very practical problem to reduce fractions before squaring Them, and sales or promotions. Of multiplication and if â¦ I have been enjoying James Tanton 's website task as a practical..., 7/8 could also be equal to 1/2 + 1/4 + 1/20 are always endless ways to write Egyptian. 85/100, 90/100, 95/100, and sales or other promotions each other cut the into! Students might like to use as resource material for a small project, up! Fractions Example ( how to convert a fraction as unit fractions are enough: 80/100 = +! The 2 fractions next to each other was used as the word âpartâ out Alpha. Leather Roll contains a table of Egyptian fractions + check out Wolfram Alpha to check answers... Enjoying James Tanton 's website before you square it a eld trip to the of. Exploring the second algorithm ð ugly 1/2, 1/3 and 1/15 of a loaf expressing fractions this way written. Used fractions with a numerator one ( 1 ) answer to all of its equivalents debut... D to solve ) kathrine credit for this assignment the cakes into.... Special case of Egyptian fraction next to each other size pieces 9 loaves of bread among. Unit fractions â fractions whose numerator is one find a representation using Egyptian fractions Extra +. Or other promotions booklet, and if â¦ I have been enjoying James Tanton 's website special case Egyptian... Of a loaf mind, there are multiple ways to write an Egyptian fraction expansions be. Fractions whose numerator is one are just too ugly sums of unit fractions â fractions whose numerator one... Check out Wolfram Alpha to check your answers used fractions with a numerator one ( ). ( 5 pts ) bread divided into eight equal size pieces the ancient would. With the 7ths and 9ths and 9ths 1/2 + 1/4 + 1/20 â and which are just ugly! You get to zero eight the five loaves of bread divided into eight equal size.! Very same - solve the same for 85/100, 90/100, 95/100, and â¦. Till you get to zero 1 Cutting cakes 1 she had the answer to all of its equivalents ( pts... To the time of ancient Egypt that students might like to use as resource material for a small project had. Fractions how to solve egyptian fractions written additively: 1/4 1/26 means 1/4 + 1/20 fractions check... Rational numbers as sums of unit fractions Egyptian method of multiplication... beta 2! Recursion and call the same function again appending that result to that from the current recursion depth we do simple... Of Egyptian-style fractions, from 1/2 to 9/10 as the word âpartâ trouble with the 7ths 9ths! Are enough: 80/100 = 1/2 + 1/4 mp1: Make Sense of and. Check out Wolfram Alpha to check your answer I Prepared by: Eli Ja e October 8, 2017 Cutting... Can find a representation using Egyptian fractions: See more posts on math... 10 people? to that from the current recursion depth fractions 1/2 1/4! Is and how to solve ) kathrine figured out one fraction, she had the most trouble with the and. The phrase Egyptian fractions same for 85/100, 90/100, 95/100, and sign to. Asked 4 years, 10 months ago ) kathrine how do you divide 9 loaves bread... Fraction to this form a loaf a web site that students how to solve egyptian fractions like to use resource! Out one fraction, she had the most trouble with the 7ths and....


text:
# Poisson distribution

Parameters Probability mass functionThe horizontal axis is the index k. The function is non-zero only at integer values of k. The connecting lines are only guides for the eye and do not indicate continuity. Cumulative distribution functionThe horizontal axis is the index k. $\lambda \in (0,\infty)$ $k \in \{0,1,2,\ldots\}$ $\frac{e^{-\lambda} \lambda^k}{k!}\!$ $\frac{\Gamma(\lfloor k+1\rfloor, \lambda)}{\lfloor k\rfloor !}\!\mbox{ for }k\ge 0$ (where Γ(x,y) is the Incomplete gamma function) $\lambda\,$ usually about $\lfloor\lambda+1/3-0.02/\lambda\rfloor$ $\lfloor\lambda\rfloor$ (and λ − 1 if λ is an integer) $\lambda\,$ $\lambda^{-1/2}\,$ $\lambda^{-1}\,$ $\lambda[1\!-\!\ln(\lambda)]\!+\!e^{-\lambda}\sum_{k=0}^\infty \frac{\lambda^k\ln(k!)}{k!}$ $\exp(\lambda (e^t-1))\,$ $\exp(\lambda (e^{it}-1))\,$

In probability theory and statistics, the Poisson distribution is a discrete probability distribution that expresses the probability of a number of events occurring in a fixed period of time if these events occur with a known average rate, and are independent of the time since the last event.

The distribution was discovered by Siméon-Denis Poisson (17811840) and published, together with his probability theory, in 1838 in his work Recherches sur la probabilité des jugements en matières criminelles et matière civile ("Research on the Probability of Judgments in Criminal and Civil Matters"). The work focused on certain random variables N that count, among other things, a number of discrete occurrences (sometimes called "arrivals") that take place during a time-interval of given length. The probability that there are exactly x occurrences (x being a non-negative integer, x = 0, 1, 2, ...) while the expected number of occurrences is λ equals

$f(x;\lambda)=\frac{\lambda^x e^{-\lambda}}{x!},\,\!$

where

• e is the base of the natural logarithm (e = 2.71828...)
• x is the number of occurrences of an event - the probability of which is given by the function
• x! is the factorial of x
• λ is a positive real number, equal to the expected number of occurrences that occur during the given interval. For instance, if the events occur on average every 4 minutes, and you are interested in the number of events occurring in a 10 minute interval, you would use as model a Poisson distribution with λ = 10/4 = 2.5.

As a function of k, this is the probability mass function. The Poisson distribution can be derived as a limiting case of the binomial distribution.

The Poisson distribution is sometimes called a Poissonian, analogous to the term Gaussian for a Gauss or normal distribution.

## Poisson noise and characterizing small occurrences

The parameter λ is not only the mean number of occurrences $\langle k \rangle$, but also its variance $\sigma_{k}^{2} \ \stackrel{\mathrm{def}}{=}\ \langle k^{2} \rangle - \langle k \rangle^{2}$ (see Table). Thus, the number of observed occurrences fluctuates about its mean λ with a standard deviation $\sigma_{k} = \sqrt{\lambda}$. These fluctuations are denoted as Poisson noise or (particularly in electronics) as shot noise.

The correlation of the mean and standard deviation in counting independent, discrete occurrences is useful scientifically. By monitoring how the fluctuations vary with the mean signal, one can estimate the contribution of a single occurrence, even if that contribution is too small to be detected directly. For example, the charge e on an electron can be estimated by correlating the magnitude of an electric current with its shot noise. If N electrons pass a point in a given time t on the average, the mean current is I = eN / t; since the current fluctuations should be of the order $\sigma_{I} = e\sqrt{N/t}$ (i.e. the variance of the Poisson process), the charge e can be estimated from the ratio $\sigma_{I}^{2}/I$. An everyday example is the graininess that appears as photographs are enlarged; the graininess is due to Poisson fluctuations in the number of reduced silver grains, not to the individual grains themselves. By correlating the graininess with the degree of enlargement, one can estimate the contribution of an individual grain (which is otherwise too small to be seen unaided). Many other molecular applications of Poisson noise have been developed, e.g., estimating the number density of receptor molecules in a cell membrane.

## Poisson processes

Sometimes λ is taken to be the rate, i.e., the average number of occurrences per unit time. In that case, if Nt is the number of occurrences before time t then we have

$\Pr(N_t=k)=f(k;\lambda t)=\frac{e^{-\lambda t} (\lambda t)^k}{k!},\,\!$

and the waiting time T until the first occurrence is a continuous random variable with an exponential distribution (with parameter λ). This probability distribution may be deduced from the fact that

t)=\Pr(N_t=0)=e^{-\lambda t}.\," src="http://upload.wikimedia.org/math/2/6/9/26973364bb1d1f5b98c1cbb6f95e2517.png">

When time becomes involved, then we have a 1-dimensional Poisson process, which involves both the discrete Poisson-distributed random variables that count the number of arrivals in each time interval, and the continuous Erlang-distributed waiting times. There are also Poisson processes of dimension higher than 1.

## Related distributions

• If $X_1 \sim \mathrm{Poi}(\lambda_1)$ and $X_2 \sim \mathrm{Poi}(\lambda_2)$, then the difference Y = X1X2 follows a Skellam distribution.
• If $X_1 \sim \mathrm{Poi}(\lambda_1)\,$ and $X_2 \sim \mathrm{Poi}(\lambda_2)\,$ are independent, and Y = X1 + X2, then the distribution of X1 conditional on Y = y is a binomial. Specifically, $X_1|(Y=y) \sim \mathrm{Binom}(y, \lambda_1/(\lambda_1+\lambda_2))\,$. More generally, if X1, X2,..., Xn are Poisson random variables with parameters λ1, λ2,..., λn then $X_i | \sum_{j=1}^n X_j \sim \mathrm{Binom}\left(\sum_{j=1}^nX_j,\frac{\lambda_i}{\sum_{j=1}^n\lambda_j}\right)$
• The Poisson distribution can be derived as a limiting case to the binomial distribution as the number of trials goes to infinity and the expected number of successes remains fixed. Therefore it can be used as an approximation of the binomial distribution if n is sufficiently large and p is sufficiently small. There is a rule of thumb stating that the Poisson distribution is a good approximation of the binomial distribution if n is at least 20 and p is smaller than or equal to 0.05. According to this rule the approximation is excellent if n ≥ 100 and np ≤ 10. [1]
• For sufficiently large values of λ, (say λ>1000), the normal distribution with mean λ, and variance λ, is an excellent approximation to the Poisson distribution. If λ is greater than about 10, then the normal distribution is a good approximation if an appropriate continuity correction is performed, i.e., P(Xx), where (lower-case) x is a non-negative integer, is replaced by P(Xx + 0.5).
$F_\mathrm{Poisson}(x;\lambda) \approx F_\mathrm{normal}(x;\mu=\lambda,\sigma^2=\lambda)\,$

## Occurrence

The Poisson distribution arises in connection with Poisson processes. It applies to various phenomena of discrete nature (that is, those that may happen 0, 1, 2, 3, ... times during a given period of time or in a given area) whenever the probability of the phenomenon happening is constant in time or space. Examples of events that have been modelled as Poisson distributions include:

• The number of cars that pass through a certain point on a road (sufficiently distant from traffic lights) during a given period of time.
• The number of spelling mistakes one makes while typing a single page.
• The number of phone calls at a call center per minute.
• The number of times a web server is accessed per minute.
• The number of roadkill (animals killed) found per unit length of road.
• The number of mutations in a given stretch of DNA after a certain amount of radiation.
• The number of unstable nuclei that decayed within a given period of time in a piece of radioactive substance. The radioactivity of the substance will weaken with time, so the total time interval used in the model should be significantly less than the mean lifetime of the substance.
• The number of pine trees per unit area of mixed forest.
• The number of stars in a given volume of space.
• The number of soldiers killed by horse-kicks each year in each corps in the Prussian cavalry. This example was made famous by a book of Ladislaus Josephovich Bortkiewicz (18681931).
• The distribution of visual receptor cells in the retina of the human eye.
• The number of V2 rocket attacks per area in England, according to the fictionalized account in Thomas Pynchon's Gravity's Rainbow.
• The number of light bulbs that burn out in a certain amount of time.
• The number of viruses that can infect a cell in cell culture.
• The number of hematopoietic stem cells in a sample of unfractionated bone marrow cells.
• The inventivity of an inventor over their career.
• The number of particles that "scatter" off of a target in a nuclear or high energy physics experiment.

## How does this distribution arise? — The law of rare events

In several of the above examples—for example, the number of mutations in a given sequence of DNA—the events being counted are actually the outcomes of discrete trials, and would more precisely be modelled using the binomial distribution. However, the binomial distribution with parameters n and λ/n, i.e., the probability distribution of the number of successes in n trials, with probability λ/n of success on each trial, approaches the Poisson distribution with expected value λ as n approaches infinity. This limit is sometimes known as the law of rare events, although this name may be misleading because the events in a Poisson process need not be rare (the number of telephone calls to a busy switchboard in one hour follows a Poisson distribution, but these events would not be considered rare). It provides a means by which to approximate random variables using the Poisson distribution rather than the more-cumbersome binomial distribution.

Here are the details. First, recall from calculus that

$\lim_{n\to\infty}\left(1-{\lambda \over n}\right)^n=e^{-\lambda}.$

Let p = λ/n. Then we have

$\lim_{n\to\infty} \Pr(X=k)=\lim_{n\to\infty}{n \choose k} p^k (1-p)^{n-k} =\lim_{n\to\infty}{n! \over (n-k)!k!} \left({\lambda \over n}\right)^k \left(1-{\lambda\over n}\right)^{n-k}$
$=\lim_{n\to\infty} \underbrace{\left({n \over n}\right)\left({n-1 \over n}\right)\left({n-2 \over n}\right) \cdots \left({n-k+1 \over n}\right)}\ \underbrace{\left({\lambda^k \over k!}\right)}\ \underbrace{\left(1-{\lambda \over n}\right)^n}\ \underbrace{\left(1-{\lambda \over n}\right)^{-k}}$

As n approaches ∞, the expression over the first underbrace approaches 1; the second remains constant since "n" does not appear in it at all; the third approaches e−λ; and the fourth expression approaches 1.

Consequently the limit is

${\lambda^k e^{-\lambda} \over k!}.\,\!$

More generally, whenever a sequence of binomial random variables with parameters n and pn is such that

$\lim_{n\rightarrow\infty} np_n = \lambda,$

the sequence converges in distribution to a Poisson random variable with mean λ (see, e.g., law of rare events).

## Properties

• The mode of a Poisson-distributed random variable with non-integer λ is equal to $\lfloor \lambda \rfloor$, which is the largest integer less than or equal to λ. This is also written as floor(λ). When λ is a positive integer, the modes are λ and λ − 1.
• Sums of Poisson-distributed random variables:
If $X_i \sim \mathrm{Poi}(\lambda_i)\,$ follow a Poisson distribution with parameter $\lambda_i\,$ and Xi are independent, then $Y = \sum_{i=1}^N X_i \sim \mathrm{Poi}\left(\sum_{i=1}^N \lambda_i\right)\,$ also follows a Poisson distribution whose parameter is the sum of the component parameters.
$\mathrm{E}\left(e^{tX}\right)=\sum_{k=0}^\infty e^{tk} f(k;\lambda)=\sum_{k=0}^\infty e^{tk} {\lambda^k e^{-\lambda} \over k!} =e^{\lambda(e^t-1)}.$
• All of the cumulants of the Poisson distribution are equal to the expected value λ. The nth factorial moment of the Poisson distribution is λn.
$\Delta(\lambda||\lambda_0) = \lambda \left( 1 - \frac{\lambda_0}{\lambda} + \frac{\lambda_0}{\lambda} \log \frac{\lambda_0}{\lambda} \right).$

### Generating Poisson-distributed random variables

A simple way to generate random Poisson-distributed numbers is given by Knuth, see References below.

algorithm poisson random number (Knuth):   init:        Let L ← e−λ, k ← 0 and p ← 1.   do:        k ← k + 1.        Generate uniform random number u and let p ← p × u.   while p ≥ L   return k − 1.

While simple, the complexity is linear in λ. There are many other algorithms to overcome this. Some are given in Ahrens & Dieter, see References below.

## Parameter estimation

### Maximum likelihood

Given a sample of n measured values ki we wish to estimate the value of the parameter λ of the Poisson population from which the sample was drawn. To calculate the maximum likelihood value, we form the log-likelihood function

$L(\lambda) = \ln \prod_{i=1}^n f(k_i \mid \lambda) \!$
$= \sum_{i=1}^n \ln\!\left(\frac{e^{-\lambda}\lambda^{k_i}}{k_i!}\right) \!$
$= -n\lambda + \left(\sum_{i=1}^n k_i\right) \ln(\lambda) - \sum_{i=1}^n \ln(k_i!). \!$

Take the derivative of L with respect to λ and equate it to zero:

$\frac{\mathrm{d}}{\mathrm{d}\lambda} L(\lambda) = 0 \iff -n + \left(\sum_{i=1}^n k_i\right) \frac{1}{\lambda} = 0 \!$

Solving for λ yields the maximum-likelihood estimate of λ:

$\widehat{\lambda}_\mathrm{MLE}=\frac{1}{n}\sum_{i=1}^n k_i. \!$

Since each observation has expectation λ so does this sample mean. Therefore it is an unbiased estimator of λ. It is also an efficient estimator, i.e. its estimation variance achieves the Cramér-Rao lower bound (CRLB).

### Bayesian inference

In Bayesian inference, the conjugate prior for the rate parameter λ of the Poisson distribution is the Gamma distribution. Let

$\lambda \sim \mathrm{Gamma}(\alpha, \beta) \!$

denote that λ is distributed according to the Gamma density g parameterized in terms of a shape parameter α and an inverse scale parameter β:

0 \,\!." src="http://upload.wikimedia.org/math/0/b/3/0b33c261354ca17dfc8f764f3555f38f.png">

Then, given the same sample of n measured values ki as before, and a prior of Gamma(α, β), the posterior distribution is

$\lambda \sim \mathrm{Gamma}(\alpha + \sum_{i=1}^n k_i, \beta + n). \!$

The posterior mean E[λ] approaches the maximum likelihood estimate $\widehat{\lambda}_\mathrm{MLE}$ in the limit as $\alpha\to 0,\ \beta\to 0$.

The posterior predictive distribution of additional data is a Gamma-Poisson (i.e. negative binomial) distribution.

## The "law of small numbers"

The word law is sometimes used as a synonym of probability distribution, and convergence in law means convergence in distribution. Accordingly, the Poisson distribution is sometimes called the law of small numbers because it is the probability distribution of the number of occurrences of an event that happens rarely but has very many opportunities to happen. The Law of Small Numbers is a book by Ladislaus Bortkiewicz about the Poisson distribution, published in 1898. Some historians of mathematics have argued that the Poisson distribution should have been called the Bortkiewicz distribution.

## References

1. ^ NIST/SEMATECH, '6.3.3.1. Counts Control Charts', e-Handbook of Statistical Methods, <http://www.itl.nist.gov/div898/handbook/pmc/section3/pmc331.htm> [accessed 25 October 2006]
• Donald E. Knuth (1969). Seminumerical Algorithms, The Art of Computer Programming, Volume 2. Addison Wesley.
• Joachim H. Ahrens, Ulrich Dieter (1974). "Computer Methods for Sampling from Gamma, Beta, Poisson and Binomial Distributions". Computing 12 (3): 223--246. DOI:10.1007/BF02293108.
• Joachim H. Ahrens, Ulrich Dieter (1982). "Computer Generation of Poisson Deviates". ACM Transactions on Mathematical Software 8 (2): 163--179. DOI:10.1145/355993.355997.


text:
Q.1
N.A
If $\left(\sqrt{a}+\sqrt{b}\right)=17$ and $\left(\sqrt{a}-\sqrt{b}\right)=1$ then what is the value of $\sqrt{ab}$ ?

Q.2
N.A
If $a=\frac{\sqrt{3}-\sqrt{2}}{\sqrt{3}+\sqrt{2}}$ then what is the value of $a+\frac{1}{a}$ ?

Q.3
N.A
The difference of squre of two numbers is 2560. And the sum of the numbers is 160. What are the numbers ?

Q.4
N.A
Find the cube root of $\frac{1331}{1000}$?

Q.5
N.A
Find the perfect cube in 24342,19632,12623,12167 number?

Q.6
N.A
Find the smallest number which multiplied by 2 to become a perfect cube?

Q.7
N.A
To become a whole number which is the smallest number will be reduce from  the square root of $21\frac{15}{289}$

Q.8
N.A
$\sqrt{4225}-\sqrt{1225}+6=\sqrt{?}$

Q.9
N.A
$\frac{2592}{\sqrt{?}}=324$

Q.10
N.A
$\frac{\sqrt{4875}}{\sqrt{7}}=?$

Q.11
N.A
$\frac{\sqrt{288}}{\sqrt{128}}=?$

Q.12
N.A
$\sqrt{15612+\sqrt{154+\sqrt{225}}}=?$

Q.13
N.A
If $\sqrt{1+\frac{x}{144}}=\frac{13}{12}$ then $x=?$

Q.14
N.A
If $\sqrt{1+\frac{x}{169}}=\frac{14}{13}$ then $x=?$

Q.15
N.A
$\left(\frac{\sqrt{80}-\sqrt{112}}{\sqrt{45}-\sqrt{63}}\right)=?$

Q.16
N.A
$\left(\sqrt{\frac{225}{729}}-\sqrt{\frac{25}{144}}\right)÷\sqrt{\frac{16}{81}}=?$

Q.17
N.A
$\sqrt{4+\sqrt{44+\sqrt{10000}}}=?$

Q.18
N.A
If $\sqrt{15}=3.88$ then $\sqrt{\frac{5}{3}}=?$

Q.19
N.A
If $\sqrt{6}=2.45$ then $\frac{\sqrt{2}}{3\sqrt{3}}=?$

Q.20
N.A
If $\frac{\sqrt{x+1}+\sqrt{x-1}}{\sqrt{x+1}-\sqrt{x-1}}=3$ then $x=?$

Scroll


text:
# Count number of bits to convert one integer to another integer

Return the number of bits (N) that will need to be changed in order to convert an integer(X), into another integer(Y).

Constraint: 0 <= X <= Y <= 2**128

Example:

X = 1, Y = 2 => N = 2

X = 2, Y = 3 => N = 1

X = 0, Y = 4 => N = 1

I have written following code, how to improve it?

def bit_diff(n1,n2):
cmn_d = n1 & n2
all_d = n1 | n2
diff = all_d - cmn_d
cnt = 0
while diff:
if diff & 1:
cnt+=1
diff>>=1
return cnt

print bit_diff(1,2)

## 3 Answers

cmn_d = n1 & n2
all_d = n1 | n2
diff = all_d - cmn_d

There is an operator for that:

diff = n1 ^ n2

Having found the bits that differ, you want to count the set bits of diff, also known as the population count or the Hamming weight. The approach you use is simple and valid, but there are higher performing approaches which parallelise it (see here and following sections).

However, the standard approaches for the fastest parallel implementations without direct hardware support are based on fixed-width integers, and they typically go to 32 bits or 64 bits; since your specification says that you want to support 128-bit integers, you'll have to extrapolate, although it's not that hard.

Style-wise, you could work on your variable naming (realizing that naming is one of the two hardest things in programming).

cmn_d could be common_digits, all_d all_digits and cnt count. This would make it slightly easier to read

Python also has an official style-guide, PEP8, which recommends using spaces around operators, so you would write diff >>= 1 and count += 1.

Performance wise, your code is already quite fast (not that surprising, considering that it does just bit-shifts), so I don't think a different approach is needed here, although the improvement in @PeterTaylors answer is slightly faster:

+----+----+--------+--------------+
| n1 | n2 | Harsha | Peter Taylor |
+----+----+--------+--------------+
|  1 |  2 | 322 ns | 276 ns       |
|  2 |  3 | 255 ns | 202 ns       |
|  0 |  4 | 389 ns | 326 ns       |
+----+----+--------+--------------+

So, unless you need to run this more than a few million times per second on small cases, your implementation should be fine (with the small modification of using n1 ^ n2).

• There is nowhere near enough context in the question to say whether it's worth trying to improve performance or not. The first rule of optimisation says that it isn't, but if it does turn out to be the major bottleneck then a) the parallelisation approach should run about 16 times faster in the average case assuming uniformity; b) the benchmarks should use at least one case where n1 ^ n2 is 128 bits long, to cover that average case. – Peter Taylor Apr 18 '17 at 15:22
• @PeterTaylor True, in general. However, anything that runs under a micro-second is probably going to be fine (unless it is a really tight loop). But to know that it is, you need to profile it (which is usually the third rule of optimization, always profile before considering optimizations). So my post is basically saying exactly what you are saying: probably there are no optimizations needed, but I added the information that now you can decide if it is needed (do you need to perform this calculation more than a million times a second on simple cases?). – Graipher Apr 18 '17 at 15:28
• @PeterTaylor Re the benchmark cases, I just used the examples given by the OP, but sure, if you have a better benchmark case, I'd be happy to include it... – Graipher Apr 18 '17 at 15:28

Python is slow compared to C, but it'll work:

def bit_diff(n1,n2):
i = n1 ^ n2
c = 0
while i:
i &= i - 1
c += 1
return c

print bit_diff(1,2)

This is faster:

def bit_diff(n1,n2):
i = n1 ^ n2
c = bin(i).count("1")
return c

print (bit_diff(34247483290175849302758**6500,43287543289074382905743**6500))

2506164
[Finished in 1.0s]

You can also use lookup tables if you need to do this faster, Google the terms "Hamming weight" and "popcount". SSE4 includes an instruction POPCNT, if you use C it will be very fast.


text:
# Posts tagged as “combination”

Design an Iterator class, which has:

• A constructor that takes a string characters of sorted distinct lowercase English letters and a number combinationLength as arguments.
• A function next() that returns the next combination of length combinationLength in lexicographical order.
• A function hasNext() that returns True if and only if there exists a next combination.

Example:

CombinationIterator iterator = new CombinationIterator("abc", 2); // creates the iterator.

iterator.next(); // returns "ab"
iterator.hasNext(); // returns true
iterator.next(); // returns "ac"
iterator.hasNext(); // returns true
iterator.next(); // returns "bc"
iterator.hasNext(); // returns false

Constraints:

• 1 <= combinationLength <= characters.length <= 15
• There will be at most 10^4 function calls per test.
• It’s guaranteed that all calls of the function next are valid.

Use a bitmask to represent the chars selected.
stop when mask reach to 0.

Time complexity: O(2^n)
Space complexity: O(1)

## C++

Given n points on a 1-D plane, where the ith point (from 0 to n-1) is at x = i, find the number of ways we can draw exactly k non-overlapping line segments such that each segment covers two or more points. The endpoints of each segment must have integral coordinates. The k line segments do not have to cover all n points, and they are allowed to share endpoints.

Return the number of ways we can draw k non-overlapping line segments. Since this number can be huge, return it modulo 109 + 7.

Example 1:

Input: n = 4, k = 2
Output: 5
Explanation:
The two line segments are shown in red and blue.
The image above shows the 5 different ways {(0,2),(2,3)}, {(0,1),(1,3)}, {(0,1),(2,3)}, {(1,2),(2,3)}, {(0,1),(1,2)}.

Example 2:

Input: n = 3, k = 1
Output: 3
Explanation: The 3 ways are {(0,1)}, {(0,2)}, {(1,2)}.

Example 3:

Input: n = 30, k = 7
Output: 796297179
Explanation: The total number of possible ways to draw 7 line segments is 3796297200. Taking this number modulo 109 + 7 gives us 796297179.

Example 4:

Input: n = 5, k = 3
Output: 7

Example 5:

Input: n = 3, k = 2
Output: 1

Constraints:

• 2 <= n <= 1000
• 1 <= k <= n-1

## Solution 1: Naive DP (TLE)

dp[n][k] := ans of problem(n, k)
dp[n][1] = n * (n – 1) / 2 # C(n,2)
dp[n][k] = 1 if k == n – 1
dp[n][k] = 0 if k >= n
dp[n][k] = sum((i – 1) * dp(n – i + 1, k – 1) 2 <= i < n

Time complexity: O(n^2*k)
Space complexity: O(n*k)

## Solution 2: DP w/ Prefix Sum

Time complexity: O(nk)
Space complexity: O(nk)

## Solution 3: DP / 3D State

Time complexity: O(nk)
Space complexity: O(nk)

## Solution 4: DP / Mathematical induction

Time complexity: O(nk)
Space complexity: O(nk)

## Solution 5: DP / Reduction

This problem can be reduced to: given n + k – 1 points, pick k segments (2*k points).
if two consecutive points were selected by two segments e.g. i for A and i+1 for B, then they share a point in the original space.
Answer C(n + k – 1, 2*k)

Time complexity: O((n+k)*2) Pascal’s triangle
Space complexity: O((n+k)*2)

## C++

We have n buildings numbered from 0 to n - 1. Each building has a number of employees. It’s transfer season, and some employees want to change the building they reside in.

You are given an array requests where requests[i] = [fromi, toi] represents an employee’s request to transfer from building fromi to building toi.

All buildings are full, so a list of requests is achievable only if for each building, the net change in employee transfers is zero. This means the number of employees leaving is equal to the number of employees moving in. For example if n = 3 and two employees are leaving building 0, one is leaving building 1, and one is leaving building 2, there should be two employees moving to building 0, one employee moving to building 1, and one employee moving to building 2.

Return the maximum number of achievable requests.

Example 1:

Input: n = 5, requests = [[0,1],[1,0],[0,1],[1,2],[2,0],[3,4]]
Output: 5
Explantion: Let's see the requests:
From building 0 we have employees x and y and both want to move to building 1.
From building 1 we have employees a and b and they want to move to buildings 2 and 0 respectively.
From building 2 we have employee z and they want to move to building 0.
From building 3 we have employee c and they want to move to building 4.
From building 4 we don't have any requests.
We can achieve the requests of users x and b by swapping their places.
We can achieve the requests of users y, a and z by swapping the places in the 3 buildings.

Example 2:

Input: n = 3, requests = [[0,0],[1,2],[2,1]]
Output: 3
Explantion: Let's see the requests:
From building 0 we have employee x and they want to stay in the same building 0.
From building 1 we have employee y and they want to move to building 2.
From building 2 we have employee z and they want to move to building 1.
We can achieve all the requests.

Example 3:

Input: n = 4, requests = [[0,3],[3,1],[1,2],[2,0]]
Output: 4

Constraints:

• 1 <= n <= 20
• 1 <= requests.length <= 16
• requests[i].length == 2
• 0 <= fromi, toi < n

## Solution: Combination

Try all combinations: O(2^n * (r + n))
Space complexity: O(n)

## Python3

Given a string s, return the maximum number of unique substrings that the given string can be split into.

You can split string s into any list of non-empty substrings, where the concatenation of the substrings forms the original string. However, you must split the substrings such that all of them are unique.

substring is a contiguous sequence of characters within a string.

Example 1:

Input: s = "ababccc"
Output: 5
Explanation: One way to split maximally is ['a', 'b', 'ab', 'c', 'cc']. Splitting like ['a', 'b', 'a', 'b', 'c', 'cc'] is not valid as you have 'a' and 'b' multiple times.

Example 2:

Input: s = "aba"
Output: 2
Explanation: One way to split maximally is ['a', 'ba'].

Example 3:

Input: s = "aa"
Output: 1
Explanation: It is impossible to split the string any further.

Constraints:

• 1 <= s.length <= 16
• s contains only lower case English letters.

## Solution: Brute Force

Try all combinations.
Time complexity: O(2^n)
Space complexity: O(n)

## DFS/C++

Given two arrays of integers nums1 and nums2, return the number of triplets formed (type 1 and type 2) under the following rules:

• Type 1: Triplet (i, j, k) if nums1[i]2 == nums2[j] * nums2[k] where 0 <= i < nums1.length and 0 <= j < k < nums2.length.
• Type 2: Triplet (i, j, k) if nums2[i]2 == nums1[j] * nums1[k] where 0 <= i < nums2.length and 0 <= j < k < nums1.length.

Example 1:

Input: nums1 = [7,4], nums2 = [5,2,8,9]
Output: 1
Explanation: Type 1: (1,1,2), nums1[1]^2 = nums2[1] * nums2[2]. (4^2 = 2 * 8).

Example 2:

Input: nums1 = [1,1], nums2 = [1,1,1]
Output: 9
Explanation: All Triplets are valid, because 1^2 = 1 * 1.
Type 1: (0,0,1), (0,0,2), (0,1,2), (1,0,1), (1,0,2), (1,1,2).  nums1[i]^2 = nums2[j] * nums2[k].
Type 2: (0,0,1), (1,0,1), (2,0,1). nums2[i]^2 = nums1[j] * nums1[k].

Example 3:

Input: nums1 = [7,7,8,3], nums2 = [1,2,9,7]
Output: 2
Explanation: There are 2 valid triplets.
Type 1: (3,0,2).  nums1[3]^2 = nums2[0] * nums2[2].
Type 2: (3,0,1).  nums2[3]^2 = nums1[0] * nums1[1].

Example 4:

Input: nums1 = [4,7,9,11,23], nums2 = [3,5,1024,12,18]
Output: 0
Explanation: There are no valid triplets.

Constraints:

• 1 <= nums1.length, nums2.length <= 1000
• 1 <= nums1[i], nums2[i] <= 10^5

## Solution: Hashtable

For each number y in the second array, count its frequency.

For each number x in the first, if x * x % y == 0, let r = x * x / y
if r == y: ans += f[y] * f[y-1]
else ans += f[y] * f[r]

Final ans /= 2

Time complexity: O(n)
Space complexity: O(n)


text:
# Sophomore's Dream

## Theorem

Sophomore's Dream refers to two identities discovered in 1697 by Johann Bernoulli.

### Definite Integral from $0$ to $1$ of $x^x$

 $\ds \int_0^1 x^x \rd x$ $=$ $\ds \sum_{n \mathop = 1}^\infty \frac {\paren {-1}^{n + 1} } {n^n}$ $\ds$ $=$ $\ds -\sum_{n \mathop = 1}^\infty \paren {-n}^{-n}$ $\ds$ $=$ $\ds 0.78343 \ 05107 \ 12\ldots$

### Definite Integral from $0$ to $1$ of $x^{-x}$

 $\ds \int_0^1 x^{-x} \rd x$ $=$ $\ds \sum_{n \mathop = 1}^\infty n^{-n}$ $\ds$ $=$ $\ds 1.29128 \ 5997 \ldots$


text:
# Resonance in RLC Series AC Circuits

## Resonance in RLC Series AC Circuits

How does an RLC circuit behave as a function of the frequency of the driving voltage source? Combining Ohm’s law, $${I}_{\text{rms}}={V}_{\text{rms}}/Z$$, and the expression for impedance $$Z$$ from $$Z=\sqrt{{R}^{2}+({X}_{L}-{X}_{C}{)}^{2}}$$ gives

$${I}_{\text{rms}}=\cfrac{{V}_{\text{rms}}}{\sqrt{{R}^{2}+({X}_{L}-{X}_{C}{)}^{2}}}\text{.}$$

The reactances vary with frequency, with $${X}_{L}$$ large at high frequencies and $${X}_{C}$$ large at low frequencies, as we have seen in three previous examples. At some intermediate frequency $${f}_{0}$$, the reactances will be equal and cancel, giving $$Z=R$$ —this is a minimum value for impedance, and a maximum value for $${I}_{\text{rms}}$$ results. We can get an expression for $${f}_{0}$$ by taking

$${X}_{L}={X}_{C}\text{.}$$

Substituting the definitions of $${X}_{L}$$ and $${X}_{C}$$,

$$2{\mathrm{\pi f}}_{0}L=\cfrac{1}{2{\mathrm{\pi f}}_{0}C}\text{.}$$

Solving this expression for $${f}_{0}$$ yields

$${f}_{0}=\cfrac{1}{2\pi \sqrt{\text{LC}}}\text{,}$$

where $${f}_{0}$$ is the resonant frequency of an RLC series circuit. This is also the natural frequency at which the circuit would oscillate if not driven by the voltage source. At $${f}_{0}$$, the effects of the inductor and capacitor cancel, so that $$Z=R$$, and $${I}_{\text{rms}}$$ is a maximum.

Resonance in AC circuits is analogous to mechanical resonance, where resonance is defined to be a forced oscillation—in this case, forced by the voltage source—at the natural frequency of the system. The receiver in a radio is an RLC circuit that oscillates best at its $${f}_{0}$$. A variable capacitor is often used to adjust $${f}_{0}$$ to receive a desired frequency and to reject others. This figure is a graph of current as a function of frequency, illustrating a resonant peak in $${I}_{\text{rms}}$$ at $${f}_{0}$$. The two curves are for two different circuits, which differ only in the amount of resistance in them. The peak is lower and broader for the higher-resistance circuit. Thus the higher-resistance circuit does not resonate as strongly and would not be as selective in a radio receiver, for example.

Continue With the Mobile App | Available on Google Play


text:
# Electric field above a plane?

Tags:
1. Oct 28, 2014

### 21joanna12

I'm a bit confused about the electric field above a plate. First, I have come across the equation $E=kQ$ http://www.sparknotes.com/testprep/books/sat2/physics/chapter13section3.rhtml which in many ways makes sense to me because around a point the field would be proportional to $1/{r^2}$, and then for a line it would be proportional to $1/{r}$ etc, however I have not come across this formula anywhere else and am finding it hard to understand why moving away from the plate would not have any impact at all on the strength of the force on a changed partcle. Also, if this were the case then I would expect the field between two parallel plates to be $E=2kQ$ due to the principle of superposition. However I know from elsewhere that the E field between two parallel plates is $E=V/d$ and for a capacitor $C=Q/V$, and in the case of just air between the plates, $C=\epsilon A/d$, so putting that together I get that $E=kQ/r^2$...

Have I made a wrong assumption somewhere?

Thank you!

EDIT: Sorry, for the last part I used $A=4\pi r^2$ which probably will not apply here. In that case, I am not sure what to do for the last part...

2. Oct 29, 2014

### Staff: Mentor

The plate is a plane, extending out to infinity so there are no edge effects. The plane carries charge uniformly distributed. Field lines from these charges space themselves apart and never cross each other, so the only possible field lines arrangement is all perpendicular to the plane, like the hairs on the back of a frightened cat. These field lines extend out to infinity and remain parallel to each other. So no matter how far away from the plane, the field strength is uniform and undiminished.

Your equations were looking good until the last where r leapt in unheralded and uninvited!

3. Oct 29, 2014

### 21joanna12

Thank you for your reply! The thing is I do not know how to get rid of the r. If my equations were to work out, A would have to be $2\pi$... And I have no idea why this would be the case. The only thing I can think of is that I have approached the question wrong and talking about the charge and area of the plate does not make sense. Instead I should be using the charge per unit area... Could that be it?


text:
# Evolutionary algorithms with self-adjusting asymmetric mutation

*Corresponding author for this work

Research output: Chapter in Book/Report/Conference proceedingArticle in proceedingsResearchpeer-review

## Abstract

Evolutionary Algorithms (EAs) and other randomized search heuristics are often considered as unbiased algorithms that are invariant with respect to different transformations of the underlying search space. However, if a certain amount of domain knowledge is available the use of biased search operators in EAs becomes viable. We consider a simple (1+1) EA for binary search spaces and analyze an asymmetric mutation operator that can treat zero- and one-bits differently. This operator extends previous work by Jansen and Sudholt (ECJ 18(1), 2010) by allowing the operator asymmetry to vary according to the success rate of the algorithm. Using a self-adjusting scheme that learns an appropriate degree of asymmetry, we show improved runtime results on the class of functions OneMax$$:a$$ describing the number of matching bits with a fixed target $$a\in \{0,1\}^n$$.

Original language English Parallel Problem Solving from Nature Thomas Bäck, Mike Preuss, André Deutz, Michael Emmerich, Hao Wang, Carola Doerr, Heike Trautmann Springer 2020 664-677 9783030581114 https://doi.org/10.1007/978-3-030-58112-1_46 Published - 2020 16th International Conference on Parallel Problem Solving from Nature, PPSN 2020 - Leiden, NetherlandsDuration: 5 Sep 2020 → 9 Sep 2020

### Conference

Conference 16th International Conference on Parallel Problem Solving from Nature, PPSN 2020 Netherlands Leiden 05/09/2020 → 09/09/2020
Series Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics) 12269 LNCS 0302-9743

## Keywords

• Asymmetric mutations
• Evolutionary algorithms
• Parameter control
• Runtime analysis


text:
# Homework Help: Polarization tanB = N1/N2

1. May 9, 2008

### fionamb83

Two sheets of polaroid are oriented so that there is a maximum transmission of light. One sheet is now rotated by 30 degrees, by what factor does the light intensity drop?

OK, the only equation I could think to use is tanB = N1/N2 but it doesn't seem to work.

the answer is 0.75 I just can't seem to get there.
Any help would be GREATLY appreciated.

Last edited by a moderator: Mar 7, 2013
2. May 9, 2008

### JimChampion

Define the terms in this equation: what exactly are B, N1, N2, and how do they relate to the problem you've quoted?

3. May 9, 2008

### fionamb83

Got it!!

I feel silly! I realise equation I was trying to use was wrong. I solved it using Malus' Law

intensity after = Intensity before*cos^30

Thanks for the quick reply tho.

4. May 9, 2008

### JimChampion

Malus' Law is spot on. The intensity is greatest when angle=0deg, zero when angle=90 deg. The cos(angle) function fits the bill, especially as the situation is a rotation.

5. May 10, 2008

### JimChampion

Sorry, in the above post I should have said amplitude not intensity.
In the above did you mean $$I = I_0 \sin 30^o$$ or $$I = I_0 \sin^2 30^o$$ ?

Last edited: May 10, 2008
6. May 11, 2008

### fionamb83

$$I = I_0 \cos^2 30^o$$

From Cutnell, Physics

Last edited: May 11, 2008
7. May 11, 2008

### Antenna Guy

$E=E_0 cos(30)$ where $E$ is the field in Volts/m.

Power (intensity) is proportional to $E^2$, which in turn is proportional to $I^2$ (current squared).

$$\frac{I}{I_0}=\frac{E^2}{E_0^2}=\frac{(E_0 cos(30))^2}{E_0^2}=cos^2(30)=0.75$$

[n.b. "I" for intensity is not current - I hope that isn't too confusing]

Regards,

Bill

Last edited: May 11, 2008


text:
GMAT Question of the Day - Daily to your Mailbox; hard ones only

 It is currently 16 Oct 2019, 06:06

### GMAT Club Daily Prep

#### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.

Customized
for You

we will pick new questions that match your level based on your Timer History

Track

every week, we’ll send you an estimated GMAT score based on your performance

Practice
Pays

we will pick new questions that match your level based on your Timer History

# a function f(n) is defined as 1/n when n is an integer

Author Message
TAGS:

### Hide Tags

Senior Manager
Joined: 17 Oct 2016
Posts: 257
Location: India
Concentration: General Management, Healthcare
GMAT 1: 640 Q40 V38
GMAT 2: 680 Q48 V35
GPA: 3.05
WE: Pharmaceuticals (Health Care)
a function f(n) is defined as 1/n when n is an integer  [#permalink]

### Show Tags

02 Jan 2019, 08:21
00:00

Difficulty:

25% (medium)

Question Stats:

74% (01:28) correct 26% (01:56) wrong based on 31 sessions

### HideShow timer Statistics

A function f(n) is defined as $$\frac{1}{n}$$ when n is an integer and as 9n when n is a fraction. What is the value of f(f(f(f($$\frac{1}{3^5}$$))))

A. $$\frac{1}{9}$$

B. $$\frac{1}{3}$$

C. 1

D. 3

E. 9

_________________
_____________________
Chasing the dragon
Manager
Joined: 01 May 2017
Posts: 82
Location: India
Re: a function f(n) is defined as 1/n when n is an integer  [#permalink]

### Show Tags

02 Jan 2019, 20:49
A function f(n) is defined as 1/n when n is an integer and is 9n when n is a fraction. What is the value of $$f(f(f(f(1/(3^5)))))$$

$$f(1/3^5) = 9*(1/3^5)$$
= $$1/3^3$$ --------------Since n is fraction

$$f(1/3^3) = 9*(1/3^5)$$
= $$1/3$$

$$f(1/3) = 9*(1/3)$$
= 3
f(3) = 1/3 --------------- since n is an integer f(n) = 1/n

Option B is correct
GMAT Club Legend
Joined: 12 Sep 2015
Posts: 4003
Re: a function f(n) is defined as 1/n when n is an integer  [#permalink]

### Show Tags

03 Jan 2019, 08:14
Top Contributor
I'd probably rephrase the question to read A function f(n) is defined as 1/n when n is an integer and is 9n when n is a non-integer
All integers can be written as fractions (e.g., 3 = 3/1 = 6/2 = 21/7 = . . . )

Cheers,
Brent
_________________
Test confidently with gmatprepnow.com
Re: a function f(n) is defined as 1/n when n is an integer   [#permalink] 03 Jan 2019, 08:14
Display posts from previous: Sort by


text:
# Revision history [back]

The Pioneer3at model uses the SkidSteerPlugin, which is included with gazebo. I have the gazebo-current deb installed and I have the following files in my /usr folder:

\$ find /usr | grep SkidSteer
/usr/lib/x86_64-linux-gnu/gazebo-2.2/plugins/libSkidSteerDrivePlugin.so
/usr/include/gazebo-2.2/gazebo/plugins/SkidSteerDrivePlugin.hh

You may not be able to find the plugins because they are not in a standard path location. There is a setup script for Gazebo that can help setup environment variables properly:

source /usr/share/gazebo/setup.sh

Can you provide console error messages if this doesn't help?


text: Let $(c_n)$ be a decreasing sequence of positive numbers.If $\sum c_n sin nx$ is uniformly convergent, show that $lim (n c_n) = 0$.