text:
# The Stacks Project

## Tag 0156

### 13.20. Right derived functors and injective resolutions

At this point we can use the material above to define the right derived functors of an additive functor between an abelian category having enough injectives and a general abelian category.

Lemma 13.20.1. Let $\mathcal{A}$ be an abelian category. Let $I \in \mathop{\mathrm{Ob}}\nolimits(\mathcal{A})$ be an injective object. Let $I^\bullet$ be a bounded below complex of injectives in $\mathcal{A}$.

1. $I^\bullet$ computes $RF$ relative to $\text{Qis}^{+}(\mathcal{A})$ for any exact functor $F : K^{+}(\mathcal{A}) \to \mathcal{D}$ into any triangulated category $\mathcal{D}$.
2. $I$ is right acyclic for any additive functor $F : \mathcal{A} \to \mathcal{B}$ into any abelian category $\mathcal{B}$.

Proof. Part (2) is a direct consequences of part (1) and Definition 13.16.3. To prove (1) let $\alpha : I^\bullet \to K^\bullet$ be a quasi-isomorphism into a complex. By Lemma 13.18.6 we see that $\alpha$ has a left inverse. Hence the category $I^\bullet/\text{Qis}^{+}(\mathcal{A})$ is essentially constant with value $\text{id} : I^\bullet \to I^\bullet$. Thus also the ind-object $$I^\bullet/\text{Qis}^{+}(\mathcal{A}) \longrightarrow \mathcal{D}, \quad (I^\bullet \to K^\bullet) \longmapsto F(K^\bullet)$$ is essentially constant with value $F(I^\bullet)$. This proves (1), see Definitions 13.15.2 and 13.15.10. $\square$

Lemma 13.20.2. Let $\mathcal{A}$ be an abelian category with enough injectives.

1. For any exact functor $F : K^{+}(\mathcal{A}) \to \mathcal{D}$ into a triangulated category $\mathcal{D}$ the right derived functor $$RF : D^{+}(\mathcal{A}) \longrightarrow \mathcal{D}$$ is everywhere defined.
2. For any additive functor $F : \mathcal{A} \to \mathcal{B}$ into an abelian category $\mathcal{B}$ the right derived functor $$RF : D^{+}(\mathcal{A}) \longrightarrow D^{+}(\mathcal{B})$$ is everywhere defined.

Proof. Combine Lemma 13.20.1 and Proposition 13.17.8 for the second assertion. To see the first assertion combine Lemma 13.18.3, Lemma 13.20.1, Lemma 13.15.14, and Equation (13.15.9.1). $\square$

Lemma 13.20.3. Let $\mathcal{A}$ be an abelian category with enough injectives. Let $F : \mathcal{A} \to \mathcal{B}$ be an additive functor.

1. The functor $RF$ is an exact functor $D^{+}(\mathcal{A}) \to D^{+}(\mathcal{B})$.
2. The functor $RF$ induces an exact functor $K^{+}(\mathcal{A}) \to D^{+}(\mathcal{B})$.
3. The functor $RF$ induces a $\delta$-functor $\text{Comp}^{+}(\mathcal{A}) \to D^{+}(\mathcal{B})$.
4. The functor $RF$ induces a $\delta$-functor $\mathcal{A} \to D^{+}(\mathcal{B})$.

Proof. This lemma simply reviews some of the results obtained so far. Note that by Lemma 13.20.2 $RF$ is everywhere defined. Here are some references:

1. The derived functor is exact: This boils down to Lemma 13.15.6.
2. This is true because $K^{+}(\mathcal{A}) \to D^{+}(\mathcal{A})$ is exact and compositions of exact functors are exact.
3. This is true because $\text{Comp}^{+}(\mathcal{A}) \to D^{+}(\mathcal{A})$ is a $\delta$-functor, see Lemma 13.12.1.
4. This is true because $\mathcal{A} \to \text{Comp}^{+}(\mathcal{A})$ is exact and precomposing a $\delta$-functor by an exact functor gives a $\delta$-functor.

$\square$

Lemma 13.20.4. Let $\mathcal{A}$ be an abelian category with enough injectives. Let $F : \mathcal{A} \to \mathcal{B}$ be a left exact functor.

1. For any short exact sequence $0 \to A^\bullet \to B^\bullet \to C^\bullet \to 0$ of complexes in $\text{Comp}^{+}(\mathcal{A})$ there is an associated long exact sequence $$\ldots \to H^i(RF(A^\bullet)) \to H^i(RF(B^\bullet)) \to H^i(RF(C^\bullet)) \to H^{i + 1}(RF(A^\bullet)) \to \ldots$$
2. The functors $R^iF : \mathcal{A} \to \mathcal{B}$ are zero for $i < 0$. Also $R^0F = F : \mathcal{A} \to \mathcal{B}$.
3. We have $R^iF(I) = 0$ for $i > 0$ and $I$ injective.
4. The sequence $(R^iF, \delta)$ forms a universal $\delta$-functor (see Homology, Definition 12.11.3) from $\mathcal{A}$ to $\mathcal{B}$.

Proof. This lemma simply reviews some of the results obtained so far. Note that by Lemma 13.20.2 $RF$ is everywhere defined. Here are some references:

1. This follows from Lemma 13.20.3 part (3) combined with the long exact cohomology sequence (13.11.1.1) for $D^{+}(\mathcal{B})$.
2. This is Lemma 13.17.3.
3. This is the fact that injective objects are acyclic.
4. This is Lemma 13.17.6.

$\square$

The code snippet corresponding to this tag is a part of the file derived.tex and is located in lines 6476–6632 (see updates for more information).

\section{Right derived functors and injective resolutions}
\label{section-right-derived-functor}

\noindent
At this point we can use the material above to define the right derived
functors of an additive functor between an abelian category having
enough injectives and a general abelian category.

\begin{lemma}
\label{lemma-injective-acyclic}
Let $\mathcal{A}$ be an abelian category.
Let $I \in \Ob(\mathcal{A})$ be an injective object.
Let $I^\bullet$ be a bounded below complex of injectives in $\mathcal{A}$.
\begin{enumerate}
\item $I^\bullet$ computes $RF$ relative to $\text{Qis}^{+}(\mathcal{A})$
for any exact functor $F : K^{+}(\mathcal{A}) \to \mathcal{D}$
into any triangulated category $\mathcal{D}$.
\item $I$ is right acyclic for any additive functor
$F : \mathcal{A} \to \mathcal{B}$ into any abelian category $\mathcal{B}$.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (2) is a direct consequences of part (1) and
Definition \ref{definition-derived-functor}.
To prove (1) let $\alpha : I^\bullet \to K^\bullet$ be a quasi-isomorphism
into a complex. By
Lemma \ref{lemma-morphisms-lift}
we see that $\alpha$ has a left inverse. Hence the category
$I^\bullet/\text{Qis}^{+}(\mathcal{A})$ is essentially constant with value
$\text{id} : I^\bullet \to I^\bullet$. Thus also the ind-object
$$I^\bullet/\text{Qis}^{+}(\mathcal{A}) \longrightarrow \mathcal{D}, \quad (I^\bullet \to K^\bullet) \longmapsto F(K^\bullet)$$
is essentially constant with value $F(I^\bullet)$. This proves (1), see
Definitions \ref{definition-right-derived-functor-defined} and
\ref{definition-computes}.
\end{proof}

\begin{lemma}
\label{lemma-enough-injectives-right-derived}
Let $\mathcal{A}$ be an abelian category with enough injectives.
\begin{enumerate}
\item For any exact functor $F : K^{+}(\mathcal{A}) \to \mathcal{D}$
into a triangulated category $\mathcal{D}$ the right derived
functor
$$RF : D^{+}(\mathcal{A}) \longrightarrow \mathcal{D}$$
is everywhere defined.
\item For any additive functor $F : \mathcal{A} \to \mathcal{B}$ into an
abelian category $\mathcal{B}$ the right derived functor
$$RF : D^{+}(\mathcal{A}) \longrightarrow D^{+}(\mathcal{B})$$
is everywhere defined.
\end{enumerate}
\end{lemma}

\begin{proof}
Combine
Lemma \ref{lemma-injective-acyclic}
and
Proposition \ref{proposition-enough-acyclics}
for the second assertion. To see the first assertion combine
Lemma \ref{lemma-injective-resolutions-exist},
Lemma \ref{lemma-injective-acyclic},
Lemma \ref{lemma-existence-computes},
and Equation (\ref{equation-everywhere}).
\end{proof}

\begin{lemma}
\label{lemma-right-derived-properties}
Let $\mathcal{A}$ be an abelian category with enough injectives.
Let $F : \mathcal{A} \to \mathcal{B}$ be an additive functor.
\begin{enumerate}
\item The functor $RF$ is an exact functor
$D^{+}(\mathcal{A}) \to D^{+}(\mathcal{B})$.
\item The functor $RF$ induces an exact functor
$K^{+}(\mathcal{A}) \to D^{+}(\mathcal{B})$.
\item The functor $RF$ induces a $\delta$-functor
$\text{Comp}^{+}(\mathcal{A}) \to D^{+}(\mathcal{B})$.
\item The functor $RF$ induces a $\delta$-functor
$\mathcal{A} \to D^{+}(\mathcal{B})$.
\end{enumerate}
\end{lemma}

\begin{proof}
This lemma simply reviews some of the results obtained so far.
Note that by
Lemma \ref{lemma-enough-injectives-right-derived}
$RF$ is everywhere defined. Here are some references:
\begin{enumerate}
\item The derived functor is exact: This boils down to
Lemma \ref{lemma-2-out-of-3-defined}.
\item This is true because $K^{+}(\mathcal{A}) \to D^{+}(\mathcal{A})$
is exact and compositions of exact functors are exact.
\item This is true because
$\text{Comp}^{+}(\mathcal{A}) \to D^{+}(\mathcal{A})$ is
a $\delta$-functor, see
Lemma \ref{lemma-derived-canonical-delta-functor}.
\item This is true because $\mathcal{A} \to \text{Comp}^{+}(\mathcal{A})$
is exact and precomposing a $\delta$-functor by an exact functor gives
a $\delta$-functor.
\end{enumerate}
\end{proof}

\begin{lemma}
\label{lemma-higher-derived-functors}
Let $\mathcal{A}$ be an abelian category with enough injectives.
Let $F : \mathcal{A} \to \mathcal{B}$ be a left exact functor.
\begin{enumerate}
\item For any short exact sequence
$0 \to A^\bullet \to B^\bullet \to C^\bullet \to 0$
of complexes in $\text{Comp}^{+}(\mathcal{A})$ there
is an associated long exact sequence
$$\ldots \to H^i(RF(A^\bullet)) \to H^i(RF(B^\bullet)) \to H^i(RF(C^\bullet)) \to H^{i + 1}(RF(A^\bullet)) \to \ldots$$
\item The functors $R^iF : \mathcal{A} \to \mathcal{B}$
are zero for $i < 0$. Also $R^0F = F : \mathcal{A} \to \mathcal{B}$.
\item We have $R^iF(I) = 0$ for $i > 0$ and $I$ injective.
\item The sequence $(R^iF, \delta)$ forms a universal $\delta$-functor (see
Homology, Definition \ref{homology-definition-universal-delta-functor})
from $\mathcal{A}$ to $\mathcal{B}$.
\end{enumerate}
\end{lemma}

\begin{proof}
This lemma simply reviews some of the results obtained so far.
Note that by
Lemma \ref{lemma-enough-injectives-right-derived}
$RF$ is everywhere defined. Here are some references:
\begin{enumerate}
\item This follows from
Lemma \ref{lemma-right-derived-properties} part (3)
combined with the long exact cohomology sequence
(\ref{equation-long-exact-cohomology-sequence-D}) for
$D^{+}(\mathcal{B})$.
\item This is
Lemma \ref{lemma-left-exact-higher-derived}.
\item This is the fact that injective objects are acyclic.
\item This is
Lemma \ref{lemma-right-derived-delta-functor}.
\end{enumerate}
\end{proof}

There are no comments yet for this tag.

## Add a comment on tag 0156

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 lower-right corner).


text:
# Finding the average of this problem

There are 100 people in a room. Each one them can eat 4 pies in total. The maximum amount of pies that can be eaten is 400 pies. If 172 pies were eaten, what is the average pie eaten by per person?

I have trouble coming up with the correct algorithm to solve this problem.

• $\frac{172}{100}$? Does it have anything to do with the pie eating capacity of the players? – zoli Mar 12 '17 at 8:21

format: plain


text:
# Simplification of CFG

Recently i was studying removal of useless symbols in productions given in Ullman Hopcroft.

The grammar goes as follows

S-> aAa | aBC

A -> aS | bD

B - > aBa | b

C-> abb | DD

In the explanation that follows, we eliminate D obviously, but the removal of C still baffles me. As D is non generating, but C is both generating and reachable. So why delete C?

The resultant grammar is shown as

S->aAa

A->aS

B->aBa | b

Here is the link to the photo of the page in the book just in case

Page 240:

Page 241:

• Apparently Hopcroft and Ullman were wrong. There is no reason to eliminate $C$. – Yuval Filmus Feb 22 '14 at 1:58
• I though so too, so I mailed Ullman saying if this is incorrect; he replied that there is a simple explanation to this; but he wont say it because he talks only to bonafide instructors about the book and that he cannot tutor the whole world :/ – Nishad Feb 22 '14 at 2:04
• By the way, in the resulting grammar $B$ is unreachable so can be removed. Perhaps Ullman was joking with you. He's right not to answer everyone, the book is quite popular. – Yuval Filmus Feb 22 '14 at 2:58
• The grammars are not equivalent since the first produces at least the word $ababb$ while the second doesn't produce anything. Are you sure you copied the result correctly? – G. Bach Feb 22 '14 at 3:45
• What edition and page is this? I could only find the 2001 edition (I think that's the second) and on pages 256 and following, the example grammar is different. – G. Bach Feb 22 '14 at 4:04

The simplified grammar obviously contains a typo, as no words containing b are derivable contradicting S -> aBC -> abC -> ababb which the original grammar allows.
The first rule should probably read S -> aAa | aBabb.


text:
# Electrolysis of Water

## Summary

Sodium sulfate solution is electrolyzed to make hydrogen and oxygen gas. A ignited wood stick shown to glow more brightly in the presence of concentrated oxygen gas (collected in a test tube). Hydrogen gas collected in a test tube is ignited using a bunsen burner.

## Materials

• Electrolysis Apparatus
• D.C. Power Supply
• Dilute (0.5M or so) NaSO solution (500 mL minimum to fill apparatus). Phenolphthalein may be added to show formation of hydroxide ion at the cathode.
• Splint
• Matches
• Test tubes

## Procedure

1. Open stopcocks, making sure that the sodium sulfate solution fills each compartment to the tip. Close stopcocks. Attach apparatus to D.C. power supply.
2. Do a check to make sure the demo works.
3. As soon as class starts, turn on the power supply. Operate at about 10-12V.
4. Hydrogen may be collect at the cathode in a small test tube and ignited. Oxygen may be collected at the anode. Add a glowing splint to show that oxygen supports combustion.
5. Rinse apparatus immediately after use to avoid corrosion of the electrode.

Hint: Too much voltage will blow the Variac fuse, best to keep demo under 15V.

Sodium sulfate solution will eventually mold.

## Discussion

The overall reaction:

$$\ce{ 2H2O_{(l)} -> 2H2_{(g)} + O2_{(g)} }$$

Reduction at the cathode:

$$\ce{2H2O + 2e- -> H2 + 2OH-}$$

Oxidation at the anode:

$$\ce{4OH- -> 2H2O + O2 + 4e-}$$

By multiplying the equation for the reaction at the cathode by two and then combining it to the equation for the reaction at the anode you get:

$$\ce {4H2O + 4e- + 4OH- -> 2H2O + O2 + 4e- + 2H2 + 4OH-}$$

Simplifying the equation by cancelling out the electrons, hydroxide ions, and by reducing the water by two units on both sides gives you the overall equation above.


text:
# Equation Number Overwriting

\documentclass[12pt, letterpaper]{Ultheses}
\usepackage{amsmath}
\usepackage{array}
\usepackage{tabu}
\usepackage{graphicx}
\graphicspath{ {/} }
\usepackage{matlab-prettifier}
\usepackage{caption}
\usepackage{subcaption}
%\usepackage[colorinlistoftodos]{todonotes}
\numberwithin{equation}{section}
%\usepackage{cleveref}
\usepackage{amsmath,amssymb,amsfonts}
%\usepackage{breqn}
\usepackage[intoc,refpage]{nomencl}
\makenomenclature
\usepackage{hyperref}
%\renewcommand{\pagedeclaration}[1]{\dotfill\hyperpage{#1}}
\newcommand{\nm}[2]{\nomenclature{#1}{#2}}
\usepackage{lipsum}
\usepackage{epstopdf}
\usepackage{fancyvrb}
%\usepackage[usenames]{color}
\usepackage{layout}
\usepackage{mydef}
\usepackage{url}
\usepackage{titlesec}
%\newcommand{\sectionbreak}{\clearpage}
\usepackage{indentfirst}
\usepackage{ragged2e}

I have use these packages. Its my thesis. I don't know which part of the code should I upload here?

How can I remove the overwriting of equation numbers? I have not labelled all the equations however after properly labeling the equation number the problem remains. How can this problem be fixed?

• how we can reproduce your problem if you not provide equation code? please edit your question and add small but complete document with your equation beginning with \documentclass{...}˙and end with \end{document}. welcome to tex.se! Mar 28 '18 at 18:41
• Welcome to TeX.SX! Mar 28 '18 at 18:43
• Take a look at the following to learn how to create a minimal working example (MWE) In short: Post code that is enough to recreate your issue, but nothing more. So the display environment you used to typeset that formula and all packages necessary to use that code snippet. And make sure that the posted code actually shows your issue. Mar 28 '18 at 19:03
• you upload only preamble. you should add code of equation too. your error is untypical and you doing something very wrong. however until we not see equation code, we cant say anything. Mar 28 '18 at 19:04
• And in the editor for your question you can highlight the code and click on the {} button to mark it as code (as I did in my edit for you). Mar 28 '18 at 19:04

The file ullthesis2017.cls -- which may or may not be functionally the same as Ultheses.cls -- contains the instructions

\@addtoreset {equation}{chapter}
\renewcommand\theequation
{\ifnum \c@chapter>\z@ \thechapter.\fi \@arabic\c@equation}

This code indicates that you should not be providing the instruction

\numberwithin{equation}{section}

in the preamble of your thesis document. For sure, if one comments out this instruction, the unfortunate equation number overprinting issue vanishes.

If I were in your shoes, I would mostly strive to find an alternative to the ullthesis2017 (or Ultheses) document class. Really.

\documentclass[12pt, letterpaper]{ullthesis2017} % same as 'Ultheses.cls'?
%% I've simplified the preamble considerably...
\usepackage{amsmath} % for '\numberwithin' macro
\numberwithin{equation}{section} % see what happens if you comment out this line...

\begin{document}
$$1+1=2$$
\end{document}

• This solved the problem of equation overwriting. thanks a ton!!!! Huge problem solved!!! Mar 28 '18 at 19:41
• I'm very fast. Good answer +1. Mar 28 '18 at 19:41
• @Abhijeet - The real solution would consist mainly in not using such a dreadful mess of a LaTeX document class.
– Mico
Mar 28 '18 at 19:43
• I am new to Latex. The graduate school provided me the template. I am slowly and steadily learning LaTeX. I will definitely code it on my own in the future. Mar 28 '18 at 19:46
• I see no problem in the code using \ifnum. Mar 28 '18 at 20:42
• your document class is unknown to me, so i cant test your code.
• with standard documentclass as is article,reportorbook is not possible reproduce your problem. for example

\documentclass[12pt, letterpaper]{article}%{Ultheses}
\usepackage{mathtools}

\begin{document}
$$\begin{split} \MoveEqLeft xxxx = 1 + yyyyy + zzzzz \\ & - uuuuuu - vvvvvvv \end{split}$$

\end{document}

gives

please test this minimal document example with your document class and see, i you will obtain your error.

• Also for you +1. Mar 28 '18 at 19:42
• It's some bizarre code in the document class used by the OP that's responsible for the overprinting issue. See my answer for more details. The "remedy", such as it is, consists of omitting the otherwise-standard instruction \numberwithin{equation}{section}.
– Mico
Mar 28 '18 at 19:42
• @Mico, +1 for your answer. it is difficult believe, that exist such documentclass`es. i sympathize with everyone they need to use them. Mar 28 '18 at 19:51


text:
Pressure Problem! help

1. Jan 16, 2005

NotaPhysicsMan

Hey,

Ok here's the problem.

A house has a roof with the dimensions in drawing. Determine the magnitude and direction of the net force that the atmosphere applies to the roof when the outside pressure rises suddenly by 10.0mm of mercury, before the pressure in the attic can adjust.

Ok here's what I got so far...

Ok so there are three forces in the vertical direction. One upwards on the roof and the the other two downwards, namely atmospheric pressure (P1) and weight (W). The other being the opposite force P2, acting upwards.
So the Fnet is really just the sum of these forces right? So to find force for P1 and P2, I just used the Pressure x Area = force formula for both, except instead of atmospheric pressure, I added 10 to 760 and converted back into Pa. Then I got the forces and subtracted, and I also found the weight to be 2816N, I also subtract this number. I get something like 1.81 x 10^6 N in the downward direction. Something's wrong...

Any ideas?

Attached Files:

• houseprob.JPG
File size:
5.9 KB
Views:
53
2. Jan 16, 2005

dextercioby

Okay,what weight??Weight of the roof??

Daniel.

3. Jan 16, 2005

NotaPhysicsMan

Yes, the weight of the roof. I found that by using the rho (p) of air as 1.29 and volume of the triangle or roof to get m. p=m/V.

4. Jan 16, 2005

dextercioby

1.Is the roof made up of air???
2.What is the formula which gives the volume of a triangle???
3.What is the problem's question???

Daniel.

5. Jan 16, 2005

NotaPhysicsMan

No, the roof's inside is air though.
volume of a triangle : area of triangle, so 1/2bxh x the length.
Determine the net force, which I really think is acting downwards. Am I at least on the right track with the vertical forces?

6. Jan 16, 2005

dextercioby

There is no such thing as the volume of a triangle...Not even area...In your case,that would be a rectangular triangular prism...It has a volume,the problem is that u don't need that.
Apply the second law of dynmics for the roof...What is the total force acting on the roof??

How many forces act on the roof??

Daniel.

7. Jan 16, 2005

NotaPhysicsMan

ok let's see. I'm pretty sure there are 3. The one acting downwards on the roof, the roof's weight acting down, and the reaction force acting upwards. So Fnet=P2A - P1A. So, (760 x (7.29x14.5)) - (770x((14.5x 4.21m)x2)=0. I tried this before, didn't work. I figure the forces acting upwards P2A acts on the rectangle surface, so I need the area for that. And the other P1A acts on both rectangles on the roof downwards so I need to multiply by two.

8. Jan 16, 2005

dextercioby

The weight of the roof has nothing to do with this problem.It's totally another interaction.There are only 2 forces that act on the roof which are interesting:The force from above and the one from below.They are pressure forces,having to do with the fact that air molecules transmit constantly momentum to the roof by their collisions with the roof.

Daniel.

PS.The net force is the vector sum of the 2.

9. Jan 16, 2005

NotaPhysicsMan

Vector sum? I don't understand this, am I suppose to break it into components? I just figure there are 2 forces up/down, pressure difference of 10 between outside/inside, and just solve for Fnet by adding the P1A=F1 and the P2A=F2 together.

10. Jan 16, 2005

dextercioby

Yes.
There's not too much "breaking",the 2 forces have only one component each.

Okay,it's good you got the picture.Now deliver the results...

Daniel.

11. Jan 16, 2005

NotaPhysicsMan

ok here's a question: the force outside acting on the roof...It acts on both rectangular areas, so for A I have two double it? The other pressure acts only on the base rectangle. I tried both ways, but still not correct.

Fnet= P2A-P1A=0
0=(1.013 x 10^5 Pa)(14.5m x (2 x (4.21cos30))) - (1.022 x 10^5 Pa x 2(14.5m x 4.21m))
=1.07x 10 ^7 N - 1.25 x 10^7 N
=1.8 x 10 ^6 N acting downwards.??

That's not right.

12. Jan 18, 2005

NotaPhysicsMan

So...Any ideas where I went wrong?

13. Jan 18, 2005

dextercioby

How come u used the angle of inclination only at one force??Both forces are inclined...

Daniel.

14. Jan 18, 2005

NotaPhysicsMan

Even the one acting upwards under the roof? I figure there are two forces one acting on the outside on both sides (hence multiply area by 2) and one reacting back at the outisde presssure. So the first pressure acting down doesn't use the angle for the calculation, I think only the one reacting back does, because you need to find the length across the house.

15. Jan 18, 2005

NotaPhysicsMan

Someone, anyone...at least check if my reasoning is correct.

16. Jan 19, 2005

NotaPhysicsMan

I'll be patient lol....


text:
# Find a polynomial of lowest degree with rational coefficients that has the given numbers as some of its zeros? -4i, 5

## My teacher did a terrible job explaining and I was hoping I could get a better explanation of how to work these kinds of problems out.

Feb 25, 2018

${x}^{3} - 5 {x}^{2} + 16 x - 80$

#### Explanation:

$5 , 4 i , - 4 i$

So

$\left(x - 4 i\right) \left(x + 4 i\right) \left(x - 5\right) \text{ }$Subtract all from $x$

$\left({x}^{2} - 4 i x + 4 i x - 16 {i}^{2}\right) \left(x - 5\right) \text{ }$ FOIL the first two paratheses

$\left({x}^{2} - 16 {i}^{2}\right) \left(x - 5\right) \text{ }$ Cancel the $4 i$ terms

$\left({x}^{2} + 16\right) \left(x - 5\right) \text{ } {i}^{2} = - 1$, so multiply $- 16$ by $- 1$

${x}^{3} - 5 {x}^{2} + 16 x - 80 \text{ }$ FOIL the remaining paratheses


text: Every individual have their own way of wheeling results.   You'd possibly need to learn the it's likely that for that distinctive scratcher lotto citation is.  It looks like that people which consider themselves fortunate, they are way more satisfied with every area of their lifestyles than unlucky folks. For this reason, the face who lotto turns towards lotto players is known as a subject to corresponding cyclical amount of 30-40 draws by which they can find all of the numbers of which will system.  Here are a handful of guidelines and lotto profitable approaches you may possibly uncover beneficial using your quest to profiting in lotto.   Even employees hold the dream to create funding for their kid's college and purchase a house.  A following fundamental characteristic from cognition is it: In knowing a good object or event, one is alert to something with a certain definiteness regarding this and certain properties.   So actually, with all the actual hitches it caused it really is no wonder that to date the content involving said book keep on being syndicated online plus the parts revealed in odds and ends only.


text:
# Converting from decimals to roman numerals

I've submitted the following code for a job interview, and I wanna know if there is anything I can improve on it, or better ways to do the same thing.

const algarismsMap = {
1 : {
1 : 'I',
4 : 'IV',
5 : 'V',
9 : 'IX'
},
1e1 : {
1 : 'X',
4 : 'XL',
5 : 'L',
9 : 'XC'
},
1e2 : {
1 : 'C',
4 : 'CD',
5 : 'D',
9 : 'CM'
},
1e3: {
1 : "I\u0305",
4 : 'I\u0305V\u0305',
5 : 'V\u0305',
9 : 'I\u0305X\u0305'
},
1e4: {
1 : "X\u0305",
4 : 'X\u0305L\u0305',
5 : 'L\u0305',
9 : 'X\u0305C\u0305'
},
1e5 : {
1 : "C\u0305",
4 : 'C\u0305D\u0305',
5 : 'D\u0305',
9 : 'C\u0305M\u0305'
}
}

const divisors = Object.keys( algarismsMap ).reverse()

const romanizeNumber = module.exports = function( n ) {

// not throwing an error because this can happen while recursing
if ( n <= 0 ) {
return ''
}

// welp, for numbers greater than 3999999 we break roman rules of not repeating the same algarism more than 3 times,
//   or we need to add more dashes, which is not really documented, at least I could not find some reliable source about it. 🤔
if ( n >= 4e6 ) {
throw new Error( 'The max supported number to be converted is 3999999' )
}

let romanizedNumber = ''

// Some special cases for the M algarism.
if ( n >= 1e3 && n <= 3999 ||  n >= 1e6 && n <= 3999999 ) {

romanizedNumber += ( n >= 1e6 ? 'M\u0305' : 'M' ).repeat( n / (n >= 1e6 ? 1e6 : 1e3 ) )
romanizedNumber += romanizeNumber( n % (n >= 1e6 ? 1e6 : 1e3 ) )

} else {

for ( let i = 0; i < divisors.length; i++ ) {

const currDivisor = divisors[i]|0
const currDivisorInfo = algarismsMap[currDivisor]

const internalDivisors = Object.keys( currDivisorInfo ).reverse()

// The number is not divisible by this one, keep going (we could just check if n < currDivisor duh)
if ( n % currDivisor === n ) {
continue
}

for ( let k = 0; k < internalDivisors.length; k++ ) {

const currInternalDivisor = internalDivisors[k]|0
const currInternalDivisorAlgarism = currDivisorInfo[currInternalDivisor]

if ( n >= currInternalDivisor * currDivisor ) {

// the 1 check here is basically for the same motive than the 'M' check above.
romanizedNumber += currInternalDivisor === 1 ? currInternalDivisorAlgarism.repeat( n / currDivisor ) : currInternalDivisorAlgarism

romanizedNumber += romanizeNumber( n % (currInternalDivisor * currDivisor) )

return romanizedNumber
}
}
}

}

return romanizedNumber
}

The \u0305 is the unicode for the combining overline character: https://en.wikipedia.org/wiki/Overline

• Semicolons are missing all over the place -- a habit that is a great source of bugs especially when something is maintaining this code. I am not a JS guy, could you tell what is the ... = internalDivisors[k]|0 idiom? May 4, 2017 at 16:13
• Thanks for explaining the x|0 idiom! Good to know. As far as the semicolons go, it's your choice but many devs including me find it a gate to bugs hard to detect. In other words The only real pitfall when coding without semicolons which is mentioned in the post you shared, is a big deal, and the prepend next line with ; is a dirty hack. The “everybody else is doing it” phrase is a real argument, if everyone uses the semicolons, not using them becomes a risk when it comes to maintenance -- as a tech lead I would enforce the semicolons. May 4, 2017 at 16:28
• As I said, it's your call -- that's why I am not posing an answer, but a comment. I'm doing it only on personal projects is a common reasoning, but as soon as you delegate maintenance to someone else you may get cursed for that decision. May 4, 2017 at 16:46
• @IgorSoloydenko Thanks for supporting semi-colons in JS! :) Call me old-school, but I tend to insist on them too May 4, 2017 at 17:17
• Haven't had time to really review this, so just two things that stand out: 1) The explanation for \u0305 should probably be in the code too, and 2) you're fond of the scientific number notation like 4e6 yet you also have to write 3999999 in the comment and error message – I'd define 3999999 as a MAX_INPUT constant or something, and stick to using decimals. To me it's just easier than doing the (admittedly simple) conversion in my head. You're already dealing with roman and decimal notation - I'd rather not add another on top of that. May 4, 2017 at 17:34

• I would define a constant overline="\u0305" and then use interpolation further down: 4 : C${overline}D#{overline},, it might even make sense to define overlineD and overlineC constants. An alternative might be to create an overline method and write something like 4: overline('CD') or even a tagged template literal (4: overlineCD) if you want to impress. • Object.keys( algarismsMap ).reverse(): The order of keys in a hash is not guaranteed, it can vary depending on the implementation and if keys have been deleted, etc. If you need order you should use an array. Also rather than reversing just define it backwards. • Rather than if {...} else [lots of code] I find it better to use an early return if {...; return; } [lots of code] • One of the biggest thing to me is the lack of tests. I would expect to see something in an interview assignment, it doesn't have to use a framework, I would be fine with something like: function test(number, roman) { if (romanizeNumber(number) !== roman) console.error(Failed!${number} should be ${roman} but was${romanizeNumber(number)});
}
test(10, 'X');
test(11, 'XI');
...

• About the lack of tests, the assignment platform were this was submitted had automated testing already (hackerrank.com). May 4, 2017 at 20:58

Short review;

• I think you mean https://en.wikipedia.org/wiki/Algorism, not algarism? I would use the correct name in that case, and personally I would even put a link to the wikipedia article for people (the vast majority I assume) who have never heard about Algorisms before

• I would call Object.keys( algarismsMap ).sort().reverse(), making sure of the sort order

• This statement annoys me tremendously as a reviewer:

if ( n >= 1e3 && n <= 3999 || n >= 1e6 && n <= 3999999 )

Either go for

if ( n >= 1e3 && n < 4e3 || n >= 1e6 && n <= 4e6 )

or

if ( n >= 1000 && n < 4000 || n >= 1000000 && n <= 4000000 )

mixing those 2 constant styles just makes my brain go 'wot?' To keep it simple, I would go with the first approach.

General style

• As this is an interview submission, I recommend a conservative coding style including semicolons.
• Mixing decimal and exponential notation for number literals is inconsistent.
• Mixing "" and '' without need is somewhat irritating.
• +string is more idiomatic and robust compared to the bitwise string|0 for integer string to number conversion.
• for (let divisor of divisors) { ... } is more succint than for (let i = 0; i < divisors.length; i++) { let divisor = divisors[i]; ... }
• Catching and handling corner cases such as if ( n % divisor === n ) continue; early at the beginning of the loop body improves readability somewhat.
• I propose renaming
• algarismsMap to algarisms - appending type information such as 'Array' or 'Map' rarely improves readability.
• algarisms to symbols - algarism is exotic, symbol is a much more common term.
• currDivisor to divisor - adding 'curr' and similar prefixes to loop iterators is noisy.
• internalDivisor to digit - as it is more specific.

Error handling

This is inconsistent:

// not throwing an error because this can happen while recursing
if ( n <= 0 ) {
return ''
}

if ( n >= 4e6 ) {
throw new Error( 'The max supported number to be converted is 3999999' )
}

You throw an error when the input is too large, but not when it is too small. Also, instead of throwing an Error you could throw the more descriptive RangeError

// The number is not divisible by this one, keep going (we could just check if n < currDivisor duh)

Why don't you use n < currDivisor then?

// welp, for numbers greater than 3999999 we break roman rules of not repeating the same algarism more than 3 times,
// or we need to add more dashes, which is not really documented, at least I could not find some reliable source about it. 🤔

Actually, you don't repeat symbols more than three times but throw an Error. This comment seems outdated. Also, using colloquial terms such as duh, welp and emoticons 🤔 in comments feels somewhat out of place in a professional setting (assuming you included them in your interview submission and not just for us reviewers).

// the 1 check here is basically for the same motive than the 'M' check above.

Since you never state the motive for the 'M' check, this comment is somewhat unhelpful.

Data structures

Your algarismsMap is a specialised, repetitive datastructure. It cannot be reused, as its structure seems to have explicitly been chosen to fit the needs of the romanizeNumber function.

However, you still need to perform key extraction and reversal

const internalDivisors = Object.keys( currDivisorInfo ).reverse()

as well as string to number conversion

const currInternalDivisor = currInternalDivisor|0

in order to extract the digits. This makes your code more complicated than necessary and less robust, as you rely on the unspecified Object.keys() enumeration order.

Also, you still need to hardcode some data within the romanizeNumber function:

romanizedNumber += ( n >= 1e6 ? 'M\u0305' : 'M' ).repeat( n / (n >= 1e6 ? 1e6 : 1e3 ) )

While you can't avoid handling these special cases somehow, you could still avoid redundant definition of roman symbols.

Design

Your monolithic, recursive romanizeNumber function is pretty complex and hard to read and understand. You can simplify your code by identifying sub-tasks and breaking it down into smaller, modular functions:

• splitDigits(n) - split a number into digits. This replaces the modulo operations all over the place such as n % (currInternalDivisor * currDivisor) as well as the whole recursion.
• romanizeDigit(digit, place) - convert a single digit. This basically replaces the inner loop over internalDivisors as well as the special vinculum handling.

We can also exploit the repetitive nature of digit conversion

1 - 10:     I II III IV V VI VII VIII IX X
10 - 100:   X XX XXX XL L LX LXX LXXX XC C
100 - 1000: C CC CCC CD D DC DCC DCCC DM M

and introduce a lookup table relating digits to symbols.

The broken-down, non-recursive, documented romanizeNumber could then be written as follows:

/**
* Split positive integer n < 1e21 into digits.
*
* @param {number} n - positive integer < 1e21.
* @return {number[]} digits starting with lowest position.
*/
function splitDigits(n) {
return Array.from(String(n), Number);
}

/**
* Symbols used by roman (vinculum) numerals in ascending order for non-vinculum or mixed-vinculum digits.
*/
const lower = ['I', 'V', 'X', 'L', 'C', 'D', 'M', 'V\u0305'];

/**
* Symbols used by roman (vinculum) numerals in ascending order for entirely-vinculum digits.
*/
const upper = ['I\u0305', 'V\u0305', 'X\u0305', 'L\u0305', 'C\u0305', 'D\u0305', 'M\u0305'];

/**
* Lookup map from decimal digits to roman symbol indices or offsets.
* @example
* lookup[4] // [0, 1] which corresponds to ['I', 'V']
*/
const lookup = [[], [0], [0, 0], [0, 0, 0], [0, 1], [1], [1, 0], [1, 0, 0], [1, 0, 0, 0], [0, 2], [2]];

/**
* Convert decimal digit to roman numeral according to the digit's place value.
* @example
* romanizeDigit(4, 1) // 'XL' since digit 4 at place 1 has place value 40
*
* @param {number} digit - digit from 0 - 9.
* @param {number} place - place of digit.
* @return {string} roman numeral with value digit × 10^place.
*/
function romanizeDigit(digit, place) {
let vinculum = place > 3 || (place == 3 && (digit == 4 || digit == 9));
if (vinculum) {
return lookup[digit].map(i => upper[2 * (place - 3) + i]).join('');
} else {
return lookup[digit].map(i => lower[2 * place + i]).join('');
}
}

/**
* Convert positive integer to roman numeral.
*
* @param {number} n - integer in range [1, 3999999].
* @return {string} roman numeral with value n.
*/
function romanizeNumber(n) {
if (n < 1 || n > 3999999) throw RangeError('Only numbers between 1 and 3999999 supported');
let digits = splitDigits(n);
return digits.map((digit, i) => romanizeDigit(digit, digits.length - i - 1)).join('');
}


text:
# Need pathfinding idea feedback

## Recommended Posts

13 hours ago, pathfinding said:

I still don't understand how that stores a coord pair of {x:1, y:2, z:3}. Could you show an example using those?

For each of the three forms? (You didn't say which one.)

Assumptions: width=6000, height=6000, maxz=4 (I always start counting at 0 rather than 1, so max is always one bigger than the biggest allowed value). Otherwise, I am just filling in the constant 'width' and 'height' values at the spots where it says 'width' or 'height', in the text I explained before.

For D[x + y * width + z * (width*height)], D is an array like D = new Tile[6000 * 6000 * 4]; // width * height * maxz

(x=1, y=2, z=3) can be found at D[1+ 2 * 6000 + 3 * 6000 * 6000];

For the increase or decrease in y for z, D is an array like D = new Tile[6000][4*6000]; // [width][maxz * height]

(x=1, y=2, z=3) can be found at D[x][y + 6000 * z] = D[1][2 + 6000 * 3];

For the stair jump table, there is no z, only x and y. Think of it as 3 separate buildings, 1 floor high, standing right next to each other. Your x/y coordinates spans all three buildings. Each building is a "z" level. You cannot leave or enter a building without teleporting, so your reachable x/y coordinates are limited if you only walk 'horizontally'. You can however teleport between buildings, so you land in a different set of x/y coordinates that you can reach.

For example, you could have one building between (0, 0)--(3000, 300), the second building between (3001, 0)--(6000, 3000), and the 3rd building between (0, 3001)--(6000, 6000). So if you're at (4563, 123), you're in building 2, or "floor" 2. If you teleport to (77, 5931), you teleported to building 3 (aka floor 3).

Of course, in the latter case you don't need to have the same shape at every floor or have equally big amounts of space for each floor. It's much more flexible.

##### Share on other sites
7 hours ago, Alberth said:

For each of the three forms? (You didn't say which one.)

Assumptions: width=6000, height=6000, maxz=4 (I always start counting at 0 rather than 1, so max is always one bigger than the biggest allowed value). Otherwise, I am just filling in the constant 'width' and 'height' values at the spots where it says 'width' or 'height', in the text I explained before...........

Doesn't this seem more complicated than just using three separate array indexes? int[z][x][y] = new int[3][6000][6000]; seems way more straightforward and would end up being the same amount of tiles anyway. Why not just use this instead?

##### Share on other sites
5 hours ago, pathfinding said:

Doesn't this seem more complicated than just using three separate array indexes? int[z][x][y] = new int[3][6000][6000]; seems way more straightforward and would end up being the same amount of tiles anyway. Why not just use this instead?

You asked how to store a 3d map in a 2d plane. I just answered that question.

I think the main point to take away is that what the player thinks and sees can be different from what the code is actually doing. As long as you keep the illusion complete, he/she will believe anything you say.

As to why, there can be technical reasons why one form is more preferred than another form. If you have a large 1D array like my first solution, "position" becomes a single number, rather than 3 numbers, which can be an advantage in coding.

You say not all tiles will be reachable. That means you're currently wasting memory space while storing the map, the 3d array does have space for the full amount of tiles even if you don't use them. Depending on how irregular your map is, such waste may become significant enough to fix.

##### Share on other sites
16 hours ago, pathfinding said:

Doesn't this seem more complicated than just using three separate array indexes? int[z][x][y] = new int[3][6000][6000]; seems way more straightforward and would end up being the same amount of tiles anyway. Why not just use this instead?

You're better off creating different 2D planes all together and representing them as "levels", and saving/loading each level to/from your db. When the player decides to go down some stairs, they load a level, instead of changing their z-position.

What you are doing with the 3 coordinate system is not performant at all, and you'd have to implement this as a 2D array anyway, unless your game camera essentially turns off the top layer rendering, current monsters, collision, and everything else just to go down one layer to turn all of the bottom layer rendering, monsters, collision, and everything else on.

##### Share on other sites
Posted (edited)

Thank you for explaining how to do so, I really appreciate it.

Wouldn't a HashSet work just as well? No memory loss if I just store a new Tile(1, 2, 3) and have the hashCode() generate on (x, y, z), then store it in a HashSet? I feel like there's nothing more optimal than this, or is there? The HashSet would only store the exact number of tiles generated, no extra spaces in memory (like the array). A lookup would be extremely fast too...

set.add(new Tile(1, 2, 3));

set.contains(new Tile(1, 2, 3)); // Returns true

Edited by pathfinding

##### Share on other sites

Without more complex wrapping code, that HashMap technique leaves no ability to store data relevant to that tile, other than its coordinates.

If the only information you have, or will ever need, about a tile is whether or not it is walkable, why aren't you just using a X*Y*Z BitSet, which consumes 1 byte per 8 tiles of walkable data?

##### Share on other sites
12 hours ago, pathfinding said:

Wouldn't a HashSet work just as well? No memory loss if I just store a new Tile(1, 2, 3) and have the hashCode() generate on (x, y, z), then store it in a HashSet? I feel like there's nothing more optimal than this, or is there? The HashSet would only store the exact number of tiles generated, no extra spaces in memory (like the array). A lookup would be extremely fast too...

HashSet would work. Indeed it doesn't provide storage for positions that you don't have, on the other hand, internal book-keeping of a hash table isn't free either. https://en.wikipedia.org/wiki/Hash_table has a lot of details. The load factor there may be killing your advantage (75% load factor is around 25% free entries, ie (= about 3*6000*6000/4 free for a full map)). In general, arrays are extremely fast to access if you have a simple incrementing integer value that you can use for indexing (which you have with positions).

One question you may want to consider is whether you need all 3 floors loaded, or even, do you need the entire floor? 3*36M tiles is nearly 100M tiles. If 1 tile is 64 byte (which you have soon), it's 6,4GB memory that you need, not counting any overhead to organize the tiles in 3 floors.

##### Share on other sites

For a big map it can be beneficial to divide the grid in chunks. Because it can limit the amount of pathfinding iterations. The suggestion of Wyrframe seems fine, including placing additional portals to divide the map, but it sounds less flexible. Depends on the number of open areas and maps you are about to make.

If you just divide the map in a regular grid and pre-calculate the connection between each chunk then you end up with a small network which serves as the first pass of your pathfinding, this one will be super fast. For example this is like navigating over which countries you travel on a world trip. You could even enhance this and consider the shortest distance (From A to C over B) in the pre-calculation process.
Here is why that could be interesting:

Next you can calculate the exact path by only using the tiles which belong to these chunks.

Here is an example of something similar in action: https://www.youtube.com/watch?v=RMBQn_sg7DA

##### Share on other sites
On 5/22/2019 at 9:37 AM, pathfinding said:

Thank you for explaining how to do so, I really appreciate it.

Wouldn't a HashSet work just as well? No memory loss if I just store a new Tile(1, 2, 3) and have the hashCode() generate on (x, y, z), then store it in a HashSet? I feel like there's nothing more optimal than this, or is there? The HashSet would only store the exact number of tiles generated, no extra spaces in memory (like the array). A lookup would be extremely fast too...

set.contains(new Tile(1, 2, 3)); // Returns true

Are you referring to walkable areas/non-walkable areas within world space? certainly. you can store every walkable tile as an index in a hash table. or, you can create a navigation mesh out of a collection of tiles and assume they're walkable, then store them all in a hash table (which might be a bit harder to do - a graph might be better for this).

my point is that, to render these things, using a 2d camera system, and to calculate collision, and do calculations of the entities that are "upstairs" or "downstairs", and calculate whatever other procedural elements you have in your world. you are not going to want to create several height-layers to such a large world without custom culling code that has to remove the other layers, when you can simply remove them yourself using a level system.

## Create an account

Register a new account

• 9
• 16
• 9
• 10
• 13


text:
Homework Help: Determine the temperature of the blood/ Heat problem

1. Mar 29, 2006

iceT

Blood can carry excess energy from the interior to the surface of the body, where the energy is dispersed in a number of ways. While a person is exercising, 0.8 kg of blood flows to the surface of the body and releases 2050 J of energy. The blood arriving at the surface has the temperature of the body interior, 37.0°C. Assuming that blood has the same specific heat capacity as water, determine the temperature of the blood that leaves the surface and returns to the interior

ok..I know that DELTA T = Q/cm
Q= heat
since i dont have the heat..i had to find it...so i did this
Q=( CM ) ( DELTA T ) = ( 4186 ) ( .8 ) ( 37.0 °C - 15.0 °C )
= 73673.6 J

now I got the heat...so i can apply this formula to find the temperature..
DELTA T = Q/cm = 73673.6 / ( 4186 ) ( .8 ) = 22 °C
but still..i keep getting it wrong... ..does any one knows what im doing wrong ??..

Last edited: Mar 29, 2006
2. Mar 29, 2006

Staff: Mentor

What do you mean you don't have the heat? The problem stated: "0.8 kg of blood flows to the surface of the body and releases 2050 J of energy."

Where did you get the 15.0 °C ? (The final temperature of the blood is what you are trying to find.)

3. Mar 29, 2006

iceT

ok.....so it should be
2050 / ( 4186 ) ( .8 ) = 0.612
BUT IT STILL WRONG.....

ok..is it 37.612 ?

Last edited: Mar 29, 2006
4. Mar 29, 2006

Staff: Mentor

What did you get for the temperature of the cooled blood?

5. Mar 29, 2006

Staff: Mentor

You're getting closer... remember that heat is being removed from the blood.

6. Mar 29, 2006

iceT

36.388

7. Mar 29, 2006

iceT

thanx alot Dr Al

Last edited: Mar 29, 2006
8. Oct 20, 2008

ElikuAberts

I have a similar problem to this but I don't understand it. Where did you guys get the 4186?

(the problem I have is...Blood can carry excess energy from the interior to the surface of the body, where the energy is dispersed in a number of ways. While a person is exercising, 0.6 kg of blood flows to the surface of the body and releases 2000 J of energy. The blood arriving at the surface has the temperature of the body interior, 37.0°C. Assuming that blood has the same specific heat capacity as water, determine the temperature of the blood that leaves the surface and returns to the interior... so basically same thing, just different numbers)

9. Oct 20, 2008

mgb_phys

It's the specific heat capacity of water, it takes 4186J of energy to raise the temperature of 1kg of water through 1 Kelvin (or 1deg C).
You have to know/look this up, it's an experimental value.

10. Oct 20, 2008

ElikuAberts

Thank you, mgb_phys! I get it now!


text:
I have a curiosity as regards the infinite product below. I wonder why Mathematica v.8.0. says
the limit is $1$. This is not true.

Limit[(Product[(1 - a/n^2), {n, 1, Infinity}])^(1/Sqrt[a]),  a -> Infinity]

-
Why do you say it is not true? –  Teake Nutma Jul 21 '13 at 12:09
@Pinguin Dirk Consider $\sqrt{a}$ is an integer. –  Chris's sis Jul 21 '13 at 12:12
@TeakeNutma see the message above. –  Chris's sis Jul 21 '13 at 12:13
Simpler example: In[4]:= Limit[(Sin[x]/x)^(1/x), x -> Infinity] Out[4]= 1 I'm not sure if this is a bug or a feature. Will investigate when time permits. –  Daniel Lichtblau Jul 21 '13 at 16:38
@DanielLichtblau Daniel, do note that when operating with real/rational numbers we end up with a 1 and when we add the assumptions about the integers we get the 0. That's regarding the OP's question. –  Sektor Jul 22 '13 at 9:08

$$\prod_{n=1}^\infty\left|\,1-\frac{a}{n^2}\,\right|^{1/\sqrt{a}}$$ As $a\to\infty$, each term is like $1+\frac{\log(a)}{n^2\sqrt{a}}$ and as $\frac{\log(a)}{n^2\sqrt{a}}$ is absolutely summable to something around $\frac{\log(a)}{\sqrt{a}}\frac{\pi^2}{6}\to0$ I would say that the product limits to $1$, unless $a=n^2$ for some $n$. So the limit doesn't exist.

-
did you consider the case when $\sqrt{a}$ is an integer? –  Chris's sis Jul 21 '13 at 12:22
If you take any $\sqrt{a}$ integer then the limit is precisely $0$. $$\pi ^{-\frac{1}{\sqrt{a}}} \left(\frac{\sin \left(\pi \sqrt{a}\right)}{\sqrt{a}}\right)^{\frac{1}{\sqrt{a}}}$$ –  Chris's sis Jul 21 '13 at 12:29
@Chris'ssister: and the expression you give there goes to $1$ as $a\to\infty$ –  robjohn Jul 21 '13 at 12:31
Definitely no. It's precisely 0 when $\sqrt{a}$ is integer. –  Chris's sis Jul 21 '13 at 12:32
Oh, yes. one term is 0. So the limit doesn't exist. –  robjohn Jul 21 '13 at 12:32

Any ideas why it is not true ? Typo/s ?

Running Win 8, Mathematica 9.0.1 the result is the same and also on my Ubuntu desktop with Mathematica 9.0.0 and WolframAlpha: Check here

Computing the (Product[(1 - a/n^2), {n, 1, Infinity}])^(1/Sqrt[a]) yields the result:

$$\pi ^{-\frac{1}{\sqrt{a}}} \left(\frac{\sin \left(\pi \sqrt{a}\right)}{\sqrt{a}}\right)^{\frac{1}{\sqrt{a}}}$$

Taking the limit of it as $a \to \infty$ is equal to $1$

And plotting it:

Edit: Assuming $\sqrt{a}\in \mathbb{Z}$ and taking the limit of the product we end up with $0$:

Limit[(Product[(1 - a/n^2), {n, 1, Infinity}])^(1/Sqrt[a]),
a -> Infinity, Assumptions :> Sqrt[a] \[Element] Integers]

-
What if $\sqrt{a}$ is an integer? –  Chris's sis Jul 21 '13 at 12:20
@Chris'ssister How about now ? –  Sektor Jul 21 '13 at 12:24
Thanks so much! Why do you think Mathematica says the limit exists when it doesn't? –  Chris's sis Jul 21 '13 at 12:26
Technically speaking the limit still exists before we made the assumptions, but the "problem" is Mathematica was operating with Real numbers. –  Sektor Jul 21 '13 at 12:34
Thanks for your effort (+1) –  Chris's sis Jul 21 '13 at 12:36


text:
Stat 411/511

# Homework 0

##### Due on canvas Oct 3rd

This homework is designed to get everyone started with RStudio, and familiar with R notebooks and submitting your notebook on canvas. It will be graded as Complete/Incomplete.

Right click on the following two links and choose “Save Link As…” to save the file to your ST511 folder

Open notebook-one.R in RStudio.

Read through the R script file, compile it as a notebook, and have a look through the compiled version. After each of the following steps, compile the notebook again to check your changes worked without error.

2. Replace the file image.jpg with a photo of yourself (do this outside RStudio) so instead of my picture, it has a photo of you.
4. Add the following code (i.e. don’t put any # or #' at the start of the line) on a new line at the end of the R script: sessionInfo()
5. Save the script as homework-0.R. Compile one last time.
6. Submit homework-0.docx on canvas under Assignments -> Homework 0.


text:
# Simplifying a Trigonometric Expression

I have to prove that:

$$x \sec x - \ln |\sec x + \tan x| + C$$

is the indefinite integral of:

$$x \sec x \tan x$$

by taking the derivative.

I've got far enough to get:

$$x\sec x\tan x + \sec x -\dfrac{|\sec x+\tan x|(\sec^2 x + \sec x \tan x)}{|\sec x + \tan x|}.$$

Kind of stuck here. Am I able to cancel out the $|\sec x + \tan x|$ on top and bottom and then set $-\sec x$ equal to $\sec^2 x + \sec x \tan x$? I'm guessing that's not right though.

Sorry for the crummy way I have it setup, feel free to edit it.

-

Two issues—first, as suggested in Jerry's answer, you have a factor of $|\sec x+\tan x|$ in the numerator of the last term of your derivative that does not belong there. Second, the derivative of $\ln|x|$ is $\frac{1}{x}$ (no absolute value), so $\frac{d}{dx}\ln|f(x)|=\frac{1}{f(x)}\cdot f'(x)$ with the chain rule.

-
Thanks for clarifying that, so there are no more abs values needed after I use the chain rule. So f'(x) = secxtanx+sec^(2)x –  Finzz Feb 8 '11 at 21:00
@Finzz: $\frac{d}{dx}(\sec x+\tan x)=\sec x\tan x+\sec^2x$, yes. $\frac{d}{dx}(\ln|\sec x+\tan x|)=\frac{1}{\sec x+\tan x}\cdot(\sec x\tan x+\sec^2x)$, which can be simplified... –  Isaac Feb 8 '11 at 21:05
Right, but all I see is to factor out secx, giving me: secx(secx + (tanx/(tanx+secx))) –  Finzz Feb 8 '11 at 21:26
@Finzz: Factoring out the common $\sec x$ is a good choice. I think your parentheses are misplaced: $\frac{1}{\sec x+\tan x}\cdot(\sec x\tan x+\sec^2x)=$ $\frac{1}{\sec x+\tan x}\cdot\sec x\cdot(\tan x+\sec x)=$ $\frac{(\tan x+\sec x)}{\sec x+\tan x}\cdot\sec x=$ $1\cdot\sec x=\sec x$ –  Isaac Feb 8 '11 at 21:29
Yes I'm not sure what I did but it looks funky, the way you wrote it makes way more sense. Thanks man. –  Finzz Feb 8 '11 at 21:44

Your derivative for $x\sec\;x$ is correct; for the second term, note that $\frac{\mathrm d}{\mathrm dx}\ln(f(x))=\frac{f^{\prime}(x)}{f(x)}$ . Apply the formula accordingly.

-
I'm confused, I already took the derivative of the ln part. Not sure what you want me to do. Are you trying to say I made an error when taking the derivative of the second term? –  Finzz Feb 8 '11 at 9:31
@Finzz: Yes, you did -- you wrote $f\cdot f'/f$ instead of $f'/f$. –  joriki Feb 8 '11 at 9:49


text:
# RDkit Two component node problem

Hi,

I want to do a virtual Suzuki coupling with the RDkit Two component node.
As far as I understood the description, the Amine/acidchlorid example and the RDKit book, the reaction is created by the SMARTS defining the leaving groups with defined coupling atoms for the two reactants and SMARTS on how the reactant coupling atoms are to be  connected.

I want to use an aromatic halide "Cl[#6:1]" and boronic acids "B(O)(O)([#6:2]".
Both SMARTS work fine in the RDKit Substructure node.

The reaction was constructed as [B(O)(O)([#6:1]).Cl[#6:2]]>>[#6:1]-[#6:2]
and the error I get from this is:

RDKit Two Component Reaction     Configure failed (ChemicalReactionParserException): null

What am I doing wrong ?

Gilbert

Hi Gilbert,

I believe the error is due to superfluous square brackets on the LHS.  The rSMARTS should read:

B(O)(O)([#6:1]).Cl[#6:2]>>[#6:1]-[#6:2]

(actually I normally do away with the explicit mapped atoms and bond on the RHS, so would have B(O)(O)([#6:1]).Cl[#6:2]>>[*:1][*:2])

This should work - but remember the top input must be your boronics, and the bottom input your chlorides - or you will get zero rows output!

Kind regards

James

Great, James, thanks a lot !

I was confused by the square brackets in the amine/acid chlorides example...

Thanks again for your help !

Kind regards

Gilbert


text:
# BSSPC 2019 P7 - Learning The Alphabet

## Problem Statement

p1geon is learning the alphabet in English class but he’s having difficulty memorizing the correct order.

Please help him find the longest subsequence of the letters he has written down which is in the correct order (that is there can be missing letters which can be filled in to create a correct subsequence of the alphabet).

## Constraints

$1 \le n \le 10$

$1 \le n \le 10^3$

$1 \le n \le 10^6$

## Input Specification

The first line of input will be an integer, $n$, representing the length of the string.

The second line of input will be a string of letters of length $n$. The letters may be lowercase or uppercase but only the alphabetical order matters.

## Output Specification

Output the length of the longest subsequence in the correct order.

## Sample Input

8
AbCDabEz

## Sample Output

6

## Explanation

The longest subsequence of correct order is AbCDEz.


text:
## The Derivative of a Composition(i.e., "The Chain Rule")

If $g$ is a function differentiable at some $a$, and $f$ is a function differentiable at $g(a)$, then the derivative of their composition exists and is given by

$$\frac{d}{dx} \left[ f\,(g(x)) \right] = f\,'(g(a)) g'(a)$$

Proof:

We begin by appealing to one of the possible definitions for the derivative:

$$(f \circ g)'(a) = \lim_{x \to a} \frac{f(g(x)) - f(g(a))}{x - a}$$

Assume for the moment that $g(x) \neq g(a)$ for all $x$ near $a$.

Then the previous expression is equal to the product of two factors:

$$\lim_{x \to a} \frac{f(g(x)) - f(g(a))}{g(x) - g(a)} \cdot \frac{g(x) - g(a)}{x - a}$$

When $g$ oscillates near $a$, then it might happen that no matter how close one gets to $a$, there is always an even closer $x$ such that $g(x)=g(a)$. For example, this happens for $g(x) = x^2 \sin(1/x)$ near the point $a=0$. Whenever this happens, the above expression is undefined because it involves division by zero. To work around this, introduce a function $Q$ as follows:

$$Q(y) = \left\{ \begin{array}{ccl} \displaystyle{\frac{f(y) - f(g(a))}{y - g(a)}} & , & y \neq g(a), \\\\ f\,'(g(a)) & , & y = g(a). \end{array} \right.$$

We will show that the difference quotient for $f \circ g$ is always equal to:

$$Q(g(x)) \cdot \frac{g(x) - g(a)}{x - a}.$$

Whenever $g(x) \neq g(a)$, this is clear because the factors of $g(x)-g(a)$ cancel. When $g(x) = g(a)$, then the difference quotient for $f \circ g$ is zero because $f(g(x)) = f(g(a))$, and the above product is zero because it equals $f\,'(g(a))$ times zero.

So the above product is always equal to the difference quotient, and to show that the derivative of $f \circ g$ at $a$ exists and to determine its value, we need only show that the limit as $x$ goes to $a$ of the above product exists and determine its value.

To do this, recall that the limit of a product exists if the limits of its factors exist. When this happens, the limit of the product of these two factors will equal the product of the limits of the factors. The two factors are

$$Q(g(x)) \quad \textrm{ and } \quad \frac{g(x) - g(a)}{x-a}$$

The latter is the difference quotient for $g$ at $a$, and because $g$ is differentiable at $a$ by assumption, its limit as $x$ tends to $a$ exists and equals $g'(a)$.

It remains to consider $Q(g(x))$.

Note first, $Q$ is defined wherever $f$ is. Furthermore, because $f$ is differentiable at $g(a)$ by assumption, $Q$ is continuous at $g(a)$. Also, $g$ is continuous at $a$ because it is differentiable at $a$. Therefore $Q \circ g$ is continuous at $a$, and

$$\lim_{x \rightarrow a} \ Q(g(x)) = Q(g(a)) = f\,'(g(a))$$

This shows that the limits of both factors exist and that they equal $f\,'(g(a))$ and $g'(a)$, respectively. Therefore the derivative of $f \circ g$ at $a$ exists and equals $f\,'(g(a)) g'(a)$.

QED.


text:
# Topological Boundary vs Manifold Boundary

Let $A$ be the open unit disc in $\mathbb{R}^2$ and $B$ be the closed unit disc in $\mathbb{R}^2$.

The toplogical boundary of $A$ and $B$ is $S^1$. This I understand.

The manifold boundary of $A$ is $\emptyset$ and the manifold boundary for $B$ is $S^1$. This I don't understand. Can someone briefly explain?

In a topological manifold $M$ (possibly with boundary), each point $p \in M$ must have an open neighborhood $p \in U$ which is homeomorphic either to an open set in $\mathbb{R}^n$ or to an open set in $\mathbb{H}^n := \{ (x_1, \ldots, x_n) \in \mathbb{R}^n \, | \, x_n \geq 0 \}$. The set $\partial \mathbb{H} := \{ (x_1, \ldots, x_{n-1}, 0) \, | \, x_1, \ldots, x_{n-1} \in \mathbb{R} \}$ is called the boundary of $\mathbb{H}$.

Let $p \in M$ and let $\varphi \colon U \rightarrow V$ be a homeomorphic between an open neighborhood of $p \in U$ in $M$ and an open neighborhood in $\mathbb{R}^n$ or $\mathbb{H}^n$. If $V \subseteq \mathbb{H}^n$ and $\varphi(p) \in \partial \mathbb{H} \cap V$, we say that $p$ is a boundary point of $M$. If $V \subseteq \mathbb{R}^n$ or $V \subseteq \mathbb{H}^n$ and $\varphi(p) \notin \partial \mathbb{H}^n$, we say that $p$ is an interiour point. It is a non-trivial result that the set of interior points and the set of boundary points is disjoint.

Consider for example the closed unit disk $B = B(0,1) \subseteq \mathbb{R}^2$. Using polar coordinates, you can easily construct a homeomorphism from an open neighborhood of each point $x \in B$ with $|x| = 1$ to an open neighborhood of $\mathbb{H}^2$ mapping $x$ to $\partial \mathbb{H}^2$. For $x \in B$ with $|x| < 1$, the open ball $\{ x \, | \, |x| < 1 \}$ is a neighborhood that is an open subset of $\mathbb{R}^2$. Thus, the boundary of the closed unit disk as a manifold is the same as the topological boundary. Since the open unit disk is already an open subset of $\mathbb{R}^2$, the boundary of it considered as a manifold is empty.

You need to review your definition of a manifold with boundary v.s. manifold without boundary.

In the case of A, for every point $p \in A$ you can find a neighbourhood $U$ such that $p \in U$ and a diffeomorphism $\phi: U \to V \subset \mathbb{R}^2$ (the natural inclusion), where $V$ is open in $\mathbb{R}^2$.

In the case of B, for every point $p \in S^1 \subset B$ you cannot find a neighborhood $U$ of $p$ such that $U$ is diffeomorphic (even homeomorphic) to some open subset $V$ of $\mathbb{R}^2$, but you can find one diffeomorphic to an open subset of some half-space $\mathbb{R}^2_{\lambda \geq c}$ making it a manifold with boundary.

NOTE: When you say that the topological boundary of $A$ is $S^1$ you are thinking of A as a subset of $\mathbb{R}^2$ and when you think of A as a manifold you think it as the whole space.