text:
I am multiplying radicals and I have a question like this:

square root of ((6x^7)(y^3)) multiplied by square root of ((7x^3)(y^-1))

In the end I got x^(5)y(square root of 42)

Does this look right at all?

2. Originally Posted by cjh824
I am multiplying radicals and I have a question like this:

square root of ((6x^7)(y^3)) multiplied by square root of ((7x^3)(y^-1))

In the end I got x^(5)y(square root of 42)

Does this look right at all?
yes, that is fine..

3. Hello, cjh824!

Simplify: . $\sqrt{6x^7y^3}\cdot\sqrt{7x^3y^{-1}}$

In the end I got: . $x^5y\sqrt{42}$ . . . . Right!

$\sqrt{6x^7y^3}\cdot\sqrt{7x^3y^{-1}} \;=\;\sqrt{(6x^7y^3)(7x^3y^{-1})}$

. . $=\;\sqrt{42x^{10}y^2} \;=\;\sqrt{42}\cdot\sqrt{x^{10}}\cdot\sqrt{y^2} \;=\;x^5y\sqrt{42}$

4. in addition, it should be true in the assumption that x and y are non negative or both negative..

simply stated, x and y should have the same sign..


text:
# Homework Help: Extension of rod -- help please

1. Jan 15, 2015

### praveenpandiyan

1. The problem statement, all variables and given/known data
see attachement

2. Relevant equations
dl= PL/AE

3. The attempt at a solution
as you see here my youngs modulus E varies linearly. i doubt that adding up E1 &E2 wld give solution.. any help?

Last edited by a moderator: Jan 15, 2015
2. Jan 15, 2015

### Staff: Mentor

What is the (approximate) Young's modulus in the first centimeter? How much will it get stretched?
What is the (approximate) Young's modulus in the last centimeter? How much will it get stretched?
Instead of calculating it centimeter by centimeter, how can you get an "exact" solution?

3. Jan 15, 2015

### Staff: Mentor

What is the tensile stress in the rod? Do you know the relationship between strain and displacement u?

4. Jan 16, 2015

### praveenpandiyan

centimeter by centimeter?. well threre must be some other way, like its going to be triangular profile with one end E1 and other end E2.. is that possible to find equivalent E acting on rod ..

5. Jan 16, 2015

### praveenpandiyan

yes sir .tensile stress =P/A. and strain = dL/L. .by hookes law E=stress/strain giives dL= PL/AE

6. Jan 16, 2015

### Staff: Mentor

The centimeter by centimeter calculation is not correct, but if you answer my questions it should give you an idea how the correct approach looks like.
It is not the first question I am helping at, I suggest that for a good reason.

7. Jan 16, 2015

### Staff: Mentor

Your equation for the strain is valid only if it is uniform from one end of the rod to the other. In this problem, because E varies with position along the rod, the strain is not uniform from one end to the other. So you need to figure out how to handle a problem in which the strain is varying with position along the rod.

Let x represent axial position measured along the rod before the rod is placed under load. Let the end x = 0 be fixed, and let the end x = L be where the load P is applied. We are going to focus on one cross section of the rod at location x before the rod is placed under load. After the rod is placed under load, this same cross section has moved to a new axial location at x + u(x), where u(x) is the distance that the cross section originally at x has moved. We call u(x) the displacement of the cross section. Of course, since the end at x = 0 is fixed, u(0) = 0.

Now let's look at what happens to two closely neighboring adjacent cross sections of the rod that were initially located at x and at x + Δx. What was the original distance between these two cross sections? What is the distance between these same two cross sections after the load has been applied? What is the increase in distance between the two cross sections? What is the increase in distance divided by the original distance? What is the limit of this as Δx approaches zero?

Chet

8. Jan 16, 2015

### praveenpandiyan

well then the material vary at every point (as u said).. so i need to find extension at given small dx. and integrate from 0 to L . is that right

9. Jan 16, 2015

### Staff: Mentor

Chet

10. Jan 16, 2015

### praveenpandiyan

only problem im facing is its E value .. at dx E= E1-((E2-E2)/L)*x .im bit confused.

11. Jan 16, 2015

### Staff: Mentor

Chet

12. Jan 16, 2015

### praveenpandiyan

let original lenght be L ... but i have no idea how to find lenght btw consecutive section after load is applied.

13. Jan 16, 2015

### praveenpandiyan

i didnot mean that way. i value you all. but i was in a hurry,, needed aproach or formula that i miss.exams coming up.

14. Jan 16, 2015

### Staff: Mentor

Several people have laid out an approach, but you need to come up with a way to use what they have said. We are not going to give you a formula that you can blindly plug numbers into.

15. Jan 16, 2015

### Staff: Mentor

Distance between successive cross sections after load is applied =$[x + Δx + u(x+Δx)]-[x + u(x)] = Δx + u(x+Δx) - u(x)$

This is my last hint until I see some effort on your part.

Chet

16. Jan 16, 2015

### praveenpandiyan

yea
h .yeah ,.. im seeing it ,anyway thanks

17. Jan 16, 2015

### Staff: Mentor

Not so fast. So, please show us your solution. It's the least you can do, given that we spent so much of our (valuable) time trying to help you.

Chet

format: plain


text:
# Math Help - Solving Linear Trig Equations

1. ## Solving Linear Trig Equations

I have many questions with this as i am genuinely confused.

First, how should a question like this be answered.

The domain is 0 to 360 degrees. the question is

3 sin x=sin x + 1

Second,

The average monthly temperature of Littletown can be modelled by the function T(t)=14.6sin 0.5(t-1) + 9.15 where T is the temperature in degrees celsius and t=0 represents January, t=1 represents February 1, and so on.

a, In which month is the average temperature the highest? the lowest?

b, Use the model to predict when the temperature is 0 degrees celsius

c, When is the temperature 20 degrees celsius.

For this one can you show me what i need to do to get the proper table of values?

Thanks alot.

2. Originally Posted by FORK
I have many questions with this as i am genuinely confused.

First, how should a question like this be answered.

The domain is 0 to 360 degrees. the question is

3 sin x=sin x + 1

Second,

The average monthly temperature of Littletown can be modelled by the function T(t)=14.6sin 0.5(t-1) + 9.15 where T is the temperature in degrees celsius and t=0 represents January, t=1 represents February 1, and so on.

a, In which month is the average temperature the highest? the lowest?

b, Use the model to predict when the temperature is 0 degrees celsius

c, When is the temperature 20 degrees celsius.

For this one can you show me what i need to do to get the proper table of values?

Thanks alot.
Should this be $3\sin^2(x)=\sin(x)+1$?
if not $3\sin(x)=\sin(x)+1\Rightarrow{2\sin(x)=1}$

then $x=arcsin\bigg(\frac{1}{2}\bigg)=\frac{\pi}{6}$\

and what other angle gives 1/2?

3. Originally Posted by Mathstud28
Should this be $3\sin^2(x)=\sin(x)+1$?
if not $3\sin(x)=\sin(x)+1\Rightarrow{2\sin(x)=1}$

then $x=arcsin\bigg(\frac{1}{2}\bigg)=\frac{\pi}{6}$\

and what other angle gives 1/2?
Its this one. $3\sin(x)=\sin(x)+1\Rightarrow{2\sin(x)=1}$

And it gives me 0.034 when i do it but my book says 0.52?


text:
# System of Particles

An object of an ordinary size which we call a “macroscopic” system contains a huge number of atoms or molecules. It is out of the question to attempt to use the laws we have discussed for a single particle to describe separately each particle in such a system. There are nevertheless some relatively simple aspects of the behaviour of a macroscopic system that (as we will show) follow the basic laws for a particle. We will be able to show that in any multi-particle system each of the mechanical quantities relevant to the state of the system consists of two parts:

• One part in which the system is treated as though it were a single particle (with the total mass of the system) located at a special point called the centre of mass. This part is often called the CM motion.
• Another part was describing the internal motion of the system, as seen by an observer located at (and moving with) the centre of mass.

## Center Of Mass

We consider a system composed of N point particles, each labelled by a value of the index I which runs from 1 to N. Each particle has its mass mi and (at a particular time) is located at its particular place ri.

The centre of mass (CM) of the system is defined by the following position vector

###### $r_{CM}=\frac{1}{M}\sum_{i}m_{i}x_{i}$

Where M is the total mass of all the particles.

This vector locates a point in space — which may or may not be the position of any of the particles. It is the mass-weighted average position of the particles, being nearer to the more massive particles.

As a simple example, consider a system of only two particles, of masses m and 2m, separated by a distance. Choose the coordinate system so that the less massive particle is at the origin and the other is at x =  as shown in the drawing. Then we have m1 = m, m2 = 2m, x1 = 0 , x2 = .

We find from the definition $x_{cm}=\frac{1}{3m}\left ( m.0+2m \right )= \frac{2}{3}l$

The location is indicated on the drawing above.

As time goes on the position vectors of the particles ri generally change with time, so in general, the CM moves. The velocity of its motion is the time derivative of its position:

$v_{CM}=\frac{1}{M}\sum_{i=1}^{N}m_{1}v_{1}$

But the sum on the right side is just the total (linear) momentum of all the particles. Solving for this, we find an important result:

###### $P_{tot}=Mv_{CM}$

This is just like the formula for the momentum of a single particle, so we see that: The total momentum of a system is the same as if all the particles were located together at the CM and moving with its velocity.


text:
Intended for healthcare professionals

Multimedia

The annals of literature are full of instances of misanthropes, knaves, and other antisocial characters who come to see the error of their ways and spend their declining years doing good works and helping their fellows. We were therefore intrigued by an announcement late last year by tobacco giant Philip Morris that it was prepared to spend $100m a year in a US campaign to reduce young people's smoking. Was this, at last, an honest attempt by Philip Morris to end its seductive marketing practices that have led to the tobacco addiction of millions of children and teenagers around the world? Philip Morris has produced a series of television advertisements entitled “Think. Don't Smoke” and has made them the centrepiece of its antismoking campaign for teenagers. The advertisements tell children that they have a choice whether to smoke. Do they work? The answer is probably not, according to a study released earlier this month (Wall Street Journal 7 April). Focus groups of 12-16 year olds were shown the Philip Morris antismoking adverts along with those from California, Massachusetts, Florida, and Arizona. The children found the Philip Morris adverts to be the least effective of all in making them “stop and think” about not smoking. Some of the respondents said that the Philip Morris adverts sounded more like a parental lecture, and overall there was a feeling that they lacked substance and good reasons not to smoke. It is reasonable to wonder why Philip Morris would undertake a multimillion dollar antismoking campaign that would seemingly undercut its efforts to attract new customers (90% of new smokers in the United States are under age). After all, Philip Morris is still spending far more on cigarette marketing that affects children adversely than on keeping tobacco out of their hands. In fact, the Marlboro Man, the rugged all-American cowboy tobacco icon, is one of the best reasons to be sceptical of Philip Morris's intentions. Marlboro's 40 year global advertising campaign is arguably one of the most successful in the history of advertising. The association of an addictive product with images of cowboys, virility, and the American West has made Marlboro the brand of choice children worldwide. In the United States Marlboro is preferred by 60% of 8th, 10th, and 12th grade boys and girls (14-18 year olds) who smoke. Among white 12th graders, Marlboro's share of the market is even higher at 70%. Between 1988 and 1997, the Marlboro campaign was responsible for convincing 1.4 million children to try smoking. If current trends continue, about 200 000 of these new smokers will die prematurely from smoking related disease. If Philip Morris was truly serious about stopping the alarming spread of teenage smoking, it would start by dropping the Marlboro Man and changing its marketing practices that influence children, such as advertising in magazines with high youth readership. In reality, Philip Morris is getting maximum public relations value out of its teenage antismoking campaign while achieving little in results. The tobacco industry has a long history of diverting attention away from its true motives. The release of internal documents in recent years has shown how tobacco companies have misled the public about the dangers of smoking and how they have directed marketing at children. As previously, the industry responds to threats of legislation or litigation with public relations campaigns. A 1995 internal Philip Morris document quoted Ellen Merlo, Philip Morris's senior vice president of corporate affairs, warning her colleagues, “If we don't do something fast to project the sense of industry responsibility regarding the youth access issue, we are going to be looking at severe marketing restrictions in a very short time. Those restrictions will pave the way for equally severe legislation or regulation on where adults are allowed to smoke.” Does that sound like a company concerned about children smoking? Another aspect of Philip Morris's strategy is to try to enhance its image by attracting credible health, education, and youth organisations as partners in its teenage antismoking effort. So far, only one group has agreed to participate: the National 4-H Council, a respected group that fosters partnerships between young people and adults, has agreed to take$4m from Philip Morris. The council claims that it has been given assurances that Philip Morris will not try to control how the money for antismoking programmes is spent. Still, there has been considerable dissension within the organisation, and many of the council's state level programmes have refused to be associated with Philip Morris. California's 4-H advisory council wrote to the president of the National 4-H Council, admonishing him that “4-H does not belong in Marlboro Country.” Many in the organisation believe that any association with Philip Morris will damage the reputation of 4-H.


text:
# For the following function {eq}f(x) = 2 e ^{- x ^4} {/eq}. a) Find {eq}f''(x) {/eq}. b) Find {eq}f''(0) {/eq}. c) Find {eq}f'' (1) {/eq}.

## Question:

For the following function {eq}f(x) = 2 e ^{- x ^4} {/eq}.

a) Find {eq}f''(x) {/eq}.

b) Find {eq}f''(0) {/eq}.

c) Find {eq}f'' (1) {/eq}.

## Finding the Second-Order Derivative:

The expression of the second derivative is {eq}\displaystyle \frac{d{f}'}{dx}={f}''(x) {/eq}. If we differentiate the first-order derivative of the function, we will get the second-order derivative. And it is known as the higher-order derivative. We can evaluate the derivative function at the value of the variable.


text:
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Yesterday a family member forwarded me a Wall Street Journal interview titled What Data Scientists Do All Day At Work. The title intrigued me immediately, partly because I find myself explaining that same topic somewhat regularly.

I wasn’t disappointed in the interview: General Electric’s Dr. Narasimhan gave insightful and well-communicated answers, and I both recognized familiar opinions and learned new perspectives. But I was disappointed that in an article about data scientists (!) they would include a chart this terrible:

Pie charts have a bad reputation among statisticians and data scientists, with good reason (see here for more). But this is an especially unfortunate example. We’re meant to compare and contrast these six tasks. But at a glance, do you have any idea whether more time is spent “Presenting Analysis” or “Data cleaning”?

The problem with a lot of pie-chart bashing (and most “chart-shaming,” in fact) is that people don’t follow up with a better alternative. So here I’ll show how I would have created a different graph (using R and ggplot2) to communicate the same information. This also serves as an example of the thought process I go through in creating a data visualization.

(I’d note that this post is appropriate for Pi Day, but I’m more of a Tau Day observer anyway).

Setup

I start by transcribing the data directly from the plot into R. readr::read_csv is useful for constructing a table on the fly:

This constructs our data in the form:1

Basic exploratory data analysis < 1 a week 11
Data cleaning < 1 a week 19
Machine learning/statistics < 1 a week 34
Creating visualizations < 1 a week 23
Presenting analysis < 1 a week 27
Extract/transform/load < 1 a week 43
Basic exploratory data analysis 1-4 a week 32
Data cleaning 1-4 a week 42
Machine learning/statistics 1-4 a week 29

Bar plot

The most common way a pie chart can be improved is by turning it into a bar chart, with categories on the x axis and percentages on the y-axis.

This doesn’t apply to all plots, but it does to this one.

Note that much like the original pie chart, we “faceted” (divided into sub-plots) based on the Task.

This graph is not yet polished, but notice that it’s already easier to tell how the distribution of responses differs between tasks. This is because the x-axis is ordered from left to right as “spend a little time” to “spend a lot of time”- therefore, the more “right shifted” each graph is, the more time is spent on it. Notice also that we were able to drop the legend, which makes the plot both take up less space and require less looking back and forth.

Alternative plots

This was one of a few alternatives I considered when I first imagined creating the plot. When you’ve made a lot of plots, you’ll learn to guess in advance which you will be worth trying, but often it’s worth visualizing a few just to check.

We have three attributes in our data: Hours, Task, and Percentage. We chose to use x, y, and facet to communicate those respectively, but we could have chosen other arrangements. For example, we could have had Task represented by color, and represented it with a line plot:

This has some advantages over the above bar chart. For starters, it makes it trivially easy to compare two tasks. (For example, we learn that “Creating visualizations” and “Data cleaning” take about the same distribution of time). I also like how obvious it makes it that “Basic exploratory data analysis” takes up more time than the others. But the graph makes it harder to focus just one one task, you have to look back and forth from the legend, and there’s almost no way we could annotate it with text like the original plot was.

Here’s another combination we could try:

This approach is more of a “table”. This communicates a bit less than the bar and line plots since it gives up the y/size aesthetic for communicating Percentage. But notice that it’s still about as easy to interpret as the pie chart, simply because it is able to communicate the “left-to-right” ordering of “less time to more time”.

Improving our graph

How can our bar plot be improved?

The first problem that jumps out is that the x-axis overlaps so the labels are nearly unreadable. This can be fixed with this solution.

Next, note that the original pie chart showed the percentages as text right on the graph. This was necessary in the pie chart simply because it’s so difficult to guess a percentage out of a pie chart- we could afford to lose it here, when the y-axis communicates the same information. But it can still be useful when you want to pick out a specific number to report (“Visualization is important: 7% of data scientists spend >4 hours a day on it!”) So I add a geom_text layer.

The ordering of task facets is arbitrary (alphabetical in this plot). I like to give them an order that makes them easier to browse- something along the lines of. A simple proxy for this is to order by “% who spend < 1 hour a week.”2

Graph design

From here, the last step would be to adjust the colors, fonts, and other “design” choices.

I don’t have terribly strong opinions about these choices (I’m pretty happy with ggplot2’s theme_bw()). But some prefer Edward Tufte’s approach of maximizing the “Data/Ink Ratio”- that is, dropping borders, grids, and axis lines. This can be achieved with theme_tufte:

Some people take this philosophy even further, and drop the y-axis altogether (since we do already have those percentages annotated on the bars).

(See here for an animated version of this “Less is more” philosophy).

So take a look at the two versions:

Which communicates more to you? And can you think of a plot that communicates this data even more clearly?

I wouldn’t.

Footnotes

1. Why did I choose to represent it in this “gathered” format, rather than one row per task and one column per hour? Because using tidy data makes it easier to plot!

2. This isn’t actually going to tell us which tasks data scientists spend the most time on: we should do some kind of weighted measure to estimate the mean. But for visualization purposes this is enough.


text:
## Hard divisibility problem [closed]

The statement of this problem is elementary... How about the proof ? Let $p$ be an odd prime number. For every integer $a$ , define the number

$S_{a}=\frac{a}{1}+\frac{a^{2}}{2}+....+\frac{a^{p-1}}{p-1}$.

Let $m$ and $n$ be integers such that $S_{3}+S_{4}-3S_{2}=\frac{m}{n}$. Prove that $p$ divides $m$.

-
I would like to see the proof. Voted to reopen. – GH Apr 29 2012 at 15:34
$S_a(p) \equiv ((a-1)^p + 1 - a^p)/p \bmod p$ [proof: expand $(a-1)^p$ in a binomial series, subtract first and last term, divide by $p$, and evaluate termwise]. So $S_3 + S_4 - 3S_2 \equiv (4 \cdot 2^p - 4 - 4^p)/p$. But that's $-(2^p-2)^2/p$, which is a multiple of $p$, QED. – Noam D. Elkies Apr 29 2012 at 16:07
Well, the punchline is related with the fact that a nontrivial homomorphism from $({\bf Z}/p^2{\bf Z}, \times)$ to $({\bf Z}/p{\bf Z}, +)$ is given by $a \mapsto (a^{p-1}-1)/p$. (The formula for $S_a$ looks like a logarithm...) – Noam D. Elkies Apr 29 2012 at 22:57
@Gerry: If I find a question interesting and nontrivial, then I like to see the answer for it. All this is highly subjective, I know. – GH Apr 29 2012 at 23:20
@Noam: Can you elaborate on your last comment? It sounds rather interesting. Thanks. – GH Apr 29 2012 at 23:21


text:
# Chapter 25 - Capacitance - Problems - Page 744: 67e

$120\ V$

#### Work Step by Step

The voltage across $C_2$ can be found using the formula: $V_2 =\frac{q_2}{C_2}$ As capacitor are arranged in series, $q_1 =q_2 =480\ \mu C$ Thus: $V_2 =\frac{480\ \mu C}{4\ \mu F}$ $V_2 =120\ V$

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


text:
Czechoslovak Mathematical Journal, Vol. 62, No. 4, pp. 969-989, 2012

# Smoothness for the collision local time of two multidimensional bifractional Brownian motions

## Guangjun Shen, Litan Yan, Chao Chen

Guangjun Shen, Department of Mathematics, Anhui Normal University, 1 East Beijing Rd., Wuhu 241000, P. R. China, e-mail: guangjunshen@yahoo.com.cn; Litan Yan, Department of Mathematics, Donghua University, 2999 North Renmin Rd., Songjiang, Shanghai 201620, P. R. China, e-mail: litanyan@dhu.edu.cn; Chao Chen, Department of Mathematics, East China University of Science and Technology, 130 Mei Long Rd., Xuhui, Shanghai 200237, P. R. China

Abstract: Let $B^{H_i,K_i}=\{B^{H_i,K_i}_t, t\geq0 \}$, $i=1,2$ be two independent, $d$-dimensional bifractional Brownian motions with respective indices $H_i\in(0,1)$ and $K_i\in(0,1]$. Assume $d\geq2$. One of the main motivations of this paper is to investigate smoothness of the collision local time
where $\delta$ denotes the Dirac delta function. By an elementary method we show that $\ell_T$ is smooth in the sense of Meyer-Watanabe if and only if $\min\{H_1K_1,H_2K_2\}<1/{(d+2)}$.


text:
# Haplotype networks in R

Haplotype networks are pretty useful for genomic analyses, especially when you’re looking at phylogeography (Shannon et al 2015) or if you’re looking at a region of special interest (Huerta-Sánchez et al 2014). A quick google search will turn up a number of blog posts that tell you how to use pegas to create a haplotype network, but many of them use the provided wood mouse dataset, which is already nicely formatted. If you’re using whole genome data (e.g. Illumina), it turns out to be a little more complicated than just importing a fasta file. In this post, I’ll show you how to get from a whole genome VCF to a haplotype network.

Pegas requires a fasta file (there are other input methods, but I found fasta to be the most straightforward) with your locus of interest (e.g. mitochondria) and requires all individuals to have the same sequence length. The data I’m starting with is a whole genome, all sites VCF file. In order to extract the mitochondria, I wrote a python script available here. To use it, you should supply a vcf file (gzipped or not is fine), an output filename, and a chromosome of interest:

python vcf2fasta.py -v individuals.vcf.gz -g -o mitochondria.fasta -c mitochondria

This script will go through the VCF file and append the appropriate reference or alternate bases for each individual and output a valid fasta file.

In theory, we should be able to plug it into pegas now because it’s a fasta file with all individuals and each individual should have the same sequence length in the mitochondria, especially since it’s already been aligned to the reference. In practice, however, this is not the case. Some individuals will be missing bases, and sometimes the reference has weird issues where sites show up twice, etc. To fix this, I use clustal to align the fasta file again. Either clustal omega or clustalw should work, but clustal omega is supposed to be faster. After running clustal, you should output a fasta file where every individual has the same number of bases. Once this is done, we can finally use pegas to build a network.

input <- "MChloroplast.fasta" d <- ape::read.dna(input, format='fasta') e <- dist.dna(d) h <- pegas::haplotype(d) h <- sort(h, what = "label") (net <- pegas::haploNet(h)) ind.hap<-with( stack(setNames(attr(h, "index"), rownames(h))), table(hap=ind, pop=rownames(d)[values]) ) plot(net, size=attr(net, "freq"), scale.ratio=0.2, pie=ind.hap) legend(-8, 0, colnames(ind.hap), col=rainbow(ncol(ind.hap)), pch=19, ncol=2)

If everything goes right, you should get something like this:

# The effect of excess reads and uneven coverage on viral sequence assembly

tl;dr: it makes it harder. Use IDBA_UD for assembly.

One of the coolest results of RNA biology has been the ability to reconstruct full viral genomes from the sequencing of siRNAs found in eukaryotes. The Wu et. al. 2010 paper in PNAS (http://www.pnas.org/content/107/4/1606.full.pdf) demonstrated that this was possible in fruit flies, mosquitoes, and nematodes. One of the things I’ve been working on has been applying this to virus discovery in crop plants. This is a cool method, but one of the problems with this is that most assemblers weren’t build with this kind of data in mind. That is to say, most assemblers expect a sample with relatively even coverage across a genome.

When we try and sequence the siRNAs, we get massive amounts of coverage in some areas and really low levels of coverage in other areas. This makes it difficult for most assemblers to reconstruct a full genome. In order to get around this, one of the things I tried was subsampling and normalizing my reads. The idea here was to even out the coverage to a lower level so that our data is more in line with what assemblers expect.

However, this didn’t go at all like I expected. What I did in the code above was subsample or normalize my reads down to a specific coverage level and map the reads to a virus that I know is in the sample. Below you can see what happened:

Coverage: 50x. Method: subsampling

Coverage: 50x. Method: normalization

Coverage: 5x. Method: subsampling

Coverage: 5x. Method: normalization

As you can see from the graphs, normalization produces a much smoother level of coverage, but doesn’t really even out the coverage at all. This doesn’t help assembly at all. Subsampling performs even worse and makes coverage look pretty terrible (especially at the 5x level). The code to do this is located here in the repository under normalization.sh and subsampling.sh. Normalization was done with bbmap and subsampling was done with bioawk.

As it turns out, the best way to deal with this is to use an assembler that can handle uneven coverage and that’s where IDBA_UD comes in. This assembler is awesome and was designed with uneven coverage in mind. From the homepage:

IDBA-UD is a iterative De Bruijn Graph De Novo Assembler for Short Reads Sequencing data with Highly Uneven Sequencing Depth. It is an extension of IDBA algorithm. IDBA-UD also iterates from small k to a large k. In each iteration, short and low-depth contigs are removed iteratively with cutoff threshold from low to high to reduce the errors in low-depth and high-depth regions. Paired-end reads are aligned to contigs and assembled locally to generate some missing k-mers in low-depth regions. With these technologies, IDBA-UD can iterate k value of de Bruijn graph to a very large value with less gaps and less branches to form long contigs in both low-depth and high-depth regions.

This assembler has performed much better than most of the alternatives (Velvet, ABySS, CLCBio, SOAP, etc.) and I’d highly recommend it if you’ve got uneven coverage in your samples.

# Interpreting Tajima’s D

## Introduction

Tajima’s D is a statistic that compares the average number of pairwise differences with the number of segregating sites. It’s an important statistic that is widely used in population genetics. However, it must be carefully analyzed because population demography changes how Tajima’s D can be interpreted. In this post, we will look at why Tajima’s D works and how demography (especially population bottlenecks) can cloud signals of Tajima’s D.

Figure 1. A population bottleneck with a new rare allele (orange) arising after the bottleneck.

First, let’s look at the two major components of Tajima’s D. $\hat{\theta}_T$ is the number of pairwise differences (Tajima’s estimator or $\pi$) and is given by:

$\hat{\theta}_T=\frac{\sum\limits_{i

where $d_{ij}$ is the number of differences between two sequences, i and j. $n$ is given by the number of sequences to compare. $\hat{\theta}_W$ is the number of segregating sites (Watterson’s estimator or S) given by:

$\hat{\theta}_W=\frac{S}{\sum\limits_{i=1}^{n-1} 1/i}$

where S is the number of sites that segregate in the sample (that is, the number of sites are variable). Now that we have these definitions, we can take a look at their differences. The expectation is that both estimators will be equal to $\theta$, which is the population scaled mutation rate. However, this is not the case! Because of the way it is calculated, $\hat{\theta}_T$ will underestimate the number of mutations that are rare in the population. Because of this, comparing the two values of $\theta$ gives us a test statistic, Tajima’s D:

$D=\frac{\hat{\theta}_T - \hat{\theta}_W}{\sqrt{\hat{V}(\hat{\theta}_T - \hat{\theta}_W)}}$

### Rare variants contribute little to $\hat{\theta}_T$

In the examples below, sequences are represented as dashes and asterisks. The sequences are aligned and a dash is a site that is the same between sequences and the asterisks represents a mutation.

Given some sequences, what are the values for $\hat{\theta}_T$ and $\hat{\theta}_W$?

Example 1

---*---*------
-------*---*--
-------*------
-----------*--

$\hat{\theta}_T=\frac{2+1+3+1+1+2}{6}=1.67$ and $\hat{\theta}_W=\frac{3}{1+\frac{1}{2}+\frac{1}{3}}=1.63$

So in this case, $\hat{\theta}_T$ gives us a similar estimate compared to $\hat{\theta}_W$ (thanks to Marie-Julie Favé and her students for pointing out an error here). However, this will change once we introduce more rare mutations. The numerator in $\hat{\theta}_T$ is the number of differences between each sequence. For example, if you compare the first 2 sequences, there are 2 differences. The first and third have 1 difference, etc.

Example 2

-*------------
----*---------
-------*------
-----------*--

$\hat{\theta}_T=\frac{2+2+2+2+2+2}{6}=2$ and $\hat{\theta}_W=\frac{4}{1+\frac{1}{2}+\frac{1}{3}}=2.2$
Here, because each mutation is a rare variant, the estimate of $\theta$ is lower in $\hat{\theta}_T$ than in $\hat{\theta}_W$. This effect is not very pronounced in this example because n is so small, but if we increase n to 100 and make every mutation a rare one (i.e. at a frequency of 0.01), we can see the effect more clearly.

Example 3

-*--------------------------------------------------------------------------------------------------
--*-------------------------------------------------------------------------------------------------
---*------------------------------------------------------------------------------------------------
----*-----------------------------------------------------------------------------------------------
...
--------------------------------------------------------------------------------------------------*-

$\hat{\theta}_T=\frac{2(99.5)}{99.5}=2$ and $\hat{\theta}_W=\frac{100}{1+\frac{1}{2}+...+\frac{1}{99}}=19.31$
Woah that’s a huge difference! Because of this difference, we can compare the two estimators and learn something about what kind of variants we have in the population.

### Tajima’s D

Tajima’s D is the comparison between the average number of pairwise differences and the number of segregating sites in a sample. We expect positive selection (or selective sweeps) to give us a negative Tajima’s D in a population that doesn’t have any demographic changes going on (population expansion/contraction, migration, etc). This is because $\hat{\theta}_W$ will be greater than $\hat{\theta}_T$. Why? Because after a selective sweep, most of the haplotypes in a population will be the same. Therefore, when mutations occur they will be rare. When you have a lot of rare mutations, $\hat{\theta}_T$ underestimates $\theta$ compared to $\hat{\theta}_W$ and you get a negative Tajima’s D.

In the case of balancing selection, alleles are kept at intermediate frequencies. This produces a positive Tajima’s D because there will be more pairwise differences than segregating sites.

### The effect of bottlenecks

Under demographic scenarios, Tajima’s D can exhibit signals that look like selection even under neutral simulations. Above, you can see how Tajima’s D changes before, during, and after a bottleneck. The effect of population expansion (recovery) on Tajima’s D is staggering. As soon as the population expands, Tajima’s D drops to about -0.45. It continues to drop and begins to recover, but stays negative. This effect is common even when the bottleneck size changes. Below, you can see what happens to Tajima’s D after a bottleneck when the recovery from the bottleneck event varies (10% of the population survives in the bottleneck):

Why does this happen? On average, a bottleneck event will remove rare alleles due to sampling and intermediate alleles will be rare. On average, there will be more rare variants than intermediate variants and Tajima’s D will be negative. This makes it hard to distinguish signals of selection from Tajima’s D when a population has gone through a bottleneck. A neutral population with no selection will look the same as a population that has recently undergone a selective sweep. Below is a stronger bottleneck (1% of population survives):

and here is a weaker bottleneck (20% of population survives):

In all cases, Tajima’s D drops to negative values after a bottleneck. The 1% bottleneck has a much different shape than either of the other bottlenecks. This is because when such an extreme bottleneck occurs, every allele will be rare and Tajima’s D will start out negative. It recovers from the bottleneck in a similar way towards 0. However, in all of these simulations, Tajima’s D never converges to 0 (note that these are neutral simulations). This is because when we have a finite number of samples, the resting point of Tajima’s D is not 0, but a small negative number close to 0.

As we can see from these simulations, Tajima’s D is a complicated statistic and care must be taken when using it to analyze populations. For more on the effect of bottlenecks on populations, check out this presentation: http://www.slideshare.net/jrossibarra/bottlenecks-some-ramblings-and-a-bit-of-data-from-maize

Acknowledgements: Thanks to Jeff Ross-Ibarra for discussions and help with the simulations.

R code for simulations:
 options(scipen=999) library(ggplot2) sims=1000000 bneck_end=runif(sims,0,2) # end comes first backward in time bneck_start=bneck_end+0.005 # start comes 2nd so is bigger number tbsfile<-cbind(bneck_end,bneck_start) write.table(file="tbsfile",tbsfile,col.names=F,row.names=F,quote=F) #we do with recombination, with theta=10 or N~80,000 #bneck then is 0.005480,000 = 1,600 generations f=pipe(paste("~/Downloads/msdir/ms 10 ", sims, " -t 10 -r 10 1000 -eN tbs 0.1 -eN tbs 1 < tbsfile | ~/Downloads/msdir/sample_stats | cut -f 6",sep="")) taj_d=scan(f) qplot(bneck_end,taj_d,geom="smooth", xlab="Bottleneck end (4N generations)", ylab="Tajima's D", main="Effect of recovery time on Tajima's D")

# PCA with ANGSD and ngsCovar

As a follow up to the last post (PCA with samtools and plink) I’m going to go over how to do PCA using genotype likelihoods from ANGSD and with ngsCovar. This method isn’t integrated in to angsd-wrapper yet, but we are looking to add it.

The documentation is a little light for ngsCovar, but there is a tutorial here (shout out to Peter Fields for linking me to that).

PCA with ANGSD/ngsCovar is pretty straightforward once you know which files you need to generate. ngsCovar takes in a binary genotype likelihood file (.geno). This file is distinct from the .glf files that are also produced by ANGSD. To generate the .geno file, you need to supply these options:

angsd/angsd -bam data/all_samples.txt -GL 1 -out results/all.test -doMaf 2 -doMajorMinor 1 -doGeno 32 -doPost 1 -nind 21 -P 8 -r 1:

Specifically, you need -doGeno 32 and -doPost 1. These should generate a .geno.gz file. Once you have this, you need to unzip your .geno.gz file (ngsCovar won’t accept your zipped .geno file):

gunzip all.test.geno.gz

Now we can run ngsCovar and supply the genotype file. The other options will depend on your data, but the command should look something like this:

ngsPopGen/ngsCovar -probfile results/all.test.geno -outfile pop.covar -nind 21 -nsites 100000 -call 0

Then, following the graphing part of the tutorial we can get a nice graph of our population structure. In order to get what we need from the graph, we have to change the script a little bit:

Rscript -e 'write.table(cbind(seq(1,10),rep(1,10),c(rep("Indica",12),rep("Allopatric",4),rep("Sympatric",4),rep("BC1", 1))), row.names=F, sep=" ", col.names=c("FID","IID","CLUSTER"), file="test.pops.clst", quote=F)'

Specifically, we have to change the part that labels the samples to match what our samples actually are: c(rep("Indica",12),rep("Allopatric",4),rep("Sympatric",4),rep("BC1", 1).

Then we can run the plotPCA.R script provided just like in the example:

Rscript scripts/plotPCA.R -i pop.covar -c 1-2 -a test.pops.clst -o test.pca.pdf

And then you get a pretty graph that looks something like this:

PS: Following up from last time, we have included an individual that was supposed to be a backcross (BC1). This individual clusters very closely to the allopatric and sympatric populations and the same sample is an outlier. This suggests 1) ANGSD/ngsCovar and samtools/plink give pretty similar results (at least for this data) and 2) we have switched labels! The outlier should be the BC1 individual and the BC1 individual should be part of the sympatric population.

# Population clustering with samtools SNP calling and Plink MDS

I was looking for a guide on how to do population clustering using samtools and plink but couldn’t find a concise guide on exactly what I need to do. So, after some hacking around, I figured it out and decided to write it down. In order to do MDS on bam files, you need to go through several steps. The general idea is:

bwa ref.fasta sample[0-9].fastq > sample[0-9].bam samtools mpileup -uf ref.fasta sample[0-9].bam | bcftools view -bvcg - > samples.raw.bcf vcftools samples.vcf -plink samples plink --file samples --genome plink --file samples --read-genome samples.genome --cluster --mds-plot 2

Then you can graph your result using R or whatever plotting software you fancy.

Mpileup: Mpileup will create a bcf file which is piped to bcftools, where the -c option will call SNPs. This file is written to disk and then converted to vcf files because vcftools doesn’t like the bcf output of samtools.

[Note: some bam samples removed to reduce complexity]

samtools mpileup -r 1: -uf students/Oryza_indica.ASM465v1.24.dna.genome.fa.gz students/og276.sorted.bam students/og278.sorted.bam | bcftools view -bvcg - > results/all.raw.bcf bcftools view all.raw.bcf > all.raw.vcf

Convert vcf to ped: This step will take the SNP called vcf file and convert it to a format usable by plink (ped and map).

vcftools --vcf all.raw.vcf --plink --out all.raw

Make a .genome file: In order to do MDS, plink needs a .genome file of your samples. This can be created with something like this:

plink --file all.raw --genome --noweb --allow-no-sex --out all.raw

Do some multidimensional scaling:

plink --file all.raw --read-genome all.raw.genome --cluster --mds-plot 2 --noweb

Plot:
d <- read.table("results/plink.mds", h=T) d$pop = factor(c(rep("indica", 12), rep("allopatric", 4), rep("sympatric", 4))) plot(d$C1, d$C2, col=as.integer(d$pop), pch=19, xlab="PC 1", ylab="PC 2", main = "MDS of Oryza (samtools/plink)") legend("topright", c("Indica", "Allopatric", "Sympatric"), pch=19, col=c(2,1,3)) text(d$C1, d$C2, labels=c(rep(NA, 18), "og276", NA), pos=1)

If you’re wondering what’s going on with og276, I have no idea yet! It should cluster with the other sympatric samples, but it didn’t.

# Searching for selection in the human genome with angsd-wrapper

The Nielsen lab has been working on a sweet program called ANGSD (Analysis of Next Generation Sequencing Data). It allows the calculation of many population genetic statistics from .bam files (along with a reference and ancestral genome). In order to make this program easier to use and to streamline analysis, I have been working on a set of wrapper scripts called angsd-wrapper. One feature of this wrapper that I’m excited about is the ability to graph the output using the awesome R package Shiny. Here, I’m going to run through using the software using widely available data from the 1000genomes project.

$git clone https://github.com/arundurvasula/angsd-wrapper.git 1000genomes  This code clones the angsd-wrapper repository into a folder called 1000genomes. There’s a readme in the repository, but a lot of the documentation is actually on the Github wiki page. ## Download data: Next, we can download some data into the data folder: Bams: $ wget ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/data/HG00096/alignment/HG00096.mapped.ILLUMINA.bwa.GBR.low_coverage.20130415.bam
wget ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/data/HG00097/alignment/HG00097.mapped.ILLUMINA.bwa.GBR.low_coverage.20130415.bam wget ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/data/HG00099/alignment/HG00099.mapped.ILLUMINA.bwa.GBR.low_coverage.20130415.bam

Human reference:

$wget ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/reference/phase2_reference_assembly_sequence/phase2_reference_assembly_sequence/hs37d5.fa.gz  Chimp reference: $ wget http://hgdownload.soe.ucsc.edu/goldenPath/panTro4/bigZips/panTro4.fa.gz

We’re almost done grabbing the data. Now we just need to create a file that tells ANGSD where the bams are located:

EUR_samples.txt

/home/adurvasu/1000genomes/data/HG00096.mapped.ILLUMINA.bwa.GBR.low_coverage.20120522.bam

Cool! And then we create a file that hold the inbreeding coefficients in a file (assumed to be 0 for this case, but really should be estimated):

EUR.F.txt

0
0
0

Now we’re really done.

## Run the software

Okay, now we get to run the software! This is where angsd-wrapper attempts to make things easier. We eventually want to calculate theta and some neutrality test statistics. First, we need to create an SFS and then we can run the thetas part of ANGSD.

In order to do this, we modify the sfs_example.conf configuration file to point to our data and do a few other things:

sfs_example.conf

UNIX_USER="adurvasu"
PROJECT_DIR=/home/$UNIX_USER/1000genomes/ ANGSD_DIR=${PROJECT_DIR}/angsd

ANC_SEQ=./data/hs37d5.fa.gz
REF_SEQ=./data/hs37d5.fa.gz
TAXON=EUR
REGIONS="1:"
DO_SAF=1
OVERRIDE=false
N_CPUS=16

Regions is set to “1:” so that we only look at chromosome 1 for now. Also, the ancestral sequence points to the human reference because ANGSD did not like how the chimp and human genomes aligned. We can run this with the following line of code:

$bash scripts/ANGSD_SFS.sh scripts/sfs_example.conf  Once that’s finished, we should have a nice shiny file called EUR_Derived in the results folder. This file contains the site frequency spectrum. Now that that’s over, we can run the theta calculation workflow. Similar to above, the thetas_example.conf file is modified: thetas_example.conf UNIX_USER="adurvasu" PROJECT_DIR=/home/$UNIX_USER/1000genomes/
ANGSD_DIR=${PROJECT_DIR}/angsd ANC_SEQ=./data/hs37d5.fa.gz REF_SEQ=./data/hs37d5.fa.gz TAXON=EUR REGIONS="1:" PEST=results/${TAXON}_DerivedSFS
OVERRIDE=true
SLIDING_WINDOW=true
WIN=1000
STEP=500
DO_SAF=1

This file is pretty similar to the one above, but there are some options for pointing to the SFS and for the sliding window. This can be run in the same way as the SFS calculation:

$bash scripts/ANGSD_Thetas.sh scripts/thetas_example.conf  Cool! Now we get to look at the data using the interactive Shiny graph! ## Download data locally and download GFF and view in shiny If you are using a cluster to run ANGSD, you will need to download the data to your local computer because Shiny is easier to deal with using a GUI. The data can be scp‘d over. Once you have it, you can navigate to the scripts folder in the terminal and run the Shiny application: $ cd scripts $R > library(shiny) > runApp("shiny") Then, load the data in the web app and wait for the graph (it’s a lot of data!). Hopefully, you get something like this: At this zoom it doesn’t really tell us anything, but because the graph is interactive, we can restrict the viewing window to any region we want. Later on we are going to localize our search to interesting regions of the genome. # Forward simulation pipelines A lot my work recently has focused on using forward simulations to test demographic models. Often times, this requires thousands (or more) of simulations. Here, I’d like to talk about my approach to running these simulations and keeping track of everything. We use a cluster with the Slurm job queue system and while each cluster has different quirks, the basic ideas are mostly the same. First, we use SLiM to simulate our populations. The basic pipeline is: slim | msstats sim.stats.$JOBID.txt

Slim uses a configuration file to create its models. This complicates things a little bit. In order to maintain flexibility of our model (i.e. drawing mutation rate from a distribution or from data and setting complex population scenarios) I have created an R script to write a configuration file for slim to read from (can be read here).

This R script has a few features. First, it keeps track of the job ID from the queueing system so that we can keep track of the file names. Next, each numerical value is set independently, allowing us to draw any of them from a distribution.

It also has a function to shape how the population grows over time. For example, in addition to choosing the initial and final population sizes, we can choose how it gets to that final population size, whether it is linear or exponential growth.

After the configuration file is written and saved to disk, slim is called from within R and the simulation starts. The simulation is piped to an awk script that prepares the output for msstats, and the output of msstats is saved with the same job ID.

This approach allows for flexible simulations and makes it easy to perform thousands of them. The pipeline is available on Github (extensive documentation pending): https://github.com/arundurvasula/domestication_sims

# Data management software proposal

I’m thinking of writing software to solve a problem. Before that, I wanted to write a proposal and find out what other people think about it. If you have any comments, please leave them at: https://gist.github.com/arundurvasula/bc9ea4506270f555d1b3 or as a comment here.

## 1. The problem:

Modern data analysis relies on many sophisticated tools that perform a wide range of calculations on data. While software continues to evolve along with methods, data management still remains a complicated problem.

First, data analysis involves a lot of trail and error. One method may work well on one dataset, but it may not work as well on another. In its nature, data analysis must be done many times to arrive upon the best solution (if there is one). This process of trial and error, however is costly in time and organization. While solutions exist to mitigate these problems (for example, software that runs other software for you), these solutions are not complete.

Specifically, organization is difficult because there is no obvious and systematic way to keep track of what has been done to data. For example, when assembling sequence data many assemblers must be used with different options to find the optimal assembly method and options. While it’s possible to keep track of what one has done in a script, this method will not capture any data analysis done outside of the script.

Second, over time, it becomes difficult to remember what analyses have been done on data. This can be addressed by appending descriptors to the filename (e.g. sample1.trimmed.qual.mapped.bam). However, this quickly becomes unwieldy and fails to capture exactly what has happened to the file (including program options).

## 2.The solution:

The project suggested here is a daemon that watches data directories using the inotify API. It stores information about what processes and users read and modify data and stores it in a hidden json log file in that directory. It will also support arbitrary metadata used to describe the data in the same json log file. For example, it can store information about how and when the data was collected. This information need not be present in all data, which provides flexibility in describing the data.

Second, this project will provide a local webserver to access and modify the logs in a user friendly manner. Because the log format is standard json, we can build upon previous web applications to quickly build a web front end, similar to CouchDB’s Futon (http://docs.couchdb.org/en/1.6.1/intro/futon.html).

# Using synthetic lethality for targeted cell death

A lethal mutation is one that spells certain death for an organism. These mutations can be induced by a researcher, or occur spontaneously between generations. Sometimes, a mutation isn’t lethal unless it is combined with another nonlethal mutation – a condition called synthetic lethality. This kind of interaction is important because it can cause a daughter cell to die unexpectedly. One example of this kind of interaction is a mutation in the BRCA1 or BRCA2 gene and a mutation in the Poly-ADP Ribose Polymerase (PARP) gene, leading to a loss of function. Independently, mutations in either one of these genes would not cause cell death. However, when both genes are mutated, a synthetic lethal interaction occurs, and the cells can die. Additionally, mutations do not have to occur for a synthetic lethal interaction to occur. If the action of PARP is inhibited (for example, by a small molecule), it is possible that the synthetic lethal result can still occur.

This type of interaction can be taken advantage of when cell death is desired, namely, cancer cell death. Scientists have observed that most cancer cells have mutations in cohesin related genes, which are genes that create proteins that oversee how chromosomes separate during cell replication.

The goal of a study by Jessica McLellen et. al. was to see if PARP inhibitors could lead to cell death in cancerous cells with mutations in their cohesin related genes. They approached this by looking at model organisms representative of human systems, namely yeast (Saccharomyces cerevisiae) and a nematode worm (Caenorhabditis elegans). These organisms have very similar replication systems, and as the authors hypothesized, would be representative of how human systems work. The authors looked for, and found, processes that were required for survival after cohesin mutations in yeast. They then checked for these same systems in C. elegans. They hypothesized that if these systems are conserved between the two species, they are probably conserved in humans as well. Using this information, the authors found that when cohesin is mutated, several proteins related to replication fork progress and stability were required. This lead them to hypothesize that proteins not found in yeast but found in C. elegans would be required for other higher eukaryotes. These proteins included the aforementioned PARP. After testing human cells, the authors found that cells with cohesin mutations were less likely to survive when treated with a PARP inhibitor. This is significant because cancerous cells are the ones that likely have cohesin mutations, and those ones can be made less viable by treatment with PARP inhibitors.

Cancer treatments that target PARP inhibition are already on the way and are in phase II of clinical trials. This research supports their effectiveness with evidence from model organisms that have very similar systems when compared with humans. While the exact mechanism that contributes to the lethality is not yet fully understood, this work shows that PARP inhibition is a viable target for tumors with cohesin mutations, which represents a significant percentage of colorectal, ovarian, and breast cancers.

References:

McLellan JL, O’Neil NJ, Barrett I, Ferree E, van Pel DM, et al. (2012) Synthetic Lethality of Cohesins with PARPs and Replication Fork Mediators. PLoS Genet 8(3): e1002574. doi:10.1371/journal.pgen.1002574

# Remote IPython notebook with Raspberry Pi

It recently stuck me that I’d really like to do some data analysis on my iPhone. This is pretty impractical because it’s a tiny screen and the keyboard often autocorrects and capitalizes things I don’t want it to, but I still wanted to do it because 1) I can, and 2) why not?.

To do this, I connected my Raspberry Pi up to the router, created a static IP address, set my router to port forward to that IP address, installed IPython and its friends, and set up a remote notebook. Pretty simple stuff!

## Static IP

To set up the static IP, I basically followed these directions.

## Port forwarding

I have a Netgear router so I just logged in at routerlogin.net, went to port forwarding, and forwarded to my Raspberry Pi’s static IP address at port 9999.

## Installing IPython and friends

Since I’m using Raspbian, it’s as easy as:

$sudo apt-get -y install ipython-notebook$sudo apt-get -y install python-matplotlib python-scipy \
python-pandas python-sympy python-nose

(copied from the IPython install guide)

## Setting up a remote notebook

Setting up a remote notebook involved following these instructions.

1. Set up a profile for the server:

\$ipython profile create nbserver

1. Create a password hash in python:

from IPython.lib import passwd
passwd()

1. Configure notebook server (change stuff in /home/user/.ipython/profile_nbserver/ipython_notebook_config.py)

c = get_config()

# Kernel config

c.IPKernelApp.pylab = ‘inline’

# Notebook config

c.NotebookApp.ip = ‘*’
c.NotebookApp.open_browser = False
I also added the line to start up notebooks into rc.local file located /etc/rc.local so that the notebook server starts up each time I log in.


text:
# Tan 2 tan Find the expression that is equivalent to tan 2 tan 4Choose the correct answer below:0 A tan0

###### Question:

tan 2 tan Find the expression that is equivalent to tan 2 tan 4 Choose the correct answer below: 0 A tan 0 B. tan 2 tan 0c tan 3 0 D. tan 8

#### Similar Solved Questions

##### Explain how the time value of money relates to present and future value. Be thorough and provide some examples.
Explain how the time value of money relates to present and future value. Be thorough and provide some examples....
##### Use implicit differentiation to find y' and evaluate y' for _ Xy 3x2 _ 4 = at the point (2,4).
Use implicit differentiation to find y' and evaluate y' for _ Xy 3x2 _ 4 = at the point (2,4)....
##### The figure shows the magnetic field through a single loop of wire, 12 cm in radius and of 8.5 Q resistance, as a function of time: Calculate the emf in the loop as function of time. Consider the time intervals (a) t = 0 to t = 2.0 $, (b) t = 2.0$tot=4.0 $, (c)t=4.0$to t= 6.0 s. The (unlform) magnetic field Is perpendicular to the plane of the loop:Eos2.0 40 6.0 8.0 ()
The figure shows the magnetic field through a single loop of wire, 12 cm in radius and of 8.5 Q resistance, as a function of time: Calculate the emf in the loop as function of time. Consider the time intervals (a) t = 0 to t = 2.0 $, (b) t = 2.0$tot=4.0 $, (c)t=4.0$to t= 6.0 s. The (unlform) magnet...
You bought a $200K condo. You got a 15-year fixed-rate mortgage and made a 20% down payment. What is your monthly payment if the annual interest rate is 4%?... 1 answer ##### The heights of a certain population of corn plants follow a distribution with mean 145 cm... The heights of a certain population of corn plants follow a distribution with mean 145 cm and standard deviation 22 cm. (a) Suppose we were to choose a sample of size 16 at random from the population, what would be the mean and standard deviation of the sample average? (b) Suppose we were to choose ... 1 answer ##### 7. Construct the D-flip-flop with positive-edge triggering and asynchronous Clear (active-low). I... 7. Construct the D-flip-flop with positive-edge triggering and asynchronous Clear (active-low). Implement the Master-Slave design with two gated D-latches from problem 6 as building blocks and inverters. a) b) Show the schematic. Complete the waveform template below (neglect the propagation delays).... 5 answers ##### Problem 2b (3p): What would the ratio [OCI I/[HOCI] be if 72.5 g of NaOCl was used instead of 145 g? complete sentences, clearly justify your reasoning: Problem 2b (3p): What would the ratio [OCI I/[HOCI] be if 72.5 g of NaOCl was used instead of 145 g? complete sentences, clearly justify your reasoning:... 5 answers ##### Next let uS evaluate head-on' collision at an intersection_ The initial velocities of the cars are shown in the diagram find the final velocity. (treat as one dimensiona in-elastic, and assume cars move together after collision)macFind VI_(Hint vi for car B = 5.0 mfs) _15 nlsE4--12Calculate the amount of Kinetic Energy lost and the % energy lost: Next let uS evaluate head-on' collision at an intersection_ The initial velocities of the cars are shown in the diagram find the final velocity. (treat as one dimensiona in-elastic, and assume cars move together after collision) mac Find VI_(Hint vi for car B = 5.0 mfs) _ 15 nls E4--12 Calculat... 1 answer ##### 3. Media applications that play audio or video files are part of a class of workloads... 3. Media applications that play audio or video files are part of a class of workloads called "streaming" workloads; i.e., they bring in large amounts of data but do not reuse much of it. Consider a video streaming workload that accesses a 2 GB working set sequentially with the following addr... 1 answer ##### The point in a lunar orbit nearest the surface of the moon is called perilume and the point farthest from the surface is called apolume. The Apollo 11 spacecraft was placed in an elliptical lunar orbit with perilune altitude$110 \mathrm{km}$and apolune altitude$314 \mathrm{km}$(above the moon). Find an equation of this ellipse if the radius of the moon is$1728 \mathrm{km}$and the center of the moon is at one focus. The point in a lunar orbit nearest the surface of the moon is called perilume and the point farthest from the surface is called apolume. The Apollo 11 spacecraft was placed in an elliptical lunar orbit with perilune altitude$110 \mathrm{km}$and apolune altitude$314 \mathrm{km}$(above the moon). ... 5 answers ##### The freezing point of ethanol, CH;CH_OH, is -117.300 %C at atmosphere. K{(ethanol) 1.99 'ClmIn a laboratory experiment, students synthesized new compound and found that when 11.86 grams of the compound were dissolved in 272.3 grams of ethanol, the solution began to freeze at -117.601 %C. The compound was also found to be nonvolatile and non- electrolyte.What is the molecular weight they determined for this compound?glmolSubmlt AngworRotry Entlro Groupmoro group attompts romalning The freezing point of ethanol, CH;CH_OH, is -117.300 %C at atmosphere. K{(ethanol) 1.99 'Clm In a laboratory experiment, students synthesized new compound and found that when 11.86 grams of the compound were dissolved in 272.3 grams of ethanol, the solution began to freeze at -117.601 %C. The c... 5 answers ##### Let a and b be two unit vectorsa (ax b)Choose -.(ax b) + (bxa)Choose _.aX (a.b)Choose_.H(a+ (ax b))Choose:.. Let a and b be two unit vectors a (ax b) Choose -. (ax b) + (bxa) Choose _. aX (a.b) Choose_. H(a+ (ax b)) Choose:..... 5 answers ##### ~ Jlasl @bJe 2 Jlguul4bul 012 aslc Oljel dpl JJWI Jlgudll &J| JLaIVI &in44bubaj JbjJlguulFor evaluating the following integraldx where a = 0 and b = 3by taking six intervals_ Now by using trapezoidal rule up to three significant figures_ The Sum of the end points (Yo Y6)=1.250001.142861.076922.20248'7 J Jianiybul oi &k Jljrw .plGJWi Jiaeui JJI Jlauvi &i4yMdx EnG ~ Jlasl @b Je 2 Jlguul 4bul 012 aslc Oljel dpl JJWI Jlgudll &J| JLaIVI &in4 4bubaj Jbj Jlguul For evaluating the following integral dx where a = 0 and b = 3 by taking six intervals_ Now by using trapezoidal rule up to three significant figures_ The Sum of the end points (Yo Y6)= 1.25000 1.... 5 answers ##### Q7. Consider flr) = :B0) _R, then the best inequality is f(u) < FI,u â‚¬ [3,0) {)sl VI, â‚¬ B,0 f(u)l VI,u â‚¬ B3,0 4 |f(4) f(u)l { Vz,u â‚¬ [3, 0) e None of these.We deduce that Lipschiu: futtion; bul nnonnAchlucs bf(x) E  Lipchie: function anl Her Waorin conlinugs Lipachitz futx Lion HoL uifoctn Eclun fx) i4 Lipechilz furction but uot uroeu contirhus 4Nonc Ihesr . Q7. Consider flr) = :B0) _R, then the best inequality is f(u) < FI,u â‚¬ [3,0) {)sl VI, â‚¬ B,0 f(u)l VI,u â‚¬ B3,0 4 |f(4) f(u)l { Vz,u â‚¬ [3, 0) e None of these. We deduce that Lipschiu: futtion; bul nnonnAchlucs bf(x) E  Lipchie: function anl Her Waorin conlinugs Lipachitz f... 1 answer ##### If Toyota Motor Company receives an order on May 3, begins production on May 14, and... If Toyota Motor Company receives an order on May 3, begins production on May 14, and ships the order on May 16 immediately following production, then what is the manufacturing cycle efficiency (MCE) ratio?... 1 answer ##### 1. Returns to scale. A production function has constant returns to scale with respect to inputs... 1. Returns to scale. A production function has constant returns to scale with respect to inputs with inputs K and L if for any z 0: For example, for a production function with constant returns to scale, doubling the amount of each input (i.e., setting z = 2) will lead to a doubling of the output fro... 5 answers ##### QUESTION 2Lecture 33_passage pdf Iirch ol tha folkoming paths most closely represenes &e net dsplacemari0 ENA trolecue undergcing PFGE in the arparatus showin In Fgure 27QulsonJ }Iedlintea? dirnncIn (nC PFge [ apoerBtus srot Fizure rrhai couljbe Directkn tha net diseloce nent vactor ofa DNA mclecule#hen tie-450 pulzes are run {0t greaier ime than the <430 pulses? QUESTION 2 Lecture 33_passage pdf Iirch ol tha folkoming paths most closely represenes &e net dsplacemari0 ENA trolecue undergcing PFGE in the arparatus showin In Fgure 27 QulsonJ } Iedlintea? dirnnc In (nC PFge [ apoerBtus srot Fizure rrhai couljbe Directkn tha net diseloce nent vactor ofa DNA ... 5 answers ##### Students What is the class width?"oudeo Anue {pllowng tb & representsMumencrdenet00-U 050.9 1.0-14 L[.910 24 students What is the class width? "oudeo Anue {pllowng tb & represents Mumen crdenet 00-U 050.9 1.0-14 L[.9 10 24... 1 answer ##### Suppose the tensile yield strength of a bcc metal varies with absolute temperature (7) as oy... Suppose the tensile yield strength of a bcc metal varies with absolute temperature (7) as oy = (2000 - 47) MN/m², and the metal's crack propagation stress varies with T as Op = (600 +27) MN/m². Calculate the Mode II to Mode III fracture-transition temperature that would be found in ten... 5 answers ##### Create lists of animal phyla that (a) are cephalized, (b) have an incomplete digestive tract, (c) have segmented bodies, and (d) have a coelom. Create lists of animal phyla that (a) are cephalized, (b) have an incomplete digestive tract, (c) have segmented bodies, and (d) have a coelom.... 1 answer ##### Pimento & Cheese Sandwich Shoppe transferred$80,000 of accounts receivable to the Augusta Bank. The transfer...
Pimento & Cheese Sandwich Shoppe transferred \$80,000 of accounts receivable to the Augusta Bank. The transfer was made with recourse. Augusta remits 80% of the factored amount to Pimento & Cheese and retains 20% to cover sales returns and allowances. When the bank collects the receivables, i...
##### Provide a general explanation for why men have nipples. Hint: Figure 35.17 may help.
Provide a general explanation for why men have nipples. Hint: Figure 35.17 may help....
##### How do you write the standard form of a line given (2.3) and (4,5)?
How do you write the standard form of a line given (2.3) and (4,5)?...
##### DDT (molar mass 354.49 g mnol) was widely used insecticide that was baned from use in the United States in 4973. This ban was brouglt about due tbe persistence of DDT in many different ecosystems. leading to high accumulations of the substance in mnany birds of prey: The insecticide was shown t0 cause thinning of egg shells; pushing many birds towards extinction; Ifa 20-L dai) Of DDT spilled into pond, resulting in a DDT concentration of 6.88 Mhow long would take for the levels of DDT reach conc
DDT (molar mass 354.49 g mnol) was widely used insecticide that was baned from use in the United States in 4973. This ban was brouglt about due tbe persistence of DDT in many different ecosystems. leading to high accumulations of the substance in mnany birds of prey: The insecticide was shown t0 cau...
##### 12. A pilot in an airplane with an airspeed of 1200 km/h wishes to fly to city that is 2000 km due east from its starting position: There is a wind blowing from N3OPE at a speed of 100 km/h:Draw a vector diagram for the situation given: Label the air speed, wind speed and ground speed. [3]At what heading (true bearing or quadrant bearing) should the pilot steer?[2]What will be the groundspeed of the airplane?[2]How long will the trip take?[2]
12. A pilot in an airplane with an airspeed of 1200 km/h wishes to fly to city that is 2000 km due east from its starting position: There is a wind blowing from N3OPE at a speed of 100 km/h: Draw a vector diagram for the situation given: Label the air speed, wind speed and ground speed. [3] At what ...
##### Please show work!! This window shows your responses and what was marked correct and incorrect from...
please show work!! This window shows your responses and what was marked correct and incorrect from yo Required information The Foundational 15 (L07-1, LO7-2, LO7-3, L07-4, LO7-5) [The following information applies to the questions displayed below] Diego Company manufactures one product that is so...


text:
# OpenGL matrix rotation/transformation

This topic is 4230 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

hi, ive been getting to grips with 3d matrix rotations and transformations. im planning to use a 3x4 matrix in an implimentation of opengl for my nintendo ds. at the moment i have an object with x,y and z coords represented by variables: with the rotation matrix do i multiply these coordinates by the rotation matrix or the actual vertices of the said object? ive read that u multiply by the objects coordinates, however if i multiply the 3vector for its position by the matrix, how will it rotate the object? would it just not move the object with unexpected results?

##### Share on other sites
how do i multiply a matrix by the coordinates of the vertices of my model? especially if my model is fairly complex, it will be a long procedure and take up alot of cpu time

##### Share on other sites
can anybody help me?

##### Share on other sites
Hi...

I had a similar problem some time ago, and what I did for example, for implementing Rotation in the Z axis was:

//Z-rotation-"matrix"
new_x = x * cos(angle) - y * sin(angle);
new_y = x * sin(angle) + y * cos(angle);

(Please correct me if I had any mistake in that formula)

This article really helped me when I had that problem, I think it may help you too. =)

http://www.gamedev.net/reference/articles/article415.asp

##### Share on other sites
Hey!
You're very right that you can't rotate an object by manipulating it's position - you have no choice but to do it on all vertices. luckily the OpenGL API (and possibly you hardware, but I really don't know about the DS) can handle that for you: you are multiplying all your vertices by the two OpenGL matrices anyways. What is typically done is just manipulating the GL_MODELVIEW matrix with your rotation. Write back if you need further help doing that.

##### Share on other sites
oh right, i think i get it now. how would i implement it? would i somehow put the modelview matrix on the stack and then multiply it with my rotation matrix? cheers guys for the input! :)

##### Share on other sites
you, you could do that, but you don't really need to use the stack :) only if you want a way to undo the change to the modelview matrix

##### Share on other sites
cheers for the help! so after i create my rotation matrix, how do i actually multiply the modelview matrix by it?

##### Share on other sites
glMultMatrix - or you can just have opengl create the matrix for you using glRotate

##### Share on other sites
cheers ill try it out now. the reason im not using glRotate is because i need rotations and translations on my objects local axis (unless im missing a way to do this!). ill get back and post my results :)

##### Share on other sites
Just multiply all the transformation matrix to get the final rotation and translation matrix.

Although you should remember that openGL uses a stach based matrix system. So if you are going to do the transforms yourself, reverse the process you are doing with OGL.

IE.
GL:
Translate
Rotate

Bruteforce:
Rotate
Translate

Here's an old tute I made that explains the concept. Didn't use OpenGL at that time. :*)

http://rel.betterwebber.com/mytutes/3dtutes/chapter4/chapter4.htm

Note. It's in BASIC but really understandable.

##### Share on other sites
it still seems like im going wrong somewhere :( (its a really slow day for me...lack of sleep!)

ok simply put: in the main loop, i load my 3d object in the normal way (with a set of glVertex commands, normals, texture coords e.t.c). i create a transformation matrix (a 4x4 array). i create an if, which says if left pad is pressed, then increment the certain part of the array that i want incremented (for rotation, translation e.t.c). now i have my matrix which i want to multiply with the gl_matrixmode matrix (i think im gettin something wrong here) with the glMultMatrix command to change the vertex's positions and directions? all this is so i can rotate and translate along the objects own axis.

sorry to keep reposting, im just finding the actual coding kinda confusing

##### Share on other sites
wow musta bored everyone ;)

##### Share on other sites
you can use glRotate and glTranslate to do transformations around any axis. Basically this is because a rotation around a different axis is just the same as a rotation around an axis through the origin combined with a translation to 'fix' the move. It's not too hard to calculate this 'fix'.. just write down your equations as a combination of a 3x3 rotational matrix and an offset vector.
It's kinda hard to explain this if you don't have a math background tho. Alternatively you could just multiply the matrices in the other order. That should give you want you need. You need to use glGet and glLoadMatrix and multiply your own matrix so it's the left operand, not the right.
I know this can all be very confusing, just keep it up ;)

##### Share on other sites
Why dont you post some of your code?

why use glMultMatrix() ?. You can get your effects with a simple glPushMatrix() and glPopMatrix() group.

Like this

for each object glPushMatrix();  glTranslate();  glRotate(); glPopMatrix();loop

##### Share on other sites
cheers for all the support guys!

LtJax: cool, i didnt know you could! do you mind explaining how to calculate this fix? i dont mean to be long, its just that the ds cannot do float point math well (no fpu chip) so i think the glRotate function in "openGL" for the ds uses fixed point math and i dont want to go creating my own method with glMultMatrix if im using floats. dont worry about the maths part, im doing a maths and comp sci degree so i "should" understand everything you say :)

FireNet: the reason i didnt want to use glRotate and glTranslate is because i didnt know you could use them along the objects local axis. but LtJax just told me that i could, so i probably will :)

##### Share on other sites
it seems there is a bug in the ds implementation of opengl, or at least it works differently. as a simple test, i called glMatrixMode(GL_MODELVIEW), loaded an identity matrix and pushed it into the modelview stack when it first loads. this should push the called identity matrix ontop of the identity matrix that is already there, and have no effect, however the model moved into a really weird position, and moving the camera had no effect. if im following opengl so far, what i did shouldn't have caused a problem. even pushing my own created matrix ontop didnt give me the results i wanted.

for this reason i think im gonna go with LtJax's method of using glRotate and glTranslate, as the actual operation is already implemented in a way i cant understand (since my test didnt even work). could you quickly explain to me how to go about it? cheers :)

p.s. sorry to keep bugging :(


text:
# Homework Help: Conditions of Stability for second order system

1. Jan 30, 2012

### Chunkysalsa

1. The problem statement, all variables and given/known data
Consider the transfer function $$H(s)=\cfrac{1}{a_{2}s^{2}+a_{1}s+a_{0}}$$

where real-valued coefficients $a_{2},a_{1}, a_{0}$ are arbitrary except that $a_{2}$ is nonzero. Verify that the system is stable iff the coefficients $a_{2},a_{1}, a_{0}$ have the same sign.

2. Relevant equations

Professor gave us a hint to observe the quadratic formula

3. The attempt at a solution
I really don't know how to start it. I've tried a prove by cases but got bogged down fairly quickly. I can post what I have if this is the correct approach but I have doubts that it is. I just kept gaining more and more cases. A couple of hints towards the right direction would be most helpful

EDIT: I should note that I understand that for the system to be stable all the poles (2 in this case) of the transfer function should be in the LHP. That is that the the Re(p)<0 where p is the pole.

Last edited: Jan 30, 2012
2. Jan 31, 2012

### jake929

Since you know the condition for stability real part of the root is less than 0 then you need to determine what is required of your constants to ensure that condition is met. Use your professors advice the quadratic equation: (-B±√B^2-4AC)/2A. There are really only two cases 1) the roots contain an imaginary part 2) the roots contain all real parts. If B^2-4AC is negative then there is an imaginary part. Show for each of the two cases what is required to get the real part to be negative.

3. Feb 1, 2012

### Chunkysalsa

Alright this is essentially what I did. I'm a bit iffy on a bit of the parts so I'll post it later today if my prof isn't able to help. I just thought they're might be a better approach then examining all possible cases.

Am I correct in saying that I'll also need to prove that if the system is stable then the coefficients are of the same sign since the statement says if and only if? The converse is easily proven but I'm just wondering if thats explicitly needed.

4. Feb 1, 2012

### jake929

If b^2-4ac<0 then the roots contain imaginary parts, the real part is -B/2A, what is required for the real part to be negative? Then what is required of c given what you have already determined for A and B?

Second case is no imaginary part or B^2-4AC>0, B^2 is always greater than 0 so what is required of AC in order to make B^2-4AC greater than 0? don't forget the ± just before the radical. Now determine what is required of -b given what you know about A and C.

From your post it looks like what you are doing is trying out what happens for each combination of signs and trying to make a conclusion. This may work too but then you have to prove that two out of the 8 possible combinations actually work. My preference would be to set boundaries on the constants based on whether there is an imaginary part of the root or not.


text:
# A $1.5\ m$ tall boy is standing at some distance from a $30\ m$ tall building. The angle of elevation from his eyes to the top of the building increases from $30^o$ to $60^o$ as he walks towards the building. Find the distance he walked towards the building.

#### Complete Python Prime Pack

9 Courses     2 eBooks

#### Artificial Intelligence & Machine Learning Prime Pack

6 Courses     1 eBooks

#### Java Prime Pack

9 Courses     2 eBooks

Given:

A $1.5 \mathrm{~m}$ tall boy is standing at some distance from a $30 \mathrm{~m}$ tall building.

The angle of elevation from his eyes to the top of the building increases from $30^{\circ}$ to $60^{\circ}$ as he walks towards the building.

To do:

We have to find the distance he walked towards the building.

Solution:

Let $AB$ be the height of the boy and $CD$ be the height of the building.

From the figure,

$\mathrm{AB}=\mathrm{OP}=\mathrm{DE}=1.5 \mathrm{~m}, \angle \mathrm{CAE}=30^{\circ}, \angle \mathrm{COE}=60^{\circ}$

Let the distance he walked towards the building be $\mathrm{AO}=x \mathrm{~m}$.

This implies,

$\mathrm{CE}=30-1.5=28.5 \mathrm{~m}$

We know that,

$\tan \theta=\frac{\text { Opposite }}{\text { Adjacent }}$

$=\frac{\text { CE }}{OE}$

$\Rightarrow \tan 60^{\circ}=\frac{28.5}{OE}$

$\Rightarrow \sqrt3=\frac{28.5}{OE}$

$\Rightarrow OE=\frac{28.5}{\sqrt3} \mathrm{~m}$.........(i)

Similarly,

$\tan \theta=\frac{\text { Opposite }}{\text { Adjacent }}$

$=\frac{\text { CE }}{AE}$

$\Rightarrow \tan 30^{\circ}=\frac{28.5}{x+OE}$

$\Rightarrow \frac{1}{\sqrt3}=\frac{28.5}{x+OE}$

$\Rightarrow x+OE=28.5\sqrt3 \mathrm{~m}$

$\Rightarrow x=28.5\sqrt3-\frac{28.5}{\sqrt3} \mathrm{~m}$            [From (i)]

$\Rightarrow x=\frac{28.5\sqrt3(\sqrt3)-28.5}{\sqrt3} \mathrm{~m}$

$\Rightarrow x=\frac{28.5(3-1)}{\sqrt3}\times \frac{\sqrt3}{\sqrt3} \mathrm{~m}$

$\Rightarrow x=\frac{28.5(2)\times\sqrt3}{3} \mathrm{~m}$

$\Rightarrow x=9.5(2)\sqrt3=19\sqrt3 \mathrm{~m}$

Therefore, the distance he walked towards the building is $19\sqrt3 \mathrm{~m}$.

Updated on 10-Oct-2022 13:23:31


text:
# WS 4.2 Nomenclature

For this nomenclature worksheet, learners write the names of covalent and ionic compounds as well as write the formulas when given the names. They also write the names of acids given the formulas and write the formulas when given the names.

Concepts

Resource Details


text:
# How do you measure the MRS for more than two goods?

For two goods, the MRS is defined as the amount of one good you would trade off for the other. Mathematically, $$\text{MRS} = \frac{dy}{dx}$$ where the amount of goods $$X$$ and $$Y$$ are denoted by $$x$$ and $$y$$ respectively.

How do we do this for three or more goods? The way (as per my understanding) is to find the tangent (hyper)plane (call it $$T$$) first. Now consider a point $$q \in B(p,\epsilon) \cap T$$ for an infinitesimally small $$\epsilon > 0$$. This tells us that we can get/give $$q_1$$ units of good $$X_1$$, $$q_2$$ units of good $$X_2$$, $$\cdots$$, $$q_{n-1}$$ units of good $$X_{n-1}$$ to give/get (trade) an unit of $$x_n$$.

How do I find the tangent $$T$$ and these elements $$q$$? For this, I need to have a general formula to compute all the $$(x_1, \cdots, x_n)$$ satisfying the equation. How do I do that?

The goal is to find the amount of units of each good we need to get/give for an unit of $$x_n$$. This does not have to be $$x_n$$, but we are looking at this particular case for brevity. Change of variable is not the main concern here.

Pairwise MRS

The Marginal Rate of Substitution is usually defined as a pairwise thing. E.g., in case of three goods $$x,y$$ and $$z$$, you would have $$\text{MRS}_{xy}, \text{MRS}_{xz}$$ and $$\text{MRS}_{yz}$$. (And you could also flip any of these, i.e. $$\text{MRS}_{yx}$$.)

These are defined as the slope of the tangent line of the two dimensional indifference curve while holding the quantities of all other goods constant. Mathematically they are the same as the "usual" MRS for two goods, e.g., $$\text{MRS}_{yz}(x,y,z) = -\frac{\frac{\partial U(x,y,z)}{\partial y}}{\frac{\partial U(x,y,z)}{\partial z}}.$$

Tangential hyperplanes

If I understand correctly, you are trying to find the hyperplane that is tangential to an indifference curve. When there are more than two but finitely many goods, this can be found using the Jacobian matrix of the utility function.

The Fréchet derivative of a function $$f: \mathbb{R}^n \to \mathbb{R}$$ is the vector $$A$$ when $$f(x + h) = f(x) + Ah +o(h)$$ where $$\lim_{||h|| \to 0} \frac{o(h)}{||h||} = 0$$.

If the vectorspace we are considering is finite dimensional and $$f$$ is Fréchet differentiable everywhere then the Fréchet derivative is given by the Jacobian matrix of $$f$$, denoted by $$J_f$$.

Consider a differentiable utility function $$U$$ and let $$\underline{x}$$ be a basket of goods. This also defines an indifference curve. Consider some nearby baskets $$\underline{x} + \underline{h}$$ which are on the same indifference curve, so $$U(\underline{x} + \underline{h}) = U(\underline{x}).$$ According to the Fréchet derivative $$U(\underline{x} + \underline{h}) = U(\underline{x}) + J_U(\underline{x}) \underline{h} +o(\underline{h}),$$ which means $$J_U(\underline{x})\underline{h} = - o(\underline{h}).$$ Since multiplying by $$J_U(\underline{x})$$ is a linear operator this implies $$J_U(\underline{x})\underline{h} = 0.$$ Thus the Jacobian defines the tangential hyperplane.

Example :
Let $$U(x,y) = xy$$. Then the Jacobian is $$J_U(x,y) = \begin{bmatrix} y & x \end{bmatrix}$$, and $$\text{MRS}(x,y)$$ is the solution to $$J_U(x,y)\begin{bmatrix} 1 \\ \text{MRS}(x,y) \end{bmatrix} = 0.$$ In this case $$\begin{bmatrix} y & x \end{bmatrix} \begin{bmatrix} 1 \\ -y/x \end{bmatrix} = 0.$$

Relation of the hyperplane and the pairwise MRSs, an example

The pairwise MRSs can be gleaned in a similar manner. Going back to the example with three goods $$x,y$$ and $$z$$, the pairwise MRSs are solutions to the following matrix equations: $$J_U(x,y,z)\begin{bmatrix} 1 \\ \text{MRS}_{xy}(x,y,z) \\ 0 \end{bmatrix} = 0,$$ $$J_U(x,y,z)\begin{bmatrix} 1 \\ 0 \\ \text{MRS}_{xz}(x,y,z) \end{bmatrix} = 0,$$ $$J_U(x,y,z)\begin{bmatrix} 0 \\ 1 \\ \text{MRS}_{yz}(x,y,z) \end{bmatrix} = 0.$$

The Jacobian also shows us how one can trade goods of multiple sorts and stay "near" the same indifference curve. If $$J_U(x,y,z)\begin{bmatrix} 1 \\ \Delta y \\ \Delta z \end{bmatrix} = 0$$ holds then trading small quantities at the ratios defined by this vector will keep us "near" the indifference curve. In my opinion this is as close as one can get to a multidimensional MRS.
• Hi, thanks for the clarification. I think there was a misunderstanding with the notation, $\nabla U$ denotes the Jacobian matrix of $U$. This notation is also written in the wiki article you shared about Jacobian Matrix. Jul 26 at 6:30
• While I did not explicitly mention that is the MRS (and I just realized that I forgot to do so), I did mean that. I have edited the equation of the tangent hyperplane to fix the error with dimension and write $x_i - x_i'$ instead of just $x_i'$ for the scalar. Is the tangent correct in my post (question) now? Jul 26 at 6:32
• @Gang'sBigBoss Hi! Unfortunately, I do not understand the indexing in your notation. What is $n$? And how are there $n-1$ things in $\langle \rangle$? This operator is only defined for two inputs? Jul 26 at 7:36
• Oh well then, the expression on the RHS is the summation $\displaystyle \sum_{i=1}^{n-1} \frac{\partial U}{\partial x_i} \cdot (x_i - x_i')$. Here $n$ is the dimensions, and in this particular sense, we are finding $\text{MRS}_{{x_1}, \cdots, x_{n-1}} (x_1, \cdots, x_n)$. There are $n-1$ elements because we the Utility function is of dim $n$. In general, we can change the variables to find $\text{MRS}_{x_{i_1}, \cdots, x_{i_{n-1}}} (x_1, \cdots, x_n)$ where each $i_j \in [1,n] \cap \mathbb{N}$ is distinct. Does this make sense? Jul 26 at 8:43


text:
Conference abstracts

Session S02 - Commutative Algebra and Algebraic Geometry

July 26, 15:40 ~ 16:10

## The Birational Geometry of $\overline{M}_{0,6}$

### CONACyT - Universidad Autonoma de Zacatecas, Mexico   -   m.m.bernal.guillen@gmail.com

We give relations among the Castravet's generators of the Cox ring of $\overline{M}_{0,6}$ and describe the maps represented by those relations.


text:
<meta http-equiv="refresh" content="1; url=/nojavascript/"> Functions as Rules and Tables | CK-12 Foundation
You are reading an older version of this FlexBook® textbook: CK-12 Algebra - Basic Go to the latest version.

# 1.5: Functions as Rules and Tables

Created by: CK-12

Instead of purchasing a one-day ticket to the theme park, Joseph decided to pay by ride. Each ride costs $2.00. To describe the amount of money Joseph will spend, several mathematical concepts can be used. First, an expression can be written to describe the relationship between the cost per ride and the number of rides, $r$. An equation can also be written if the total amount he wants to spend is known. An inequality can be used if Joseph wanted to spend less than a certain amount. Example 1: Using Joseph’s situation, write the following: a. An expression representing his total amount spent b. An equation that shows Joseph wants to spend exactly$22.00 on rides

c. An inequality that describes the fact that Joseph will not spend more than $26.00 on rides Solution: The variable in this situation is the number of rides Joseph will pay for. Call this $r$. a. $2(r)$ b. $2(r) = 22$ c. $2(r) \le 26$ In addition to an expression, equation, or inequality, Joseph’s situation can be expressed in the form of a function or a table. Definition: A function is a relationship between two variables such that the input value has ONLY one output value. ## Writing Equations as Functions A function is a set of ordered pairs in which the first coordinate, usually $x$, matches with exactly one second coordinate, $y$. Equations that follow this definition can be written in function notation. The $y$ coordinate represents the dependent variable, meaning the values of this variable depend upon what is substituted for the other variable. Consider Joseph’s equation $m = 2r$. Using function notation, the value of the equation (the money spent $m$) is replaced with $f(r)$. $f$ represents the function name and $(r)$ represents the variable. In this case the parentheses do not mean multiplication; they separate the function name from the independent variable. $& \quad \ input\\& \quad \ \ \ \downarrow\\& \quad \underbrace{f(x)}= y \leftarrow output\\& \ function\\& \quad \ \ box$ Example 2: Rewrite the following equations in function notation. a. $y=7x-3$ b. $d=65t$ c. $F=1.8C+32$ Solution: a. According to the definition of a function, $y=f(x)$, so $f(x)=7x-3$. b. This time the dependent variable is $d$. Function notation replaces the dependent variable, so $d = f(t) = 65t$. c. $F = f(C) = 1.8C + 32$ ## Why Use Function Notation? Why is it necessary to use function notation? The necessity stems from using multiple equations. Function notation allows one to easily decipher between the equations. Suppose Joseph, Lacy, Kevin, and Alfred all went to the theme park together and chose to pay$2.00 for each ride. Each person would have the same equation $m=2r$. Without asking each friend, we could not tell which equation belonged to whom. By substituting function notation for the dependent variable, it is easy to tell which function belongs to whom. By using function notation, it will be much easier to graph multiple lines (Chapter 4).

Example 3: Write functions to represent the total each friend spent at the park.

Solution: $J(r)= 2r$ represents Joseph’s total, $L(r)= 2r$ represents Lacy's total, $K(r)= 2r$ represents Kevin's total, and $A(r)= 2r$ represents Alfred’s total.

## Using a Function to Generate a Table

A function really is an equation. Therefore, a table of values can be created by choosing values to represent the independent variable. The answers to each substitution represent $f(x)$.

Use Joseph’s function to generate a table of values. Because the variable represents the number of rides Joseph will pay for, negative values do not make sense and are not included in the value of the independent variable.

$R$ $J(r) = 2r$
0 $2(0) = 0$
1 $2(1) = 2$
2 $2(2) = 4$
3 $2(3) = 6$
4 $2(4) = 8$
5 $2(5) = 10$
6 $2(6) = 12$

As you can see, the list cannot include every possibility. A table allows for precise organization of data. It also provides an easy reference for looking up data and offers a set of coordinate points that can be plotted to create a graphical representation of the function. A table does have limitations; namely it cannot represent infinite amounts of data and it does not always show the possibility of fractional values for the independent variable.

## Domain and Range of a Function

The set of all possible input values for the independent variable is called the domain. The domain can be expressed in words, as a set, or as an inequality. The values resulting from the substitution of the domain represent the range of a function.

The domain of Joseph’s situation will not include negative numbers because it does not make sense to ride negative rides. He also cannot ride a fraction of a ride, so decimals and fractional values do not make sense as input values. Therefore, the values of the independent variable r will be whole numbers beginning at zero.

Domain: All whole numbers

The values resulting from the substitution of whole numbers are whole numbers times two. Therefore, the range of Joseph’s situation is still whole numbers just twice as large.

Range: All even whole numbers

Example 4: A tennis ball is bounced from a height and bounces back to 75% of its previous height. Write its function and determine its domain and range.

Solution: The function of this situation is $h(b)= 0.75b$, where $b$ represents the previous bounce height.

Domain: The previous bounce height can be any positive number, so $b \ge 0$.

Range: The new height is 75% of the previous height, and therefore will also be any positive number (decimal or whole number), so the range is all positive real numbers.

Multimedia Link For another look at the domain of a function, see the following video where the narrator solves a sample problem from the California Standards Test about finding the domain of an unusual function. Khan Academy CA Algebra I Functions (6:34)

## Write a Function Rule

In many situations, data is collected by conducting a survey or an experiment. To visualize the data, it is arranged into a table. Most often, a function rule is needed to predict additional values of the independent variable.

Example 5: Write a function rule for the table.

$& \text{Number of CDs} && 2 && 4 && 6 && 8 && 10\\& \text{Cost}\ (\) && 24 && 48 && 72 && 96 && 120$

Solution: You pay $24 for 2 CDs,$48 for 4 CDs, and $120 for 10 CDs. That means that each CD costs$12.

We can write the function rule.

$\text{Cost} = \12 \times \text{number of CDs}$ or $f(x) = 12x$

Example 6: Write a function rule for the table.

$&&x && -3 && -2 && -1 && 0 && 1 && 2 && 3\\&&y && \quad 3 && \quad 2 && \quad 1 && 0 && 1 && 2 && 3$

Solution: The values of the dependent variable are always the positive outcomes of the input values. This relationship has a special name, the absolute value. The function rule looks like this: $f(x) = |x|$.

## Represent a Real-World Situation with a Function

Let’s look at a real-world situation that can be represented by a function.

Example 7: Maya has an internet service that currently has a monthly access fee of $11.95 and a connection fee of$0.50 per hour. Represent her monthly cost as a function of connection time.

Solution: Let $x=$ the number of hours Maya spends on the internet in one month and let $y=$ Maya’s monthly cost. The monthly fee is $11.95 with an hourly charge of$0.50.

The total cost $=$ flat fee $+$ hourly fee $\times$ number of hours. The function is $y = f(x) = 11.95 + 0.50x$

## Practice Set

Sample explanations for some of the practice exercises below are available by viewing the following video. Note that there is not always a match between the number of the practice exercise in the video and the number of the practice exercise listed in the following exercise set.  However, the practice exercise is the same in both. CK-12 Basic Algebra: Domain and Range of a Function (12:52)

1. Rewrite using function notation: $y= \frac{5}{6} x-2$.
2. What is one benefit of using function notation?
3. Define domain.
4. True or false? Range is the set of all possible inputs for the independent variable.
5. Generate a table from $-5 \le x \le 5$ for $f(x)= -(x)^2- 2$
6. Use the following situation for question 6: Sheri is saving for her first car. She currently has $515.85 and is savings$62 each week.
1. Write a function rule for the situation.
2. Can the domain be “all real numbers"? Explain your thinking.
3. How many weeks would it take Sheri to save $1,795.00? In 7 - 11, identify the domain and range of the function. 1. Dustin charges$10 per hour for mowing lawns.
2. Maria charges $25 per hour for math tutoring, with a minimum charge of$15.
3. $f(x) = 15x - 12$
4. $f(x) = 2x^2 + 5$
5. $f(x)=\frac{1}{x}$
6. What is the range of the function $y = x^2 - 5$ when the domain is $-2$, $-1$, 0, 1, 2?
7. What is the range of the function $y = 2x - \frac{3}{4}$ when the domain is $-2.5$, 1.5, 5?

8 , 9

Feb 22, 2012

Dec 11, 2014

# Reviews

Image Detail
Sizes: Medium | Original

CK.MAT.ENG.SE.1.Algebra-Basic.1.5