text:
### Author Topic: Order of Operations  (Read 2914 times)

0 Members and 1 Guest are viewing this topic.

#### ACagliano

• Posts: 910
• Rating: +32/-2
##### Order of Operations
« on: April 01, 2014, 03:32:42 pm »
I have been trying to do this myself, but I'm failing. I need to ask for at the least conceptual, if not coding assistance...

I need to make an order of operations parser. For instance, the string: ((3x+7)(x-3))/4x should be evaluated into memory:

3x+7
*
x-3
/
4x

My language is Axe. If there's an app (like Symbolic) that does this, then this post is also an official permission request to view, and perhaps borrow elements from them, if they would help.

#### Aspiring

• LV3 Member (Next: 100)
• Posts: 81
• Rating: +5/-0
• The only source of knowledge is experience-Einsten
##### Re: Order of Operations
« Reply #1 on: April 01, 2014, 04:27:37 pm »
I recommend you create it with a computer programming language (like lua or python) first so that you can have the concept done and then "port" it to axe because it would be somewhat more difficult to do it initially in axe because axe doesn't come with dynamic arrays (I am not implying that it should though, I like axe how it is.)

#### ACagliano

• Posts: 910
• Rating: +32/-2
##### Re: Order of Operations
« Reply #2 on: April 01, 2014, 05:25:42 pm »
Ok. The problem is, I don't even know where to start... my initial thought was, starting at position 1 of the input string,

search for a (.
if found, search for next )
copy contents to scrap buffer.
rinse and repeat.

but beyond that, I'm lost...

#### Hayleia

• Programming Absol
• Coder Of Tomorrow
• LV12 Extreme Poster (Next: 5000)
• Posts: 3367
• Rating: +393/-7
##### Re: Order of Operations
« Reply #3 on: April 01, 2014, 05:41:17 pm »
I recommend you create it with a computer programming language (like lua or python) first so that you can have the concept done and then "port" it to axe because it would be somewhat more difficult to do it initially in axe because axe doesn't come with dynamic arrays (I am not implying that it should though, I like axe how it is.)
It would be even more difficult to have to port it from a "high level" language into Axe, so I'd say that coding in Axe direcly is a better idea.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

#### Aspiring

• LV3 Member (Next: 100)
• Posts: 81
• Rating: +5/-0
• The only source of knowledge is experience-Einsten
##### Re: Order of Operations
« Reply #4 on: April 01, 2014, 07:30:04 pm »
You might be right I was just thinking that first he would need to come up with the concept for how to do it but there are lots of ways to do things.  There might be some ways that are better in high level programming languages but very difficult in axe.

#### ACagliano

• Posts: 910
• Rating: +32/-2
##### Re: Order of Operations
« Reply #5 on: April 01, 2014, 09:50:37 pm »
Ok I came up with a partial algorithm, but I may need some assistance coding it. Order of operations goes PEMDAS, so parentheses are first. So, my idea is to loop:

Code: [Select]
input->AA->WWhile inData(')',A)   ;; in the example 3x + (7x + 4x + (3x) - (2x-1))   ;; while we have a ), this will keep looping   While inData('(',W)<inData(')',A)       If inData('(',W) < inData(')',A)           inData('(',W) -> Z           End       inData('(',W) + 1 -> W   ;; while the next ( we find is in front of the ), we loop.   ;; When it moves behind it, we are in a new nested parentheses, so we stop looping.   ;;  Z is saved, so we can recall correct location.   End ;; Once we are out of the second while loop, we can copy the innermost parentheses... ;; contents to another location in RAM, and zero terminate it, or length pre-pend it. ;; then we delete the contents of that paren from the source string. doing so eliminates that... ;; ), so that the first while loop returns the position of the next ) in its test, so we loop until parens... ;; are all gone.End

#### ACagliano

• Posts: 910
• Rating: +32/-2
##### Re: Order of Operations
« Reply #6 on: April 03, 2014, 08:16:33 am »
bumpity bump

#### ACagliano

• Posts: 910
• Rating: +32/-2
##### Re: Order of Operations
« Reply #7 on: April 04, 2014, 09:54:17 pm »
Ok I came up with a partial algorithm, but I may need some assistance coding it. Order of operations goes PEMDAS, so parentheses are first. So, my idea is to loop:

Code: [Select]
input->AA->WWhile inData(')',A)   ;; in the example 3x + (7x + 4x + (3x) - (2x-1))   ;; while we have a ), this will keep looping   While inData('(',W)<inData(')',A)       If inData('(',W) < inData(')',A)           inData('(',W) -> Z           End       inData('(',W) + 1 -> W   ;; while the next ( we find is in front of the ), we loop.   ;; When it moves behind it, we are in a new nested parentheses, so we stop looping.   ;;  Z is saved, so we can recall correct location.   End ;; Once we are out of the second while loop, we can copy the innermost parentheses... ;; contents to another location in RAM, and zero terminate it, or length pre-pend it. ;; then we delete the contents of that paren from the source string. doing so eliminates that... ;; ), so that the first while loop returns the position of the next ) in its test, so we loop until parens... ;; are all gone.End

bump on that.

When i talk to people about order of operations...they say "make a tree". but my question is...how the heck do you make a "tree" in assembly? you just have arrays of bytes...

#### Aspiring

• LV3 Member (Next: 100)
• Posts: 81
• Rating: +5/-0
• The only source of knowledge is experience-Einsten
##### Re: Order of Operations
« Reply #8 on: April 04, 2014, 10:30:45 pm »
See this: http://www.dreamincode.net/forums/topic/286193-how-do-calculators-know-the-order-of-operations/

You to do this you could have a function that calls itself.  So here is example 3 + 3 * 4

+
/  \
3    *        =   15
/  \
3   4

To evaluate this the function would look for the first operator it can find which is a "+"  then the function would divide the expression into two expressions: [size=78%]"3"  and also "3 * 4"[/size]

Then the function would call itself for each of the two functions to evaluate and add the value from each function because the operator is a plus.
so something like this
sub(evaluate,"3") + sub(evaluate,"3*4")

when running sub(evaluate,"3")  the parser won't find any operator (of course) so it then knows that it is just a number and it just returns the number.

when running sub(evaluate, "3*4") ..... and so on so forth until it has the answer.  You will need to add parentheses.  Also it is very important to note that there are some problems with the method I showed.  Think about what would happen if you evaluated "3 * 4 + 3" the program would return "21" but the answer is clearly "15".  This could be solved by having the function also look for the next operator and acting appropriately.

I hope that this helps.

#### ACagliano

• Posts: 910
• Rating: +32/-2
##### Re: Order of Operations
« Reply #9 on: April 05, 2014, 10:23:25 am »
Ok, that helps a bit. So as a follow up to that... is Axe advanced enough now to take arbitrary Label names? Like you said sub(evaluate, [arg]). Can I do LBL EVALUATE? Or must I use the 2-character label names?

#### TheMachine02

• LV6 Super Member (Next: 500)
• Posts: 452
• Rating: +105/-0
• me = EF99+F41A
##### Re: Order of Operations
« Reply #10 on: April 05, 2014, 10:27:00 am »
You can perfectly use Lbl EVALUATE. Axe allows up to 13 characters name, and you can also use lowercase.
(like Lbl Evaluate)
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

#### ACagliano

• Posts: 910
• Rating: +32/-2
##### Re: Order of Operations
« Reply #11 on: April 05, 2014, 12:19:21 pm »
Nice! Didn't know that. Haven't been up to date on Axe's features before now. :p Is that the same for variable names now? Anything else it can do? lol

#### Hayleia

• Programming Absol
• Coder Of Tomorrow
• LV12 Extreme Poster (Next: 5000)
• Posts: 3367
• Rating: +393/-7
##### Re: Order of Operations
« Reply #12 on: April 05, 2014, 12:31:45 pm »
Nice! Didn't know that. Haven't been up to date on Axe's features before now. :p Is that the same for variable names now?
Yeah, you just need to "declare" them. For example do "L5->°MyVar", and then yo are able to do "Myvar++" and everything you want.

Anything else it can do?
Well just ask what you want it to do so we can answer that it is possible
Basically, except maybe ultra advanced things such as patching the OS, you can do everything.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

#### ACagliano

• Posts: 910
• Rating: +32/-2
##### Re: Order of Operations
« Reply #13 on: April 05, 2014, 02:32:26 pm »
Thats pretty awesome. So it seems to me like Axe is being designed to at least *feel* like using a C-style language for the computer. Am I right?

As for functions, how about direct ROM call injection? Like using b_call(_MD5Init) or something, that require certain registers as input? Or if its not implemented, maybe a variation on sub(, where argument one is the ROM call name, and the other arguments are like loads into registers, in {PTR}->[register] format?

Edit: So here would be an all-text algorithm..

Lbl Evaluate

1. if number of ( > number of ); then error one or more paren not closed
2. if number of ( < number of ); then error, too many )
3. find innermost (...), dump expression into scrap RAM
4. repeat 3 for each wrapping (...), until there are no parentheses left to evaluate. Each iteration of this becomes an "entry" in scrap RAM. When we have no more parentheses, we dump the rest of the expression into scrap RAM.
5. For each entry in scrap RAM, break apart entry into expressions, by the operator, and perform * and / before + and -.

Would that work?
« Last Edit: April 05, 2014, 03:16:41 pm by ACagliano »


text:
Q:

# What did Sir Isaac Newton do?

A:

The work of Sir Isaac Newton revolutionized science and laid the foundations of modern mathematics and physics. Among his accomplishments are the formulation of the laws of motion and gravitation, the development of calculus and the invention of the first reflecting telescope.

## Keep Learning

Sir Isaac Newton made many mathematical contributions, including the generalized binomial theorem, Newton's identities, Newton's method and classified plain curves. His insights are the framework of calculus.

Some of Newton's most important work was in the fields of mechanics and physics. He studied gravitation and its orbits on planets. Through his observations and through his derivation of Kepler's laws of motion, Newton at last confirmed the heliocentric model of the cosmos. Moreover, he created the three laws of motion that underscore physics: that an object stays at rest or uniform motion unless acted upon by an outside force; that the rate of change in an object's momentum is equal to the applied force on that object; and that for every action there is an equal and opposite reaction.

Sir Isaac Newton did very important work in the field of optics. By observing that light to a prism refracts different colors from different angles, he determined that color is an intrinsic property of light. He also concluded that objects themselves do not generate color but that color is the result of an object's interaction with already-colored light.

Sources:

## Related Questions

• A:

Sir Isaac Newton primarily worked at Cambridge University in England. However, he also derived some of his most important theories at his parents' home in Woolsthorpe, an English village in the county of Lincolnshire.

Filed Under:
• A:

According to Curiosity.com, Isaac Newton's work focused on several topics which eventually became the basis for the entire field of classical physics. While he had many achievements, his most important theories included those that governed the laws of motion and the foundations of calculus.

Filed Under:
• A:

Sir Isaac Newton is one of the most prominent scientists in history. Newton was an essential thinker during the scientific revolution, cataloging his work in "Mathematical Principles of Natural Philosophy." Newton is considered one of the most influential scientists and mathematicians.

format: plain


text:
# How many ways to colour a tetrahedron with monochromatic triangles.

I'm trying to find how many different ways there are to colour the edges of a regular tetrahedron with n colours such that there are no monochromatic triangles.

Certainly for one triangle there must be n choose 3 ways but I'm not quite sure how to generalise this to a tetrahedron.

Any help would be much appreciated!

-
is monochromatic one solid colour ie not all faces could be blue? – Ben May 21 '13 at 15:58
You mean coloring the edges? – ccorn May 21 '13 at 16:46
Colouring the edges yes, sorry. Monochromatic triangle would mean every edge is the same colour. Have edited the question now. – Wooster May 21 '13 at 17:44

Consider the three edges $e_1$, $e_2$, $e_3$ emanating from the top vertex $v_0$.

(i) You can color $e_1$, $e_2$, $e_3$ using three different colors in $n(n-1)(n-2)$ ways. For each of these colorings you can color the three bottom edges $e_4$, $e_5$, $e_6$ arbitrarily, but not all of them equal. This gives $n(n-1)(n-2)(n^3-n)$ admissible colorings of type (i).

(ii) You can color $e_1$, $e_2$, $e_3$ using two different colors in $3n(n-1)$ ways. The bottom edges then can be colored in $n^2(n-1)-(n-1)$ ways, where the $-(n-1)$ term again discounts the monochromatic bottom triangles. This gives $3 n(n-1)(n^2-1)(n-1)$ admissible colorings of type (ii).

(iii) You can color $e_1$, $e_2$, $e_3$ using a single color in $n$ ways. The bottom edges then can be colored in $(n-1)^3-(n-1)$ admissible ways. This gives $n(n-1)\bigl((n-1)^2-1\bigr)$ admissible colorings of type (iii).

Adding it all up we obtain $N:=n^6-4n^4+6n^2-3n$ admissible colorings.

-

For one triangle there are actually $n^3-n$ edge colourings, including reflections and rotations.

There are $6$ edges in a tetrahedron, $n^6$ ways to colour the edges, $4$ triangles, $n^4$ colourings with any given triangle monocromatic, $6$ pairs of triangles, $n^2$ colourings with any given pair of triangles both monochromatic, 4 ways to pick $3$ triangles, $n$ colourings with $3$ triangles, hence all triangles, monochromatic, $1$ way to pick $4$ triangles and $n$ colourings with $4$ triangles monochromatic.

The number of $n$-colourings without monochromatic triangles is then $n^6-4n^4+6n^2-3n$.

-
I wish I could upvote this twice; it's perfect. – MJD May 22 '13 at 0:59
@MJD: I tried several times, but I didn't arrive at understanding this answer, even though the result is correct. That's why I posted my own. Can you shed some light on it? – Christian Blatter May 22 '13 at 16:35
I agree that it is highly abbreviated. I had to read carefully before I understood. Does it help if I explain that it's an application of the inclusion-exclusion formula, or should I provide more detail? – MJD May 22 '13 at 16:50


text:
### danilka.pro's blog

By danilka.pro, 6 years ago, translation,

## 483A - Counterexample

Problem author gridnevvvit

This problem has two possible solutions:

1. Let's handle all possible triples and check every of them for being a counterexample. This solution works with asymptotics O(n3logA)
2. Handle only a few cases. It could be done like this:
  if (l % 2 != 0)
l++;

if (l + 2 > r)
out.println(-1);
else
out.println(l + " " + (l + 1) + " " + (l + 2));

Jury's solution: 8394832

## 483B - Friends and Presents

Problem author gridnevvvit

Jury's solution is using binary search. First, you can notice that if you can make presents with numbers 1, 2, ..., v then you can make presents with numbers 1, 2, ..., v, v + 1 too. Let f(v) be the function returning true or false: is it right, that you can make presents with numbers 1, 2, ..., v. Let f1 be the number of numbers divisible by x, f2 — the number of numbers divisible by y, and both — number of numbers divisible by x and by y (as soon as x and y are primes, it is equivalent to divisibility by x·y). Then to first friend at first we shold give f2 - both numbers, and to second friend f1 - both numbers. Then we must check, could we give all other numbers divisible neither by x nor by y.

This solution works with

Jury's solution: 8394846

## 483C - Diverse Permutation / 482A - Diverse Permutation

Problem author gridnevvvit

Let's see, what's the solution for some k = n - 1:

1 10 2 9 3 8 4 7 5 6

At the odd indexes we placed increasing sequence 1, 2, 3 .., at the even — decreasing sequence n, n - 1, n - 2, ... First, we must get the permutation the way described above, then get first k numbers from it, and then we should make all other distances be equal to 1.

This solution works with O(n).

Jury's solution: 8394876

## 483D - Interesting Array / 482B - Interesting Array

Problem author gridnevvvit

We will solve the task for every distinct bit. Now we must handle new constraint: l[i], r[i], q[i]. If number q[i] has 1 in bit with number pos, then all numbers in segment [l[i], r[i]] will have 1 in that bit too. To do that, we can use a standard idea of adding on a segment.

Let's do two adding operation in s[pos] array — in position l[i] we will add 1, and in posiotion r[i] + 1 — -1. Then we will calculate partial sums of array s[pos], and if s[pos][i] > 0 (the sum on prefix length i + 1), then bit at position pos will be 1, otherwise — 0.

After that, you can use segment tree to check satisfying constraints.

Jury's solution: 8394894

## 483E - Game with Strings / 482C - Game with Strings

Problem author gridnevvvit

Now, when we have array d calculated, it is not hard to calculate the answer. Let's handle some mask mask. Now we should try to make one more question in position pos, which is equal to adding one more 1-bit in mask in position pos. After that we may guess some strings, they are 1-bits in mask s = d[mask] ^ d[mask | (1 << pos)]. Then you have to calculate number of bits in s quickly and update the answer.

Jury's solution: 8394918

## 482D - Random Function and Tree

Problem author RoKi

Let's calculate d[v][p] dynamics — the answer for vertex v with size of parity p.

At first step to calculate this dynamic for vertex v we should count all different paintings of a subtree visiting all children in increasing order of their numbers. By multiplying this number by 2 we will get paintings visiting children in decreasing order. Now some paintings may count twice. To fix that, let's have a look on a some subtree of a vertex v.

Consider all the parities of children subtrees visited by our function (0 or 1). First thing to note is that among these parities exist two different values, the subtree will have different paintings with different ordering (you can prove it yourself). Otherwise, all our children sizes have the same parity.

If all sizes are even, this subtree will be counted twice. Otherwise, if sizes are odd, we are interested only in odd count of visited subtrees. This way, we must subtract from our dynamic the number of ways to paint any number of children with even subtree sizes and odd number of children with odd subtree sizes.

Jury's solution: 8394936

## 482E - ELCA

Problem author dans

Let's split all M requests in blocks containing requests each. Every block will be processed following way:

First using dfs we need to calculate for every vertex v, where u is every ancestor of v, sizei — size of subtree of vertex i, including itself. This value shows how will the answer change after removing or adding vertex v as child to any other vertex, furthermore, answer will change exactly by pathv·sizev (decreasing or increasing).

Then we will calculate chv the same way — the number of all possible vertex pairs, which have LCA in vertex v. This value shows how the answer changes after changing Vv — if Vv changes by dVv, answer changes by chv·dVv.

Then mark all vertexes, which occur in our block at least once (in worst case their number is ). Next, mark every vertex being LCA of some pair of already marked vertexes, using DFS. We can prove that final number of these vertexes is at most . After all this we got 'compressed' tree, containing only needed vertexes. Parent of vertex i in compressed tree we will call vertex numbered Pi.

On the image above example of this 'compression' way is given. Vertexes colored red are vertexes in request block, blue — vertexes marked after LCA, dotted line — Pv → v edges in compressed tree.

On such compressed tree we need to calculate one new value Cv for every vertex v — the size of a vertex, lying on a way from Pv to v after Pv on main (non-compressed) tree (son of a Pv vertex in main tree).

Now we should process request on changing parent of vertex v from pv to u on a compressed tree. The answer will change by pathv·sizev. Now for every vertex i, lying on a way from root to Pv vertex, two values will change: sizei will be decreased by sizev, but chi will be decreased by sizev·(sizei - Ct), (Pt = i), but pathi will stay unchanged. For every other vertex j only pathj will be changed: it will be decreased by . After that, we got compressed subtree where subtree of a vertex v is missing. Next, doing the same way as above, all values are changed considering that v (and all it's subtree) is a children of a vertex u. Do not forget to change Cv too.

Let's see, how the value-changing request of a vertex v is to be processed. As described above, the answer will be changed by chv·dVv. For every vertex i lying in vertex v subtree only pathi will be changed (it could be easy done using Cto values), all other values stay unchanged.

This solution has complexity, but in N = M case it has to be .

Авторское решение: 8394944

• +24

 » 6 years ago, # |   0 Well, will English translations be available at sometime? google translate was blocked in China.:D
•  » » 6 years ago, # ^ |   0 translate.google.cn
 » 6 years ago, # |   +3 I think that problem 483B could be solved in a mush easier way, which works O(1): 8386617
•  » » 6 years ago, # ^ |   0 The gcd function would give the log factor. So it wouldn't be O(1) ;)
•  » » » 6 years ago, # ^ |   0 As soon as x and y are primes, there is no needed — their is equal to x·y.
•  » » » 6 years ago, # ^ |   0 Oh, I see. I forgot that.
 » 6 years ago, # | ← Rev. 2 →   +22 There are lots of very similar ways to solve Game with Strings. Here are two more of them: first, calculate d[mask] as in the editorial.1) The number of different masks you visit during a game is equal to number of questions you ask. So from linearity of expectation the expected number of questions is the sum of the probability that you will visit mask, for all masks.That probability is easy to calculate: it's .See 8396215 for the code.2) Let dp[mask] be the expected number of questions from state mask. When we try to ask question pos in state mask, the chance that we will not guess correctly right away is equal to the fraction frac = bitCount(d[mask ^ (1<
•  » » 6 years ago, # ^ |   +3 Why should I divide binom(len, bitCount(mask)) ? I don't understand this.Can you explain it?
•  » » » » 2 weeks ago, # ^ | ← Rev. 2 →   0 Deleted
 » 6 years ago, # |   0 What does totalGuessed[i] denote in the link given in the Div1 C- Game of Strings? http://codeforces.com/contest/483/submission/8394918
 » 6 years ago, # | ← Rev. 3 →   0 Why we are doing sum[r[i]]-- in the solution of Div1-B ??
•  » » 6 years ago, # ^ |   0 Instead of iterating all the intervals to set the bits to 1, he stores the beginning and end of those intervals and only iterates the whole array one time for each bit position
 » 6 years ago, # | ← Rev. 5 →   0 Can someone explain Div2/b with more details? #include using namespace std; int main() { int cnt1,cnt2,x,y; cin >>cnt1 >>cnt2 >>x >>y; int l=1,r=INT_MAX,m; while(l=cnt1 && m-m/y>=cnt2 && m-m/(x*y)>=cnt1+cnt2){ r=m; } else{ l=m+1; } } cout <
•  » » 6 years ago, # ^ |   0 Define the value for INT_MAX
•  » » 6 years ago, # ^ | ← Rev. 2 →   0 use #include for using INT_MAX
 » 6 years ago, # |   0 Sorry, but can anyone explain to me the Div1-C method? I can't understand it well. 1. the solution says: Let's handle some mask mask. Now we should try to make one more question in position pos, which is equal to adding one more 1-bit in mask in position pos. What does it mean by saying "make one more question"? 2. what does this s = d[mask]^d[mask|(1<
 » 6 years ago, # | ← Rev. 6 →   -14 Deleted
 » 4 years ago, # |   0 Link to my sol for C:- http://codeforces.com/contest/483/submission/20360073Here's what i did:We need K distinct numbers.right.So,i tried to get difference K,then K-1,then K-2 till 1.Example:- 5 3step 1: 1step 2: 1 4step 3: 1 4 2step 4: 1 4 2 3step 5 : print rem with diff 1;so answer is 1 4 2 3 5.
 » 3 years ago, # |   0 could some one explain the answer for problem b in binary search please
 » 3 years ago, # |   +4 HI ,Every one. Can you help me with pro Div1B/Div2D ? My submission got ACCEPTED. BUT, I have a test which it's answer should be NO. AND my AC code print YES. the test is: 5 2 1 5 1023 1 5 511 AND THIS IS MY SUBMISSION: http://codeforces.com/contest/482/submission/29177333
•  » » 3 years ago, # ^ |   0
•  » » » 3 years ago, # ^ |   +3 Abusing notifications, huh?
•  » » » 3 years ago, # ^ |   0 Passing system test doesn't mean your program is correct. It only means it passed all tests, the author thought of. It should happen barely, but you can't get rid of it.For example think of a code, which does if()s for all given test cases, and prints the correct answer. Obviously it won't work generally, but it will get AC.It's okay if you notice this, and ask to add this to tests, but you shouldn't abuse notifications, as extraVirgin said. Also, you should fix your code at your own, to pass both system tests, and this test.
 » 2 years ago, # |   0 For 483A: How to code the first method? Let's handle all possible triples and check every of them for being a counterexample. This solution works with asymptotics O(n3logA)??
 » 6 months ago, # |   0 segment tree is not necessary in 483D
 » 5 months ago, # | ← Rev. 4 →   0 .
 » 2 months ago, # |   0 483A — Counterexample how did he come up with that algorithm ? can anyone please explain
•  » » 2 months ago, # ^ |   0 see ,between any two even number there is an odd number(ex:10,11,12) so if (r-l+1)>3 and l is even then the answer is l,l+1,l+2 else you have to print l+1,l+2,l+3.(please ensure that if d==3 or d<3 and l is odd then answer is -1)
 » 5 weeks ago, # | ← Rev. 2 →   0 In Problem A how my answer violates the range


text:
Lemma 90.10.3. Let $S$ be a scheme contained in $\mathit{Sch}_{fppf}$. Let $a : F \to G$ be a map of presheaves on $(\mathit{Sch}/S)_{fppf}$. Let $\mathcal{P}$ be as in Definition 90.10.1. Assume $a$ is representable by algebraic spaces. Then $a : F \to G$ has property $\mathcal{P}$ (see Bootstrap, Definition 76.4.1) if and only if the corresponding morphism $\mathcal{S}_ F \to \mathcal{S}_ G$ of categories fibred in groupoids has property $\mathcal{P}$.

Proof. Note that the lemma makes sense by Lemma 90.9.5. Proof omitted. $\square$

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).


text:
4,367 views

Aishwarya studies either computer science or mathematics everyday. If she studies computer science on a day, then the probability that she studies mathematics the next day is $0.6$. If she studies mathematics on a day, then the probability that she studies computer science the next day is $0.4$. Given that Aishwarya studies computer science on Monday, what is the probability that she studies computer science on Wednesday?

1. $0.24$
2. $0.36$
3. $0.4$
4. $0.6$

### Subscribe to GO Classes for GATE CSE 2022

on Wednesday we want cs

required probability = $0.6 \times 0.4 + 0.4 \times 0.4 = 0.4$

### 1 comment

Nice, thanks for the visuals

prob of studying CS on Tue = 0.4

prob of studying CS on Wed given that it was studied on Tue = 0.4 x 0.4 = 0.16

prob of studying Math on Tue = 0.6

prob of studying CS on Wed given that Math was studied on Tue = 0.6 x 0.4 = 0.24

prob = 0.16 + 0.24 = 0.4
I think both the events are independent events bcoz the prob she studies cs any particular day is .4 and she studies Maths any particular day is  .6 .

Given that she study cs on Mon then,∣

prob(Cs on Wed) = P(Cs on Tue , Cs on Wed) +P(Maths on Tue,Cs on Wed)

=P(Cs on Tue).P(Cs on Wed)+P(Maths on Tue).P(Cs on Wed)

=.4*.4 +.6*.4 =.4

In short, prob(Cs on Wed ∣ Cs on Mon ) = prob(Cs on Wed) = .4      // Independent
by

Given that Aishwarya studied CS on Monday,so possible scenarios are-:

$\text{MON TUE WED}$

$\text{1.CS MATHS MATHS}$

$\text{2.CS MATHS CS}$

$\text{3.CS CS MATHS}$

$\text{4.CS CS CS}$

case $1$ and $3$ will be discarded as the question is asking the probability that she studies computer science on Wednesday

Given that

• $\text{CS} \rightarrow \text{MATHS}=0.6$
• $\text{MATHS} \rightarrow CS=0.4$
• $\text{CS} \rightarrow \text{CS} =0.4$
• $\text{Maths} \rightarrow \text{Maths} =0.6$

Considering Case $2$ and $4$ we need to find their respective probability.

case $2 -: 0.6 \times 0.4$

case $4-: 0.4 \times 0.4$

Required proabaility=$0.24+.16=0.4$

by
I'll use obvious notations.

$P(M|C)=0.6$

$P(C|M)=0.4$

Since she studies either of $M$ or $C$ everyday $P(C|C)=0.4$

If she studies $C$ on Monday, we want her to study $C$ on Wednesday, too.

We can do this via:

$C \rightarrow C \rightarrow C$ or $C \rightarrow M \rightarrow C$

$0.4*0.4+0.6*0.4$

=> $0.16+0.24$

=> $0.4$

If Understood , Just UPVOTED :)


text:
# Gas station without pumps

## 2016 April 30

### Sixteenth weight progress report

Filed under: Uncategorized — gasstationwithoutpumps @ 17:39
Tags: , , , , , ,

This post is yet another weight progress report, continuing the previous one. I’m doing a little better this month, going above my target range for only 5 days:

Weight is still hovering around the upper end of my self-selected target range.

April saw a gradual decrease in weight, followed by a large upward spike at the end of the month.

The large upward spike corresponded to a 4-day trip to Illinois for a family wedding and a 90th birthday celebration for my dad.  His birthday was months ago, but travel to Colorado in mid-winter is a difficult, so we moved the celebration to the same weekend as his granddaughter’s wedding, so that we could get everyone to come.

My exercise for April was good (averaging 4.72 miles/day bicycling), despite the trip to Illinois and having had a bad cold for the last week (flying with a bad cold is no fun).

## 2016 April 29

### Miswiring errors

Filed under: Circuits course — gasstationwithoutpumps @ 15:25
Tags: ,

In yesterday’s post, Revised microphone pre-amp lab too long, I wrote about problems in this week’s lab, and one of the items seems to have resonated with at least one other instructor:

a surprisingly large number connected both nodes for a resistor to the same end of a resistor, leaving the other end unconnected.  I’ve not seen that mistake before, so I don’t know what triggered it.

CCPhysicist commented

I’ve seen that error (connecting two wires to the same end of a resistor) before, more than once, but I also don’t have a clue why they do it. It is worst if the resistors are in a box where they can see the connectors but not the resistors (even when they see the resistor symbol between the connectors), but also happens with loose resistors. Now my students have the excuse that we start doing those labs before we get to DC circuits in lecture, so I assume it means they have no idea that current flows through things and that switches break a circuit, but I have no idea why they get to college without any experience related to the basic concept of electric current. Maybe whatever misconceptions they have about current are stubborn enough to survive a semester of physics.

As for why you got many instances of that error, I’d suspect “authoritative ignorance” syndrome. Others were following someone who talks a good game but doesn’t know the play. Can happen just by one person looking at what another is doing, without any actual bad mentoring taking place.

I don’t think that “authoritative ignorance” was the problem here, as the students making the error were in both sections and they made it in different places in the circuit. I responded with my best guess at what was happening:

My conjecture is that students aren’t using a misconception of current—they aren’t thinking about the function of the resistor at all. They just have the idea “connect up the resistor to A and B”. Having a wire between point A and the resistor and between point B and the resistor satisfies that objective, even though it doesn’t mean anything if the resistor is not between A and B

I discussed this with the class today, and suggested that they change their mental language and think of connecting a resistor between two nodes, rather than to two other components. I also talked about switching their thinking from “components connected by wires” to the dual graph, nodes connected by components, and assigning a color to each node.

Color coding each node makes it much easier to notice incorrect connections (two different colors connected together), though it doesn’t help with noticing missing connections.  For that, I recommend that students check each component to make sure every node is there, and every node to make sure it has the right number of components.

CCPhysicist commented

Perhaps I will work on introducing the concept that labs like most of our circuit labs are about discovering the function of everything we use (meters as well, because they are part of the circuit, and even the wires themselves), and discourage the use of words like “to” instead of “through”. After all, the two wires in your example actually do carry current “to” and “from” the resistor!

I insist in the weekly design reports that students not use “voltage through” or “current across”, but always “voltage across” and “current through” to talk about V and I for a component.  I don’t think that this help much with their understanding, though, as the misunderstandings about voltage always being a difference are still common, and students still routinely apply Ohm’s Law to voltages and currents measured in different places.

Any problem that involves a voltage, a current, and a resistance causes many of them to invoke $V=IR$, even when the voltage and current are unrelated or related in something other than a simple resistance.  (For example, when chosing a DC bias resistor for an electret microphone, we have a non-linear I-vs-V relationship for the mic, and generally have a voltage drop across the resistor that needs to be added to the voltage drop across the microphone to get the power-supply voltage, but students will take any of the voltages (the mic voltage, the voltage across the resistor, or the power-supply voltage) to get the resistance of the bias resistor, when only one of the voltages is appropriate.

My labs are not about “discovering the function of everything we use”, but about learning how to design circuits with imperfect parts. (That’s one difference between a physics lab and an engineering lab.) I’m trying to give the students tool skills: both mental tools and physical tools.  The notion of having multiple models for something and using the simplest one you can get away with is one of the skills I’m trying to get them to develop.  The extremely simple models used in intro physics courses are often not good enough for practical use and developing better models from first principles is too hard, so we do a lot of measuring and empirical fitting.  (The loudspeaker modeling lab is a good example, where we go through 4 different models of the loudspeaker: R, L+R, L+R+RLC, semi-inductor+R+RLC.  Sometimes the simple model of the loudspeaker as being 4Ω is adequate, and sometimes we’ll use the full complexity of the non-linear model.)

There are a lot of learning experiences that are generally unavailable with simulations (like the problem of measuring voltages in voltage dividers made of 4.7MΩ resistors when your meter has a 10MΩ input impedance, or the problem of clipping when using high gain in an op amp, because of input voltage offset errors).  Students are much more likely to remember to design around input offset voltages if they have observed an unexpected output voltage offset and tried to figure out what caused it, than if they are simply guided to do designs that have low gain without knowing why (or allowed to do large-gain designs without realizing that they wouldn’t work reliably, as I have often done myself, even though I theoretically know better).

## 2016 April 28

### Revised microphone pre-amp lab too long

Filed under: Circuits course — gasstationwithoutpumps @ 23:47
Tags: , , ,

How many of my posts have the theme “lab too long”? (answer: too many)

I spent 10 hours in the instructional lab on Tuesday and 11 hours today (Thursday) helping students do the microphone pre-amp lab, and my group tutor is going to have to open the lab on Sunday for several students to finish soldering and testing their boards.

This means that the lab is between 1.5–2× longer than it should be.  You’d think that I would be able to predict the length of a lab better by my fourth year of teaching this course!

What went wrong, and how can I fix it for next year?

• The design is somewhat harder for the first op-amp lab than in previous years, because I made a decision to do all the op-amp labs this year with a single power supply, not dual supplies.  That makes for a slightly more difficult start, but students don’t have to make the transition from dual supplies (which are getting quite rare these days) to single supplies. The transition is a surprisingly hard one for students to make, as the simplification that they learned for the case when the reference voltage is zero no longer apply, and they have to learn everything over again.  Learning the more general form first will, I believe, result in less confusion in the long run, but it does make for a slightly more complex first project.
• This year I’m having students solder their pre-amp boards, so that they can re-use them as part of their class-D power amplifier in three weeks.  This was a deliberate choice, to reduce the amount of effort in the class-D lab, which was running too long in previous years, but it roughly doubled the time it took students to finish the lab.
• Because students had larger ceramic capacitors this year, and I had them set the high-pass cutoff frequency near their speaker resonances, some students opted to use very large capacitors and small resistors for their high-pass filters. This made a very small impedance in the passband, and attenuated the signal from the microphone and its large-impedance biasing resistor.
I’ll have to put a warning in the book about the high-pass filter needing to have a larger impedance than the bias resistor, to avoid changing the current-to-voltage conversion.
• Some students had the opposite problem, putting a small capacitor with a very large resistor, so that there was a very high impedance signal driving the input to the amplifier. Since we are using op amps with tiny bias currents, this is not a problem for the circuit’s functioning, but it made looking at the signals with the oscilloscope difficult—increasing the difficulty of debugging.
• Many students were surprised to see that the output voltage was not centered at their Vref voltage.  This provided a teaching moment for looking at the MCP6004 data sheet and explaining the notion of the input offset voltage. Because they were using gains of 100×–300×, the ±4.5mV offset became an output offset of ±0.45V–1.35V, sometimes resulting in serious clipping.  I need to warn students about that imperfection of op amps before they do the design.  A better design would use a multi-stage amplifier, with high-pass filters between stages to get rid of accumulated DC offset.
• I suggested to several students that they look at Vout vs. Vin, by recording a slow sine wave (say 300Hz) at 5kHz sampling with PteroDAQ.  This turned out to have some interesting effects when students used 32× averaging, because the time delay between the two channels was enough to get the signals far enough out of phase to open up the plot into an ellipse. Again, I’ll need to talk about that in class tomorrow.
• Lots of students made the mistake of incorrectly applying Ohm’s Law and getting too large a bias resistor, so that their microphones were not in saturation at the power-supply voltage of 3.3V.  Luckily, increasing the voltage to 5V (as we will do in the power-amp lab) will rescue their designs.
• Lots of students made the standard mistakes of skipping a wire or two, or putting a wire in the wrong hole while soldering, but a surprisingly large number connected both nodes for a resistor to the same end of a resistor, leaving the other end unconnected.  I’ve not seen that mistake before, so I don’t know what triggered it.
• The lead-free solder we have to work with this year (99.3% Sn, 0.7% Cu) is a pain to work with—it doesn’t tin the soldering irons well, and it is difficult to remove from the boards in the event of a mistake.

I think that the soldering lab should not be the first op-amp lab, but I still like the idea of the students having to solder up their microphone preamps. So I’ll have to do a major reorganization of the book this summer, to move a different lab into the first position.

Currently, I’m thinking that the transimpedance amplifier and pulse monitor lab would be a good choice as the first op-amp lab.  It would be a bit unusual to start with a transimpedance amplifier rather than a standard voltage amplifier, but the transimpedance amplifier is actually conceptually simpler.  Unfortunately, the pulse monitor using a transimpedance amplifier really needs to be 2 stages, with a transimpedance amplifier to bias the phototransistor, a high-pass filter, and an AC gain stage.  (Yes, I know I’ve posted about pulse monitors without amplifiers, but a major point of the lab is to teach about transimpedance amplifiers.)

The corner frequencies for the pulse monitor are really low, requiring big resistors even with their biggest capacitors, so the “too small a resistor” problem goes away, though not the “too big a resistor” problem.

By making the microphone preamp the second, or even third, op amp lab, students will spend less time on getting a breadboarded design working, and more time on learning to lay out and solder their circuits. They’ll also be much more amenable to a 2-stage design, to reduce the output offset voltage.  I think that rearranging the labs may be worth the effort it will take to rewrite the corresponding chapters of the book, but undoubtedly something else will go wrong next year, and I’ll have to do yet another major revision.

Ah well, at least I’ve gotten the demo for tomorrow’s class (blood and breath pressure) working tonight, and I’ll be able to get to bed before midnight.

## 2016 April 20

### AliExpress guarantee is bogus

Filed under: Uncategorized — gasstationwithoutpumps @ 07:43
Tags: ,

I have bought a number of things (mainly electronics) direct from China using AliExpress.  I was encouraged to do so by their “Buyer Protection”:

You will get a full refund if your order does not arrive within the delivery time promised by the seller.

I have twice now needed to invoke that guarantee—both times items shipped by China Post that did not arrive.  I don’t know whether the problem is that shippers weren’t sending stuff, or stuff was getting “lost” in China Post.

The first time was a small order, and AliExpress followed through on their guarantee.

The second time was a larger order for my class (about \$150 worth of resistor assortments), and the shipper sent me a tracking number that indicated that the shipment had been sent to Russia.  I opened the dispute with AliExpress after waiting a month for the delivery, and after a long wait they denied the claim saying that they were satisfied with the evidence.  I escalated the dispute, and the escalation was denied—in the denial I was sent a different tracking number claiming that the delivery had been made 2 months earlier.

I was not informed of messages from the seller, only of final decisions by AliExpress (for instance, the “corrected” tracking number was supposedly entered into the AliExpress system on 11 April, but I didn’t get informed of it until 20 April, when AliExpress denied my escalated claim).

The tracking claims that delivery was attempted on Feb 27 at 1:16pm and made on Feb 29, at 5:32pm.  I was home both times and no such delivery was made.  (Also our mailman never gets to our part of the route by early afternoon, and rarely even by 5:32pm—I believe that the tracking is fraudulent, which leads me to suspect China Post, rather than the shipper.)

Bottom-line:  the AliExpress guarantee is not worth much if no delivery is made.  In future, I will not order from AliExpress except when either

• the item is so cheap I don’t really care if it isn’t delivered (there seems to be about a 20% risk).
• the item is expensive enough that I’m willing to pay for a reliable delivery service like DHL rather than the free shipping through China Post.

Update 2016 June 9: AliExpress did refund the money for the undelivered goods—it took a while, and the process was murky, but I retract what I said earlier about their not standing behind their guarantee. I will still be using them only when I’m either willing to risk non-delivery or willing to pay a lot for delivery, as I still have no confidence in China Post, and I don’t want to go through the process of asking for refunds that take 3 months to receive.

## 2016 April 16

### Santa Cruz Mini Maker Faire went well

The first Santa Cruz Mini Maker Faire seemed to go well.  I did not get to see much of it, since I was busy at my booth most of the day, though I did get a break for lunch while my assistant Henry manned the booth, and I made a quick tour of the exhibits during that break, to see what was there, though with no time to chat with other exhibitors.

I understand that about 1800 people bought tickets to the Mini Maker Faire, which probably means there were over 2000 people on-site, including volunteers and makers.  I hope the food vendors did OK—I ate at the Ate3One truck, since I never have before, but my opinion afterwards was that CruzNGourmet and Zameen have better food (both of those trucks are frequently on campus, and I’ve eat at each several times).

My day went pretty well, though I had one annoying problem, having to do with my pulse monitor display. When I set up the booth Friday evening, the pulse monitor was not working, and I thought that the phototransistor had somehow been broken in the rough ride in the bike trailer, so I brought the pulse monitor home, replaced the phototransistor and tested in thoroughly.  Everything worked great, so I packed it more carefully for transport in the morning.

When I got everything set up Saturday morning, I found I had no electricity, though the electricity had worked fine the night before.  After I finally tracked down a staff member with the authority to do anything about it, he suggested unplugging the other stuff plugged in and switching outlets.  I turned out that the only problem was that the outlets were so old and worn out that they no longer gripped plugs properly—taping the extension cord to the outlet box so that the weight of the cord didn’t pull out the plug fixed the power problem.

Once I had power, I tested the pulse monitor, and it failed again!  I used the oscilloscope to debug the problem, and found that the first stage transimpedance amplifier was saturating—there was too much light in the room, and even shading the pulse monitor didn’t help. By then, my assistant for the day (and my group tutor for the class on campus), Henry, had arrived and gotten the parking permit on his car, so I raced home on my bike to get resistors, capacitors, op amp chips, multimeters, hookup wire,and clip leads to try to rebuild the pulse monitor from scratch on the bread board.

When I got back to Gateway School, I tried a simple fix before rebuilding everything—I added a pair of clip leads to the board so that I could add a smaller resistor in parallel with the feedback resistor in the transimpedance amplifier, reducing the gain by a factor of about 30.  This reduced gain kept the first stage from saturating, and the pulse monitor worked fine.  Rather than rebuild the amplifier, I just left the pair of clip leads and the resistor in place all day—they caused no problem despite many people trying out the pulse monitor.

I think that I want to redesign the pulse monitor with a logarithmic first stage, so that it will be insensitive to ambient light over several decades of light.  That should be an easy fix, but I’ll have to test it to make sure it works. I don’t think I’ll have time this weekend or next to do that, but I’ll add it to my to-do list.

I’ll need to think about whether to include having a logarithmic response in the textbook—that is certainly more advanced than what I currently include (just a transimpedance amplifier), which is already pushing students a bit.  A transimpedance amplifier is a pretty common component in bioelectronics, so I really want to leave one in the course.  I’m not sure a logarithmic amplifier is important enough or simple enough to include at this level (I don’t currently cover the non-linearity of diodes).

Here is the booth display with my assistant, Henry. I was permitted to use painter’s tape to attach the banner to the whiteboard.

The magenta laptop on right (which my family refers to as the “Barbie laptop”) was a used Windows laptop that I bought for testing out PteroDAQ installation on Windows. It was set up with PteroDAQ running all day, recording a voltage from a pressure sensor and a frequency from a hysteresis oscillator (as a capacitance touch center).

Just to the left of that was a fairly bright stroboscope, using 20 of my constant-current LED boards. To its left is my laptop, displaying the current draft of my book. Behind (and above) the laptop is my desk lamp, which uses the same electronic hardware as the stroboscope, though with only 6 LED boards, not 20.

In front of the laptop is the pulse monitor, which includes a TFT display in an improvised foamcore stand. I used just a half block for the pulse sensor, relying on ambient light (sunlight and the desk lamp) for illuminating the finger.

To the left of the pulse monitor was a stack of business cards for my book and sheets of paper with my email address and URLs for this blog and the book.  I should have included the PteroDAQ URL as well, but I had forgotten to do so. I did tell a lot of people how to find PteroDAQ from the navigation bar of my blog, but putting it on the handout would have been better. Ah well, something to fix next year (if Gateway is crazy enough to do another Mini Maker Faire, which I hope they are).

I also had all my bare PC boards that I had designed and not populated, plus my two Hexmotor H-bridge boards, behind the business cards. One of the amplifier prototyping boards was displaying in the Panavise that I use for soldering.

On the far left of the table is my Kikusui oscilloscope and two function generators, set up to generate Lissajous figures.  I let kids play with the frequencies of the function generators, take their pulse with the pulse monitor, and play with the pressure sensor and the capacitive touch sensor.

My booth was not the most popular of the Faire by any means (certainly the R2 Makers Club in the next booth was more popular), but I was kept busy all day and I talked with a lot of people who seemed genuinely interested in what I was doing, both with the UCSC course and as a hobbyist.

Next Page »


text:
Jonathan wrote:

> I was always quite confused by natural transformations, but it seems they're just a selection of morphisms in the target category? How interesting!

Yes!

Well, a **transformation** between functors \$$F, G : \mathcal{C} \to \mathcal{D}\$$ is just an arbitrary selection of a morphism \$$\alpha_x : F(x) \to G(x) \$$ in the target category for each object \$$x\$$ in the source category. That's enough to create the vertical 'struts' in this picture:

But it's **natural** when the squares with these struts as their vertical sides _commute_. And that's the cool part.

Your answer to Puzzle 126 is very nice, and the nugget of insight lurks here:

> Practically speaking, the inclusion map allows us to extend a database in a consistent way.

The commuting of the squares, which makes our transformation 'natural', is a kind of _consistency condition!_

Your answer to Puzzle 127 is also very nice:

> This seems to be a kind of reduction or compaction, where equivalent rows are coalesced and existing relationships involving the coalesced rows are updated.

Right, and the commuting of the naturality squares says we are doing this in a _consistent_ way.

> It is notable that the database instance \$$H\$$ replaces Stan with Bob as Tyler's friend, which ensures that all induced squares commute.

Maybe someone can expound a bit more on the notion of 'consistency' that I'm vaguely alluding to. All I mean is that a bunch of squares commute... but it's good to try to tease out the meaning of this, and express it in something resembling plain English.


text:
### Archive

Archive for the ‘Geometry’ Category

## Circle theorems 2: Questions

### Set 2

Categories: Geometry

## Circle Theorems 2

Tangents to circles

### Theorem 1

The length of the tangents from a point to a circle are of equal length

### Theorem 2

The Angle between a tangent and a radius is a right-angle

### Theorem 3

The angel between a tangent and a cord is equal to the angle subtended by the cord

### Examples

Given that PA is a tangent find the value of $x$
Since PA is a tangent $\angle PAO = 90^o$
$\implies x = 180^o-90^o-65^o=25^o \because 180^o \mbox{in a }\triangle$

Given that PA and PB are tangents find the value of $x$
Since PA and PB are tangents they must both be of equal length.  Therefore $\triangle ABP$ is isosceles.
$\implies \angle ABP =\frac{180^o-49^o}{2}=65.5^o \because$ base angles in an isosceles triangle are equal.
$\implies x=90^o-65.5^o=24.5^o \because$ the angle between a tangent and a radius is a right-angle.

Find the value of $x$
Since $\triangle ABC \mbox{ is isosceles}\implies \angle ACB = 50^o$
$\implies x=50^o \because \mbox{Angle subtended by the cord}$

#### Questions

Categories: Geometry

## Trigonometry: Right-angled triangles Quesitons

For each set of questions find the value of $\mbox{w, x, y and z}$

Make sure to write down all the working.  It is a good habit to be rigorous in your answers.

Set 1

Set 2

Set 3

Set 4

Set 5

Categories: Triangles

## Trigonometry and Right-angled triangles

#### Conceptual Understanding

If we find the ratio between a pair of sides on a triangle the value will be a constant even on larger triangles provided the triangles are similar to each other.

### The right-angled trigonometry triangle

The hypotenuse is the longest side and is opposite the right-angle

The opposite is the side that is opposite the given angle. (Or the angle we wish to find)

The adjacent is the side next to the given angle.  (It is between the given angle and the right angle)

### The ratios SohCahToa

$\displaystyle sin \theta = \frac{opp}{hyp}$

$\displaystyle cos \theta = \frac{adj}{hyp}$

$\displaystyle tan \theta = \frac{opp}{adj}$

When solving a trigonometry right-angled triangle problem we need two pieces of information and then use the relevant ratio to find the third.

There are three possible scenarios.

1. We are finding an angle
2. We are finding a side that is a numerator in the ratio
3. We are finding a side that is a denominator in the ratio

### Examples

Type 1 (The unknown is the numerator)

We have the hypotenuse and we want the opposite side.  The only ratio with hypotenuse and opposite in it is the sine ratio.

$\displaystyle sin\theta = \frac{opp}{hyp}$

Let’s fill out the equation

$\displaystyle sin 35^o=\frac{x}{17}$

$\displaystyle \implies 0.374=\frac{x}{17}$

$\implies x=9.75cm$

Type 2 (The unknown is the denominator)

We have the opposite and we want the adjacent side.  The only ratio with adjacent and opposite in it is the tangent ratio.

$\displaystyle tan \theta = \frac{opp}{adj}$

Let’s fill out the equation

$\displaystyle tan 27^o=\frac{28}{x}$

$\implies x\times tan 27^o=28$

$\displaystyle \implies x=\frac{28}{tan 27^o}$

$\therefore x =54.95mm$

Type 3 (The angle is unknown)

We have the hypotenuse and adjacent side.  The only ratio with adjacent and hypotenuse in it is the cosine ratio.

$\displaystyle cos \theta = \frac{adj}{hyp}$

Let’s fill out the equation

$\displaystyle cos x=\frac{15}{32}$

$\implies \displaystyle x=cos^{-1}\left(\frac{15}{32}\right)$

$\implies x =62.0^o$

#### Questions

Categories: Triangles

## Pythagoras’ Theorem Questions

Set 1: Find the value of a, b, c and d

Set 2: Find the value of a, b, c and d

Set 3: Find the value of a and c in the first diagram and the area of the second diagram

Categories: Triangles

## Pythagoras’ Theorem Proof

### Consider a pair of right-angled similar triangles

Consider $\triangle ABD$

Since it is right-angled that implies that $\beta + \delta = 90^o$

Which implies that $\triangle ACD$ is similar to the other two triangle.

Since the triangles are similar

$\displaystyle \frac{a}{c}=\frac{c}{a+d}$

$\implies a^2+ad=c^2$

Also $\displaystyle \frac{b}{d}=\frac{a}{b}$

$\implies ad=b^2$

Substituting gives $\displaystyle a^2+b^2=c^2$

Categories: Geometry

## Angle at the centre of a circle proof

Proof

$AO=BO=CO=DO \because \mbox{they are all radii of a circle}$

$\implies \triangle AOC \mbox{ and }\triangle BOC \mbox{are isosceles}$

Let $\angle OAC=\alpha$

$\implies \angle ACO=\alpha\because \mbox{base angles in an isosceles trinagle are equal}$

$\mbox{So } \angle COA = 180^o-2\alpha\because 180^o\mbox{ in a triangle}$

$\implies \angle AOD = 2\alpha \because 180^o\mbox{ on a line}$

Let $\angle CBO=\beta$

$\implies \angle OCB=\beta\because \mbox{base angles in an isosceles trinagle are equal}$

$\mbox{So } \angle BOC= 180^o-2\beta\because 180^o\mbox{ in a triangle}$

$\implies \angle DOB = 2\beta\because 180^o\mbox{ on a line}$

$\mbox{So } \angle ACB = (\alpha + \beta)$

$\mbox{and } \angle AOB=(2\alpha + 2\beta)=2(\alpha + \beta)$

$\implies \angle AOB=2(\angle ACB)$

Q.E.D.

Categories: Geometry


text:
北京大学期刊网　|　作者　　审稿人　　编委专家　　工作人员 首页　  |  　关于　  |  　浏览　  |  　投稿指南　  |  　新闻公告
 数学进展
 研究论文
 Attractors of the Derivative Complex Ginzburg-Landau Equation in Unbounded Domains Attractors of the Derivative Complex Ginzburg-Landau Equation in Unbounded Domains 郭柏灵,韩永前 GUO Bo-ling HAN Yong-qian Institute of Applied Physics and Computational Mathematics,P.O.Box 8009,Beijing,100088,P.R.China,Institute of Applied Physics and Computational Mathematics,P.O.Box 8009,Beijing,100088,P.R.China (Institute of Applied Physics and Computational Mathematics, P.O. Box 8009, Beijing, 100088, P. R. China 收稿日期: 2005-10-25 出版日期: 2005-10-25
 55 浏览 引用导出
0
/   /   推荐
 摘要 We consider the following initial boundary problem of derivative complex Ginzburg-Landau (DCGL)equation (1) (2) in an unbounded domain Ω(?) 2.Here u is a complex valued function of(x,t)∈Ω×(?)+, a1>0,b1>0,σ>0,a2,b2∈(?),λ=(λ1,λ2)and μ=(μ1,μ2)are complex constant vector.
 No related articles found!
Viewed
Full text

Abstract

Cited


text:
# How do you multiply (x^3+1)^2?

Jan 7, 2017

#### Answer:

See full explanation below:

#### Explanation:

This expression can be rewritten as:

$\left(\textcolor{red}{{x}^{3} + 1}\right) \left(\textcolor{b l u e}{{x}^{3} + 1}\right)$

We can next cross multiply each term in the parenthesis on the left by each term in the parenthesis on the right:

$\left(\textcolor{red}{{x}^{3}} \times \textcolor{b l u e}{{x}^{3}}\right) + \left(\textcolor{red}{{x}^{3}} \times \textcolor{b l u e}{1}\right) + \left(\textcolor{red}{1} \times \textcolor{b l u e}{{x}^{3}}\right) + \left(\textcolor{red}{1} \times \textcolor{b l u e}{1}\right) \to$

${x}^{6} + {x}^{3} + {x}^{3} + 1$

Now we can combine like terms:

${x}^{6} + 2 {x}^{3} + 1$


text:
# Real integrals with complex coefficients

1. Mar 16, 2012

### VantagePoint72

I'm curious about the validity of various techniques from good old calculus in one real variable when dealing with complex coefficients. I know enough complex analysis to know that the rules change when dealing with complex variables, but I'm curious about the case when the variables are still real and its just coefficients that are complex.

For example, suppose you wanted to do the following integral:

$$\int_{-\infty}^{\infty} e^{-\left(t + i\alpha\right)^2} dt$$

with $\alpha$ real. Can I just do u-substitution like this:

$$u = t + i\alpha \rightarrow du = dt \\ \int_{-\infty}^{\infty} e^{-\left(t + i\alpha\right)^2} dt = \int_{u=-\infty}^{u=\infty} e^{-u^2} du$$

and conclude the integral is $\sqrt{\pi}$ like usual? Punching it into Wolfram Alpha confirms that's the result, so it's more whether or not what I did was valid in general that I'm interested in, rather than this particular result. Can I still use the familiar tricks, or does the mere presence of complex numbers invalidate these old techniques?

2. Mar 17, 2012

### mathman

I am not sure about the validity of the technique but in this case it looks like the right answer. Expand the exponent and get eα2 multiplying the Fourier transform of e-t2, which is e2 (with some constants including √π).


text:
## Existentialism Mathematics #06

March 17, 2010

Notes on Existentialism Mathematics by dr. Algirdas Javtokas (New Frontiers in Mathematics Series).

.

Proposition. 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 01 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1

011111110100 = 00

0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 01 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 01 0 0 0 0 1 11 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1

.

Proof  1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 11 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 01 1 0 1 01 0 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0

01111110 $\displaystyle\int$ 00 $\times$ 00

0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 01 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 01 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0

010 $\displaystyle\sum$ 100 $\displaystyle\sum$ 010101000

.

Example. 0 1 1 0 1 01 0 0 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 01 1 1 0 00 1 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0 1 1 1 0 00 1 0 1 0 1 0.

0100 $\otimes$ 0100 $\supset$ 00010 $\subset$ 000

1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 11 0 1 0 1 0 0 1 1 0 1 01 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0

0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 00 0 0 0 1 1 1 1 10 0 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 0 00 0 0 1 1 1 1 0 1 0 0 1

000010 $\asymp$ 011000

0 1 1 1 1 0 00 1 0 1 0 1 01 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 01 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 01 1 0 1 01 0 1 0 11 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1

.

Theorem. 0 1 01 0 1 0 1 0 0 0 0 1 11 1 1 1 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 001 1 1 1 1 11 1 0 0 0 0 0 1 1 1 1 0 0 00 0 1 1 1 1 1 0 0 00 0 1 1 1 1 1 1 1 1 1 0 00 0 0 1 1 1 1 00 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 00 0 0 1 1 1 1 0 1

00 $\leftrightarrow$ 00

.

Proof  0 1 01 0 1 0 1 0 0 0 0 1 11 1 1 1 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 0 00 1 0

00010010 $\displaystyle\sum$ 00010010 = 000

0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 01 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 01 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0

0 1 01 0 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 01 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 0 0 1 1 0 1 01 0 1 0 1 0 0 0 0 1 1 1 1 0 00 1 0 1 0 1 01 1 0 1 01 0 1 0 1 1 1 1 1 1 1 1 1 1 101

.

### 4 Responses to “Existentialism Mathematics #06”

1. Your message is a great reward for all the effords that were made!

2. kitty Says:

what is that?

3. Haha, great post that MANY will not understand. Fun read!

4. actually public schools can also give great education to your kids, it is also as good as most private schools ..


text:
# Math Help - Mathematician Is Chosen for Genius' Grant - Los Angeles Times

1. ## Mathematician Is Chosen for Genius' Grant - Los Angeles Times

Mathematician Is Chosen for `Genius' Grant
From Los Angeles Times, CA -

The medal is often called the mathematics equivalent of the Nobel Prize. Terence Tao, 31, sometimes called the "Mozart of Math," is probably the best mathematician in the world now. Last month he received the Fields Medal. Terry will receive \$500,000 over five years to use any way he pleases. All of you aspiring mathematicians out there can rest assured that not all Mathematicians spend their days as hermits living with there mother, never spending money and refusing large sums of money. If you are really good and contribute to mathematics there are grants and prizes to support a lavish lifestyle.

2. Google "math" news?? Who posts these, google or admins?

3. Originally Posted by classicstrings


text:
# Unit Circle Proofs

1. Homework Statement
The problem comes with a diagram but I'll use the wikipedia diagram because it's nice and pretty and I'll just rearrange the letters to suit it.

Prove that AE = Tan($$\theta$$)

Similar triangles may help.

2. Homework Equations
Basic similar triangles equations of:

$$\frac{OF}{AC}$$ = $$\frac{OE}{AC}$$ = $$\frac{OA}{FE}$$

3. The Attempt at a Solution

After working out the above relationship, I've tried to look specifically at the ACE triangle. I already have AC = sin($$\theta$$) and EC = OE - cos($$\theta$$)

AE = $$\sqrt{(AC)^{2} + (EC)^{2}}$$
I need to rearrange it somehow so I get: AE = $$\sqrt{\frac{sin^{2}(\theta)}{cos^{2}(\theta)}}$$ but I'm not sure how to go about this. I'm getting a bit lost/sidetracked so hopefully you can give me some help. There a part (b) in this question but I won't ask about that until after this and hopefully once I can solve this (b) will be easy.

Last edited by a moderator:

Related Precalculus Mathematics Homework Help News on Phys.org
Hmm. I got an email saying that Integral had replied but nothing is showing here.

tiny-tim
Homework Helper
Welcome to PF!

Hi Einstein2nd! Welcome to PF!

One definition of tan is: "opposite/adjacent".

In this case, in the triangle OAE, the side opposite theta is AE, and the side adjacent to theta is OA.

So tantheta = AE/OA = AE/1 = AE.

This is actually the reason why it's called the tangent … it's the length of the tangent!
(… the clue's in the name … )

Alternatively, using similar triangles as suggested:

Hint: OAE is similar to OCA.

Last edited:
I may be on the wrong track here but you are saying OE = tan(theta) when I was trying to prove AE = tan(theta). Has there been a mixup with the letters on the wikipedia diagram I gave or is there somethign more to it than that?

Thank you for your help so far!

tiny-tim
Homework Helper
oops!

Hi Einstein2nd!

Yes, you're right … I got the letters wrong.

I should have written:

In this case, in the triangle OAE, the side opposite theta is AE, and the side adjacent to theta is OA.

So tantheta = AE/OA = AE/1 = AE.

Sorry!


text:
# Add the two polynomials. (-3y^{4}+6y^{2}+7) and (10y^{4}-7y^{2}-2y-4)

$\left(-3{y}^{4}+6{y}^{2}+7\right)$ and $\left(10{y}^{4}-7{y}^{2}-2y-4\right)$
You can still ask an expert for help

• Questions are typically answered in as fast as 30 minutes

Solve your problem for the price of one coffee

• Math expert for every subject
• Pay only if we can solve it

Virginia Palmer
Step 1
We need to add the following two polynomials
$\left(-3{y}^{4}+6{y}^{2}+7\right)$ and $\left(10{y}^{4}-7{y}^{2}-2y-4\right)$
Step 2
The polynomials can be added and simplified as following
$\left(-3{y}^{4}+6{y}^{2}+7\right)+\left(10{y}^{4}-7{y}^{2}-2y-4\right)=-3{y}^{4}+6{y}^{2}+7+10{y}^{4}-7{y}^{2}-2y-4$
$=\left(-3{y}^{4}+10{y}^{4}\right)+\left(6{y}^{2}-7{y}^{2}\right)-2y+7-4$
$=\left(-3+10\right){y}^{4}+\left(6-7\right){y}^{2}-2y+3$
$=7{y}^{4}-{y}^{2}-2y+3$
Hence, $\left(-3{y}^{4}+6{y}^{2}+7\right)+\left(10{y}^{4}-7{y}^{2}-2y-4\right)=7{y}^{4}-{y}^{2}-2y+3$

Hector Roberts


text:
# Number of substrings of length M in a string of length N

This question is probably quite easy.

I know that the number of substrings of length M in a string of length N are the total number of possible starting points. I know that this is N - M + 1. I don't doubt this. However, I can't seem to come up or find an explanation on WHY this is.

Similar to How many substrings of length m can be formed from a string of length n?. Different because I don't want the formula but the explanation behind the formula.

-

The first starting point is clearly $1$, so to find the number of possible starting points, we need to find the last possible starting point. Look first at a numerical example, say $M=6$ and $N=10$. Can I start at $10-6=4$? Yes, because I get the substring occupying positions $4,5,6,7,8$, and $9$. As you can see, I could have started one position later, at $5$, so there are actually $5$ possible starting points.

Try another, say $M=4$ and $N=15$. Again, it's natural to think first of $15-4=11$ as a possible late starting point, and it works: the substring occupies positions $11,12,13$, and $14$. Once again, I could have started one position later, at $12$, and there are $12$ possible starting points.

Note that in both cases $N-M$ came up one short of the right answer. There's a simple reason for this. If take away the first $N-M$ positions, $N-(N-M)=M$ positions remain. You took away positions $1$ through $N-M$, so the first of the remaining positions must be $N-M+1$. And it's the last possible starting point, because only $M$ positions are left: you're looking at the very last block of $M$ positions.

-
Exactly what I was looking for. Thanks! – larry May 4 '12 at 19:12

If your string is an ordered sequence of characters $A=\{a_1,\dots,a_n\}$ and your substrings are contiguous subsequences, i.e. of consecutive terms of $A$, then they must start at some $a_i$. Since the substring has length $m$, it must then end at $a_{i+m-1}$. This gives you constraints $1\le i$ and $i+m-1\le n$ $\implies$ $i\le n-m+1$ or, altogether, $$1\le i\le n-m+1\,.$$ So how many starting places $i$ are possible for the substring?

-

It sort of depends on what you mean by substring. Look at the string ABABAB. How many substrings of length $2$ does it have? Start at the first letter. You get AB. Start at the second letter. You get BA. Start at the third letter. You get AB. Start at the fourth letter. You get BA. Start at the fifth letter. You get AB.

There were $5$ places to start, so in a certain sense we got five substrings. But there were only two different ones. So do we say $5$ or do we say $2$? Let us decide it is $5$. Of course, there cannot possibly be any ambiguity if the letters are all different.

So for simplicity assume the letters are all different. Now let's work out a few concrete case, and then everything will be obvious to you.

How many substrings of length $3$ are there in the string $12345678$? We can start anywhere up to and including $6$. So there are $6$ substrings of length $3$. Note that $6=8-3+1$.

How many substrings of length $3$ are there in the string $123456789ABC$? Note that our word has $12$ symbols, and we can start our substring at anything from $1$ to $A$, inclusive. So how many start points are there? Clearly $10$. Note that $10=12-3+1$.

Now we have the string $a_1a_2a_3\cdots a_{47}$. How many substrings of length $3$? The latest we can start is at $a_{45}$, so there are $45$ substrings. Note that $45=47-3+1$.

Now look at the string $a_1a_2a_3\cdots a_{100}$. How many substrings of length $8$? The latest we can start is at $a_{93}$, so there are $93$ substrings, and $93=100-8+1$.

Why is $a_{93}$ the last place we can start? We want to start at a place $p$ such that there are $8$ numbers from $p$ to $100$, inclusive. So there should be $100-8$ numbers from $1$ to $p-1$. Thus $p-1=92$, and therefore $p=93$.

Play with a few more concrete cases, they need not be too big. (So far, I have done all the playing, you have been reading.) Soon everything will be clear.

-


text:
The open source CFD toolbox
transformBox.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
9 Copyright (C) 2020 FOSS GP
10-------------------------------------------------------------------------------
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27
28Class
29 Foam::transformBox
30
31Description
32 Defines control points based on given lower and upper boundaries for the
33 box and additional translation, rotation and scaling vectors.
34 The latter can be copied over from the Paraview clip or transform filters,
35 to facilitate the definition of a more general box.
36
37SourceFiles
38 transformBox.C
39
40\*---------------------------------------------------------------------------*/
41
42#ifndef transformBox_H
43#define transformBox_H
44
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52/*---------------------------------------------------------------------------*\
53 Class transformBox Declaration
54\*---------------------------------------------------------------------------*/
56class transformBox
57:
59{
60
61protected:
62
63 // Protected Member Functions
64
65 //- Compute control points
66 virtual void computeControlPoints();
67
68
69private:
70
71 // Private Member Functions
72
73 //- No copy construct
74 transformBox(const transformBox&) = delete;
75
76 //- No copy assignment
77 void operator=(const transformBox&) = delete;
78
79
80public:
81
82 //- Runtime type information
83 TypeName("transformBox");
84
85
86 // Constructors
87
88 //- Construct from components
90
91
92 //- Destructor
93 virtual ~transformBox() = default;
94};
95
96
97// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98
99} // End namespace Foam
100
101// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102
103#endif
104
105// ************************************************************************* //
NURBS3DVolume morpher. Includes support functions for gradient computations Base class providing supp...
Definition: NURBS3DVolume.H:76
Abstract base for selecting how to construct the control points of a volumetric B-Splines morpher.
Defines control points based on given lower and upper boundaries for the box and additional translati...
Definition: transformBox.H:58
virtual ~transformBox()=default
Destructor.
TypeName("transformBox")
Runtime type information.
virtual void computeControlPoints()
Compute control points.
Definition: transformBox.C:50
Namespace for OpenFOAM.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73


text:
Microbial 'omics

Brought to you by

You give this program one or more FASTQ files and a short sequence, and it returns all short reads from the FASTQ file that matches to it. The purpose of this is to get back short reads that may be extending into hypervariable regions of genomes, resulting a decreased mappability of short reads in the metagenome given a reference. You often see those areas of genomes as significant dips in coverage, and in most cases with a large number of SNVs. When you provide the downstream conserved sequence, this program allows you to take a better look at those regions at the short read level without any mapping.

See program help menu or go back to the main page of anvi’o programs and artifacts.

## Provides

No one has described the usage of this program :/ If you would like to contribute, please see previous examples here, and feel free to add a Markdown formatted file in that directory named “anvi-script-get-short-reads-matching-something.md”. For a template, you can use the markdown file for anvi-gen-contigs-database. THANK YOU!
Are you aware of resources that may help users better understand the utility of this program? Please feel free to edit this file on GitHub. If you are not sure how to do that, find the __resources__ tag in this file to see an example.


text:
## Precalculus (6th Edition) Blitzer

The solution of the giving expression is $x=9$.
It is given that ${{\log }_{2}}\left( \frac{x+9}{x} \right)=1$ \begin{align} & \log \left( \frac{x+9}{x} \right)=\log \,2 \\ & \frac{x+9}{x}=2 \\ & x+9=2x \\ & x=9 \end{align} Therefore, the solution of the giving expression is $x=9$.


text:
# Numerical error analysis

I stand before the following task and I do not know how to solve it.

The input parameter $$a=10^6, b=10^6 + 10^{-2}$$ will be round internally to $$a^*, b^*$$ with $$a=a^*(1 + \epsilon_1)$$ $$b=b^*(1 + \epsilon_2)$$ where $$|\epsilon_1|,|\epsilon_2|\ll 1$$ Determine through error analysis of first order (quadratic terms in \epsilon will be neglected) an estimation of $$\epsilon_1,\epsilon_2$$ such that $$z=\frac{1}{a-b}$$ and $$z^*=\frac{1}{a^*-b^*}$$ satisfy $$z=z^* (1+\epsilon_*)$$ with $$|\epsilon_*|\le 10^{-7}$$

Well what does it exactly mean that a number is round to $$a=a^*(1 + \epsilon)$$ I guess $$\epsilon$$ is the smallest possible steps between numbers that can be realised by the computer.

• You are more or less correct. The number $\epsilon$ is as far as most programming is concerned, a random number within some interval (typically $[-10^{-16}, 10^{-16}]$ for $32$-bit numbers, the range of this interval is called machine epsilon) signifying how much a number is changed from input until storage in computer memory, due to the fact that most non-integers do not have a terminating binary expansion. – Arthur Feb 23 '15 at 10:19
• In your case you have to figure out how small the $\epsilon$ for $a$ and $b$ have to be for the compounded rounding error of $z$ to not be too big (subtraction of two almost equal numbers, like in the denominator in the definition of $z$, is completely devastating for accuracy of representation). – Arthur Feb 23 '15 at 10:22

We know $$z=\frac{1}{a-b},\qquad z^* = \frac{1}{a\,(1+\epsilon_a) - b\,(1+\epsilon_b)},$$ Consider $z/z^*$ and we get, $$\frac{z}{z^*} = (1+\epsilon_z) = \frac{a\,(1+\epsilon_a) - b\,(1+\epsilon_b)}{a-b},$$ Which gives us $$\epsilon_z = \frac{a\,\epsilon_a - b\,\epsilon_b}{a-b}$$ If we let $a = c + d/2$ and $b=c-d/2$ then we can see what the error looks like given the difference and we get $$\epsilon_z = \frac{2c(\epsilon_a - \epsilon_b) - d(\epsilon_a+\epsilon_b)}{2d}.$$ You can then plug this into your inequality for $\epsilon_z$. What can we see about the error given this form? As the difference between the two numbers approaches zero we get $$\lim_{|d|\rightarrow 0} \epsilon_z = \begin{cases}\infty & \mathrm{if }\,\,\epsilon_a \neq \epsilon_b\\0 &\mathrm{if }\,\,\epsilon_a = \epsilon_b\end{cases}$$ I.e., for a small difference the same relative error in $a$ and $b$ leads to roughly the same absolute error, which cancels out due to the differing signs. As the difference gets bigger however we have $$\lim_{|d|\rightarrow \infty} \epsilon_z = -\frac{1}{2}(\epsilon_a + \epsilon_b)$$ This term will not exactly cancel because the same magnitude of fractional error will give a large absolute difference in error due to the different sizes of $a$ and $b$. Similarly if $a^*$ is too large and $b^*$ is too small, due to the sign difference this acts to compound the error due to the minus sign infront of $b$. Additionally we can see there is a minus sign in front of $\epsilon_z$ in this limit, this results because $z^*$ involves taking a recprocal and so having the denominator too small leads to the numerator being too large and vice-versa.
Of course, this whole discussion is predecated on the fact we assume we can calculate $z^*$ exactly given the rounded $a^*$ and $b^*$. in reality there will also be rounding error inside the computer for storing $z^*$.
Edit: I just noticed I used the errors defined the wrong way for $a$ and $b$, i.e. I used $a^* = a(1+\epsilon_a)$ not $a=a^*(1+\epsilon)$ but this does not matter much since you specified that quadratic error terms are to be ignored we can write $$a^* = \frac{a}{1+\epsilon} = a(1 - \epsilon + O(\epsilon^2))$$ and we can easily absorb the sign change in our defintion of the error.