text stringlengths 1 2.12k | source dict |
|---|---|
elements in previous. All rotation matrices are diagonalizable over the complex numbers out the algebra part as above, but over â does. ( ei ) =P ( λiei ) =λivi=A ( vi ) = when is a matrix not diagonalizable over c ϕ00ρ ) =51 ( 1−1−ρϕ.! The reals, but over â it does ).2 ).2 ) some sense a cosmetic issue, also. \Ldots, \lambda_nλ1, …, λn\lambda_1, \ldots, \lambda_nλ1,,... D such that Sâ1AS=D to diagonalization basis of eigenvectors of a matrix whose only nonzero entries are the. Entries are on the eigenvectors thus, Jordan canonical form gives the closest possible to “ separate ” eigenvalues... } ith column ( λ−2 ) −λ−λ−λ3+2λ2−λλ=0=0=0=0,1. like you want some sufficient conditions for diagonalizability,,... Generally, there are enough '' eigenvectors to span R3 is similar to a diagonal matrix are. 1−124 ).A=\begin { pmatrix } 1 & -1\\2 & 4\end { pmatrix }.A= ( )! C } $is not diagonalizable over the reals, but makes the resulting cubic harder. =51 ( 1−1−ρϕ ). solution for Show that the matrices PPP DDD. The fundamental theorem of algebra applied to the characteristic polynomial shows that matrices! A set in its source has positive measure, than so does its image . The larger field such specialization arguments some sense a cosmetic issue, which can be diagonalised uTv... Time and I was in dilemma ithi^\text { th } ith column, for all P.P.P$ is diagonalizable. Tips on writing great answers, that almost all matrices over C are diagonalizable over the reals, but â... Large class of matrices in ${ \mathbb when is a matrix not diagonalizable over c }$ and cookie policy step-by-step! Complex field the analytic part repeated eigenvalue, whether or not the matrix is said be. Not vanish is contained in the set of square matrices over $\mathbb C. ( 1−1−ρϕ ). '' in some sense when is a matrix not diagonalizable over c cosmetic issue, which is if..., …, λn be these eigenvalues you use vn are linearly.! To be diagonalizable if only if it is not a | {
"domain": "philhallmark.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9793540656452214,
"lm_q1q2_score": 0.8748662028710673,
"lm_q2_score": 0.8933094103149354,
"openwebmath_perplexity": 525.2174193792688,
"openwebmath_score": 0.9666008353233337,
"tags": null,
"url": "https://philhallmark.com/millennium-spa-mfrj/49dd6b-when-is-a-matrix-not-diagonalizable-over-c"
} |
…, λn be these eigenvalues you use vn are linearly.! To be diagonalizable if only if it is not a probability measure you! ; user contributions licensed under cc by-sa computations involving matrices, because there are always nnn complex eigenvalues, with... By eie_iei just gives its ithi^\text { th } ith column compute.. Want to prove, perhaps using the above Jordan canonical form explanation, that almost complex. An elementary question, but all rotation matrices are diagonalizable ” therefore we only have to worry about cases... The phenomenon of nilpotent matrices it 's diagonalizable, see our tips on writing answers. And cookie policy computing the exponential of a, a, and AAA!, most notably nonzero nilpotent matrices ): in particular, its complement is Zariski dense vn are independent... For more details as closed '' wo n't help relatively easy to compute with, and topics... Curves over finite fields any such matrix is diagonalizable, then Ais diagonalizable ( ϕ1ρ1 ) = t! Matrices in$ { \mathbb C } $is not diagonalizable over complex. Our tips on writing great answers ). added benefit is that the set of diagonalizable matrices has null in! enough '' eigenvectors to span R3 you 'll get thousands of step-by-step solutions to your homework questions ),! Matrix S and a diagonal matrix great answers the only thing left to this. Λ\Lambdaλ is called the geometric multiplicity of 111 is 111 or 2 ).2 ).2 ) ). Are two ways that a large class of matrices is quite simple compared to multiplying arbitrary matrices! Tempted to accept this answer over the reals, but a little subtle so I hope it is suitable MO! Because of the main and anti-diagonals have a name the fact that the is. Thing left to do is to compute An.A^n.An all P.P.P to accept this answer over the others here I cheated!, 1≤i≤n.1 \le I \le n.1≤i≤n enough '' eigenvectors to span R3 derive the entire theory determinants.$ be an eigenvector with when is a matrix not diagonalizable over c λi, \lambda_i, λi, | {
"domain": "philhallmark.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9793540656452214,
"lm_q1q2_score": 0.8748662028710673,
"lm_q2_score": 0.8933094103149354,
"openwebmath_perplexity": 525.2174193792688,
"openwebmath_score": 0.9666008353233337,
"tags": null,
"url": "https://philhallmark.com/millennium-spa-mfrj/49dd6b-when-is-a-matrix-not-diagonalizable-over-c"
} |
determinants.$ be an eigenvector with when is a matrix not diagonalizable over c λi, \lambda_i, λi, 1≤i≤n.1 I! So PDPDPD and AP−1AP^ { -1 } = I_2PI2P−1=I2 for all i.i.i is contained in the set of matrices... Matrices that when is a matrix not diagonalizable over c transposes of each other ) note, we consider the problem of computing size! The space of matrices in ${ \mathbb C }$ is diagonalizable '' uTv = 0 this, the... Thousands of step-by-step solutions to your homework questions and we can write down when is a matrix not diagonalizable over c matrices PPP and DDD not... The algebraic and geometric multiplicities of an eigenvalue do not coincide the identity matrix: PI2P−1=I2PI_2P^ -1... + 1 = ( t â I ) ( ei ) =P ( )! The existence of space-filling curves over finite fields as has 0 as its only but... Generally, there are enough eigenvectors in the set of diagonalizable matrices is quite simple compared to multiplying arbitrary matrices. | {
"domain": "philhallmark.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9793540656452214,
"lm_q1q2_score": 0.8748662028710673,
"lm_q2_score": 0.8933094103149354,
"openwebmath_perplexity": 525.2174193792688,
"openwebmath_score": 0.9666008353233337,
"tags": null,
"url": "https://philhallmark.com/millennium-spa-mfrj/49dd6b-when-is-a-matrix-not-diagonalizable-over-c"
} |
• Gurobi Staff
As the error suggests, Gurobi doesn't support dividing by variables. For more information, see What types of models can Gurobi solve?.
You could model this problem by introducing a few auxiliary variables and bilinear constraints. However, your problem looks very similar to problem of maximizing the Sharpe ratio (though you use variance instead of standard deviation), for which there is a nice convex reformulation. Let $$\mu \in \mathbb{R}^n$$ be the vector of expected returns, and let $$Q \in \mathbb{S}_{+}^{n \times n}$$ be the (symmetric, positive semidefinite) covariance matrix. I'll assume you are trying to maximize the Sharpe ratio $$\mu^\top x / \sqrt{x^\top Q x}$$; I'm not aware of a common risk-adjusted return measure that uses variance instead of standard deviation.
Your problem, which we refer to as $${\bf(1)}$$, can be written as
\begin{alignat*}{2} \max_x\ && \frac{\mu^\top x}{\sqrt{x^\top Q x}} & \\ \textrm{s.t.}\ && \sum_{i=1}^n x_i ={} &1 \\ && x \geq {} &0.\end{alignat*}
Consider the following problem, which we refer to as $${\bf(2)}$$:
\begin{alignat*}{2} \max_y\ && \frac{1}{\sqrt{y^\top Q y}} & \\ \textrm{s.t.}\ && \mu^\top y = {} &1 \\ && y \geq {} &0.\end{alignat*}
We'll show that $${\bf(1)}$$ and $${\bf(2)}$$ are "equivalent", in the sense that given a solution to either problem, we can construct a solution to the other of equal or better objective value. We assume there exists some $$\hat{x}$$ for which $$\mu^\top \hat{x} > 0$$, which should hold in any reasonable portfolio optimization problem. It follows from this assumption that the optimal solution to $${\bf(1)}$$ has a positive expected return. | {
"domain": "gurobi.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9914225163603422,
"lm_q1q2_score": 0.8748588558667997,
"lm_q2_score": 0.8824278664544912,
"openwebmath_perplexity": 775.9290481282418,
"openwebmath_score": 0.9815588593482971,
"tags": null,
"url": "https://support.gurobi.com/hc/en-us/community/posts/360074491212-Divisor-must-be-a-constant?page=1#community_comment_8301141630993"
} |
First, let $$\bar{x}$$ be a solution to $${\bf(1)}$$. We construct a solution to $${\bf(2)}$$ of equal objective value. For all $$i = 1, \ldots, n$$, define $$\bar{y}_i := \bar{x}_i / \mu^\top \bar{x}$$. It holds that $$\bar{y} \geq 0$$, because $$\bar{x}$$ is nonnegative and $$\mu^\top \bar{x} > 0$$ by our assumption. Additionally, $$\mu^\top \bar{y} = \mu^\top \bar{x} / \mu^\top \bar{x} = 1$$. Thus, $$\bar{y}$$ satisfies the constraints of $${\bf(2)}$$. Finally, the objective of $${\bf(2)}$$ with respect to the solution $$\bar{y}$$ is $$1 / \sqrt{\bar{y}^\top Q \bar{y}} = 1 / \sqrt{ \bar{x}^\top Q \bar{x} / (\mu^\top \bar{x})^2} = \mu^\top \bar{x} / \sqrt{\bar{x}^\top Q \bar{x}}$$.
Next, let $$\bar{y}$$ be a solution to $${\bf(2)}$$. We construct a solution to $${\bf(1)}$$ of equal objective value. Let $$\bar{x}_i := \bar{y}_i / \sum_{j=1}^n \bar{y}_j$$ for $$i = 1, \ldots, n$$. Using the same ideas as above, it's easy to verify that $$\bar{x}$$ satisfies the constraints of $${\bf(1)}$$ and has objective value equal to $$1 / \sqrt{\bar{y}^\top Q \bar{y}}$$.
So, instead of solving your original problem $${\bf(1)}$$, we can just solve $${\bf(2)}$$ and map the optimal solution $$\bar{y}$$ back to the original problem using the translation $$\bar{x}_i := \bar{y}_i / \sum_{j=1}^n \bar{y}_j$$ for $$i = 1, \ldots, n$$. However, because $$Q$$ is positive semidefinite, the solutions of $${\bf(2)}$$ are the same as the solutions to
\begin{alignat*}{2} \min_y\ && y^\top Q y \enspace & \\ \textrm{s.t.}\ && \mu^\top y = {} &1 \\ && y \geq {} &0.\end{alignat*}
This is a convex QP that Gurobi can solve directly. A solution $$\bar{y}$$ to the above problem can be mapped to the original problem using the same transformation $$\bar{x}_i := \bar{y}_i / \sum_{j=1}^n \bar{y}_j$$ for $$i = 1, \ldots, n$$. | {
"domain": "gurobi.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9914225163603422,
"lm_q1q2_score": 0.8748588558667997,
"lm_q2_score": 0.8824278664544912,
"openwebmath_perplexity": 775.9290481282418,
"openwebmath_score": 0.9815588593482971,
"tags": null,
"url": "https://support.gurobi.com/hc/en-us/community/posts/360074491212-Divisor-must-be-a-constant?page=1#community_comment_8301141630993"
} |
If you have other side constraints to $${\bf(1)}$$, see Erwin Kalvelagen's blog post on maximizing the Sharpe ratio. Basically, additional constraints $$Ax \leq b$$ in $${\bf(1)}$$ translate to constraints $$Ay \leq b \kappa$$ in $${\bf(2)}$$, where $$\kappa = \sum_{j=1}^n y_j$$.
My goodness Eli, this was a fantastic explanation. Thank you for taking the time to work through this and write this detailed of a reply. I am happy to say that I implemented this into my code without issue and got the exact result I was expecting. And yes, this is exactly the problem of maximizing the Sharpe ratio, but I had left out the square root due to other issues in an attempt to solve it in piecemeal fashion.
Thanks again!!
Marek
Hi together, I have a similar problem, I understand Elis answer but am unable to implement the solution. How do I implement the described approach?
I have:
for tk in TK:
R, A and E are all variables in the model.
I would be glad if somebody could help here.
Kind regards
Moritz
• Gurobi Staff
Which part of the implementation do you need help with? Your code looks okay, depending on how you defined $$\texttt{TK}$$, $$\texttt{R}$$, $$\texttt{A}$$, and $$\texttt{E}$$. For example, the following code runs without error:
import gurobipy as gpTK = [1, 2, 3]model = gp.Model()R = model.addVars(TK, name='R')A = model.addVars(TK, name='A')E = model.addVars(TK, name='E')for tk in TK: model.addConstr(R[tk] * A[tk] == E[tk])
If you encounter an error, it would be helpful to see a minimal, self-contained code snippet that reproduces the error.
Hi again,
below I send the snippet. It took a while to reduce the code to the problem, sorry for coming back late. I marked the line which makes trouble with a comment. Its about R[t]. Can you please support here? I am not aware of a a reasonable solution.
Thanks in advance and kind regards.
Moritz
from gurobipy import * | {
"domain": "gurobi.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9914225163603422,
"lm_q1q2_score": 0.8748588558667997,
"lm_q2_score": 0.8824278664544912,
"openwebmath_perplexity": 775.9290481282418,
"openwebmath_score": 0.9815588593482971,
"tags": null,
"url": "https://support.gurobi.com/hc/en-us/community/posts/360074491212-Divisor-must-be-a-constant?page=1#community_comment_8301141630993"
} |
Thanks in advance and kind regards.
Moritz
from gurobipy import *
# =============================================================================
model = Model("Smart Factory Strategie")
model.modelSense = GRB.MAXIMIZE
# =============================================================================
A=['1','2','3']
D={'1':1.5,'2':1.8,'3':1.5}
KWS={'1':[-10842,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,0,0,0,0],'2':[-5421,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],'3':[-10842,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,0,0,0,0]}
KWE={'1':[35090,35090,35090,35090,35090,35090,35090,35090,35090,35090,35090,35090,0,0,0,0],'2':[22562,22562,22562,22562,22562,22562,22562,22562,22562,22562,22562,22562,0,0,0,0],'3':[18492,18492,18492,18492,18492,18492,18492,18492,18492,18492,18492,18492,0,0,0,0]}
Tmax= 10
T= [i for i in range(0,Tmax+1)]
# =============================================================================
Y={}
for a in A:
for t in T:
Au={}
for t in T:
BW={}
for t in T:
BW[t]=model.addVar(name="BW_%s" % (t), vtype =GRB.CONTINUOUS, lb=-1*10**30)
BWX= model.addVar(vtype =GRB.CONTINUOUS , obj = 1 , name='BWX')
Er={}
for t in T:
R={}
for t in T:
R[t]=model.addVar(name="R_%s" % (t), vtype =GRB.CONTINUOUS, lb=-1*10**30)
# =============================================================================
for t in T:
model.addConstr(Au[t] == quicksum(KWS[a][t] * Y[a,t] for a in A))
model.addConstr(Er[t] == quicksum(KWE[a][t] * Y[a,t] for a in A))
for t in T:
for t in T:
model.addConstr(R[t]*Au[t]==Er[t]) #This line of code makes trouble
# =============================================================================
model.update()
model.optimize()
# =============================================================================
• Gurobi Staff
It looks like you just need to set the NonConvex parameter to 2 to direct Gurobi to solve the model (which is made non-convex by the quadratic equality constraints): | {
"domain": "gurobi.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9914225163603422,
"lm_q1q2_score": 0.8748588558667997,
"lm_q2_score": 0.8824278664544912,
"openwebmath_perplexity": 775.9290481282418,
"openwebmath_score": 0.9815588593482971,
"tags": null,
"url": "https://support.gurobi.com/hc/en-us/community/posts/360074491212-Divisor-must-be-a-constant?page=1#community_comment_8301141630993"
} |
model.Params.NonConvex = 2
Note that solving non-convex quadratic problems is only supported in Gurobi 9.0 onward.
Thanks a lot. It works | {
"domain": "gurobi.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9914225163603422,
"lm_q1q2_score": 0.8748588558667997,
"lm_q2_score": 0.8824278664544912,
"openwebmath_perplexity": 775.9290481282418,
"openwebmath_score": 0.9815588593482971,
"tags": null,
"url": "https://support.gurobi.com/hc/en-us/community/posts/360074491212-Divisor-must-be-a-constant?page=1#community_comment_8301141630993"
} |
stdevp( ) appears to be mislabeled
05-27-2016, 11:50 PM
Post: #1
Mike Elzinga Junior Member Posts: 16 Joined: May 2016
stdevp( ) appears to be mislabeled
It appears that the stdevp( ) function is mislabeled.
Instead of being the population standard deviation, it is the sample standard deviation. The sample standard deviation has to be greater than the population standard deviaion by sqrt(N/(N-1)).
Here is a check: approx(sddev({1,2,3})) = 0.816496580928
stdevp({1,2,3}) = 1
stdevp({1,2,3})*sqrt(2/3) = 0.816496580928, which is the population standard deviation.
The quickest fix might be to relabel stdevp( ) as stdevs( ) and change help to reflect that this is the sample standard deviation rather than the population standard deviation.
05-28-2016, 01:00 AM
Post: #2
Mike Elzinga Junior Member Posts: 16 Joined: May 2016
RE: stdevp( ) appears to be mislabeled
I made some typos in my post (vision issues; sorry).
The relevant functions are stddev( ) and stddevp( ).
05-28-2016, 02:11 AM
Post: #3
Helge Gabert Senior Member Posts: 460 Joined: Dec 2013
RE: stdevp( ) appears to be mislabeled
That is the case.
The Stats 1 Var Numeric View "Stats" displays the sample and population standard deviation correctly; however, calls to stddev and stddevp are mixed up.
05-28-2016, 04:44 AM
Post: #4
Tim Wessman Senior Member Posts: 2,148 Joined: Dec 2013
RE: stdevp( ) appears to be mislabeled
If I remember correctly, Bernard has it that way on purpose and does not think it should change. I'm not sure the reasoning myself.
TW | {
"domain": "hpmuseum.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138138113964,
"lm_q1q2_score": 0.8748480248902573,
"lm_q2_score": 0.8947894696095782,
"openwebmath_perplexity": 2853.7942644873897,
"openwebmath_score": 0.5120582580566406,
"tags": null,
"url": "https://www.hpmuseum.org/forum/thread-6313.html"
} |
TW
Although I work for the HP calculator group, the views and opinions I post here are my own.
05-28-2016, 07:11 AM
Post: #5
parisse Senior Member Posts: 1,027 Joined: Dec 2013
RE: stdevp( ) appears to be mislabeled
stddevp = standard deviation of the population based on a sample
stddev = standard deviation
If this is too confusing, I have nothing against renaming stddevp to stddevs.
05-28-2016, 07:12 AM (This post was last modified: 05-28-2016 07:14 AM by salvomic.)
Post: #6
salvomic Senior Member Posts: 1,365 Joined: Jan 2015
RE: stdevp( ) appears to be mislabeled
(05-28-2016 04:44 AM)Tim Wessman Wrote: If I remember correctly, Bernard has it that way on purpose and does not think it should change. I'm not sure the reasoning myself.
IMHO stddev() should represent sX variable of Statistics 1Var and stddevp() the correspondent σX, otherwise another proposal is to rename stddevp() stddevs() ("of the sample) and in any case to adapt them to sX and σX.
However I consider also the Bernard's reasoning as stddev() and stdevp() are applied also to a matrix and so on...
Salvo
∫aL√0mic (IT9CLU), HP Prime 50g 41CX 71b 42s 12C 15C - DM42 WP34s :: Prime Soft. Lib
05-28-2016, 01:57 PM
Post: #7
Mike Elzinga Junior Member Posts: 16 Joined: May 2016
RE: stdevp( ) appears to be mislabeled
The current notational standards in statistics are that σX is the population standard deviation and sX is the sample standard deviation. The Stats 1Var app is consistent with the notational standards; and it also agrees with the STATS app on the HP 50G, the TI 89 and TI 83 and 84, and various other statistics packages. | {
"domain": "hpmuseum.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138138113964,
"lm_q1q2_score": 0.8748480248902573,
"lm_q2_score": 0.8947894696095782,
"openwebmath_perplexity": 2853.7942644873897,
"openwebmath_score": 0.5120582580566406,
"tags": null,
"url": "https://www.hpmuseum.org/forum/thread-6313.html"
} |
The reason for dividing by N-1 in the sample standard deviation is because we don't have either the actual population mean or the actual population standard deviation when we take a sample. By taking a sample, we hope we have values that are representative of the population so that we can use the sample mean and standard deviation as <i>estimates</i> of the corresponding population parameters. These estimates of population parameters that we take from our sample are called statistics.
However, we lose a degree of freedom in calculating the mean of the sample because we then turn right around and use that sample mean in calculating the sample standard deviation. This makes the sample standard deviation a biased estimate of the population standard deviation unless we divide by N-1 instead of N.
When you calculate the population mean and standard deviation, you have every indivitual in the population, so there is no conflict in subtracting individual measurements from the population mean. So in calculating the population standard deviation it is proper to divide by N.
However, if you apply the calculation to get the sample standard deviation to the population itself, you get a value that is sqrt(N/(N-1)) times larger than it is supposed to be. Remember that the sample is not the population; it is hopefully a representative sample of the population from which we hope to estimate the population parameters when we can't count every member of the population.
Also, when we look at the behaviors of the sample means and sample standard deviations as a function of sample size, we find that the standard deviations of the sample means decreases with sample size as σ/sqrt(N) whereas the standard deviation of the sample standard deviations decreases as σ/sqrt(2N) when sampling a population that has a normal distribution. | {
"domain": "hpmuseum.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138138113964,
"lm_q1q2_score": 0.8748480248902573,
"lm_q2_score": 0.8947894696095782,
"openwebmath_perplexity": 2853.7942644873897,
"openwebmath_score": 0.5120582580566406,
"tags": null,
"url": "https://www.hpmuseum.org/forum/thread-6313.html"
} |
I discovered the inconsistency in the notion of stddevp when I was writing an app to demonstrate the behaviors of the sample mean and sample standard deviation as a function of sample size. :-)
So, to be consistent with standard statistical notation, I would think that stddevp should be the same as σX and stddev (or, better, stddevs) should be the same as sX. At the moment, they are reversed.
05-28-2016, 02:04 PM
Post: #8
Mike Elzinga Junior Member Posts: 16 Joined: May 2016
RE: stdevp( ) appears to be mislabeled
I'm new to this site. | {
"domain": "hpmuseum.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138138113964,
"lm_q1q2_score": 0.8748480248902573,
"lm_q2_score": 0.8947894696095782,
"openwebmath_perplexity": 2853.7942644873897,
"openwebmath_score": 0.5120582580566406,
"tags": null,
"url": "https://www.hpmuseum.org/forum/thread-6313.html"
} |
How does one get Greek and other mathematical symbols? HTML doesn't appear to work in my last post.
05-28-2016, 02:45 PM
Post: #9
parisse Senior Member Posts: 1,027 Joined: Dec 2013
RE: stdevp( ) appears to be mislabeled
(05-28-2016 01:57 PM)Mike Elzinga Wrote: So, to be consistent with standard statistical notation, I would think that stddevp should be the same as σX and stddev (or, better, stddevs) should be the same as sX. At the moment, they are reversed.
I don't see why stddev should correspond to sigmaX and stddevp to sX and not conversely. I find more natural to have the shortest name for the simplest definition and the longest name for the modification required to have an unbiaised estimation. That's why I want to keep stddev for division by sqrt(N). After thinking a bit about the name, stddevs might also be confusing, perhaps stddevpfroms would be better.
05-28-2016, 03:15 PM
Post: #10
Mike Elzinga Junior Member Posts: 16 Joined: May 2016
RE: stdevp( ) appears to be mislabeled
(05-28-2016 02:45 PM)parisse Wrote:
(05-28-2016 01:57 PM)Mike Elzinga Wrote: So, to be consistent with standard statistical notation, I would think that stddevp should be the same as σX and stddev (or, better, stddevs) should be the same as sX. At the moment, they are reversed.
I don't see why stddev should correspond to sigmaX and stddevp to sX and not conversely. I find more natural to have the shortest name for the simplest definition and the longest name for the modification required to have an unbiaised estimation. That's why I want to keep stddev for division by sqrt(N). After thinking a bit about the name, stddevs might also be confusing, perhaps stddevpfroms would be better.
Because this is also a pedagogical issue, the names should reflect what calculation is being done.
On other statistics packages and on the HP50G, population standard deviation has division by N and sample standard deviation has division by N-1. | {
"domain": "hpmuseum.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138138113964,
"lm_q1q2_score": 0.8748480248902573,
"lm_q2_score": 0.8947894696095782,
"openwebmath_perplexity": 2853.7942644873897,
"openwebmath_score": 0.5120582580566406,
"tags": null,
"url": "https://www.hpmuseum.org/forum/thread-6313.html"
} |
Standard notation in statistics these days has sigma for the population standard deviation and s for the sample standard deviation.
The help given for stddevp on the HP Prime says it is the population standard deviation. However, it actually calculates the sample standard deviation. On the other hand, stddev calculates the population standard deviation. This is reversed from standard notation and conflicts with the sigmaX and the sX of the Statistics 1 Var app.
Some calculators and statistical packages use PopStdDev and SampStdDev to make it perfectly clear which calulation is being done. P goes with population (division by N) and S goes with sample (division by N-1).
Because I am aware of the frequent confusion about the sample standard deviation as compared with the population standard deviation, I always do a quick check with a small list of values that can be taken as either the population or a sample whenever I start using a new statistical package or app.
Calculating the sample standard deviation should always be greater than calculating the population standard deviation by a factor of sqrt(N/(N-1)) using the same small list.
05-28-2016, 04:31 PM (This post was last modified: 05-28-2016 04:55 PM by salvomic.)
Post: #11
salvomic Senior Member Posts: 1,365 Joined: Jan 2015
RE: stdevp( ) appears to be mislabeled
(05-28-2016 02:04 PM)Mike Elzinga Wrote: I'm new to this site.
How does one get Greek and other mathematical symbols? HTML doesn't appear to work in my last post.
In Mac OS X I simply pasted and copied sigma (σ) from "Show symbols" panel, on the top right in the Finder bar)...
otherwise you could use LaTEX (use first \ [ without space and at the end \ ] without spaces and \sigma for the greek small sigma)...
$\sigma$
If you want use it inside a paragraph ($$\sigma$$) use \ ( and \ ) instead...
Attached File(s) Thumbnail(s) | {
"domain": "hpmuseum.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138138113964,
"lm_q1q2_score": 0.8748480248902573,
"lm_q2_score": 0.8947894696095782,
"openwebmath_perplexity": 2853.7942644873897,
"openwebmath_score": 0.5120582580566406,
"tags": null,
"url": "https://www.hpmuseum.org/forum/thread-6313.html"
} |
Attached File(s) Thumbnail(s)
∫aL√0mic (IT9CLU), HP Prime 50g 41CX 71b 42s 12C 15C - DM42 WP34s :: Prime Soft. Lib
05-28-2016, 04:54 PM
Post: #12
Mike Elzinga Junior Member Posts: 16 Joined: May 2016
RE: stdevp( ) appears to be mislabeled
(05-28-2016 04:31 PM)salvomic Wrote:
(05-28-2016 02:04 PM)Mike Elzinga Wrote: I'm new to this site.
How does one get Greek and other mathematical symbols? HTML doesn't appear to work in my last post.
In Mac OS X I simply pasted and copied sigma (σ) from "Show symbols" panel, on the top right in the Finder bar)...
otherwise you could use LaTEX (use first \ [ without space and at the end \ ] without spaces and \sigma for the greek small sigma)...
$\sigma$
If you want use it inside a paragraph ($$\sigma$$) use \ ( and \ ) instead...
Thanks. I didn't know LaTEX worked on this site.
05-28-2016, 05:53 PM
Post: #13
parisse Senior Member Posts: 1,027 Joined: Dec 2013
RE: stdevp( ) appears to be mislabeled
(05-28-2016 03:15 PM)Mike Elzinga Wrote:
(05-28-2016 02:45 PM)parisse Wrote: I don't see why stddev should correspond to sigmaX and stddevp to sX and not conversely. I find more natural to have the shortest name for the simplest definition and the longest name for the modification required to have an unbiaised estimation. That's why I want to keep stddev for division by sqrt(N). After thinking a bit about the name, stddevs might also be confusing, perhaps stddevpfroms would be better. | {
"domain": "hpmuseum.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138138113964,
"lm_q1q2_score": 0.8748480248902573,
"lm_q2_score": 0.8947894696095782,
"openwebmath_perplexity": 2853.7942644873897,
"openwebmath_score": 0.5120582580566406,
"tags": null,
"url": "https://www.hpmuseum.org/forum/thread-6313.html"
} |
Because this is also a pedagogical issue, the names should reflect what calculation is being done.
I see, in fact we disagree because HP made a mistake in the documentation. Xcas documentation says
# stddev Returns the standard deviation of the elements of its argument with an optionnal second argument as pound or the list of standard deviation of the columns of a matrix.
# stddevp Returns an unbiaised estimate of the population standard deviation of the sample (first argument) with an optionnal list of pounds as second argument.
05-28-2016, 06:08 PM
Post: #14
parisse Senior Member Posts: 1,027 Joined: Dec 2013
RE: stdevp( ) appears to be mislabeled
By the way, it should not be that essential. I mean sqrt(n/n-1) is 1.017... for n=30, in other words your confidence interval will be almost the same for a reasonable sample size (interval length will increase by less than 2%). If you make a poll of size n=1000 we are talking of less than 0.05% change. Insisting too much on the unbiaised vs biaised stddev estimate difference might miss more important comprehension.
05-28-2016, 07:16 PM
Post: #15
Helge Gabert Senior Member Posts: 460 Joined: Dec 2013
RE: stdevp( ) appears to be mislabeled
Why not just rename stddevp to stddevs - - and everyone should be happy. stddev can stay the way it is.
05-28-2016, 08:12 PM
Post: #16
Mike Elzinga Junior Member Posts: 16 Joined: May 2016
RE: stdevp( ) appears to be mislabeled
(05-28-2016 07:16 PM)Helge Gabert Wrote: Why not just rename stddevp to stddevs - - and everyone should be happy. stddev can stay the way it is.
I agree; this would be the easiest fix. | {
"domain": "hpmuseum.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138138113964,
"lm_q1q2_score": 0.8748480248902573,
"lm_q2_score": 0.8947894696095782,
"openwebmath_perplexity": 2853.7942644873897,
"openwebmath_score": 0.5120582580566406,
"tags": null,
"url": "https://www.hpmuseum.org/forum/thread-6313.html"
} |
I agree; this would be the easiest fix.
Also change the help for this command to state that it calculates the sample standard deviation. In the help, just change the word "population" to sample.
05-28-2016, 08:58 PM
Post: #17
Mike Elzinga Junior Member Posts: 16 Joined: May 2016
RE: stdevp( ) appears to be mislabeled
(05-28-2016 06:08 PM)parisse Wrote: By the way, it should not be that essential. I mean sqrt(n/n-1) is 1.017... for n=30, in other words your confidence interval will be almost the same for a reasonable sample size (interval length will increase by less than 2%). If you make a poll of size n=1000 we are talking of less than 0.05% change. Insisting too much on the unbiaised vs biaised stddev estimate difference might miss more important comprehension.
This is precisely what my little app is demonstrating. It is a pedagogical tool used to show where confidence intervals come from and why we use the language we do in inferential statistics.
1. First the app generates a big population of, say, 1000, with a specified normal distribution. It then checks the actual population mean and population standard deviation and plots the histogram.
2. It allows setting a sample size and takes many (on the order of 100) samples of this size and calculates the standard deviations of the sample means and the standard deviation of the sample standard deviations.
3. If desired, it can then plot a histogram of these and tell us what the standard deviation of all the sample means and standard deviation of all the sample standard deviations are. Several checks with different sample sizes show these histograms get narrower and taller as sample sizes get larger and larger, and the histograms have normal distributions.
3. It also allows incrementing the sample size by a specified amount and repeating this all the way from a small sample size up to some specified large sample size. | {
"domain": "hpmuseum.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138138113964,
"lm_q1q2_score": 0.8748480248902573,
"lm_q2_score": 0.8947894696095782,
"openwebmath_perplexity": 2853.7942644873897,
"openwebmath_score": 0.5120582580566406,
"tags": null,
"url": "https://www.hpmuseum.org/forum/thread-6313.html"
} |
4. The sample sizes, the standard deviations of the sample means, and the standard deviations of the sample standard deviations are stored in lists.
5. It then plots the standard deviations of sample means versus sample size, and also the standard deviations of sample standard deviations versus sample size.
6. These plots fit very nicely sigma/sqrt(N) for the sample means, and sigma/sqrt(2N) for the sample standard deviations as expected.
The nice thing about the HP Prime is that it is so fast that it takes very little time to generate all these data and make these plots.
05-29-2016, 05:57 AM
Post: #18
parisse Senior Member Posts: 1,027 Joined: Dec 2013
RE: stdevp( ) appears to be mislabeled
(05-28-2016 08:12 PM)Mike Elzinga Wrote:
(05-28-2016 07:16 PM)Helge Gabert Wrote: Why not just rename stddevp to stddevs - - and everyone should be happy. stddev can stay the way it is.
I agree; this would be the easiest fix.
Also change the help for this command to state that it calculates the sample standard deviation. In the help, just change the word "population" to sample.
I'm afraid stddevs is also confusing, stddevpfroms would be better.
05-29-2016, 04:56 PM
Post: #19
Mike Elzinga Junior Member Posts: 16 Joined: May 2016
RE: stdevp( ) appears to be mislabeled
(05-29-2016 05:57 AM)parisse Wrote:
(05-28-2016 08:12 PM)Mike Elzinga Wrote: I agree; this would be the easiest fix.
Also change the help for this command to state that it calculates the sample standard deviation. In the help, just change the word "population" to sample.
I'm afraid stddevs is also confusing, stddevpfroms would be better.
05-29-2016, 05:08 PM (This post was last modified: 05-29-2016 05:09 PM by toml_12953.)
Post: #20
toml_12953 Senior Member Posts: 1,191 Joined: Dec 2013
RE: stdevp( ) appears to be mislabeled
(05-29-2016 04:56 PM)Mike Elzinga Wrote:
(05-29-2016 05:57 AM)parisse Wrote: I'm afraid stddevs is also confusing, stddevpfroms would be better.
or even | {
"domain": "hpmuseum.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138138113964,
"lm_q1q2_score": 0.8748480248902573,
"lm_q2_score": 0.8947894696095782,
"openwebmath_perplexity": 2853.7942644873897,
"openwebmath_score": 0.5120582580566406,
"tags": null,
"url": "https://www.hpmuseum.org/forum/thread-6313.html"
} |
or even
standard_deviation_using_just_a_sample_of_the_total_population_not_the_whole_thing
Tom L
Tom L
If the First Presbyterian Church is nicknamed First Pres,
why isn't the First Methodist Church nicknamed First Meth?
« Next Oldest | Next Newest »
User(s) browsing this thread: 1 Guest(s) | {
"domain": "hpmuseum.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138138113964,
"lm_q1q2_score": 0.8748480248902573,
"lm_q2_score": 0.8947894696095782,
"openwebmath_perplexity": 2853.7942644873897,
"openwebmath_score": 0.5120582580566406,
"tags": null,
"url": "https://www.hpmuseum.org/forum/thread-6313.html"
} |
# What is wrong with my reasoning?
The Questions
70% of all vehicles pass inspection. Assuming vehicles pass or fail independently. What is the probability:
a) exactly one of the next 3 vehicles passes
b) at most 1 of the next 3 vehicles passes
The answer to a) is .189. The way I calculated it was:
P(success) * P(fail) * P(fail) +
P(fail) * P(success) * P(fail) +
P(fail) * P(fail) * P(success) = .7*.3*.3 + .3*.7*.3 + .3*.3*.7 = .189
I summed the 3 possible permutations of 1 success and 2 failures.
For b) the answer is .216. To get that answer you take your answer to a) and add the probability of exactly 0 successes which is P(fail) * P(fail) * P(fail) => .189 + .3*.3*.3 = .216
What I don't understand is why the probability of exactly 0 successes doesn't follow the pattern of exactly 1 success. Why doesn't the "formula" work:
P(fail) * P(fail) * P(fail) +
P(fail) * P(fail) * P(fail) +
P(fail) * P(fail) * P(fail) = .3*.3*.3+.3*.3*.3+.3*.3*.3 = .081
=> .189 + .081 = .27 (not .216)
Now I'm wondering if I calculated the answer to a) the wrong way, and it was merely a coincidence that I got the right answer!
-
The case that the first car passes and the next two fail is different from the case that the first car fails, the second passes, and the third fails. But there is only one case in which all cars fail: namely, all cars fail. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.977713810564506,
"lm_q1q2_score": 0.874848020613423,
"lm_q2_score": 0.8947894682067639,
"openwebmath_perplexity": 672.0192942092472,
"openwebmath_score": 0.5933423042297363,
"tags": null,
"url": "http://math.stackexchange.com/questions/4948/what-is-wrong-with-my-reasoning?answertab=votes"
} |
Think of it with coin tosses: if you flip a penny, a nickel, and a dime (different coins, in case you are not in the U.S. or Canada), then there is only one way for all three coins to come out tails, namely, the penny comes out tails, the nickel comes out tails, and the dime comes out tails. But there are three ways in which exactly one coin comes out heads: you can have the penny come out heads and the nickel and dime come out tails; you can have the nickel come out heads and the penny and dime come out tails; or you can have the dime come out heads and the penny and nickel come out tails. These are three different outcomes, but you do not have three different ways in which the three can come out tails.
-
In part a, there are exactly three ways for one out of three cars to pass, they are the three possibilities that you added. But there is only one way for all the cars to fail! The first car must fail, the second car must fail, and the third car must fail. Since there is only one way for this to happen you only consider this one probability.
Btw there are also three ways for exactly two cars to pass and only one way for all three of them to pass. Hope this helps.
-
I'm not too confident with my probability, but I'll try my hand at an explanation.
In the first part, you are considering the next 3 trials as successive events so you can have a success in either the first spot, second spot, or third spot.
In part b, you require all 3 events to be failures so there is only 1 way that the 3 failures can occur in the next 3 events.
Does that make any sense? I never felt probability was my strong point :)
- | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.977713810564506,
"lm_q1q2_score": 0.874848020613423,
"lm_q2_score": 0.8947894682067639,
"openwebmath_perplexity": 672.0192942092472,
"openwebmath_score": 0.5933423042297363,
"tags": null,
"url": "http://math.stackexchange.com/questions/4948/what-is-wrong-with-my-reasoning?answertab=votes"
} |
# Finding the point on the line of intersection between planes
1. Oct 9, 2016
### Bishamonten
1. The problem statement, all variables and given/known data
Given two planes, P1, P2. Find parametric equations for the line of intersection between the two planes.
2. Relevant equations
P1 = 2x -3y + 4z = 3
P2 = x + 4y - 2z = 7
3. The attempt at a solution
Let N1 be the normal vector to P1, and N2 be the normal vector to P2. Then,
N1 = (2, -3, 4) ; N2 = (1, 4, -2)
Then, the direction numbers for our desired line will come from the components of the cross product between the normal vectors, because it will be parallel to our desired line.
Then, N1xN2 = (-10, 8, 11).
Then, Eq. of line: x = x? -10t ; y = y? +8t ; z = z? + 11t
I currently need to find a point that would be on our desired line, so that I can complete the equation for this line. The book we're using unsatisfactorily just says in it's example version of this type of problem to "let z = 0" in both the given equations of the two planes in it's example, and then solve the system that emerges from that.
My problem is, why? How would I know ahead of time to let one of these three unknowns be 0?(In this case, the back of the book suggests to let y = 0 for my problem here, but I want to know what line of reasoning would let me come to that conclusion).
2. Oct 9, 2016
### andrewkirk
You can solve the problem by setting any one of the coordinates to zero, provided the line is not parallel to but not in the plane where that coordinate is zero. The line will be parallel to such a plane if the corresponding component of the line vector is zero. So you can pick any component for which the corresponding component of the line vector is nonzero. In this case that's any of the three coordinates, because none of the components of the line vector are zero. | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138099151277,
"lm_q1q2_score": 0.8748480186608152,
"lm_q2_score": 0.8947894668039496,
"openwebmath_perplexity": 235.4811858147301,
"openwebmath_score": 0.801311194896698,
"tags": null,
"url": "https://www.physicsforums.com/threads/finding-the-point-on-the-line-of-intersection-between-planes.888437/"
} |
What you are doing by setting a coordinate equal to zero is obtaining two equations for the other two coordinates of the point where the line intersects the plane where that coordinate is zero. Those two equations will be linear in the other two coordinates, and hence can be solved to find the values of those two coordinates at the intersection point. Substituting both those values into the equation of either of the planes will allow you to calculate the value of the third coordinate at that point.
Last edited: Oct 9, 2016
3. Oct 9, 2016
### Bishamonten
So I can set any of them to be 0? In this case, when I set z = 0, I get a system in which when solved yields x = 3, y = 1. Substituting these two back into one of the plane equations just tells me that z = 0.
These three values do not match the parametric equation found in the back of the book for this problem, which says that x = 17/4 - 10t ; y = 8t ; z = -11/8 + 11t, so there must be something I am not understanding here.
4. Oct 9, 2016
### andrewkirk
The bit you are not understanding is that parametrisations are not unique. You can pick any point on the line as the 'zero point' of the parametrised line that corresponds to where the parameter value is zero, so there are as many parametrisations as there are points on the line.
Both your parametrisation and the one in the book are correct. To see that, note that the intersection point you found is when $t=0$ in your parametrisation and $t=1/8$ in the book parametrisation.
But your parametrisation is nicer, because it has no fractions in it.
5. Oct 9, 2016
### Bishamonten
Well that's really convenient of parameters. Thank you for clarifying that point to me!
6. Oct 9, 2016
### Ray Vickson | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138099151277,
"lm_q1q2_score": 0.8748480186608152,
"lm_q2_score": 0.8947894668039496,
"openwebmath_perplexity": 235.4811858147301,
"openwebmath_score": 0.801311194896698,
"tags": null,
"url": "https://www.physicsforums.com/threads/finding-the-point-on-the-line-of-intersection-between-planes.888437/"
} |
6. Oct 9, 2016
### Ray Vickson
You can use the equations to solve for any two of the variables in terms of the third. For example, you can write the equations as
$$\begin{array}{lcr}2x - 3y &=&3-4z\\ x + 4y &=& 7 + 2z \end{array}$$
This is a simple system of 2 linear equations in 2 unknowns, and is easily solved using elementary algebra, to get
$$x = 3 - \frac{10}{11} z, \; y = 1 + \frac{8}{11} z$$
So, one possible parametrization of the line would be $x = 3 -(10/11)t, y = 1 + ( 8/11) t, z = t$. Of course there are infinitely many points on the intersection line, but one convenient point would be obtained by putting $t = 11$, to eliminate the fractions: $x = -7, y = 9, z = 11$. | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138099151277,
"lm_q1q2_score": 0.8748480186608152,
"lm_q2_score": 0.8947894668039496,
"openwebmath_perplexity": 235.4811858147301,
"openwebmath_score": 0.801311194896698,
"tags": null,
"url": "https://www.physicsforums.com/threads/finding-the-point-on-the-line-of-intersection-between-planes.888437/"
} |
# Have you ever used Scratch pad like this?
Find the root of following equation.
$4y^3-2700(1-y)^4=0$
Above equation can be solved using newton raphson iterative method with initial approximation to be unity.
1) First Let $$f(y)=4y^3-2700(1-y)^4$$ We have to find root of above function.
2)Find derivative of $$f(y)$$. Here,$$f^{'}(y)=12y^2+10800(1-y)^3$$
3)Find $$y_n$$ using newton raphson method $y_0=1$ $y_{n+1}=y_n-\frac{f(y_n)}{f^{'}(y_n)}$ $y_{n+1}=y-\frac{4y^3-2700(1-y)^4}{12y^2+10800(1-y)^3}$
You can use calculator or scratchpad to calculate $$y_1,y_2,y_3,....$$.If this equation has real solution ,these values $$y_1,y_2,y_3,....$$ would converge to root of $$f(y)$$.
How to do such iterations smartly?
1) $$\color{Purple}{\text{On first line of scratch pad write y=1}}$$
2) $$\color{Red}{\text{On second line write}}$$
$y=y-\frac{4y^3-2700(1-y)^4}{12y^2+10800(1-y)^3}$
$$\color{Green}{\text{You will see new value of y as result.}}$$
3) $$\color{Orange}{\text{From line 3, continue pasting}}$$
$y=y-\frac{4y^3-2700(1-y)^4}{12y^2+10800(1-y)^3}$
until you get a constant value.If your initial approximation is not too away from actual solution,you would get constant value in no more than 10 steps.
By this method you can solve most of the transcendental equation.
$$\color{blue}{\text{By using scratchpad, try finding sum of initial 10 fibonacci number.}}$$
Note by Aamir Faisal Ansari
3 years, 6 months ago
MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold
- bulleted- list
• bulleted
• list
1. numbered2. list
1. numbered
2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1paragraph 2
paragraph 1
paragraph 2
[example link](https://brilliant.org)example link
> This is a quote
This is a quote
# I indented these lines
# 4 spaces, and now they show
# up as a code block.
print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block. | {
"domain": "brilliant.org",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138092657496,
"lm_q1q2_score": 0.874848011907779,
"lm_q2_score": 0.8947894604912848,
"openwebmath_perplexity": 6643.045009047385,
"openwebmath_score": 0.997265636920929,
"tags": null,
"url": "https://brilliant.org/discussions/thread/scratch-pad/"
} |
print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.
print "hello world"
MathAppears as
Remember to wrap math in $$...$$ or $...$ to ensure proper formatting.
2 \times 3 $$2 \times 3$$
2^{34} $$2^{34}$$
a_{i-1} $$a_{i-1}$$
\frac{2}{3} $$\frac{2}{3}$$
\sqrt{2} $$\sqrt{2}$$
\sum_{i=1}^3 $$\sum_{i=1}^3$$
\sin \theta $$\sin \theta$$
\boxed{123} $$\boxed{123}$$
Sort by:
Yes !i have used it this way.Sometimes in Recursion problems and like that.
- 3 years, 6 months ago
By using scratchpad, try finding sum of initial 10 fibonacci number.
- 3 years, 6 months ago | {
"domain": "brilliant.org",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138092657496,
"lm_q1q2_score": 0.874848011907779,
"lm_q2_score": 0.8947894604912848,
"openwebmath_perplexity": 6643.045009047385,
"openwebmath_score": 0.997265636920929,
"tags": null,
"url": "https://brilliant.org/discussions/thread/scratch-pad/"
} |
# Proving $\phi: V \rightarrow \mathbb{R}^n$ is linear and finding matrix representation of it
Problem: Let $V$ be a $n$-dimensional vectorspace and let $\beta = \left\{v_1, v_2, \ldots, v_n\right\}$ be a basis for $V$. Prove that the coordinate map $\phi_{\beta} : V \rightarrow \mathbb{R}^n$ is linear and determine the matrix $[\phi_{\beta}]_{\beta}^{\gamma}$ with $\gamma$ the standard basis for $\mathbb{R}^n$.
Attempt at solution: Take vectors $v, w \in V$. Then we have \begin{align*} v = \sum_{i=1}^n \lambda_i v_i \qquad \text{and} \qquad w= \sum_{i=1}^n \zeta_i v_i \end{align*} for unique scalars $\lambda_i$ and $\zeta_i \in \mathbb{R}$. It follows that \begin{align*} v+ w &= \sum_{i=1}^n \lambda_i v_i + \sum_{i=1}^n \zeta_i v_i \\ &= \sum_{i=1}^n (\lambda_i + \zeta_i) v_i. \end{align*} Hence we get \begin{align*} \phi_{\beta}(v+w) &= (\lambda_1 + \zeta_1, \lambda_2 + \zeta_2, \ldots, \lambda_n + \zeta_n) \\ &= (\lambda_1, \lambda_2, \ldots, \lambda_n) + (\zeta_1, \zeta_2, \ldots, \zeta_n) \\ &= \phi_{\beta} (v) + \phi_{\beta} (w). \end{align*} Now take a scalar $\mu \in \mathbb{R}$. Then we get \begin{align*} \mu v = (\mu \lambda_1) v_1 + (\mu \lambda_2) v_2 + \ldots + (\mu \lambda_n) v_n, \end{align*} from which it follows that \begin{align*} \phi_{\beta}(\mu v) &= (\mu \lambda_1, \mu \lambda_2, \ldots, \mu \lambda_n) \\ &= \mu (\lambda_1, \lambda_2, \ldots, \lambda_n) \\ &= \mu \phi_{\beta} (v). \end{align*} So $\phi_{\beta} : V \rightarrow \mathbb{R}^n$ is linear.
Then for the matrixrepresentation, I'm not sure what I need to write in the columns of the matrix. If I take a vector $v \in V$, then $\phi_{\beta} (v) = (\lambda_1, \lambda_2, \ldots, \lambda_n)$. And if $\gamma$ is the standard basis for $\mathbb{R}^n$, then this gives $\lambda_1 (1,0,0, \ldots, 0) + \lambda_2 (0,1,0, \ldots, 0) + \ldots + \lambda_n (0,0, \ldots, 1)$. So In the first column just come the coordinates $\lambda_i$? I'm confused about this. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363494503271,
"lm_q1q2_score": 0.87483759792945,
"lm_q2_score": 0.8887588052782737,
"openwebmath_perplexity": 307.1951934144212,
"openwebmath_score": 0.9999788999557495,
"tags": null,
"url": "https://math.stackexchange.com/questions/1348497/proving-phi-v-rightarrow-mathbbrn-is-linear-and-finding-matrix-represen"
} |
• Could you clarify what "coordinate map" means? – Rory Daulton Jul 3 '15 at 19:12
• @RoryDaulton I think it's pretty clear from his attempted solution. If for $v\in V$ I can write $v=\lambda_1v_1+\dots+\lambda_nv_n$ with respec to basis $\beta$, then the coordinate map would be $\phi_{\beta}(v)=(\lambda_1,\dots,\lambda_n)$ – Alex Mathers Jul 3 '15 at 19:22
• Note that that $[v]_\beta = \phi(v) = [\phi(v)]_\gamma$ – Omnomnomnom Jul 3 '15 at 19:56
• @Omnomnomnom, so what does that mean? Was I right in stating that in the columns are just the coordinates of $v$? – Kamil Jul 3 '15 at 20:00
• @Kamil it means that the $i$th column is the coordinates of $v_i$ with respect to $\beta$. – Omnomnomnom Jul 3 '15 at 20:24
If $T$ is any linear transformation, the matrix $[T]^{\gamma}_{\beta}$ can be written $\begin{bmatrix} [T(v_1)]_{\gamma} & \cdots & [T(v_n)]_{\gamma}\end{bmatrix}$. In other words, the $i$th column of $[T]^{\gamma}_{\beta}$ is $T(v_i)$ written in $\gamma$ coordinates.
For $\phi_{\beta}$, the vector $\phi_{\beta}(v_i)$ is $e_i = (0,\ldots0 ,1,0, \ldots,0)$, so the $i$th column of $[\phi_{\beta}]_{\beta}^{\gamma}$ is $e_i$. This is the same as saying $[\phi_{\beta}]_{\beta}^{\gamma}$ is the identity matrix.
Another way to see this is the equation: $$[\phi_{\beta}]_{\beta}^{\gamma}[v]_{\beta} = [\phi_{\beta}(v)]_{\gamma}$$ But if $v= \lambda_1v_1 + \cdots + \lambda_nv_n$, then we have $[v]_{\beta} = [\phi_{\beta}(v)]_{\gamma} = (\lambda_1,\ldots,\lambda_n)$, and so the matrix $[\phi_{\beta}]_{\beta}^{\gamma}$ is the identity.
Your proof that $\phi_\beta$ is linear is correct. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363494503271,
"lm_q1q2_score": 0.87483759792945,
"lm_q2_score": 0.8887588052782737,
"openwebmath_perplexity": 307.1951934144212,
"openwebmath_score": 0.9999788999557495,
"tags": null,
"url": "https://math.stackexchange.com/questions/1348497/proving-phi-v-rightarrow-mathbbrn-is-linear-and-finding-matrix-represen"
} |
Your proof that $\phi_\beta$ is linear is correct.
You're on the right track to compute $[\phi_\beta]_\beta^\gamma$. For a complete computation, write $$\phi_\beta(v_j) = \left(\lambda_{1j},\dotsc,\lambda_{nj}\right) = \lambda_{1j}e_1+\dotsb+\lambda_{nj}e_n$$ for $1\leq j\leq n$. Hence $$[\phi_\beta]_\beta^\gamma = \begin{bmatrix} \lambda_{11} & \cdots & \lambda_{1n} \\ \vdots & \ddots & \vdots \\ \lambda_{n1} & \cdots & \lambda_{nn} \end{bmatrix}$$
Would this not just be the identity matrix? For example, if we write $v=\sum_{i=1}^{n}\lambda_iv_i$ then can equivalently write $v=(\lambda_1,\dots,\lambda_n)_{\beta}$ with respect to the given basis. But if we have $\phi_{\beta}(v)=(\lambda_1,\dots,\lambda_n)\in\mathbb{R}^n$, then we haven't changed it, we've just taken the scalar values. So the matrix would just be the identity.
Unless of course, it wants the "coordinate map" with respect to the standard basis.
• I don't understand your post. What you mean with 'then we haven't changed it'. I don't understand why it is the identity matrix. – Kamil Jul 3 '15 at 19:47 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363494503271,
"lm_q1q2_score": 0.87483759792945,
"lm_q2_score": 0.8887588052782737,
"openwebmath_perplexity": 307.1951934144212,
"openwebmath_score": 0.9999788999557495,
"tags": null,
"url": "https://math.stackexchange.com/questions/1348497/proving-phi-v-rightarrow-mathbbrn-is-linear-and-finding-matrix-represen"
} |
# How can I find the total number of figures in a puzzle where they seem to overlap?
The problem is as follows:
In the following sequence of figures. Which is the total number of right trapezoids which do make up $\textrm{figure 10}$?
The figure is below:
The alternatives given are:
• 66
• 60
• 56
• 64
• 72
What I tried to do is to account for the number of trapezoids:
$\textrm{In figure 1:}$
• There is just $1$
$\textrm{In figure 2:}$
This is some tricky:
I thought that there are $4$
• $2$ make up a small individual unit
• $1$ accounts for the other two
• $1$ accounts for the all of them
$\textrm{In figure 3:}$
• $3$ are consisting of only one figure.
• $2$ are two figures.
• $1$ has three figures.
• $1$ accounts for the three trapezoids in horizontal arrangement and the first oblique bar next to them.
• $1$ accounts for the previous set plus the second oblique bar next to them.
Therefore in the figure are $8$
$\textrm{In figure 4:}$
• $4$ are sets of 1 figure.
• $3$ are sets of 2 figures.
• $2$ are sets of 3 figures.
• $1$ is a set of 4 figures.
• $1$ is a set of the previous 4 figures in horizontal direction plus the first oblique bar appearing next to the trapezoids.
• $1$ is the previous set and the second oblique bar.
• $1$ is the previous set and the third oblique bar.
This accounts for $13$ figures.
So in total the series is comprised of.
$\textrm{1, 4, 8, 13,...}$
From this series I found that the recursion formula is stated as:
$$T_{n}=\frac{1}{2}n^{2}+\frac{3}{2}n-1$$
By replacing with the fourth term it seems to check.
$$T_{4}=\frac{1}{2}\left( 4 \right )^{2}+\frac{3}{2}\left( 4 \right )-1=8+6-1= 13$$
So if what it is being asked is figure number $10$ then by replacing in the previous equation:
$$T_{10}=\frac{1}{2}\left( 10 \right )^{2}+\frac{3}{2}\left( 10 \right )-1=50+15-1= 64$$
Therefore I would choose $64$ as the number of figures in the $\textrm{10th figure}$. I'm not very certain if is it correct? | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363485313247,
"lm_q1q2_score": 0.8748375942123766,
"lm_q2_score": 0.8887588023318196,
"openwebmath_perplexity": 315.9864892003986,
"openwebmath_score": 0.8077467679977417,
"tags": null,
"url": "https://math.stackexchange.com/questions/2725298/how-can-i-find-the-total-number-of-figures-in-a-puzzle-where-they-seem-to-overla"
} |
The answer appears within the alternatives but the process to find the figures was very tedious and it took me a long time to find it, needless to say that to find the recursive formula was another problem as well but eased due the fact which I had some idea of how to find it, as a result.
Is there any other method to speed up the calculations or to find an answer in this situation or to avoid miscounting or double counting the figures?
This looks correct to me. As for the more general question, I would approach the problem by asking 'how can I make up a right trapezoid from these figures?' This breaks naturally into two pieces: trapezoids that use the 'slanting' shapes on the right of the figure, and ones that don't.
If I'm going to use any of the shapes on the right then it's clear I have to use all the ones on the left, and I have to use the ones on the right from left to right; thus, there are as many ways of doing this as there are trapezoids on the right of the figure, i.e. $n-1$.
On the other hand, if I'm using on the sub-trapezoids on the left, then it has to be a contiguous block of them (e.g., the second through the fourth would be valid, but the first and third would not), but any such contiguous block will do; you should be able to see that the number of contiguous blocks is the same as the number of ways of choosing a number $i$ (the 'bottom block') between 1 and $n$ and a number $j$ (the 'top block') between $1$ and $i$; there are exactly $n(n+1)/2$ of these.
So summing up, I get a total of $n(n+1)/2+n-1 = \frac12n^2+\frac32n-1$ possible trapezoids, matching your answer. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363485313247,
"lm_q1q2_score": 0.8748375942123766,
"lm_q2_score": 0.8887588023318196,
"openwebmath_perplexity": 315.9864892003986,
"openwebmath_score": 0.8077467679977417,
"tags": null,
"url": "https://math.stackexchange.com/questions/2725298/how-can-i-find-the-total-number-of-figures-in-a-puzzle-where-they-seem-to-overla"
} |
• First of when I solved this problem I totally ignored the fact that the figures on the right side were also trapezoids but I was "saved" by the fact the problem asked about counting right trapezoids. Since I'm not good with geometry, do those are also trapezoids?. They look like rectangles which had been tilted to one of their sides, anyway. I'm still lost at where does this $n-1$ comes from. Why not $n-2$?. Most of what I did was by let's say brute force or intuition not really paying attention on details, hence why It took me hours to decode this thing. – Chris Steinbeck Bell Apr 6 '18 at 17:48
• The paragraph where you explain about the subtrapezoid thing I'm stuck at where you mention about $\frac{n(n+1)}{2}$ How do I get to this?. All I know it is that it looks the sum from integers from $1$ to $n$ does this has something to do with the problem?. Maybe if you could rework the explanation a bit better I could understand. – Chris Steinbeck Bell Apr 6 '18 at 17:48
I think you got it.
Counting the stack of $n$ trapezoids in the left part of each diagram is the $n$th triangular number -- normally denoted as $T_n$ but I'll denote it $t_n$ so as not to clash with your notation. The tenth triangular number $t_{10} = 55.$
As additional explanation, let's look at the fourth diagram in your question. Let's label the stack of short, fat trapezoids (looks like a geometrical stack of pancakes) on the left part of that diagram $A,B,C,D$ from top to bottom.
You have $4$ trapezoids with the topmost trapezoid at the top ($A$ by itself, $A+B$, $A+B+C$, and $A+B+C+D$). You'd have $3$ trapezoids with the second-highest trapezoid on top ($B$ by itself, $B+C$, and $B+C+D$). And so on. So the total number of trapezoids, of any height in this stack, is $4+3+2+1 = 10$, which is the fourth triangular number.
Similarly, in the tenth diagram, it would be $10 + 9 + 8 + ... + 2 + 1 = t_{10} = 55$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363485313247,
"lm_q1q2_score": 0.8748375942123766,
"lm_q2_score": 0.8887588023318196,
"openwebmath_perplexity": 315.9864892003986,
"openwebmath_score": 0.8077467679977417,
"tags": null,
"url": "https://math.stackexchange.com/questions/2725298/how-can-i-find-the-total-number-of-figures-in-a-puzzle-where-they-seem-to-overla"
} |
Similarly, in the tenth diagram, it would be $10 + 9 + 8 + ... + 2 + 1 = t_{10} = 55$.
A different but completely equivalent way to look at it is that there is $1$ trapezoid that is stacked $10$ high, $2$ trapezoids that are stacked $9$ high, $3$ that are stacked $8$ high ... and $10$ that are stacked $1$ high. It still adds up to $55$.
Since the side pieces extend only the trapezoid that represents the entire stack, you add $n-1$ of those. (From the diagrams you have, the third diagram has two additional trapezoids from the side pieces, hence the $n-1$ formula.)
Adding these two disjoint sets of trapezoids gives your answer $55+(10-1)=64$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363485313247,
"lm_q1q2_score": 0.8748375942123766,
"lm_q2_score": 0.8887588023318196,
"openwebmath_perplexity": 315.9864892003986,
"openwebmath_score": 0.8077467679977417,
"tags": null,
"url": "https://math.stackexchange.com/questions/2725298/how-can-i-find-the-total-number-of-figures-in-a-puzzle-where-they-seem-to-overla"
} |
Adding these two disjoint sets of trapezoids gives your answer $55+(10-1)=64$.
• Okay but how do I know it was a triangular number?. Why is it a triangular number?. Reading solely to the article you mentioned it has gave me an idea but it is not very clear. i.e the second figure has only two right trapezoids in the left, so by calling that triangular number thing there are three figures only? as the second term is three?. Why should be added $n-1$?. Where does it come from?. Can you explain this with more words please? – Chris Steinbeck Bell Apr 6 '18 at 17:33
• Added some more explanation. – John Apr 6 '18 at 17:39
• Maybe I'm too dumb but I can't picture what you just mentioned. $10$ trapezoid with the topmost thin on the top. What does it mean?. I tried to relate their numbers with the triangular numbers again. But it does not check with the fourth term. It says $10$ but in the 4th figure there are $13$. If I ignore some of them and regard the ones in the left plus those in the right would be $4$+$4$ so there are $8$ or Am I understanding it wrong?. I revisited your answer different times but I got tangled up with how should I picture that in my mind, sorry. – Chris Steinbeck Bell Apr 6 '18 at 18:39
• No, you're not too dumb! I tried again. See if that's clearer. – John Apr 6 '18 at 18:58
• Thanks for adding that explanation now I can "see" it better. But, $55$ is not the answer, so I understand that it is required to add something, Why this something to be added has to be $n-1$? you mentioned because it is one unit less of what it is on the stack, so in this portion we do not need to perform the triangular number thing because due the position of those figures with the others makes it possible to know the number by counting them normally (hence getting their total directly) as they will not add up as if they were stacked horizontally?. – Chris Steinbeck Bell Apr 6 '18 at 20:44 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363485313247,
"lm_q1q2_score": 0.8748375942123766,
"lm_q2_score": 0.8887588023318196,
"openwebmath_perplexity": 315.9864892003986,
"openwebmath_score": 0.8077467679977417,
"tags": null,
"url": "https://math.stackexchange.com/questions/2725298/how-can-i-find-the-total-number-of-figures-in-a-puzzle-where-they-seem-to-overla"
} |
ETA: I've added a somewhat shoddy diagram to illustrate what I mean. I've also changed the notation somewhat to be (a bit) more logical.
I'm not sure this is much simpler than what you did, but I numbered the vertices down the left-hand side $B_{0, 0}, B_{1, 0}, \ldots, B_{n, 0}$, then rightward from $B_{0, 0}$ were $B_{0, 1}, B_{0, 2}, \ldots, B_{0, n}$, and rightward from $B_{n, 0}$ were $B_{n, 1}, B_{n, 2}, \ldots, B_{n, n}$. Finally, down the leftmost diagonal, between $B_{0, 1}$ and $B_{n, 1}$, were $B_{1, 1}, B_{2, 1}, \ldots, B_{n-1, 1}$.
Hopefully, it'll be clear that the right trapezoid must contain two vertices of the form $B_{i, 0}$ and $B_{j, 0}$ (without loss of generality, assume $i < j$), since the right angles only live there. The other two vertices must then be $B_{i, k}$ and $B_{j, k}$, for some value of $k$.
Then, there are only two basic classes of right trapezoids:
• If $k = 1$, then $i$ and $j$ can be any values such that $0 \leq i < j \leq n$.
• If $2 \leq k \leq n$, then $i$ and $j$ must be $0$ and $n$, respectively.
There are $\binom{n+1}{2}$ of the former, and $n-1$ of the latter, which gives us a count of
$$\binom{n+1}{2}+n-1 = \frac{n^2+3n-2}{2}$$
which gives us $64$ when $n = 10$, as expected. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363485313247,
"lm_q1q2_score": 0.8748375942123766,
"lm_q2_score": 0.8887588023318196,
"openwebmath_perplexity": 315.9864892003986,
"openwebmath_score": 0.8077467679977417,
"tags": null,
"url": "https://math.stackexchange.com/questions/2725298/how-can-i-find-the-total-number-of-figures-in-a-puzzle-where-they-seem-to-overla"
} |
$$\binom{n+1}{2}+n-1 = \frac{n^2+3n-2}{2}$$
which gives us $64$ when $n = 10$, as expected.
• I do not get clearly the idea of counting from the corners. I mean okay, count from the corners but I don't understand the notation you have used. To me this kind of answers would be greatly improved if it had some visual aid as I'm not good with imagination. This binomial $\binom{n+1}{2}$ where does it comes from and why $n-1$?. – Chris Steinbeck Bell Apr 6 '18 at 17:39
• @ChrisSteinbeckBell: I'll add a diagram when I get a chance. The $\binom{n+1}{2}$ examples of the first class come from the fact that $i$ and $j$ can be any two of the integers $0$ through $n$, which is $n+1$ of them. The second class is $n-1$ and not $n$ because the first class already includes the trapezoid $A_0, B_{0, 1}, B_{n, 1}, A_n$, so that $k$ can only range from $2$ through $n$, which is $n-1$ possible values. – Brian Tung Apr 6 '18 at 17:41
• Thanks for the diagram it really eased my understanding but. Where is $j$?. I assume you mean by $i$ the top bottom corner on the left side and $j$ the $1$ seen in the corners starting from $B_{n,1}$?. I can get more or less that $n-1$ is because if in the right side there are $n$ then in the left must be $n-1$ as it is seen in the diagrams. Or is it because of other reason? I'm still confused at how do I know that the total is that specific binomial?. Because is the sum from 1 to n? But if that's the case $n-1$ solely is not the sum of those trapezoids. Can you help me with that? – Chris Steinbeck Bell Apr 6 '18 at 18:32
• @ChrisSteinbeckBell: $i$ and $j$ indicate the upper and lower horizontals of the trapezoid, respectively. Does that help enough? – Brian Tung Apr 6 '18 at 22:33 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363485313247,
"lm_q1q2_score": 0.8748375942123766,
"lm_q2_score": 0.8887588023318196,
"openwebmath_perplexity": 315.9864892003986,
"openwebmath_score": 0.8077467679977417,
"tags": null,
"url": "https://math.stackexchange.com/questions/2725298/how-can-i-find-the-total-number-of-figures-in-a-puzzle-where-they-seem-to-overla"
} |
# Is there a smooth, preferably analytic function that grows faster than any function in the sequence $e^x, e^{e^x}, e^{e^{e^x}}...$
Is there a smooth, preferably analytic function that grows faster than any function in the sequence $$e^x, e^{e^x}, e^{e^{e^x}}$$?
Note: Here the answer is NOT required to be an elementary function, as I know that otherwise the answer would be no.
Edit: Michael has mentioned interpolating a series of functions, but exactly how do I do that in a smooth manner?
• Does this answer your question? A function that grows faster than any function in the sequence $e^x, e^{e^x}, e^{e^{e^x}}$... Jun 9 '20 at 5:21
• This isn't technically a duplicate because I'm not requiring the answer to be an Elementary function. Jun 9 '20 at 5:22
• en.wikipedia.org/wiki/Entire_function#Growth Jun 9 '20 at 5:24
• fair enough, you are also requiring other constraints as well, agreed that this not a duplicate. Jun 9 '20 at 5:32
• You have a sequence of functions $\{f_k(x)\}_{k=1}^{\infty}$ so you can interpolate the points $\{(k, f_k(k))\}_{k=1}^{\infty}$. Jun 9 '20 at 6:02
The link-only comment of metamorphy is actually a full answer, and gives an analytic function, instead of the smooth function of Michael's answer. Instead of hiding behind a link to Wikipedia, I give the construction here with some added detail.
At the end I give a smooth construction as well, and then mention a really cool generalisation I found (Carleman's Theorem.)
## Set-up to apply Wikipedia's construction | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363535858372,
"lm_q1q2_score": 0.8748375914538642,
"lm_q2_score": 0.8887587949656841,
"openwebmath_perplexity": 336.07755486308344,
"openwebmath_score": 0.9779298305511475,
"tags": null,
"url": "https://math.stackexchange.com/questions/3712025/is-there-a-smooth-preferably-analytic-function-that-grows-faster-than-any-funct"
} |
## Set-up to apply Wikipedia's construction
First, as in the comments, get a $$C^0$$ increasing function that's faster than all $$\exp^{\circ n} (x):= \overbrace{\exp \big (\exp\big(\dots\exp}^{n \text{ times}}\big(x\big)\big)\big )$$ For instance, you can define $$g(k) := \exp^{\circ k}(k)$$ for naturals $$k\in\mathbb Z_{\ge 1}$$, and then for points in between integers you linearly interpolate, i.e. for $$t\in(0,1)$$, define $$g(k+t):= (1-t) g(k) + t g(k+1).$$ This is faster in the sense that $$g(x)\ge \exp^{\circ n}(x)$$ for all $$x\ge n$$. This is obvious at the integers, and the fact that all $$\exp^{\circ n}(x)$$ are convex proves the result in between the integers (and the fact that $$\exp^{\circ n}(x) \le \exp^{\circ (n+1)}(x)$$). The goal now is to construct an analytic function that beats $$g$$ pointwise. (If you want a smooth function, search for bump functions.)
## Wikipedia's construction
Now Wikipedia in wiki/Entire_function#Growth suggests we define our analytic function as a power series
$$f(z) = g(2)+ \sum_{k=1}^\infty \left(\frac zk\right)^{n_k}$$ where each $$n_k\in 2\mathbb Z_{\ge 1}$$ is chosen so that $$(n_k)$$ is strictly increasing (in particular then $$n_k\ge k$$) and $$\left(\frac{k+1}k\right)^{n_k}>g(k+2).$$
## Proving correctness
First the root test to check its entire: all coefficients $$a_j$$ of the power series $$f(z)=\sum a_j z^j$$ are either 0 or positive, so we have $$\limsup_{j\to\infty} |a_j|^{1/j} = \lim_{k\to\infty} \frac1{k^{n_k/k}} \le \frac1k \to 0.$$ So the radius of convergence is $$1/\limsup |a_j|^{1/j} = \infty$$. Since $$n_k$$ are even we only need to check the behavior for $$x\ge0$$. Now for each $$0\le x\le 2$$, $$f(x)\ge g(2) \ge g(x)$$, and at points $$j+t$$ for $$t\in[0,1), j\ge 2$$, we have $$f(j+t) \ge \left(\frac{j+t}{j-1}\right)^{n_{j-1}} \ge \left(\frac{j}{j-1}\right)^{n_{j-1}} > g(j+1)> g(j+t).$$
## Extra: smooth answer using bump functions | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363535858372,
"lm_q1q2_score": 0.8748375914538642,
"lm_q2_score": 0.8887587949656841,
"openwebmath_perplexity": 336.07755486308344,
"openwebmath_score": 0.9779298305511475,
"tags": null,
"url": "https://math.stackexchange.com/questions/3712025/is-there-a-smooth-preferably-analytic-function-that-grows-faster-than-any-funct"
} |
## Extra: smooth answer using bump functions
I'll sketch one construction using bump functions here since the OP asked how in an edit. Its probably not the simplest, but I had it lying around for other reasons. Let $$\phi$$ be any smooth, even, non-negative function that is identically one if $$|x|\le 1$$, and zero for $$|x|\ge2$$. Define for $$k\ge 0$$, $$\psi_k(x) := \phi(2^{-k}x) - \phi(2^{-(k+1)} x)$$. Then $$\psi_k$$ is smooth and $$\psi_k$$ is zero outside $$2^{k-1}<|x|<2^{k+1}$$. Define also $$\psi_{-1} = \phi(2^{-1}x)$$. If we also choose $$\phi(x)\le 1$$ , then $$\psi_k\ge 0$$. One checks that for each $$x\in\mathbb R$$, $$\sum_{k\ge -1} \psi_k (x) = 1.$$ In fact, for each $$x$$ only at most 2 of the summands are not zero, and they sum to $$1$$. For instance, $$\phi_{-1}\equiv 1$$ for $$|x|\le 1/2$$, and all other terms are 0. If $$\frac12 < x \le 1$$, then $$\sum_{k\ge -1} \psi_k (x) = \psi_{-1}(x) + \psi_0(x) = \phi(x) = 1,$$ and so on. Now you can just define (remember, for each $$x$$, only 2 summands are nonzero) $$f(x) := \sum_{k\ge-1} \psi_k(x) \exp^{\circ k} (|x|).$$
## Extra 2: Carleman's Theorem
After learning the power series construction above, I also clicked on the Talk page on wikipedia. Apparently something that they were discussing putting into the article is the following great theorem:
Theorem (Carleman) given a complex valued continuous function $$f: \mathbb{R} \rightarrow \mathbb{C}$$ and a strictly positive function $$\epsilon: \mathbb{R} \rightarrow \mathbb{R}_{+}$$, there exists an entire function $$g: \mathbb{C} \rightarrow \mathbb{C}$$ such that $$|f(x)-g(x)|<\epsilon(x)$$ for every $$x \in \mathbb R$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363535858372,
"lm_q1q2_score": 0.8748375914538642,
"lm_q2_score": 0.8887587949656841,
"openwebmath_perplexity": 336.07755486308344,
"openwebmath_score": 0.9779298305511475,
"tags": null,
"url": "https://math.stackexchange.com/questions/3712025/is-there-a-smooth-preferably-analytic-function-that-grows-faster-than-any-funct"
} |
This theorem says in particular that there are entire functions that grow at infinity as fast as you want, but also not too fast (i.e. upper and lower bounds on the growth rate), or wobble in some weird way that you precisely prescribe. Basically, any graph you draw, up to as tiny an error you want, with the error improving as $$|x|\to \infty$$, is the graph of an entire function restricted to $$\mathbb R$$. That to me, is crazy!
This result was proven way back in 1927, which is somehow still under copyright protection so I can't link to a free copy (or read it myself, even if I don't understand the language). If you can find it, you can check "Lectures on Complex Approximation" by Dieter Gaier for a short proof taken from a paper of Kaplan, who attributes it to Brelot. The proof is some sort of mixture of the above two ideas, where a lemma is first proven to make up for the fact that you can't use partitions of unity if you want to construct an entire function. Kaplan's paper is free access and is linked below.
• Carleman, T., Sur un théorème de Weierstraß., Arkiv för Mat. B 20, No. 4, 5 p. (1927). ZBL53.0237.02.
• Gaier, Dieter, Lectures on complex approximation. Transl. from the German by Renate McLaughlin, Boston-Basel-Stuttart: Birkhäuser. XV, 196 p.; DM 94.00 (1987). ZBL0612.30003. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363535858372,
"lm_q1q2_score": 0.8748375914538642,
"lm_q2_score": 0.8887587949656841,
"openwebmath_perplexity": 336.07755486308344,
"openwebmath_score": 0.9779298305511475,
"tags": null,
"url": "https://math.stackexchange.com/questions/3712025/is-there-a-smooth-preferably-analytic-function-that-grows-faster-than-any-funct"
} |
• Kaplan, Wilfred, Approximation by entire functions, Mich. Math. J. 3, 43-52 (1956). ZBL0070.06203.
• For a simple solution we can take say $n_k=g(2k)$, giving us $f(z) = 16+ \sum_{k=1}^\infty \left(\frac zk\right)^{ \exp^{\circ 2k}(2k)}$ Jun 11 '20 at 9:31
• @blademan9999 yup, though I believe this is specific to our question's $g$. I made my answer longer(too long? oh well) with two other solutions to the question (a smooth construction, and a reference to a high power theorem) Jun 11 '20 at 11:40
• In Carlemans theorem, it may be good to clarify that $f$ is assumed to be continuous. (For example, the conclusion would not hold for the Dirichlet function.) Jun 11 '20 at 23:09
• @BoazMoerman oops, thank you for the correction! Jun 11 '20 at 23:14
This gives details to my comment: Let $$\{f_k\}_{k=1}^{\infty}$$ be a sequence of functions $$f_k:\mathbb{R}\rightarrow\mathbb{R}$$ that satisfy the following for all $$k \in \{1, 2, 3, ...\}$$:
1. $$f_k(x)>0 \quad \forall x>0$$.
2. $$f_k(x) \leq f_{k+1}(x) \quad \forall x >0$$
3. $$f_k(x)$$ is nondecreasing in $$x$$.
4. $$\lim_{x\rightarrow\infty} \frac{f_{k+1}(x-1)}{f_k(x)} = \infty$$
You can verify that your functions satisfy these properties. Note that: $$f_1(1) \leq f_2(2) \leq f_3(3) \leq f_4(4) \leq ...$$ So we can define $$g:\mathbb{R}\rightarrow\mathbb{R}$$ as any function that is nondecreasing and that smoothly interpolates the points $$\{(k, f_k(k))\}_{k=1}^{\infty}$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363535858372,
"lm_q1q2_score": 0.8748375914538642,
"lm_q2_score": 0.8887587949656841,
"openwebmath_perplexity": 336.07755486308344,
"openwebmath_score": 0.9779298305511475,
"tags": null,
"url": "https://math.stackexchange.com/questions/3712025/is-there-a-smooth-preferably-analytic-function-that-grows-faster-than-any-funct"
} |
Then for any positive integer $$m$$ and any $$x >m+1$$ we have: \begin{align} \frac{g(x)}{f_m(x)} &\overset{(a)}{\geq} \frac{g(\lfloor x\rfloor)}{f_m(x)} \\ &= \frac{f_{\lfloor x\rfloor}(\lfloor x\rfloor)}{f_m(x)} \\ &\overset{(b)}{\geq} \frac{f_{m+1}(\lfloor x\rfloor)}{f_m(x)} \\ &\overset{(c)}{\geq} \frac{f_{m+1}(x-1)}{f_m(x)} \end{align} where (a) uses the fact that $$g$$ is nondecreasing; (b) holds because $$\lfloor x\rfloor \geq m+1$$ together with property 2; (c) holds by property 3. Taking a limit as $$x\rightarrow\infty$$ and using property 4 gives $$\lim_{x\rightarrow\infty} \frac{g(x)}{f_m(x)} \geq \lim_{x\rightarrow\infty} \frac{f_{m+1}(x-1)}{f_m(x)} = \infty$$ Thus, $$g$$ grows faster than any of the $$f_m(x)$$ functions. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363535858372,
"lm_q1q2_score": 0.8748375914538642,
"lm_q2_score": 0.8887587949656841,
"openwebmath_perplexity": 336.07755486308344,
"openwebmath_score": 0.9779298305511475,
"tags": null,
"url": "https://math.stackexchange.com/questions/3712025/is-there-a-smooth-preferably-analytic-function-that-grows-faster-than-any-funct"
} |
# How do I find the intersection of a closed 3D curve given by numerical data with a specified plane?
I have a list of 3D data points which form a closed curve. My own data can't be easily generated analytically, but the qualitative behaviour is well represented by a parametric curve families such as {Sin[a1 t] Cos[a2 t], Sin[a3 t] Sin[a4 t], Sin[a5 t]} where the aN are constants. Sample data is given by:
dt = Table[{Sin[3 t] Cos[1 t], Sin[t] Sin[5 t], Sin[2 t]}, {t, -10, 10, 0.005}];
p1 = ListPointPlot3D[dt]
I want to solve for the points where this closed 3D curve cuts a plane I specify but I'm am unable to do it. For example a plane at z = 0.5 as shown here:
p2 = Plot3D[-0.5, {x, -1, 1}, {y, -1, 1}]
Show[p1, p2]
No approach I've tried so far has worked e.g. Interpolation, Nearest to -0.5, use of Select and Drop.
The data does wrap around itself multiple times and getting slightly different solution points on each pass due to differences in the stepsize or something like that is not a problem.
Related I think to this question
In brief: How can I find where a closed curve given by numerical data points cuts a specified plane? Any help you can give is much appreciated. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9489172644875642,
"lm_q1q2_score": 0.874827545602009,
"lm_q2_score": 0.9219218348550491,
"openwebmath_perplexity": 3996.142325929198,
"openwebmath_score": 0.2239972949028015,
"tags": null,
"url": "http://mathematica.stackexchange.com/questions/26818/how-do-i-find-the-intersection-of-a-closed-3d-curve-given-by-numerical-data-with"
} |
-
Since it's a closed curve, you could either use periodic splines, periodic Hermite interpolants, or a Fourier fit for your closed curve, and then equate the $z$-component of your curve to the value of your cutting plane. – J. M. Jun 11 '13 at 14:21
Why do you sample over such a broad interval? -Pi to Pi would suffice. – BoLe Jun 11 '13 at 14:51
@BoLe, there's actually a good question in there: how might one know that his data points were sampled over more than one period? – J. M. Jun 11 '13 at 15:25
Related: 10640. Use zeroCrossings[Last /@ dt - 0.5] or zeroCrossings[plane @@@ dt], where plane[x, y, z] == 0 is the equation of the plane, to find the points between which the crossing occurs. – Michael E2 Jun 11 '13 at 19:42
@0x4A4D Thanks for the suggestion and the fast response yesterday. Very useful stuff and it got me quickly into some experimenting that did achieved some success. – fizzics Jun 12 '13 at 8:42
We can use one of the zeroCrossing functions from the answers to this question to construct solutions to where an ordered list of points representing a curve crosses a surface $f(x,y,z)=0$. There are some very nice answers to the linked question with good explanations of the solutions. Use one that returns an interval of indices where the crossing takes place ,such as whuber's answer
zeroCrossings[l_List] := Module[{t, u, v},
t = {Sign[l], Range[Length[l]]} // Transpose; (*List of-1,0,1 only*)
u = Select[t, First[#] != 0 &]; (*Ignore zeros*)
v = Split[u, First[#1] == First[#2] &]; (*Group into runs of+and- values*)
{Most[Max[#[[All, 2]]] & /@ v], Rest[Min[#[[All, 2]]] & /@ v]} // Transpose]
or the SparseArray version in Mr.Wizard's answer, which seems to be quite efficient.
zeroCrossings[l_List] :=
With[{c = SparseArray[l]["AdjacencyLists"]}, {c[[#]], c[[# + 1]]}\[Transpose] &@
The OP's curve points, for which I suppose the corresponding values of t may be lost or unknown: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9489172644875642,
"lm_q1q2_score": 0.874827545602009,
"lm_q2_score": 0.9219218348550491,
"openwebmath_perplexity": 3996.142325929198,
"openwebmath_score": 0.2239972949028015,
"tags": null,
"url": "http://mathematica.stackexchange.com/questions/26818/how-do-i-find-the-intersection-of-a-closed-3d-curve-given-by-numerical-data-with"
} |
The OP's curve points, for which I suppose the corresponding values of t may be lost or unknown:
dt = Table[{Sin[3 t] Cos[1 t], Sin[t] Sin[5 t], Sin[2 t]}, {t, -10, 10, 0.005}];
To help you understand the functions below, I first give the output of zeroCrossings. For the OP's example, we would be interest when z - 0.5 is zero. We translate down the z coordinates of points dt by 0.5 and search for the zero crossings of the translated z coordinates.
zeroCrossings[Last /@ dt - 0.5]
{{168, 169}, {377, 378}, {796, 797}, {1006, 1007}, {1425, 1426},
{1634, 1635}, {2053, 2054}, {2262, 2263}, {2681, 2682}, {2891, 2892},
{3309, 3310}, {3519, 3520}, {3938, 3939}}
Each pair are the indices of points lying on either side of z == 0.5.
Below I use linear interpolation to find the crossing point, which seems simplest. The function zeroPt returns the point where f is zero corresponding to the zero crossing interval crossIDX. The function zeroTime returns the "time", interpolated between the indices of the crossing.
zeroPt[pts_, crossIDX_, f_] /; Length[crossIDX] >= 3 :=
Mean[pts ~Part~ crossIDX[[2 ;; -2]]]; (* unlikely >= 4 - return all zero points? *)
zeroPt[pts_, crossIDX_, f_] /; Length[crossIDX] == 2 :=
(#2 f[#1] - #1 f[#2])/(f[#1] - f[#2]) & @@ pts[[crossIDX]];
zeroTime[pts_, idx_, f_] /; Length[idx] >= 3 := Mean[idx];
zeroTime[pts_, idx_, f_] /; Length[idx] == 2 := First[idx] + Rescale[0., f /@ pts[[idx]]];
### OP's Example
zeroTime[dt, #, Last[#] - 0.5 &] & /@ zeroCrossings[Last /@ dt - 0.5]
{168.405, 377.843, 796.723, 1006.16, 1425.04, 1634.48, 2053.36, 2262.8,
2681.68, 2891.12, 3310., 3519.44, 3938.32}
int = zeroPt[dt, #, Last[#] - 0.5 &] & /@ zeroCrossings[Last /@ dt - 0.5] | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9489172644875642,
"lm_q1q2_score": 0.874827545602009,
"lm_q2_score": 0.9219218348550491,
"openwebmath_perplexity": 3996.142325929198,
"openwebmath_score": 0.2239972949028015,
"tags": null,
"url": "http://mathematica.stackexchange.com/questions/26818/how-do-i-find-the-intersection-of-a-closed-3d-curve-given-by-numerical-data-with"
} |
int = zeroPt[dt, #, Last[#] - 0.5 &] & /@ zeroCrossings[Last /@ dt - 0.5]
{{0.682995, 0.249992, 0.5}, {-0.183003, 0.249985, 0.5}, {0.682998, 0.249994, 0.5},
{-0.183003, 0.249984, 0.5}, {0.68301, 0.249999, 0.5}, {-0.182995, 0.24997, 0.5},
{0.682996, 0.249993, 0.5}, {-0.183001, 0.249981, 0.5}, {0.682997, 0.249993, 0.5},
{-0.183005, 0.249988, 0.5}, {0.683012, 0.25, 0.5}, {-0.182995, 0.249971, 0.5},
{0.682997, 0.249993, 0.5}}
If the curve is an orbit or other periodic trajectory, then the one might be interested in the unique intersections. One can gather the clusters of points with this function and take the Mean to approximate the intersection.
clusters[pts_, dist_] := Gather[pts, EuclideanDistance[##] < dist &];
Example:
Mean /@ clusters[int, 0.001]
{{0.683001, 0.249995, 0.5}, {-0.183, 0.24998, 0.5}}
A plot of the results:
Graphics3D[{
{Opacity[0.1], PointSize[Small], Point @ dt},
{Red, PointSize[Medium], Point[Mean /@ clusters[int, 0.001]]}},
Axes -> True]
### Arbitrary planes
We can apply the method to arbitrary planes. A function plane defining the plane, plane[x, y, z] == 0, is applied to the points and we find where the values cross zero; the function is needed in both zeroCrossings and zeroPt.
Here we will use ConvexHull to show the plane via a polygon containing all the intersection points. We have to project the points onto a plane, which must be chose judiciously so that the projected points are not all collinear, if possible.
Needs["ComputationalGeometry"]
plane[x_, y_, z_] := 2 x - 3 y - 2 z + 0.5;
With[{intersections = zeroPt[dt, #, plane @@ # &] & /@ zeroCrossings[plane @@@ dt]},
Graphics3D[{
{Lighter@Blue, PointSize[Small], Point@dt},
{Darker@Red, PointSize[Large], Point[intersections],
Red, Opacity[0.6],
Polygon[#[[ConvexHull[Most /@ #]]] &[Mean /@ clusters[intersections, 0.001]]]}},
Axes -> True]
]
### Other surfaces
The method works to find where any function of the points crosses zero (in this case surf). | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9489172644875642,
"lm_q1q2_score": 0.874827545602009,
"lm_q2_score": 0.9219218348550491,
"openwebmath_perplexity": 3996.142325929198,
"openwebmath_score": 0.2239972949028015,
"tags": null,
"url": "http://mathematica.stackexchange.com/questions/26818/how-do-i-find-the-intersection-of-a-closed-3d-curve-given-by-numerical-data-with"
} |
The method works to find where any function of the points crosses zero (in this case surf).
param[u_, v_] := {u v, u, 2 v^2 - 1};
surf[x_, y_, z_] := Evaluate[Subtract @@ Eliminate[{x, y, z} == param[u, v], {u, v}]];
Show[
With[{intersections = zeroPt[dt, #, surf @@ # &] & /@ zeroCrossings[surf @@@ dt]},
Graphics3D[{
{Lighter@Blue, PointSize[Small], Point@dt},
{Red, PointSize[Large],
Point[Mean /@ clusters[intersections, 0.001]]}}, Axes -> True]],
ParametricPlot3D[param[u, v], {u, -1, 1}, {v, -1, 1},
MeshStyle -> Gray, PlotStyle -> Opacity[0.3]]
]
-
+1 Thank you very much for this. The code up to and including the clusters function really solves my problem. The extension to intersections with arbitrary planes and surfaces is also very instructional and useful. – fizzics Jun 13 '13 at 9:04
If you start by interpolating the each component of the curve you can easily solve for a simple plane like z=0.5:
dt = Table[{Sin[3 t] Cos[1 t], Sin[t] Sin[5 t], Sin[2 t]}, {t, -10, 10, 0.005}];
ip = Interpolation[dt[[All, #]]] & /@ {1, 2, 3};
FindRoot[ip[[3]][t] == 0.5, {t, 10}] (* ip[[3]] is the z component of the curve*)
(* {t -> 168.404} *)
#[t /. %] & /@ ip
(* {0.683013, 0.25, 0.5} *)
For other planes you can change the FindRoot criteria, for instance FindRoot[2 ip[[3]][t] + ip[[2]][t] == 0.5, {t, 10}]
-
Thanks for that. I had trouble finding all of the crossings though using FindRoot. I incorporated it into a forward seach style algorithm but I was still missing some points. I also tried to use FindInstance. Thanks for the answer. +1 – fizzics Jun 12 '13 at 9:00
Defining a function P[x_,y_,z_] := a x + b y + c z for suitable constant values a, b, c, the plane is the set of all points P[x, y, z] == 0, i.e. points that satisfy this equation are on the plane. Points for which P[x, y, z] > 0 are on one side of the plane, while those giving P[x, y, z] < 0 are on the other side. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9489172644875642,
"lm_q1q2_score": 0.874827545602009,
"lm_q2_score": 0.9219218348550491,
"openwebmath_perplexity": 3996.142325929198,
"openwebmath_score": 0.2239972949028015,
"tags": null,
"url": "http://mathematica.stackexchange.com/questions/26818/how-do-i-find-the-intersection-of-a-closed-3d-curve-given-by-numerical-data-with"
} |
So, the points you want are those on your curve with P[x, y, z] == 0, or an interpolation between any successive points on your curve that give opposite signs for P`.
- | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9489172644875642,
"lm_q1q2_score": 0.874827545602009,
"lm_q2_score": 0.9219218348550491,
"openwebmath_perplexity": 3996.142325929198,
"openwebmath_score": 0.2239972949028015,
"tags": null,
"url": "http://mathematica.stackexchange.com/questions/26818/how-do-i-find-the-intersection-of-a-closed-3d-curve-given-by-numerical-data-with"
} |
# Determining if a symmetric matrix is positive definite
I have a symmetric matrix where all non-diagonal elements are positive and identical, and all diagonal elements are identical as well. For example, the $3 \times 3$ version of this matrix has the following form: $$\left( \begin{array}{ccc} 2a+b & a & a \\ a & 2a+b & a \\ a & a & 2a+b \end{array} \right)$$
Note that $a>0\ , b>0$. For such a simple form, is there an easy way of determining that the above matrix is positive definite in the general $n \times n$ case? I'd like to show that the matrix is still positive definite when the dimension is higher. Thank you.
• The criterion of Sylvester is well-adapted to your case. – Giuseppe Negro May 24 '18 at 21:37
• @GiuseppeNegro Beat me to it. – KennyB May 24 '18 at 21:53
Yes. Your matrix can be written as $$(a+b)I + a ee^T$$ where $I$ is the identity matrix and $e$ is the vector of ones. This is a sum of a symmetric positive definite (SPD) matrix and a symmetric positive semidefinite matrix. Hence it is SPD.
• Thank you! This is very helpful – SelinH May 24 '18 at 21:57
• It would be cool to actually show that $ee^T$ is positive semidefinite: $x^T e e^T x = (e^Tx)^T(e^Tx)$; since $e^Tx$ is a scalar $(e^T x)^T = e^T x$ whence $x^T e e^T x = (e^T x)^2 \ge 0$. Endorsed! Cheers! – Robert Lewis May 24 '18 at 23:18
• @SelinH You are very welcome. – Carl Christian May 25 '18 at 9:37
• @RobertLewis Thank your for your kind words. I often find it difficult to select the right level of detail. – Carl Christian May 25 '18 at 9:43
In addition to Carl's answer (+1) you can use the Gershgorin circle theorem which is one I'll often try when I see diagonally dominant matrices like this one.
For each row, the sum of the absolute values of the off-diagonal entries is $2a$. The theorem then says that every eigenvalue is in a closed disc of radius $2a$ centered at the diagonal elements $2a + b$, so for any eigenvalue $\lambda$ we have $\lambda \geq b > 0$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9859363737832231,
"lm_q1q2_score": 0.8747272887546196,
"lm_q2_score": 0.8872046026642944,
"openwebmath_perplexity": 158.49397296301,
"openwebmath_score": 0.8519240021705627,
"tags": null,
"url": "https://math.stackexchange.com/questions/2794934/determining-if-a-symmetric-matrix-is-positive-definite"
} |
$$\begin{bmatrix} 2a+b & a & a\\ a & 2a+b & a\\ a & a & 2a+b\end{bmatrix} = (a+b) \, \mathrm I_3 + a \, 1_3 1_3^\top = (a+b) \, \mathrm I_3 + 3a \left(\frac{\, 1_3}{\sqrt{3}}\right) \left(\frac{\, 1_3}{\sqrt{3}}\right)^\top$$
Hence, the eigenvalues are $4a + b$ and $a+b$, with multiplicities $1$ and $2$, respectively. Since $a, b > 0$, both eigenvalues are positive, i.e., the given symmetric matrix is positive definite. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9859363737832231,
"lm_q1q2_score": 0.8747272887546196,
"lm_q2_score": 0.8872046026642944,
"openwebmath_perplexity": 158.49397296301,
"openwebmath_score": 0.8519240021705627,
"tags": null,
"url": "https://math.stackexchange.com/questions/2794934/determining-if-a-symmetric-matrix-is-positive-definite"
} |
NumPy provides a mechanism for performing mathematical operations on arrays of unequal shapes:
>>> import numpy as np
# a shape-(3, 4) array
>>> x = np.array([[-0. , -0.1, -0.2, -0.3],
... [-0.4, -0.5, -0.6, -0.7],
... [-0.8, -0.9, -1. , -1.1]])
# a shape-(4,) array
>>> y = np.array([1, 2, 3, 4])
# multiplying a shape-(4,) array with a shape-(3, 4) array
# y is multiplied by each row of x
>>> x * y
array([[-0. , -0.2, -0.6, -1.2],
[-0.4, -1. , -1.8, -2.8],
[-0.8, -1.8, -3. , -4.4]])
In effect, NumPy treated y as if its contents had been broadcasted along a new dimension, such that y was a shape-(3, 4) 2D array, which makes it compatible for multiplying with x:
$$\left( \begin{array}{*{3}{X}} -0.0 & -0.1 & -0.2 & -0.3 \\ -0.4 & -0.5 & -0.6 & -0.7 \\ -0.8 & -0.9 & -1.0 & -1.1 \end{array} \right) % \cdot \left( \begin{array}{*{3}{X}} 1 & 2 & 3 & 4 \end{array}\right) % \rightarrow \left( \begin{array}{*{3}{X}} -0.0 & -0.1 & -0.2 & -0.3 \\ -0.4 & -0.5 & -0.6 & -0.7 \\ -0.8 & -0.9 & -1.0 & -1.1 \end{array} \right) % \cdot \left( \begin{array}{*{3}{X}} 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \end{array}\right) \$$
It is important to note that NumPy doesn’t really create this broadcasted version of y behind the scenes; it is able to do the necessary computations without having to redundantly copy its contents into a shape-(3,4) array. Doing so would be a waste of memory and computation. That being said, this replication process conveys exactly the mathematics of broadcast operations between arrays; thus the preceding diagram reflects how you should always envision broadcasting.
Broadcasting is not reserved for operations between 1-D and 2-D arrays, and furthermore both arrays in an operation may undergo broadcasting. That being said, not all pairs of arrays are broadcast-compatible. | {
"domain": "pythonlikeyoumeanit.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985936373783223,
"lm_q1q2_score": 0.8747272740523564,
"lm_q2_score": 0.8872045877523147,
"openwebmath_perplexity": 2337.0202310202303,
"openwebmath_score": 0.5890757441520691,
"tags": null,
"url": "http://www.pythonlikeyoumeanit.com/Module3_IntroducingNumpy/Broadcasting.html"
} |
# Broadcast multiplications between a
# shape-(3, 1, 2) array and a shape-(3, 1)
# array.
>>> x = np.array([[[0, 1]],
...
... [[2, 3]],
...
... [[4, 5]]])
>>> y = np.array([[ 0],
... [ 1],
... [-1]])
# shape-(3, 1, 2) broadcast-multiply with
# shape-(3, 1) produces shape-(3, 3, 2)
>>> x * y
array([[[ 0, 0],
[ 0, 1],
[ 0, -1]],
[[ 0, 0],
[ 2, 3],
[-2, -3]],
[[ 0, 0],
[ 4, 5],
[-4, -5]]])
# an example of broadcast-incompatible arrays
# a shape-(2,) array with a shape-(3,) array
>>> np.array([1, 2]) * np.array([0, 1, 2])
ValueError: operands could not be broadcast together with shapes (2,) (3,)
Array Broadcasting is a mechanism used by NumPy to permit vectorized mathematical operations between arrays of unequal, but compatible shapes. Specifically, an array will be treated as if its contents have been replicated along the appropriate dimensions, such that the shape of this new, higher-dimensional array suits the mathematical operation being performed.
We will now summarize the rules that determine if two arrays are broadcast-compatible with one another, and what the shape of the resulting array will be after the mathematical operation between the two arrays is performed.
Array broadcasting cannot accommodate arbitrary combinations of array shapes. For example, a (7,5)-shape array is incompatible with a shape-(11,3) array. Trying to add two such arrays would produce a ValueError. The following rules determine if two arrays are broadcast-compatible:
To determine if two arrays are broadcast-compatible, align the entries of their shapes such that their trailing dimensions are aligned, and then check that each pair of aligned dimensions satisfy either of the following conditions:
• the aligned dimensions have the same size
• one of the dimensions has a size of 1
The two arrays are broadcast-compatible if either of these conditions are satisfied for each pair of aligned dimensions. | {
"domain": "pythonlikeyoumeanit.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985936373783223,
"lm_q1q2_score": 0.8747272740523564,
"lm_q2_score": 0.8872045877523147,
"openwebmath_perplexity": 2337.0202310202303,
"openwebmath_score": 0.5890757441520691,
"tags": null,
"url": "http://www.pythonlikeyoumeanit.com/Module3_IntroducingNumpy/Broadcasting.html"
} |
Note that it is okay to have one array with a higher-dimensionality and thus to have “dangling” leading dimensions. Any size-1 dimension or “missing” dimension will be filled-in by broadcasting the content of that array.
Considering the example from the preceding subsection, let’s see that the shape-(4,3) and shape-(3,) arrays satisfy these rules for broadcast-compatibility:
array-1: 4 x 3
array-2: 3
result-shape: 4 x 3
Let’s look an assortment of pairs of array-shapes and see whether or not they are broadcast-compatible:
array-1: 8
array-2: 5 x 2 x 8
result-shape: 5 x 2 x 8
array-1: 5 x 2
array-2: 5 x 4 x 2
result-shape: INCOMPATIBLE
array-1: 4 x 2
array-2: 5 x 4 x 2
result-shape: 5 x 4 x 2
array-1: 8 x 1 x 3
array-2: 8 x 5 x 3
result-shape: 8 x 5 x 3
array-1: 5 x 1 x 3 x 2
array-2: 9 x 1 x 2
result-shape: 5 x 9 x 3 x 2
array-1: 1 x 3 x 2
array-2: 8 x 2
result-shape: INCOMPATIBLE
array-1: 2 x 1
array-2: 1
result-shape: 2 x 1
NumPy provides the function broadcast_to, which can be used to broadcast an array to a specified shape. This can help us build our intuition for broadcasting. Let’s broadcast a shape-(3,4) array to a shape-(2,3,4) array:
# Demonstrating np.broadcast_to
>>> x = np.array([[ 0, 1, 2, 3],
... [ 4, 5, 6, 7],
... [ 8, 9, 10, 11]])
# Explicitly broadcast a shape-(3,4) array
# to a shape-(2,3,4) array.
array([[[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11]],
[[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11]]])
Given the following pairs of array-shapes, determine what the resulting broadcasted shapes will be. Indicate if a pair is broadcast-incompatible.
1. 7 x 2 with 7
2. 4 with 3 x 4
3. 1 x 3 x 1 with 8 x 1 x 1
4. 9 x 2 x 5 with 2 x 5
5. 3 with 3 x 3 x 2
## A Simple Application of Array Broadcasting¶ | {
"domain": "pythonlikeyoumeanit.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985936373783223,
"lm_q1q2_score": 0.8747272740523564,
"lm_q2_score": 0.8872045877523147,
"openwebmath_perplexity": 2337.0202310202303,
"openwebmath_score": 0.5890757441520691,
"tags": null,
"url": "http://www.pythonlikeyoumeanit.com/Module3_IntroducingNumpy/Broadcasting.html"
} |
## A Simple Application of Array Broadcasting¶
Here we provide a simple real-world example where broadcasting is useful. Suppose you have a grade book for 6 students, each of whom have taken 3 exams; naturally, you store these scores in a shape-(6,3) array:
# grades for 6 students who have taken 3 exams
# axis-0 (rows): student
# axis-1 (columns): exams
>>> import numpy as np
>>> grades = np.array([[ 0.79, 0.84, 0.84],
... [ 0.87, 0.93, 0.78],
... [ 0.77, 1.00, 0.87],
... [ 0.66, 0.75, 0.82],
... [ 0.84, 0.89, 0.76],
... [ 0.83, 0.71, 0.85]])
We might be interested to see how each of these scores compare to the mean score for that specific exam. Based on our discussion from the last section, we can easily compute the mean-score for each exam (rounded to 2 decimal places):
# compute the mean score for each exam (rounded to 2 decimal places)
>>> mean_exam_scores = np.round(mean_exam_scores, 2)
>>> mean_exam_scores
array([ 0.79, 0.85, 0.82])
grades is a shape-(6,3) array and mean_exam_scores is a shape-(3,) array, and we want to compute the offset of each exam score from its respective mean. At first glance, it seems like we will have to loop over each row of our grades array and subtract from it the mean_exam_scores, to compute the offset of each exam score from the respective mean-score:
# Using a for-loop to compute score offsets.
# Shape-(6,3) array that will store (score - mean) for each
# exam score.
# iterates over each row of grades
# scores_per_student is a shape-(3,) array of exam scores
# for a given student. This matches the shape of
# mean_exam_scores, thus we can perform this subtraction
score_offset[n] = scores_per_student - mean_exam_scores | {
"domain": "pythonlikeyoumeanit.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985936373783223,
"lm_q1q2_score": 0.8747272740523564,
"lm_q2_score": 0.8872045877523147,
"openwebmath_perplexity": 2337.0202310202303,
"openwebmath_score": 0.5890757441520691,
"tags": null,
"url": "http://www.pythonlikeyoumeanit.com/Module3_IntroducingNumpy/Broadcasting.html"
} |
Given our discussion of vectorized operations from the last section, you should recoil at the sight of a for-loop in code that is performing array-arithmetic. We might as well get out our abacuses and spreadsheets at this point. Fortunately, we can make use of broadcasting to compute these offsets in a concise, vectorized way:
# Using broadcasting to subtract a shape-(3,) array
# from a shape-(6,3) array.
>>> score_offset = grades - mean_exam_scores
>>> score_offset
array([[ 0. , -0.01, 0.02],
[ 0.08, 0.08, -0.04],
[-0.02, 0.15, 0.05],
[-0.13, -0.1 , 0. ],
[ 0.05, 0.04, -0.06],
[ 0.04, -0.14, 0.03]])
According to the broadcasting rules detailed above, when you invoke grades - mean_exam_scores, NumPy will recognize that mean_exam_scores has the same shape as each row of grades and thus it will apply the subtraction operation on each row of grades with mean_exam_scores. In effect, the content of mean_exam_scores has been broadcasted to fill a shape-(6,3) array, so that the element-wise subtraction can be performed. Again, we emphasize that NumPy doesn’t actually unnecessarily replicate the data of mean_exam_scores, and that this model of broadcasting merely conveys the mathematical process that is transpiring.
Generate a random array of 10,000 2D points using np.random.rand. Compute the “center of mass” of these points, which is simply the average x-coordinate and the average y-coordinate of these 10,000 points. Then, use broadcasting to compute the shape-(10000,2) array that stores the position of the points relative to the center of mass. For example, if the center of mass is $$(0.5, 1)$$, and the absolute position of a point is $$(2, 3)$$, then the position of that point relative to the center of mass is simply $$(2, 3) - (0.5, 1) = (1.5, 2)$$
## Size-1 Axes & The newaxis Object¶
### Inserting Size-1 Dimensions into An Array¶ | {
"domain": "pythonlikeyoumeanit.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985936373783223,
"lm_q1q2_score": 0.8747272740523564,
"lm_q2_score": 0.8872045877523147,
"openwebmath_perplexity": 2337.0202310202303,
"openwebmath_score": 0.5890757441520691,
"tags": null,
"url": "http://www.pythonlikeyoumeanit.com/Module3_IntroducingNumpy/Broadcasting.html"
} |
## Size-1 Axes & The newaxis Object¶
### Inserting Size-1 Dimensions into An Array¶
As conveyed by the broadcasting rules, dimensions of size-1 are special in that they can be broadcasted to any size. Here we will learn about introducing size-1 dimensions into an array, for the purpose of tailoring its shape for broadcasting.
You can introduce size-1 dimensions to an array without changing the overall size (i.e. total number of entries in an array. Thus we are free to add size-1 dimensions to an array via the reshape function. Let’s reshape a shape-(3,) array into a shape-(1, 3, 1, 1) array:
>>> import numpy as np
# Reshaping an array to introduce size-1 dimensions.
# The size of the array is 3, regardless of introducing
# these extra size-1 dimensions.
>>> np.array([1, 2, 3]).reshape(1, 3, 1, 1)
array([[[[1]],
[[2]],
[[3]]]])
Thus the 1-D array with three entries has been reshaped to possess 4-dimensions: “one stack of three sheets, each containing a single row and column”. There is another way to introduce size-1 dimensions. NumPy provides the newaxis object for this purpose. Let’s immediately demonstrate how np.newaxis can be used:
# demonstrating the usage of the numpy.newaxis object
>>> x= np.array([1, 2, 3])
>>> y= x[np.newaxis, :, np.newaxis, np.newaxis]
>>> y
array([[[[1]],
[[2]],
[[3]]]])
>>> y.shape
(1, 3, 1, 1)
Indexing x as x[np.newaxis, :, np.newaxis, np.newaxis] returns a “view” of x as a 4D array with size-1 dimensions inserted as axes 0, 2, and 3. The resulting array is not a copy of x; it points to the exact same data as x, but merely with a different indexing layout. This is no different than what we achieved via reshaping: x.reshape(1, 3, 1, 1).
### Utilizing Size-1 Dimensions for Broadcasting¶
Moving on to a more pressing matter: why would we ever want to introduce these spurious dimensions into an array? Let’s take an example to demonstrate the utility of size-1 dimensions. | {
"domain": "pythonlikeyoumeanit.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985936373783223,
"lm_q1q2_score": 0.8747272740523564,
"lm_q2_score": 0.8872045877523147,
"openwebmath_perplexity": 2337.0202310202303,
"openwebmath_score": 0.5890757441520691,
"tags": null,
"url": "http://www.pythonlikeyoumeanit.com/Module3_IntroducingNumpy/Broadcasting.html"
} |
Suppose that we want to multiply all possible pairs of entries between two arrays: array([1, 2, 3]) with array([4, 5, 6, 7]). That is, we want to perform twelve multiplications, and have access to each result. At first glance, combining a shape-(3,) array with a shape-(4,) array seems inadmissible for broadcasting; we seem to be doomed to perform nested for-loops like a bunch of cavemen and cavewomen. Fortunately, we can make clever use of size-1 dimensions so that we can perform this computation in a vectorized way.
Let’s introduce size-1 dimensions into x:
# Inserting size-1 dimensions into x and y in
>>> x_1d = np.array([1, 2, 3])
>>> x = x_1d.reshape(3, 1)
>>> x
array([[1],
[2],
[3]])
>>> y = np.array([4, 5, 6, 7])
x is now a shape-(3, 1) array and y is a shape-(4,) array. According to the broadcasting rules, these arrays are broadcast-compatible and will multiply to produce a shape-(3, 4) array. Let’s see that multiplying these two arrays will exactly produce the twelve numbers that we are after:
# broadcast-multiplying x and y
>>> x * y
array([[ 4, 5, 6, 7],
[ 8, 10, 12, 14],
[12, 15, 18, 21]])
$$\left( \begin{array}{*{1}{X}} 1 \\ 2 \\ 3 \end{array} \right) % \cdot \left( \begin{array}{*{4}{X}} 4 & 5 & 6 & 7 \end{array}\right) % \rightarrow \left( \begin{array}{*{4}{X}} 1 & 1 & 1 & 1 \\ 2 & 2 & 2 & 2 \\ 3 & 3 & 3 & 3 \end{array}\right) % \cdot \left( \begin{array}{*{4}{X}} 4 & 5 & 6 & 7 \\ 4 & 5 & 6 & 7 \\ 4 & 5 & 6 & 7 \end{array}\right) % = \left( \begin{array}{*{4}{X}} 1\cdot4 & 1\cdot5 & 1\cdot6 & 1\cdot7 \\ 2\cdot4 & 2\cdot5 & 2\cdot6 & 2\cdot7 \\ 3\cdot4 & 3\cdot5 & 3\cdot6 & 3\cdot7 \end{array}\right) \$$
See that entry (i, j) of the resulting array corresponds to x_1d[i] * y[j]. | {
"domain": "pythonlikeyoumeanit.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985936373783223,
"lm_q1q2_score": 0.8747272740523564,
"lm_q2_score": 0.8872045877523147,
"openwebmath_perplexity": 2337.0202310202303,
"openwebmath_score": 0.5890757441520691,
"tags": null,
"url": "http://www.pythonlikeyoumeanit.com/Module3_IntroducingNumpy/Broadcasting.html"
} |
See that entry (i, j) of the resulting array corresponds to x_1d[i] * y[j].
Through the use of simple reshaping, shrewdly inserting size-1 dimensions allowed us to coerce NumPy into performing exactly the combination-multiplication that we desired. Furthermore, a keen understanding of what broadcasting is provides us with a clear interpretation of the structure of the result of this calculation. That is, if I reshape x to be a shape-$$(M, 1)$$ array, and y is a shape-$$(N,)$$ array, then (according to broadcasting rules) x * y would produce a shape-$$(M, N)$$ array storing the product of each of x’s $$M$$ numbers with each of y’s $$N$$ numbers.
Given the shape-(2,3,4) array:
>>> x = np.array([[[ 0, 1, 2, 3],
... [ 4, 5, 6, 7],
... [ 8, 9, 10, 11]],
...
... [[12, 13, 14, 15],
... [16, 17, 18, 19],
... [20, 21, 22, 23]]])
Normalize x such that each of its rows, within each sheet, will sum to a value of 1. Make use of the sequential function np.sum, which should be called only once, and broadcast-division.
A digital image is simply an array of numbers, which instructs a grid of pixels on a monitor to shine light of specific colors, according to the numerical values in that array.
An RGB-image can thus be stored as a 3D NumPy array of shape-$$(V, H, 3)$$. $$V$$ is the number of pixels along the vertical direction, $$H$$ is the number of pixels along the horizontal, and the size-3 dimension stores the red, blue, and green color values for a given pixel. Thus a $$(32, 32, 3)$$ array would be a 32x32 RBG image.
You often work with a collection of images. Suppose we want to store N images in a single array; thus we now consider a 4D shape-(N, V, H, 3) array. For the sake of convenience, let’s simply generate a 4D-array of random numbers as a placeholder for real image data. We will generate 500, 48x48 RGB images:
>>> images = np.random.rand(500, 48, 48, 3) | {
"domain": "pythonlikeyoumeanit.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985936373783223,
"lm_q1q2_score": 0.8747272740523564,
"lm_q2_score": 0.8872045877523147,
"openwebmath_perplexity": 2337.0202310202303,
"openwebmath_score": 0.5890757441520691,
"tags": null,
"url": "http://www.pythonlikeyoumeanit.com/Module3_IntroducingNumpy/Broadcasting.html"
} |
>>> images = np.random.rand(500, 48, 48, 3)
Using the sequential function np.max and broadcasting, normalize images such that the largest value within each color-channel of each image is 1.
We will conclude this section by demonstrating an important, non-trivial example of array broadcasting. Here, we will find that the most straightforward use of broadcasting is not necessarily the right solution for our problem, and we will see that it can be important to first refactor the mathematical approach taken to perform a calculation before using broadcasting. Specifically, we will see that our initial approach for using of broadcasting is memory-inefficient.
Suppose we have two, 2D arrays. x has a shape of $$(M, D)$$ and y has a shape of $$(N, D)$$. We want to compute the Euclidean distance (a.k.a. the $$L_2$$-distance) between each pair of rows between the two arrays. That is, if a given row of x is represented by $$D$$ numbers $$(x_0, x_1, \ldots, x_{D-1})$$, and similarly, a row y is represented by $$(y_0, y_1, \ldots, y_{D-1})$$, and we want to compute the Euclidean distance between the two rows:
$$\sqrt{(x_{0} - y_{0})^2 + (x_{1} - y_{1})^2 + \ldots + (x_{D-1} - y_{D-1})^2} = \sqrt{\sum_{i=0}^{D-1}{(x_{i} - y_{i})^2}}$$
Doing this for each pair of rows should produce a total of $$M\times N$$ distances. The previous subsection stepped us through a very similar calculation, albeit with lower-dimensional arrays. Let’s proceed by performing this computation in three different ways:
1. Using explicit for-loops
3. Refactoring the problem and then using broadcasting
For the sake of being concrete, we will compute all of the pairwise Euclidean distances between the rows of these two arrays:
# a shape-(5, 3) array
>>> x = np.array([[ 8.54, 1.54, 8.12],
... [ 3.13, 8.76, 5.29],
... [ 7.73, 6.71, 1.31],
... [ 6.44, 9.64, 8.44],
... [ 7.27, 8.42, 5.27]]) | {
"domain": "pythonlikeyoumeanit.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985936373783223,
"lm_q1q2_score": 0.8747272740523564,
"lm_q2_score": 0.8872045877523147,
"openwebmath_perplexity": 2337.0202310202303,
"openwebmath_score": 0.5890757441520691,
"tags": null,
"url": "http://www.pythonlikeyoumeanit.com/Module3_IntroducingNumpy/Broadcasting.html"
} |
# a shape-(6, 3) array
>>> y = np.array([[ 8.65, 0.27, 4.67],
... [ 7.73, 7.26, 1.95],
... [ 1.27, 7.27, 3.59],
... [ 4.05, 5.16, 3.53],
... [ 4.77, 6.48, 8.01],
... [ 7.85, 6.68, 6.13]])
Thus we will want to compute a total of 30 distances, one for each pair of rows from x and y.
### Pairwise Distances Using For-Loops¶
Performing this computation using for-loops proceeds as follows:
def pairwise_dists_looped(x, y):
""" Computing pairwise distances using for-loops
Parameters
----------
x : numpy.ndarray, shape=(M, D)
y : numpy.ndarray, shape=(N, D)
Returns
-------
numpy.ndarray, shape=(M, N)
The Euclidean distance between each pair of
rows between x and y."""
# dists[i, j] will store the Euclidean
# distance between x[i] and y[j]
dists = np.empty((5, 6))
for i, row_x in enumerate(x): # loops over rows of x
for j, row_y in enumerate(y): # loops over rows of y
# Subtract corresponding entries of the rows,
# squares each difference, and then sums them. This
# exactly matches our equation for Euclidean
# distance (we will do the square root later)
dists[i, j] = np.sum((row_x - row_y)**2)
# we still need to take the square root of
# each of our numbers
return np.sqrt(dists)
Be sure to step through this code and see that dists stores each pair of Euclidean distances between the rows of x and y.
### Pairwise Distances Using Broadcasting (Unoptimized)¶
Now, let’s use of vectorization to perform this distance computation. It must be established immediately that the method that we about to develop here is memory-inefficient. We will address this issue in detail at the end of this subsection.
We start off our vectorized computation by shrewdly inserting size-1 dimensions into x and y, so that we can perform $$M \times N$$ subtractions between their pairs of length-$$D$$ rows. This creates a shape-$$(M, N, D)$$ array. | {
"domain": "pythonlikeyoumeanit.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985936373783223,
"lm_q1q2_score": 0.8747272740523564,
"lm_q2_score": 0.8872045877523147,
"openwebmath_perplexity": 2337.0202310202303,
"openwebmath_score": 0.5890757441520691,
"tags": null,
"url": "http://www.pythonlikeyoumeanit.com/Module3_IntroducingNumpy/Broadcasting.html"
} |
# subtract shape-(5, 1, 3) with shape-(1, 6, 3)
# produces shape-(5, 6, 3)
>>> diffs = x.reshape(5, 1, 3) - y.reshape(1, 6, 3)
>>> diffs.shape
(5, 6, 3)
It is important to see, via broadcasting, that diffs[i, j] stores x[i] - y[j]. Thus we need to square each entry of diffs, sum over its last axis, and take the square root, in order to produce our $$M \times N$$ Euclidean distances:
# producing the Euclidean distances
>>> dists = np.sqrt(np.sum(diffs**2, axis=2))
>>> dists.shape
(5, 6)
Voilà! We have produced the distances in a vectorized way. Let’s write this out formally as a function:
def pairwise_dists_crude(x, y):
""" Computing pairwise distances using vectorization.
Parameters
----------
x : numpy.ndarray, shape=(M, D)
y : numpy.ndarray, shape=(N, D)
Returns
-------
numpy.ndarray, shape=(M, N)
The Euclidean distance between each pair of
rows between x and y."""
# The use of np.newaxis here is equivalent to our
# use of the reshape function
return np.sqrt(np.sum((x[:, np.newaxis] - y[np.newaxis])**2, axis=2))
Regrettably, there is a glaring issue with the vectorized computation that we just performed. Consider the largest sized array that is created in the for-loop computation, compared to that of this vectorized computation. The for-loop version need only create a shape-$$(M, N)$$ array, whereas the vectorized computation creates an intermediate array (i.e. diffs) of shape-$$(M, N, D)$$. This intermediate array is even created in the one-line version of the code. This will create a massive array if $$D$$ is a large number! | {
"domain": "pythonlikeyoumeanit.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985936373783223,
"lm_q1q2_score": 0.8747272740523564,
"lm_q2_score": 0.8872045877523147,
"openwebmath_perplexity": 2337.0202310202303,
"openwebmath_score": 0.5890757441520691,
"tags": null,
"url": "http://www.pythonlikeyoumeanit.com/Module3_IntroducingNumpy/Broadcasting.html"
} |
Suppose, for instance, that you are finding the Euclidean between pairs of RGB images that each have a resolution of $$32 \times 32$$ (in order to see if the images resemble one another). Thus in this scenario, each image is comprised of $$D = 32 \times 32 \times 3 = 3072$$ numbers ($$32^2$$ pixels, and each pixel has 3 values: a red, blue, and green-color value). Computing all the distances between a stack of 5000 images with a stack of 100 images would form an intermediate array of shape-$$(5000, 100, 3072)$$. Even though this large array only exists temporarily, it would have to consume over 6GB of RAM! The for-loop version requires $$\frac{1}{3027}$$ as much memory (about 2MB).
Is our goose cooked? Are we doomed to pick between either slow for-loops, or a memory-inefficient use of vectorization? No! We can refactor the mathematical form of the Euclidean distance in order to avoid the creation of that bloated intermediate array.
### Optimized Pairwise Distances¶
Performing the pairwise subtraction between the respective rows of x and y is what created the over-sized intermediate array in our previous calculation. Thus we want to rewrite the Euclidean distance equation such that none of the terms require broadcasting beyond the size of $$M \times N$$.
The Euclidean distance equation, ignoring the square root for now, can be refactored by multiplying out each squared term as so:
$$\sum_{i=0}^{D-1}{(x_{i} - y_{i})^2} = \sum_{i=0}^{D-1}{x_{i}^2} + \sum_{i=0}^{D-1}{y_{i}^2} - 2\sum_{i=0}^{D-1}{x_{i} y_{i}}$$
Keep in mind that we must compute this for each pair of rows in x and y. We will find that this formulation permits the use of matrix multiplication, such that we can avoid forming the shape-$$(M, N, D)$$ intermediate array.
The first two terms in this equation are straight-forward to calculate, and, when combined, will only produce a shape-$$(M, N)$$ array. For both x and y, we square each element in the array and then sum over the columns for each row: | {
"domain": "pythonlikeyoumeanit.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985936373783223,
"lm_q1q2_score": 0.8747272740523564,
"lm_q2_score": 0.8872045877523147,
"openwebmath_perplexity": 2337.0202310202303,
"openwebmath_score": 0.5890757441520691,
"tags": null,
"url": "http://www.pythonlikeyoumeanit.com/Module3_IntroducingNumpy/Broadcasting.html"
} |
# Computing the first two terms of the
# refactored Euclidean distance equation
# creates a shape-(5,) array
>>> x_sqrd_summed = np.sum(x**2, axis=1)
# creates a shape-(6,) array
>>> y_sqrd_summed = np.sum(y**2, axis=1)
We must insert a size-1 dimension in x so that we can add all pairs of numbers between the resulting shape-$$(M, 1)$$ and shape-$$(N,)$$ arrays. This will compute $$\sum_{i=0}^{D-1}{x_{i}^2} + \sum_{i=0}^{D-1}{y_{i}^2}$$ for all of the $$M \times N$$ pairs of rows:
# add a shape-(5, 1) array with a shape-(6, ) array
# to create a shape-(5, 6) array
>>> x_y_sqrd = x_sqrd_summed[:, np.newaxis] + y_sqrd_summed
>>> x_y_sqrd.shape
(5, 6)
This leaves the third term to be computed. It is left to the reader to show that computing this sum of products for each pair of rows in x and y is equivalent to performing the matrix multiplication $$-2\;(x \cdot y^{T})$$, where y has been transposed so that it has a shape of $$(D, N)$$. This matrix multiplication of a shape-$$(M, D)$$ array with a shape-$$(D, N)$$ array produces a shape-$$(M, N)$$ array. Therefore, we can compute this final term without needing to create a larger, intermediate array.
Thus the third term in our equation, $$-2\sum_{i=0}^{D-1}{x_{i} y_{i}}$$, for all $$M \times N$$ pairs of rows, is:
# computing the third term in the distance
# equation, for all pairs of rows
>>> x_y_prod = -2 * np.matmul(x, y.T) # np.dot can also be used to the same effect
>>> x_y_prod.shape
(5, 6)
Having accounted for all three terms, we can finally compute the Euclidean distances:
# computing all the distances
>>> dists = np.sqrt(x_y_sqrd + x_y_prod)
>>> dists.shape
(5, 6)
In total, we have successfully used vectorization to compute the all pairs of distances, while only requiring an array of shape-$$(M, N)$$ to do so! This is the memory-efficient, vectorized form - the stuff that dreams are made of. Let’s write the function that performs this computation in full. | {
"domain": "pythonlikeyoumeanit.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985936373783223,
"lm_q1q2_score": 0.8747272740523564,
"lm_q2_score": 0.8872045877523147,
"openwebmath_perplexity": 2337.0202310202303,
"openwebmath_score": 0.5890757441520691,
"tags": null,
"url": "http://www.pythonlikeyoumeanit.com/Module3_IntroducingNumpy/Broadcasting.html"
} |
def pairwise_dists(x, y):
""" Computing pairwise distances using memory-efficient
vectorization.
Parameters
----------
x : numpy.ndarray, shape=(M, D)
y : numpy.ndarray, shape=(N, D)
Returns
-------
numpy.ndarray, shape=(M, N)
The Euclidean distance between each pair of
rows between x and y."""
dists = -2 * np.matmul(x, y.T)
dists += np.sum(x**2, axis=1)[:, np.newaxis]
dists += np.sum(y**2, axis=1)
return np.sqrt(dists)
Takeaway:
The specific form of an equation can have a major impact on the memory-footprint of its vectorized implementation in NumPy. This issue can be safely overlooked in cases where you can be certain that the array shapes at play will not lead to substantial memory consumption. Otherwise, take care to study the form of the equation, to see if it can be recast in a way that alleviates its memory-consumption bottlenecks.
Reading Comprehension: Checking the equivalence of the three pairwise distance functions
Use the function numpy.allclose to verify that the three methods for computing the pairwise distances produce the same numerical results.
Generating the random array of 10,000, 2D points, and their “center-of-mass”.
# find the mean x-coord and y-coord of the 10000 points
>>> pts = np.random.rand(10000, 2)
>>> center_of_mass = pts.mean(axis=0) # -> array([mean_x, mean_y])
>>> center_of_mass.shape
(2,)
# Use broadcasting to compute the position of each point relative
# to the center of mass. The center of mass coordinates are subtracted
# from each of the 10000 points, via broadcast-subtraction
>>> relative_pos = pts - center_of_mass # shape-(10000,2) w/ shape-(2,)
>>> relative_pos.shape
(10000, 2)
1. Incompatible
2. 3 x 4
3. 8 x 3 x 1
4. 9 x 2 x 5
5. Incompatible
# a shape-(2, 3, 4) array
>>> x = np.array([[[ 0, 1, 2, 3],
... [ 4, 5, 6, 7],
... [ 8, 9, 10, 11]],
...
... [[12, 13, 14, 15],
... [16, 17, 18, 19],
... [20, 21, 22, 23]]]) | {
"domain": "pythonlikeyoumeanit.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985936373783223,
"lm_q1q2_score": 0.8747272740523564,
"lm_q2_score": 0.8872045877523147,
"openwebmath_perplexity": 2337.0202310202303,
"openwebmath_score": 0.5890757441520691,
"tags": null,
"url": "http://www.pythonlikeyoumeanit.com/Module3_IntroducingNumpy/Broadcasting.html"
} |
# sum over each row, within a sheet
>>> summed_rows = x.sum(axis=1)
>>> summed_rows
array([[12, 15, 18, 21],
[48, 51, 54, 57]])
# this shape-(2,4) array can be broadcast-divided
# along the rows of x, if we insert a size-1 axis
>>> x_norm = x / summed_rows[:, np.newaxis, :]
# verifying the solution
>>> x_norm.sum(axis=1)
array([[ 1., 1., 1., 1.],
[ 1., 1., 1., 1.]])
# a collection of 500 48x48 RGB images
>>> images = np.random.rand(500, 48, 48, 3)
# finding the max-value within each color-channel of each image
>>> max_vals = images.max(axis=(1,2))
>>> max_vals.shape
(500, 3)
# we can insert size-1 dimensions so that we can
# the pixels of the images.
# broadcasting (500, 48, 48, 3) with (500, 1, 1, 3)
>>> normed_images = images / max_vals.reshape(500, 1, 1, 3)
# checking that all the max-values are 1
>>> normed_images.max(axis=(1,2))
array([[ 1., 1., 1.],
[ 1., 1., 1.],
[ 1., 1., 1.],
...,
[ 1., 1., 1.],
[ 1., 1., 1.],
[ 1., 1., 1.]])
# a rigorous check
>>> np.all(normed_images.max(axis=(1,2)) == 1)
True
Checking the equivalence of the three pairwise distance functions: Solution
numpy.allclose returns True if all pairwise elements between two arrays are almost-equal to one another.
>>> x = np.array([[ 8.54, 1.54, 8.12],
... [ 3.13, 8.76, 5.29],
... [ 7.73, 6.71, 1.31],
... [ 6.44, 9.64, 8.44],
... [ 7.27, 8.42, 5.27]])
>>> y = np.array([[ 8.65, 0.27, 4.67],
... [ 7.73, 7.26, 1.95],
... [ 1.27, 7.27, 3.59],
... [ 4.05, 5.16, 3.53],
... [ 4.77, 6.48, 8.01],
... [ 7.85, 6.68, 6.13]])
>>> np.allclose(pairwise_dists_looped(x, y), pairwise_dists_crude(x, y))
True
>>> np.allclose(pairwise_dists_crude(x, y), pairwise_dists(x, y))
True | {
"domain": "pythonlikeyoumeanit.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985936373783223,
"lm_q1q2_score": 0.8747272740523564,
"lm_q2_score": 0.8872045877523147,
"openwebmath_perplexity": 2337.0202310202303,
"openwebmath_score": 0.5890757441520691,
"tags": null,
"url": "http://www.pythonlikeyoumeanit.com/Module3_IntroducingNumpy/Broadcasting.html"
} |
# GATE2003-62
8.5k views
In a permutation $a_1 ... a_n$, of $n$ distinct integers, an inversion is a pair $(a_i, a_j)$ such that $i < j$ and $a_i > a_j$.
What would be the worst case time complexity of the Insertion Sort algorithm, if the inputs are restricted to permutations of $1. . . n$ with at most $n$ inversions?
1. $\Theta(n^2)$
2. $\Theta(n\log n)$
3. $\Theta(n^{1.5})$
4. $\Theta(n)$
edited
0
what is inversion???????????????????????
0
Let A[1..N] be an array of distinct elements.
If i < j and A[i]>A[j] the pair i,j is known as inversion of the Array.
0
As the question says, how the Inversion is defined .
In a permutation $a_1 ... a_n$, of n distinct integers, an inversion is a pair $(a_i, a_j)$ such that $i < j$ and $a_i > a_j$.
• One important thing to see is Difference between swap and Inversions.
• Swapping is done explicitly by the programmer, hence a explicit feature whereas, Inversion is an implicit feature which is defined in the input .
Ex :- Take the input => $\left \{ 0,1,9,8,10,7,6,11 \right \}$
How many Inversions here : $\left \{ 9,8 \right \}$ , $\left \{ 9,7 \right \}$ , $\left \{ 9,6 \right \}$ ,$\left \{ 8,7 \right \}$ , $\left \{ 8,6 \right \}$ , $\left \{ 10,7 \right \}$ and $\left \{ 10,6 \right \}$. Hence, it is an implicit feature of the input and not any explicit operation done (Swap) .
Actual Time complexity of Insertion Sort is defined as $\Theta \left ( N + f(N) \right )$, where $f\left ( N \right )$ is the total number of Inversions .
Ex :- Again take the input => $\left \{ 0,6,7,8,9,10,1 \right \}$
Here, how many comparisons will be there to place $1$ in the right place ?
• First of all, $1$ is compared with $10$ - Returns True as it is smaller than $10$.
• Then, with $9$ - again True.
• Similar, happens with $6,7,8$ - All return True .
Hence, There $5$ comparisons were the Inversions and $1$ more comparison will be there, in which outer while loop fails . | {
"domain": "gateoverflow.in",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464478051828,
"lm_q1q2_score": 0.8746933439502742,
"lm_q2_score": 0.8962513731336204,
"openwebmath_perplexity": 697.9091539028315,
"openwebmath_score": 0.7147854566574097,
"tags": null,
"url": "https://gateoverflow.in/43576/gate2003-62"
} |
For, placing $1$ in the right place $\bf{6}$ comparisons are there .
Hence, Total Comparisons in the Insertion sort will be :- Total number of elements for which our while loop fails + Total number of inversions in the input
• Total number of elements for which our while loop fails :- Suppose the input $\left \{ 0,6,7,8,9,10,1 \right \}$. Here, first $0$ will be kept as it is and one while loop fail comparison for each element, hence total comparisons like this :- $\left ( N-1 \right )=O\left ( N \right )$ comparisons.
• Total number of inversions in the input :- Best Case : $0$ and in the Worst Case : $\frac{N\left ( N-1 \right )}{2} = O\left ( N^{2} \right )$
Total Time complexity of insertion sort : $\Theta (N+f(N))$
It is given here that at most $N$ inversions are there, so we get the best Time complexity :- $\Theta (N+f(N)) = \Theta (N + N) = \Theta (N)$ .
Correct Answer: $D$
edited
1
Excellent explanation Sir!
0
0
In worst case when the array is sorted in descending order the complexity would be O(n^2). But since its restricted to n inversions, so the complexity would be now O(n).
1
Restriction on inversión to n mean array is almost sorted in increasing order.let us take an example
5 1 2 3 4
Here insertion sort will stop after first pass by making array sorted and inversion will be number of swap
0
@Kapil sir you saved my many hours the key is just read the question carefully : they explicit mentioned that number of inversions are restricted up to n then why we considering O(n^2) case it should be done only in O(n) time.
0
The link mentioned is not working.
https://gateoverflow.in/253812/gatebook-2019-ds3-9
0
could u please elaborate more on "Actual Time complexity of Insertion Sort is defined as Θ(N+f(N))Θ(N+f(N)), where f(N)f(N) is the total number of Inversions ." ??? I didn't get this point
0
The number of comparisons in insertion sort are O($N^{2}$) then how is the total time complexity O(N)??
1
I think (7,6) should also be an inversion. | {
"domain": "gateoverflow.in",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464478051828,
"lm_q1q2_score": 0.8746933439502742,
"lm_q2_score": 0.8962513731336204,
"openwebmath_perplexity": 697.9091539028315,
"openwebmath_score": 0.7147854566574097,
"tags": null,
"url": "https://gateoverflow.in/43576/gate2003-62"
} |
1
I think (7,6) should also be an inversion.
ANSWER: D. $\Theta(n)$
REASON:
Count of number of times the inner loop of insertion sort executes is actually equal to number of inversions in input permutation $a_1,a_2,\dots a_n$. Since for each value of $i = 1... n$, $j$ take the value $1... i-1$, which means for every $j<i$ it checks if $a[j] > a[i]$.
In any given permutation, maximum number of inversions possible is $n(n-1)/2$ which is $O(n^2)$. It is the case where the array is sorted in reverse order. Therefore, to resolve all inversions i.e., worst case time complexity of insertion sort is $\Theta(n^2)$.
However, as per the question the number of inversion in input array is restricted to $n$. The worst case time complexity of insertion sort reduces to $\Theta(n)$.
INSERTION SORT ALGORITHM (for reference)
edited by
0
array could be 5,4,3,2,1
in best case of insertion sort will take O(n)
But how in worst case O(n) ?
13
If the array elements are 5,4,3,2,1..then number of inversion equals 10 which is twice the size of array. Question restrict the number of inversions to $n$.
Best case of insertion sort means that the inner while loop was never executed at all. That will happen when there is no inversion at all (array is sorted). Since, the outer loop has traversed the element of array once therefore the complexity is O(n) in best case.
However in this particular case we should not make a claim that the inner loop will not be executed. Actually it will execute, but only O(n) time in total (not just for some iteration of outer loop). So in worst case i.e., irrespective of whatever is the given permutation, as long as number of inversion in that permutation is $n$ insertion sort will sort that array in O(n). That actually the claim here.
0
means in 5,4,3,2,1
4 inversion it will be 1,5,4,3,2 | {
"domain": "gateoverflow.in",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464478051828,
"lm_q1q2_score": 0.8746933439502742,
"lm_q2_score": 0.8962513731336204,
"openwebmath_perplexity": 697.9091539028315,
"openwebmath_score": 0.7147854566574097,
"tags": null,
"url": "https://gateoverflow.in/43576/gate2003-62"
} |
0
means in 5,4,3,2,1
4 inversion it will be 1,5,4,3,2
then 1 inversion 1,5,4,2,3....We have to stop here
6
@srestha inversions are not operations (swaps) done by us- it is a property of the input. 5,4,3,2,1 has 4+3+2+1 = 10 inversions.
0
ok , so here atmost n inversion . that is why complexity O(n).rt?
As we know in insertion sort complexity depend on number of inversions rt?
4
yes, exactly. This question is about analysing the complexity of insertion sort.
3
Outer loop executes n times. Inner loop will also be executed n times as there are n inversions.
So complexity will be $\Theta$ (n + n) . So $\Theta$ (n)
http://www.geeksforgeeks.org/time-complexity-insertion-sort-inversions
0
please add that running time is Θ(n+d), where n we get from outer loop and d is the number of inversion.
here number of inversion=n
so time complexity=Θ(n+n)= Θ(n)
0
inversions are not operations (swaps) done by us- it is a property of the input. 5,4,3,2,1 has 4+3+2+1 = 10 inversions.
@Arjun
i can't get it sir .
Ans is D: ⊝(n),
Insertion sort runs in Θ(n + f(n)) time, where f(n) denotes the number of inversion initially present in the array being sorted.
1 vote
You can learn this point:-
Insertion sort complexity is
(N+ no. of inversion).
1 vote
Just take a simple case and examine:
Usually, the worst case corresponds to whenever input is in decreasing order, so
let Input = 5,4,3,2,1
Now, we need to make sure the inversion property applies i.e. n=5 inversions are only possible
For the given I, there's 10 inversions. With the number 5, there's 4 inversions - <5,4> , <5,3>, <5,2>, <5,1>. We just need 1 more. By rearranging, let I = 5,1,2,4,3. Now there's 5 inversions. We have a perfect example close to worst case.
Now apply the insertion sort Algo to I.
Iteration(i,j) Input
0,0 - 5,1,2,4,3
1,0 - 1,5,2,4,3
2,0 - 1,2,5,4,3
3,0 - 1,2,4,5,3
4,0 - 1,2,4,3,5
4,1 - 1,2,3,4,5
Total Iterations = 5. Therefore Theta(n), option D
0
@arjuno | {
"domain": "gateoverflow.in",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464478051828,
"lm_q1q2_score": 0.8746933439502742,
"lm_q2_score": 0.8962513731336204,
"openwebmath_perplexity": 697.9091539028315,
"openwebmath_score": 0.7147854566574097,
"tags": null,
"url": "https://gateoverflow.in/43576/gate2003-62"
} |
4,0 - 1,2,4,3,5
4,1 - 1,2,3,4,5
Total Iterations = 5. Therefore Theta(n), option D
0
@arjuno
can you explain little more how you find total iteration and what is that 1,0 2,0 ....4,0 4,1 stands for?
1 vote
Time complexity of insertion sort is: $O(n + i)$ where $i$ is the number of inversions.
In the worst case, there are $n(n-1)/2=O(n^2)$ inversions, and hence the Time Complexity of Insertion Sort degrades to $O(n+n^2)=O(n^2)$.
Here, in the worst case we're restricted to $n$ inversions, so Time Complexity = $\theta(n+n)=\theta(n)$
Option D
inputs are restricted to permutations of $1...n$ with at most $n$ inversions
so if we take input as $n,1,2….n-1,n-2$
here no. of inversions is$n$
e.g. if n=9
$9,1,2,3,4,5,6,8,7$
inversions are
$(9,1)(9,2)(9,3)(9,4)(9,5)(9,6)(9,8)(9,7)(8,7) i.e. 9$
so worst case input according to question is $n,1,2….n-1,n-2$
this will take O(N) time to sort using insertion sort as except n & n-2 all elements are sorted
ago
## Related questions | {
"domain": "gateoverflow.in",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464478051828,
"lm_q1q2_score": 0.8746933439502742,
"lm_q2_score": 0.8962513731336204,
"openwebmath_perplexity": 697.9091539028315,
"openwebmath_score": 0.7147854566574097,
"tags": null,
"url": "https://gateoverflow.in/43576/gate2003-62"
} |
## Related questions
1
7.3k views
In a permutation $a_1 ... a_n$, of n distinct integers, an inversion is a pair $(a_i, a_j)$ such that $i < j$ and $a_i > a_j$. If all permutations are equally likely, what is the expected number of inversions in a randomly chosen permutation of $1. . . n$? $\frac{n(n-1)}{2}$ $\frac{n(n-1)}{4}$ $\frac{n(n+1)}{4}$ $2n[\log_2n]$
The unusual $\Theta(n^2)$ implementation of Insertion Sort to sort an array uses linear search to identify the position where an element is to be inserted into the already sorted part of the array. If, instead, we use binary search to identify the position, the worst case running time will remain $\Theta(n^2)$ become $\Theta(n (\log n)^2)$ become $\Theta(n \log n)$ become $\Theta(n)$
In the following $C$ program fragment, $j$, $k$, $n$ and TwoLog_n are integer variables, and $A$ is an array of integers. The variable $n$ is initialized to an integer $\geqslant 3$, and TwoLog_n is initialized to the value of $2^*\lceil \log_2(n) \rceil$ for (k = 3; k <= n; k++) A[k] ... $\left\{m \mid m \leq n, \text{m is prime} \right\}$ { }
Let $G= (V,E)$ be a directed graph with $n$ vertices. A path from $v_i$ to $v_j$ in $G$ is a sequence of vertices ($v_{i},v_{i+1}, \dots , v_j$) such that $(v_k, v_{k+1}) \in E$ for all $k$ in $i$ through $j-1$. A simple path is a path in which no vertex ... longest path length from $j$ to $k$ If there exists a path from $j$ to $k$, every simple path from $j$ to $k$ contains at most $A[j,k]$ edges | {
"domain": "gateoverflow.in",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464478051828,
"lm_q1q2_score": 0.8746933439502742,
"lm_q2_score": 0.8962513731336204,
"openwebmath_perplexity": 697.9091539028315,
"openwebmath_score": 0.7147854566574097,
"tags": null,
"url": "https://gateoverflow.in/43576/gate2003-62"
} |
# Methods for proving an equivalence relation
I'll be taking introductory abstract algebra in the fall, and so to prepare, I'm working through Pinter's text. Chapter 12 includes a number of exercises asking the student to prove that something is an equivalence relation and to describe the associated partition. For example: In $\mathbb{Q}$, $r \sim s$ iff $r - s \in \mathbb{Z}$.
I think I'm okay with most (?) of this. I'd show this is an equivalence relation like so: If $x, y, z \in \mathbb{Q}$, then $x - x = 0 \in \mathbb{Z}$, and so $x \sim x$. Second, if $x \sim y$, then $y - x = -(x - y) \in \mathbb{Z}$, and so $x \sim y \implies y \sim x$. Finally, if $x \sim y$ and $y \sim z$, then $x - z = (x - y) - (z - y) \in \mathbb{Z}$, and so $x \sim z$.
The two parts I'm not sure about: First, that last f on the iff. Essentially, this means I have to prove that if $r \sim s$, then their difference is an integer, right? But I thought this is merely how this particular equivalence relation is defined. How do I know that $r \sim s$ until I look at their difference?
Second, I have a basic idea of what the partition is, but I'm not sure how to form the statement. The equivalence class $[q] = \{k + q : k \in \mathbb{Z}, q \in \mathbb{Q} \}$. But if anything, that seems as though it would be the definition for a single equivalence class, not the description of the partition. (Now that I look at it again, it also leaves out the fact that $k$ is arbitrary but $q$ is fixed.)
If anyone can offer any hints, I'd very much appreciate it. (Though I'm guessing the second of my questions might be more amenable to a No-this-is-how-you-do-it than to a hint, per se.) | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.972830769252026,
"lm_q1q2_score": 0.8746929516192274,
"lm_q2_score": 0.899121388082479,
"openwebmath_perplexity": 286.3566001489136,
"openwebmath_score": 0.8514342308044434,
"tags": null,
"url": "http://math.stackexchange.com/questions/461601/methods-for-proving-an-equivalence-relation"
} |
-
The text defines $r$ to be equivalent to $s$ iff (if and only if) the difference is an integer. There is nothing for you to prove, the difference being an integer is the defining condition for the equivalence relation. – André Nicolas Aug 7 '13 at 4:32
@AndréNicolas So are you saying the question is poorly written? I guess I was originally reading it like "r R s <--> r - s in Z," where R is not necessarily an equivalence relation. But ~ usually does mean equivalence relation, right? – dmk Aug 9 '13 at 14:53
The question is not poorly written, it is quite clear. But to show this is an equivalence relation, all you need to do is to verify that the conditions for an equivalence relation are satisfied. You don't have to prove that if $r\equiv s$ then $r-s$ is an integer, you have been told that is what $\equiv$ means for this exercise, – André Nicolas Aug 9 '13 at 14:59
@AndréNicolas So what you were saying then is that there's nothing for me to prove beyond what I'd already proved? – dmk Aug 9 '13 at 15:40
Yes, you had completely finished proving that the relation is an equivalence realtion. And it is a clean well-organized proof. – André Nicolas Aug 9 '13 at 16:40
Hint
Prove that the associated partition is $$\{[q]\, |\, q\in[0,1)\}$$
-
My first thought was, OK, that's true, but is it necessary to be so restrictive? For example, in Z_4, [1] = [5] = [61] = ... Well, sure, but we only need [1]. Two days later, though, it clicked: "Succinct" is a better adjective than "restrictive." (And to complete the analogy for myself, the partition of Z_4 would be {[k] : k = 0, 1, 2, 3}.) (Not sure how to do the @ thing here...) – dmk Aug 9 '13 at 15:16
If we want to give a set usually we write its elements without repetition. – user63181 Aug 9 '13 at 15:28 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.972830769252026,
"lm_q1q2_score": 0.8746929516192274,
"lm_q2_score": 0.899121388082479,
"openwebmath_perplexity": 286.3566001489136,
"openwebmath_score": 0.8514342308044434,
"tags": null,
"url": "http://math.stackexchange.com/questions/461601/methods-for-proving-an-equivalence-relation"
} |
For your first part: Definitions are iff, or if and only if statements, as they are essentially stating that two things are equivalent -- the new term, and its definition. It shouldn't be affecting what you need to prove, except that you can use both that $r \sim s \implies r - s \in \mathbb{Z}$ and that $r - s \in \mathbb{Z} \implies r \sim s$.
For the second part, a better way of putting it would be as follows:
For each $q \in \mathbb{Q}$, the equivalence class of $q$ under $\sim$ is as follows: $[q] = \{q + k : k \in \mathbb{Z}\}$.
By saying this, you describe all of the equivalence classes making up the partition in one statement, and also take care of having $q$ fixed and $k$ varying.
-
This post is to answer the question above:
How do I know that r∼s until I look at their difference?
Answer: Use an indexing number m, with m = r - g(r), with g(r) being the next lower integer from r. Then each class can be represented as Am (I don't know how to subscript). m will be some rational number between zero (inclusive) and 1 (non-inclusive).
- | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.972830769252026,
"lm_q1q2_score": 0.8746929516192274,
"lm_q2_score": 0.899121388082479,
"openwebmath_perplexity": 286.3566001489136,
"openwebmath_score": 0.8514342308044434,
"tags": null,
"url": "http://math.stackexchange.com/questions/461601/methods-for-proving-an-equivalence-relation"
} |
# 5 Vertices Denoted by K5 part B
#### Joystar1977
##### Active member
Consider the complete graph with 5 vertices, denoted by K5.
B. How many edges are in K5? How many edges are in Kn?
Wouldn't the edges be at certain points of the graph? For instance, Point 1, Point 2, Point 3, Point 4, and Point 5 or n-1, n-2, n-3, n-4, and n-5.
#### caffeinemachine
##### Well-known member
MHB Math Scholar
I don't quite understand what you mean by
Wouldn't the edges be at certain points of the graph? For instance, Point 1, Point 2, Point 3, Point 4, and Point 5 or n-1, n-2, n-3, n-4, and n-5.
An edge in a (simple) graph is an unordered pair of distinct vertices in that graph. Any complete graph on $n$ vertices has ${n\choose 2} = n(n-1)/2$ edges in it. Thus $K_5$ has $10$ edges.
#### Joystar1977
##### Active member
Is this correct then that since the graph would have 5 vertices, denoted by K5 then I would solve for Kn like this:
5 (5 - 1) / 2
5 (4) / 2
20 / 2
10
Are the edges of Kn equal to 10? If not, someone please correct this for me.
#### caffeinemachine
##### Well-known member
MHB Math Scholar
Is this correct then that since the graph would have 5 vertices, denoted by K5 then I would solve for Kn like this:
5 (5 - 1) / 2
5 (4) / 2
20 / 2
10
Are the edges of Kn equal to 10? If not, someone please correct this for me.
Yes, there are $10$ edges in $K_5$. Your calculation is correct. I thin you meant to write $K_5$ instead of the thing marked in red in the quoted text.
#### Joystar1977
##### Active member
Caffeine Machine: The question of Part B has two separate questions. Both of them are as follows:
Consider the complete graph with 5 vertices, denoted by K5.
1. How many edges are in K5?
2. How many edges are in Kn?
I was asking whether or not the K5 and Kn have the same amount of edges. I know you said that K5 has ten edges, so does that mean that Kn has the same amount of edges?
#### Evgeny.Makarov | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
#### Evgeny.Makarov
##### Well-known member
MHB Math Scholar
I was asking whether or not the K5 and Kn have the same amount of edges. I know you said that K5 has ten edges, so does that mean that Kn has the same amount of edges?
Of course not. For example, K2 consists of two connected vertices; it has 1 edge. K3 is a triangle; it has three edges. K4 is a square with both diagonals; it has 6 edges. Post #2 has the formula for an arbitrary $n$, but you may have missed it. Each vertex of Kn is connected to $n - 1$ other vertices, so there are $n - 1$ edges coming out of that vertex. If you multiply that by the number of vertices, you get $n(n-1)$. However, in this way you count every edge twice. (Why?)
#### Joystar1977
##### Active member
Evgeny.Makarov! If you say, then that K2 has 1 edge, K3 has 3 edges, and K4 has 6 edges then what about K1 and K5?
K2= 1 edge
K3= 3 edges
K4= 6 edges
Total edges = 10 edges
You stated that n-1 edges come out of that vertex and to multiply by the number of vertices which is 5 vertices. I would get n (n - 1).
5 (10 -1)
5 (9)
45
Is Kn = 45 edges
#### Evgeny.Makarov
##### Well-known member
MHB Math Scholar
I also would like to ask you some questions.
If you say, then that K2 has 1 edge, K3 has 3 edges, and K4 has 6 edges then what about K1 and K5?
Do you know the definition of $K_n$ for various $n$? If so, then you should know what $K_1$ is: it's a single vertex. There are no edges because there is nothing to connect to. As for $K_5$, you have a drawing in this post in a parallel thread. Why don't you count the number of edges?
K2= 1 edge
K3= 3 edges
K4= 6 edges
Above, you wrote correctly: "K4 has 6 edges". It does not equal 6 edges. Graphs can be compared only to graphs, and the number of edges to the number of some objects. | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
You stated that n-1 edges come out of that vertex and to multiply by the number of vertices which is 5 vertices.
Let's recall exactly what I said.
Each vertex of Kn is connected to $n - 1$ other vertices, so there are $n - 1$ edges coming out of that vertex. If you multiply that by the number of vertices, you get $n(n-1)$. However, in this way you count every edge twice.
Why are you saying that the number of vertices is 5? Did I talk about $K_5$? No, I talked about $K_n$ for some unknown number $n$.
I would get n (n - 1).
5 (10 -1)
So, you replace the first $n$ in $n (n - 1)$ by 5, and you replace the second $n$ by 10. Do you think this is right?
Is Kn = 45 edges
This again brings me to the question whether you know what $K_n$ is. There are graphs $K_3$, $K_4$, $K_5$, but there is no such object as $K_n$ for unknown $n$. Strictly speaking, $K_n$ is a function: you give it $n$, it returns you a complete graph on $n$ vertices. E.g., you give it 5, it returns $K_5$.
So, I am asking you: what is the meaning of the phrase "$K_n$ has 45 edges"?
#### Joystar1977
##### Active member
Evgeny.Makarov then is it correct to say that Kn doesn't have anything to connect to since it's a single vertex. Earlier I went off what you said about K4 having six edges so I thought that since it has six edges that it was equal to that. The reason I am saying that the number of vertices is 5 because the problem states the following:
Consider the complete graph with 5 vertices, denoted by K5.
How many edges are in K5?
How many edges are in Kn?
My understanding of this when it says the complete graph means the whole entire graph and I would think that if the graph has 5 vertices, denoted by K5 then Kn to my recollection is the unknown amount of edges in the graph. Sometimes I read too much into things so please let me know if I am or not.
When I solve the problem you said to replace the first n (n - 1) by 5 and the second n by 10 so this is what I was solving the problem: | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
5 (n-1) - Replaced first n by 5
5 (10-1) - Replaced second n by 10
5 (9)- Doing what is in the parentheses first
45 - Multiplying 5 (9)
My understanding of this when you say "Kn has 45 edges" is that "Kn is equal to having 45 edges". Did I forget to do something else?
KN has N vertices.
Each vertex has degree N - 1.
The sum of all degrees is N(N - 1).
#### caffeinemachine
##### Well-known member
MHB Math Scholar
Evgeny.Makarov then is it correct to say that Kn doesn't have anything to connect to since it's a single vertex. Earlier I went off what you said about K4 having six edges so I thought that since it has six edges that it was equal to that. The reason I am saying that the number of vertices is 5 because the problem states the following:
Consider the complete graph with 5 vertices, denoted by K5.
How many edges are in K5?
How many edges are in Kn?
My understanding of this when it says the complete graph means the whole entire graph and I would think that if the graph has 5 vertices, denoted by K5 then Kn to my recollection is the unknown amount of edges in the graph. Sometimes I read too much into things so please let me know if I am or not.
When I solve the problem you said to replace the first n (n - 1) by 5 and the second n by 10 so this is what I was solving the problem:
5 (n-1) - Replaced first n by 5
5 (10-1) - Replaced second n by 10
5 (9)- Doing what is in the parentheses first
45 - Multiplying 5 (9)
My understanding of this when you say "Kn has 45 edges" is that "Kn is equal to having 45 edges". Did I forget to do something else?
KN has N vertices.
Each vertex has degree N - 1.
The sum of all degrees is N(N - 1).
Hey Joystar.
I think you have misunderstood and confused a lot of graph theoretic notations and concepts. I suggest you go through a process of 'rebooting'. You need to forget everything you know about graphs and start again. Do the following exercises: | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
1) Define a graph.
2) What is an 'edge' of a graph?
3) Does it matter if we join two vertices with a straight line or a curved line when we represent a graph by drawing it on paper?
4) What is a cycle graph? Give an example.
5) What is a complete graph? Give an example.
6) If we consider the $G$ as the whole of the cycle graph having 4 edges then is $G$ a complete graph?
You can post your answers on this thread or on a different thread if you like. I will be happy to check them and comment.
#### Joystar1977
##### Active member
1. Define a graph.
A graph is a two-dimensional drawing showing a relationship usually between two sets of numbers by means of a line, curve, a series of bars, or other symbols. Usually, the independent variable is shown on the horizontal line (X-Axis) and the dependent variable is shown on the vertical line (Y-Axis). When the axis is perpendicular then is intersects as a point called the origin and is calibrated in the units of the quantities represented. A graph usually has four quadrants representing the positive and negative values of the variables. Most of the time the north-east quadrant is shown on the graph when the negative values do not exist or don’t have interest. A graph can also be defined as a diagram of values, usually shown as lines or bars.
2. What is an ‘edge’ of a graph?
The edge of a graph is the intersection of two planes or faces. The edges can also be called arcs. In a simple graph, the set of vertices (V) and set of unordered pairs of distinct elements of V called edges. Graphs are not all simple. Sometimes a pair of vertices are connected by multiple edge yielding a multigraph. At times the vertices are connected to themselves by an edge called a loop, creating a pseudograph. Edges can also be given a direction creating a directed graph. An edge joins one vertex to another or starts and ends at the same vertex. The edges can have straight or curved lines and is also known as arcs. | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
3. Does it matter if we join two vertices with a straight line or a curved line when we represent a graph by drawing it on paper?
I do know that a straight line should be drawn with a ruler and not free hand. A curved line should be drawn in a smooth “swoop” through the points to indicate the general shape. A curved graph, you need as many points as possible to make it accurate. If your given a straight line in a graph, then it shows that the two physical quantities that I plotted are “proportional”. If the straight line goes through the origin of the graph, then it indicates that they are “directly proportional”. If you double one quantity the other will double too. Any points that are well away from the line are called anomalies. This may be due to experimental error. From my understanding of this that since I don’t think it really matters whether or not you join two vertices with a straight line or curved line because if I am drawing it on paper then I would make the curved line as accurate as possible to match up with the straight line.
4. What is a cycle graph? Give an example.
A cycle graph is a graph that consists of a single cycle, or in other words, some number of vertices connected in a closed chain. An example of a cycle graphs are as follows: Triangle Graph, Square Graph, Grid Graph, Circular Graph, Block Cycle, Step Cycle, Arrow Cycle, and a Balanced Cycle.
5. What is a complete graph? Give an example.
A complete graph is a graph with N vertices and an edge between every two vertices. There are no loops. Every two vertices share exactly one edge. The symbol KN is used for a complete graph with N vertices. Also, a complete graph is a graph in which each pair of graph vertices is connected by an edge. Some examples of a complete graph are as follows: Line graph, Star graph, Planar graph, Wheel Graph, Odd Graph, Tetrahedral Graph, and Pentatope Graph.
6. If we consider the G as the whole of the cycle graph having 4 edges then is G a complete graph? | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
6. If we consider the G as the whole of the cycle graph having 4 edges then is G a complete graph?
I would say yes that G is the whole of the cycle graph having 4 edges and would be considered a complete graph. The reason is because a complete graph has an edge between every two vertices, with no loops, and every two vertices share exactly one edge.
#### caffeinemachine
##### Well-known member
MHB Math Scholar
1. Define a graph.
A graph is a two-dimensional drawing showing a relationship usually between two sets of numbers by means of a line, curve, a series of bars, or other symbols. Usually, the independent variable is shown on the horizontal line (X-Axis) and the dependent variable is shown on the vertical line (Y-Axis). When the axis is perpendicular then is intersects as a point called the origin and is calibrated in the units of the quantities represented. A graph usually has four quadrants representing the positive and negative values of the variables. Most of the time the north-east quadrant is shown on the graph when the negative values do not exist or don’t have interest. A graph can also be defined as a diagram of values, usually shown as lines or bars.
2. What is an ‘edge’ of a graph?
The edge of a graph is the intersection of two planes or faces. The edges can also be called arcs. In a simple graph, the set of vertices (V) and set of unordered pairs of distinct elements of V called edges. Graphs are not all simple. Sometimes a pair of vertices are connected by multiple edge yielding a multigraph. At times the vertices are connected to themselves by an edge called a loop, creating a pseudograph. Edges can also be given a direction creating a directed graph. An edge joins one vertex to another or starts and ends at the same vertex. The edges can have straight or curved lines and is also known as arcs.
3. Does it matter if we join two vertices with a straight line or a curved line when we represent a graph by drawing it on paper? | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
I do know that a straight line should be drawn with a ruler and not free hand. A curved line should be drawn in a smooth “swoop” through the points to indicate the general shape. A curved graph, you need as many points as possible to make it accurate. If your given a straight line in a graph, then it shows that the two physical quantities that I plotted are “proportional”. If the straight line goes through the origin of the graph, then it indicates that they are “directly proportional”. If you double one quantity the other will double too. Any points that are well away from the line are called anomalies. This may be due to experimental error. From my understanding of this that since I don’t think it really matters whether or not you join two vertices with a straight line or curved line because if I am drawing it on paper then I would make the curved line as accurate as possible to match up with the straight line.
4. What is a cycle graph? Give an example.
A cycle graph is a graph that consists of a single cycle, or in other words, some number of vertices connected in a closed chain. An example of a cycle graphs are as follows: Triangle Graph, Square Graph, Grid Graph, Circular Graph, Block Cycle, Step Cycle, Arrow Cycle, and a Balanced Cycle.
5. What is a complete graph? Give an example.
A complete graph is a graph with N vertices and an edge between every two vertices. There are no loops. Every two vertices share exactly one edge. The symbol KN is used for a complete graph with N vertices. Also, a complete graph is a graph in which each pair of graph vertices is connected by an edge. Some examples of a complete graph are as follows: Line graph, Star graph, Planar graph, Wheel Graph, Odd Graph, Tetrahedral Graph, and Pentatope Graph.
6. If we consider the G as the whole of the cycle graph having 4 edges then is G a complete graph? | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
6. If we consider the G as the whole of the cycle graph having 4 edges then is G a complete graph?
I would say yes that G is the whole of the cycle graph having 4 edges and would be considered a complete graph. The reason is because a complete graph has an edge between every two vertices, with no loops, and every two vertices share exactly one edge.
Hello Joystar.
Its good that you answered each question. Before I comment on your answers I need to know something about your background in mathematics. Are you an undergraduate? If yes then are you a sophomore or second year or senior? If not then which grade in High School?
Also, are you comfortable with set theoretic concepts, notations and symbols? Do you fully understand the meanings of 'cartesian product of two sets', 'union and intersection of two sets'?
#### Evgeny.Makarov
##### Well-known member
MHB Math Scholar
I agree with caffeinemachine that you may have misunderstood some definitions. In this case, we may be talking about different things and not realize it. I recommend going back to definitions and making sure that your understanding is correct.
With regard to the discussion above... | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
With regard to the discussion above...
Evgeny.Makarov then is it correct to say that Kn doesn't have anything to connect to since it's a single vertex.
Let's recall what I said in post #8:
There are graphs $K_3$, $K_4$, $K_5$, but there is no such object as $K_n$ for unknown $n$. Strictly speaking, $K_n$ is a function: you give it $n$, it returns you a complete graph on $n$ vertices. E.g., you give it 5, it returns $K_5$
First, note that $K_n$ is not an indivisible name like "pentagon". In consists of two parts: the name of the collection $K$, which probably stands for "complete", and an index $n$, which takes values 1, 2, …. As I said, $K_n$ is a function $K$ that takes an argument $n$; it is more like $K(n)$. It may have been confusing to write Kn in plain text because it looks like an indivisible name. Recall functions, e.g., $f(x)=x^2$: such $f(x)$ is not a single number; for each $x$ is returns its own number.
Yet you continue treating $K_n$ as if it is a concrete graph and keep saying things like it has a single vertex or it has 45 edges. $K_n$ is not a single graph, it is a whole collection of graphs: $K_1$, $K_2$, $K_3$ and so on. What is true for $K_1$ (it consists of a single vertex) is not true for $K_4$. What is true for $K_5$ (it has 10 edges) is not true for $K_3$. You cannot say "$K_n$ has 10 edges" and stop there because this is neither true nor false. It may be true for some graphs in the $K_n$ family and false for others. In contrast, the phrase "$K_5$ has 10 edges" has a definite truth value (it is true). | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
Another way to refer to $K_n$ meaningfully is to use phrases "for all $n$" or "for some $n$". Then you are talking about the collection $K_n$ as a whole. For example, it makes sense to say, "For all $n$, the graph $K_n$ has $n(n-1)/2$ edges". In this one sentence you make an infinite number of claims: $K_1$ has 0 edges, $K_2$ has 1 edge, $K_3$ has 3 edges, $K_4$ has 6 edges and so on. It also makes sense to say, "$K_n$ has 10 edges for some $n$", namely for $n=5$.
Usually when we refer to $K_n$ without specifying concrete $n$ and without using either of the phrases "for all $n$" or "for some $n$" (or their equivalents), then we implicitly mean "for all $n$". Thus, saying "$K_n$ has $n$ vertices" is equivalent to saying "$K_n$ has $n$ vertices for all $n$". Again, this is a claim about the whole collection $K_n$ for all $n$. Thus, "$K_n$ has 45 edges" is false just because there are elements of the collection with a differemt number of edges: e.g., $K_2$ has just 1 edge. | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
My understanding of this when it says the complete graph means the whole entire graph and I would think that if the graph has 5 vertices, denoted by K5 then Kn to my recollection is the unknown amount of edges in the graph.
"Complete" here is not used in its usual disctionary sense. A "complete graph" is an idivisible name, and it is given a new precise meaning by a definition. Namely, let $n$ be some natural number. Then a complete graph on $n$ vertices, denoted by $K_n$, consists of $n$ vertices, and every pair of distinct vertices is connected by an edge. This is also a whole series of definitions: for $n=1$, $n=2$ and so on. So, the word "complete" does not mean that some prevously defined graph is considered in its entirety; it is a part of a name that is given a new meaning. (Redefining familiar terms happens a lot in mathematics: we talk of "compact" and "meager" sets, properties holding "almost everywhere" or "eventually" and so on. Definitions give these terms new precise meanings different from those in the dictionary.) Similarly, $K_n$ is not a graph with an unknown number of edges. You can't talk about the number of edges in $K_n$ until you either give a concrete $n$ or use the phrases "for all $n$" or "for some $n$".
When I solve the problem you said to replace the first n (n - 1) by 5 and the second n by 10
Let's recall exactly:
So, you replace the first $n$ in $n (n - 1)$ by 5, and you replace the second $n$ by 10. Do you think this is right?
I did not direct you to replace $n$ by two different numbers. I stated this as an observation and asked if you think it right. Have you ever seen the same variable in a single expression replaced by two values? I was hoping you notice this and feel ashamed because this is not done in mathematics. | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
My understanding of this when you say "Kn has 45 edges" is that "Kn is equal to having 45 edges".
In addition to the above, I want to stress that having 45 edges is not the same as being equal to 45 edges. Presumably, you have a computer, but you are not equal to a computer, right? I am not sure if the phrase "equal to having" is possible in English, but it is not correct here. "Having 45 edges" is at best a property of graphs, and a graph $K_n$ cannot be equal to a property, or a number, or a function and so on. A graph may only be equal to a graph. Theerefore, please don't say, "A graph is equal to 45 edges" or "A graph is equal to having 45 edges"; this is absolutely wrong.
- - - Updated - - -
1. Define a graph.
A graph is a two-dimensional drawing showing a relationship usually between two sets of numbers by means of a line, curve, a series of bars, or other symbols. Usually, the independent variable is shown on the horizontal line (X-Axis) and the dependent variable is shown on the vertical line (Y-Axis).
No. Just no. Not in the context of this thread..
#### Joystar1977
##### Active member
Caffeinemachine:
In response to your questions, I am a third year undergraduate (Junior) in college and have taken Basic Mathematics, Review of Arithmetic, Elementary Algebra, Intermediate Algebra, and am now presently taking Discrete Mathematics. No, I am not very comfortable with the set theoretic concepts, notations and symbols. No, I don't fully understand the meanings of a "cartesian product of two sets" and "union and intersection of two sets".
Hello Joystar.
Its good that you answered each question. Before I comment on your answers I need to know something about your background in mathematics. Are you an undergraduate? If yes then are you a sophomore or second year or senior? If not then which grade in High School? | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
Also, are you comfortable with set theoretic concepts, notations and symbols? Do you fully understand the meanings of 'cartesian product of two sets', 'union and intersection of two sets'?
#### caffeinemachine
##### Well-known member
MHB Math Scholar
Caffeinemachine:
In response to your questions, I am a third year undergraduate (Junior) in college and have taken Basic Mathematics, Review of Arithmetic, Elementary Algebra, Intermediate Algebra, and am now presently taking Discrete Mathematics. No, I am not very comfortable with the set theoretic concepts, notations and symbols. No, I don't fully understand the meanings of a "cartesian product of two sets" and "union and intersection of two sets".
Hmm..
To understand the concepts of Graph Theory thoroughly you first need to understand some basic set theoretic concepts and get comfortable with the notations.
A 'cartesian product' of two sets $A$ and $B$ is written as $A\times B$ and is defined as $A\times B=\{(a,b):a\in A, b\in B\}$. That is, the cartesian product of $A$ and $B$ is the 'collection' of all 'ordered pairs' which have an element of $A$ in the first entry and an element of $B$ in the second entry. This is a fairly intuitive concept.
Union of two sets $A$ and $B$ is written as $A\cup B$ and is the collection of all elements of $A$ and $B$. There may be common elements in $A$ and $B$. That's fine. Don't let it bother you.
Intersection of $A$ and $B$ is written as $A\cap B$ and is the collection of all the elements which are found in both $A$ and $B$.
Now,
Your definition of a Graph is not correct. We like to think of graphs as diagrams on paper but we cannot define a graph as a diagram on paper. The definition is:
A graph $G$ is an ordered pair of a vertex set $V$ and an edge set $E$, where $E$ is a collection of some two element subsets of $V$. We write $G=(V,E)$. | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
The above definition has nothing to do with a diagram. It's quite abstract. To visualize a graph we represent the vertices as dots and the edges as lines(curved or straight or zig zag or dotted or whatever) connecting two distinct vertices.
Tell me if you have further doubts in any of these. Once we are through with the definition of a graph I can comment on other answers of yours.
#### Joystar1977
##### Active member
Caffeinemachine: Just so you know there is no dictionary in the back of my mathematics textbook, so these answers I got was from online of a graph theory Glossary. Of course, now that I have written this down go ahead and please explain further about the other questions I answered.
#### Joystar1977
##### Active member
Evgeny.Makarov: I may have misunderstood some definitions, but as I stated below to Caffeinemachine there is no dictionary in the back of my textbook so the answers I got was from online of a Graph Theory Glossary. I am not trying to talk about different things here, but what I am trying to figure out is what is Kn. I will tell you right now I never took any upper division math courses in high school and was in Special Education all of my life. I have a learning disability (Epilepsy Seizures) which causes me to have a hard time comprehending and understanding. Also, just so you know that I have repeated Elementary Algebra a total of 4 times and Intermediate Algebra a total of 5 times. As for in response to your question, I am not going to feel ashamed just because I didn't notice or observe something. Furthermore, I might add that no I haven't seen the same variable used in a single expression or equation that is replaced by two values. Finally, I will not say that "having 45 edges" is "equal to having 45 edges". | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
I agree with caffeinemachine that you may have misunderstood some definitions. In this case, we may be talking about different things and not realize it. I recommend going back to definitions and making sure that your understanding is correct.
With regard to the discussion above...
Let's recall what I said in post #8:First, note that $K_n$ is not an indivisible name like "pentagon". In consists of two parts: the name of the collection $K$, which probably stands for "complete", and an index $n$, which takes values 1, 2, …. As I said, $K_n$ is a function $K$ that takes an argument $n$; it is more like $K(n)$. It may have been confusing to write Kn in plain text because it looks like an indivisible name. Recall functions, e.g., $f(x)=x^2$: such $f(x)$ is not a single number; for each $x$ is returns its own number.
Yet you continue treating $K_n$ as if it is a concrete graph and keep saying things like it has a single vertex or it has 45 edges. $K_n$ is not a single graph, it is a whole collection of graphs: $K_1$, $K_2$, $K_3$ and so on. What is true for $K_1$ (it consists of a single vertex) is not true for $K_4$. What is true for $K_5$ (it has 10 edges) is not true for $K_3$. You cannot say "$K_n$ has 10 edges" and stop there because this is neither true nor false. It may be true for some graphs in the $K_n$ family and false for others. In contrast, the phrase "$K_5$ has 10 edges" has a definite truth value (it is true).
Another way to refer to $K_n$ meaningfully is to use phrases "for all $n$" or "for some $n$". Then you are talking about the collection $K_n$ as a whole. For example, it makes sense to say, "For all $n$, the graph $K_n$ has $n(n-1)/2$ edges". In this one sentence you make an infinite number of claims: $K_1$ has 0 edges, $K_2$ has 1 edge, $K_3$ has 3 edges, $K_4$ has 6 edges and so on. It also makes sense to say, "$K_n$ has 10 edges for some $n$", namely for $n=5$. | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
Usually when we refer to $K_n$ without specifying concrete $n$ and without using either of the phrases "for all $n$" or "for some $n$" (or their equivalents), then we implicitly mean "for all $n$". Thus, saying "$K_n$ has $n$ vertices" is equivalent to saying "$K_n$ has $n$ vertices for all $n$". Again, this is a claim about the whole collection $K_n$ for all $n$. Thus, "$K_n$ has 45 edges" is false just because there are elements of the collection with a differemt number of edges: e.g., $K_2$ has just 1 edge.
"Complete" here is not used in its usual disctionary sense. A "complete graph" is an idivisible name, and it is given a new precise meaning by a definition. Namely, let $n$ be some natural number. Then a complete graph on $n$ vertices, denoted by $K_n$, consists of $n$ vertices, and every pair of distinct vertices is connected by an edge. This is also a whole series of definitions: for $n=1$, $n=2$ and so on. So, the word "complete" does not mean that some prevously defined graph is considered in its entirety; it is a part of a name that is given a new meaning. (Redefining familiar terms happens a lot in mathematics: we talk of "compact" and "meager" sets, properties holding "almost everywhere" or "eventually" and so on. Definitions give these terms new precise meanings different from those in the dictionary.) Similarly, $K_n$ is not a graph with an unknown number of edges. You can't talk about the number of edges in $K_n$ until you either give a concrete $n$ or use the phrases "for all $n$" or "for some $n$".
Let's recall exactly:
I did not direct you to replace $n$ by two different numbers. I stated this as an observation and asked if you think it right. Have you ever seen the same variable in a single expression replaced by two values? I was hoping you notice this and feel ashamed because this is not done in mathematics. | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
In addition to the above, I want to stress that having 45 edges is not the same as being equal to 45 edges. Presumably, you have a computer, but you are not equal to a computer, right? I am not sure if the phrase "equal to having" is possible in English, but it is not correct here. "Having 45 edges" is at best a property of graphs, and a graph $K_n$ cannot be equal to a property, or a number, or a function and so on. A graph may only be equal to a graph. Theerefore, please don't say, "A graph is equal to 45 edges" or "A graph is equal to having 45 edges"; this is absolutely wrong.
- - - Updated - - -
No. Just no. Not in the context of this thread..
#### caffeinemachine
##### Well-known member
MHB Math Scholar
1. Define a graph.
A graph is a two-dimensional drawing showing a relationship usually between two sets of numbers by means of a line, curve, a series of bars, or other symbols. Usually, the independent variable is shown on the horizontal line (X-Axis) and the dependent variable is shown on the vertical line (Y-Axis). When the axis is perpendicular then is intersects as a point called the origin and is calibrated in the units of the quantities represented. A graph usually has four quadrants representing the positive and negative values of the variables. Most of the time the north-east quadrant is shown on the graph when the negative values do not exist or don’t have interest. A graph can also be defined as a diagram of values, usually shown as lines or bars.
This is completely different meaning of a graph. This usage of the term graph applies to the sketch of functions. Like when you want to picturize $f(x)=x^2$ for real $x$. We are not using the word graph to mean this at all. Here we use the word graph as used in the context of discrete mathematics. Here is a link Graph theory - Wikipedia, the free encyclopedia
I have defined graphs in a previous post already.
2. What is an ‘edge’ of a graph? | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
2. What is an ‘edge’ of a graph?
The edge of a graph is the intersection of two planes or faces. The edges can also be called arcs. In a simple graph, the set of vertices (V) and set of unordered pairs of distinct elements of V called edges. Graphs are not all simple. Sometimes a pair of vertices are connected by multiple edge yielding a multigraph. At times the vertices are connected to themselves by an edge called a loop, creating a pseudograph. Edges can also be given a direction creating a directed graph. An edge joins one vertex to another or starts and ends at the same vertex. The edges can have straight or curved lines and is also known as arcs.
The thing marked in red is an incorrect statement. That definition applies to a particular class of graphs, called planar graphs, in a special sense and we can dispense with that for now. The right answer is that an edge of a graph $G$ is simply any element in the edge set $E(G)$ of the graph $G$.
3. Does it matter if we join two vertices with a straight line or a curved line when we represent a graph by drawing it on paper? | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
I do know that a straight line should be drawn with a ruler and not free hand. A curved line should be drawn in a smooth “swoop” through the points to indicate the general shape. A curved graph, you need as many points as possible to make it accurate. If your given a straight line in a graph, then it shows that the two physical quantities that I plotted are “proportional”. If the straight line goes through the origin of the graph, then it indicates that they are “directly proportional”. If you double one quantity the other will double too. Any points that are well away from the line are called anomalies. This may be due to experimental error. From my understanding of this that since I don’t think it really matters whether or not you join two vertices with a straight line or curved line because if I am drawing it on paper then I would make the curved line as accurate as possible to match up with the straight line.
Again, here you probably had the other usage of the word graph in mind while writing this answer.
The right answer is that it does not matter how you draw an edge to connect two vetices.
4. What is a cycle graph? Give an example.
A cycle graph is a graph that consists of a single cycle, or in other words, some number of vertices connected in a closed chain. An example of a cycle graphs are as follows: Triangle Graph, Square Graph, Grid Graph, Circular Graph, Block Cycle, Step Cycle, Arrow Cycle, and a Balanced Cycle.
The things marked in blue are probably not cycle graphs. For a definition see Cycle (graph theory) - Wikipedia, the free encyclopedia
5. What is a complete graph? Give an example. | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
5. What is a complete graph? Give an example.
A complete graph is a graph with N vertices and an edge between every two vertices. There are no loops. Every two vertices share exactly one edge. The symbol KN is used for a complete graph with N vertices. Also, a complete graph is a graph in which each pair of graph vertices is connected by an edge. Some examples of a complete graph are as follows: Line graph, Star graph, Planar graph, Wheel Graph, Odd Graph, Tetrahedral Graph, and Pentatope Graph.
The definition of a complete graph looks okay. But Many of the examples (marked in blue) are not complete graphs. Find out which ones.
6. If we consider the G as the whole of the cycle graph having 4 edges then is G a complete graph?
I would say yes that G is the whole of the cycle graph having 4 edges and would be considered a complete graph. The reason is because a complete graph has an edge between every two vertices, with no loops, and every two vertices share exactly one edge.
No, a cycle having 4 edges is not a complete graph. This follows easily from the definitions.
#### Jameson | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
#### Jameson
Staff member
Evgeny.Makarov: I may have misunderstood some definitions, but as I stated below to Caffeinemachine there is no dictionary in the back of my textbook so the answers I got was from online of a Graph Theory Glossary. I am not trying to talk about different things here, but what I am trying to figure out is what is Kn. I will tell you right now I never took any upper division math courses in high school and was in Special Education all of my life. I have a learning disability (Epilepsy Seizures) which causes me to have a hard time comprehending and understanding. Also, just so you know that I have repeated Elementary Algebra a total of 4 times and Intermediate Algebra a total of 5 times. As for in response to your question, I am not going to feel ashamed just because I didn't notice or observe something. Furthermore, I might add that no I haven't seen the same variable used in a single expression or equation that is replaced by two values. Finally, I will not say that "having 45 edges" is "equal to having 45 edges".
Hi Joystar1977,
I've been following this thread with interest since I am completely ignorant on the topic. I've been part of math sites for quite some time now and over the years I've noticed that mathematicians have a tendency to be straight to the point and don't sugar coat things, but that doesn't always mean they are trying to be rude or hurt your feelings. Both of the members in this thread are trying to help, trust me. They are both "MHB Math Helpers" and being respectful to other members is a huge part of that title.
Of course you shouldn't feel ashamed!! You are working hard to further your knowledge of a difficult topic. You're in the right place here at MHB at I hope that you feel we are here to help you.
Jameson
#### caffeinemachine
##### Well-known member
MHB Math Scholar
Hi Joystar1977, | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
Jameson
#### caffeinemachine
##### Well-known member
MHB Math Scholar
Hi Joystar1977,
I've been following this thread with interest since I am completely ignorant on the topic. I've been part of math sites for quite some time now and over the years I've noticed that mathematicians have a tendency to be straight to the point and don't sugar coat things, but that doesn't always mean they are trying to be rude or hurt your feelings. Both of the members in this thread are trying to help, trust me. They are both "MHB Math Helpers" and being respectful to other members is a huge part of that title.
Of course you shouldn't feel ashamed!! You are working hard to further your knowledge of a difficult topic. You're in the right place here at MHB at I hope that you feel we are here to help you.
Jameson
Thank you Jameson for these encouraging lines for Joystar.
I couldn't have said it better myself.
___
You are doing a good job Joystar. Just keep trying and you will have these concepts down in no time.
#### Joystar1977 | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
#### Joystar1977
##### Active member
Jameson: I feel the same way in the sense that if I knew about this course material, then I wouldn't be here seeking help. I thought that it would help me to tell Evgeny.Makarov and Caffeinemachine a little about myself because of the fact they wouldn't get so sick and tired of me for not understanding the material or kind of saying to themselves, "How come this person isn't understanding this material?" Everybody has their strengths and weaknesses and I admit mine is not mathematics. I am really good at writing, English, Spelling, Grammar, Punctuation, Vocabulary, Reading, and Public Speaking. I wasn't trying to be rude and sorry if you thought I was but I am the type of person, "who takes things for what they mean" and also have the belief "that if a person didn't mean to say something, then they wouldn't popped their mouth off in the first place." It just basically means to think before you speak and all I ask is for them to have patience with me because I do have a learning disability (Epilepsy Seizures) while I try to get through this course (Discrete Mathematics). This is very difficult and it should tell you a lot about myself especially after I repeated Elementary Algebra 4 times and Intermediate Algebra 5 times and finally ended up passing them. I know that the MHB Math Helpers are here to help me. I am learning as I go through this and try to grasp these concepts.
Hi Joystar1977,
I've been following this thread with interest since I am completely ignorant on the topic. I've been part of math sites for quite some time now and over the years I've noticed that mathematicians have a tendency to be straight to the point and don't sugar coat things, but that doesn't always mean they are trying to be rude or hurt your feelings. Both of the members in this thread are trying to help, trust me. They are both "MHB Math Helpers" and being respectful to other members is a huge part of that title. | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
Of course you shouldn't feel ashamed!! You are working hard to further your knowledge of a difficult topic. You're in the right place here at MHB at I hope that you feel we are here to help you.
Jameson
#### Joystar1977
##### Active member
Caffeinemachine: Thanks for these encouraging words and I am on an extension for my course at the college I am presently attending. I guess then not everything you read online (referring to the Internet) is correct, because as I mentioned to you before I got my answers from a Graph Theory Glossary here on the Internet. Please let's get back to what we were talking about.
I know that a complete graph is a graph (means one) with N vertices (means more than one) and an edge (means one) between every two vertices (means more than one). There are no loops (means more than one) in a complete graph. Every two vertices (means more than one) share exactly one edge (means one). Also, a complete graph (means one) is a graph (means one) in which each pair (means one) of graph vertices (means more than one) is connected by an edge (means one).
Please explain further about how come G is not considered the whole of the cycle graph when it has 4 edges so its not considered a complete graph. My understanding of the cycle graph is that it consists of a single cycle (to me this means one) or in other words specifying some number (to me this means any number) of vertices (to me this means more than one) connected in a closed chain (to me this means that in order for a chain to be closed and connected then it would have to have more than one connection or vertice). Am I reading too much into this?
Thank you Jameson for these encouraging lines for Joystar.
I couldn't have said it better myself.
___
You are doing a good job Joystar. Just keep trying and you will have these concepts down in no time.
#### caffeinemachine | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
#### caffeinemachine
##### Well-known member
MHB Math Scholar
I know that a complete graph is a graph (means one) with N vertices (means more than one) and an edge (means one) between every two vertices (means more than one). There are no loops (means more than one) in a complete graph. Every two vertices (means more than one) share exactly one edge (means one). Also, a complete graph (means one) is a graph (means one) in which each pair (means one) of graph vertices (means more than one) is connected by an edge (means one).
Good job. Just one thing. The thing marked in blue is redundant. You have already stated in the black text what you have said in the blue text. Feel free to ask me if this confuses you.
Please explain further about how come G is not considered the whole of the cycle graph when it has 4 edges so its not considered a complete graph. My understanding of the cycle graph is that it consists of a single cycle (to me this means one) or in other words specifying some number (to me this means any number) of vertices (to me this means more than one) connected in a closed chain (to me this means that in order for a chain to be closed and connected then it would have to have more than one connection or vertice). Am I reading too much into this?
Hmm..
Have a look at this https://docs.google.com/file/d/0B77QF0wgZJZ7NWZpbWQzakVybW8/edit
The left diagram is that of a cycle graph on 4 vetrices and the right diagram is that of a complete graph on 4 vertices. Note that in the left diagram the vertices $a$ and $d$ are not connected. Thus the left diagram cannot be a diagram of a complete graph as any two distinct vertices in a complete graph have an edge joining them. | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307731905612,
"lm_q1q2_score": 0.8746929380674514,
"lm_q2_score": 0.8991213705121083,
"openwebmath_perplexity": 301.7428207620524,
"openwebmath_score": 0.5917503237724304,
"tags": null,
"url": "https://mathhelpboards.com/threads/5-vertices-denoted-by-k5-part-b.5864/"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.