What makes a chord minor, major or diminished?

Question: I've started learning music theory bit by bit but there's something that I can't quite figure out.
I know that when you're in a certain key, the first is major, the second and third are minor, the fourth and fifth are major, the sixth is minor and the 7th is diminished.
What I don't understand is why.
Update
What I understand from the comments and sources is that the intervals between the triads make up whether a chord is major, minor or diminished.
Key of C:
C . . . E . . G --> (major)
D . . F . . . A --> (minor)
E . . G . . . B --> (minor)
F . . . A . . C --> (major)
G . . . B . . D --> (major)
A . . C . . . E --> (minor)
B . . D . . F   --> (diminished)

How will this play out for let's say... the key of D?
Comment: Also related: https://music.stackexchange.com/questions/62699/whats-the-logic-behind-chords-building-patterns-that-are-in-key?rq=1
Comment: Related: https://music.stackexchange.com/questions/11659/what-determines-a-chords-name/11669#11669
Comment: Between the two questions linked, this question has already been answered. There are also many other questions that also go into this on the site. This is a common beginner question.
Answer: We call these triad qualities.
Whenever you determine the quality of a triad, you have to base it off of the root of the triad, not the tonic of the overall key.
So in C major, you have D F A. Even though you're in C major (we call C the tonic of the key), we need to think briefly in the key of D to determine the quality of the D F A triad.
In D major, there are two sharps: F# and C#. Since the F in D major is actually F♯, F♯ is the major third above D. As such, a D major triad would be D F♯ A. Since we want D F A, we see that the major third F♯ is lowered a half step to the minor third F♮.
So we have D F, which is a minor third. Now we need to look at the fifth D A.
But there's a nice trick with fifths. If two pitches are a perfect fifth apart, they will share the same accidental. The only exception are the pairs B♭/F and B/F♯. Otherwise, all pitches that are a fifth apart and have the same accidental create a perfect fifth. D A matches this rule, so it's a perfect fifth.
Now we have D F A, which has a boundary interval of a perfect fifth and a third that is minor. This creates a minor triad.

If we turn now to F A C, we think again in the key of the triad's root: here, F. F has one flat (B♭) in the key signature, otherwise everything else is natural in the F major key. Therefore, A is a major third above F, and we know from our previous rule that F C is a perfect fifth. As such, a perfect fifth with a major third inside is a major triad.

There are two other triad qualities: diminished and augmented. Diminished triads have a diminished fifth (a perfect fifth that's one half step too small) with a minor third, and augmented triads have an augmented fifth (a perfect fifth that's one half step too large) with a major third.
In summary:

Major triad: major third with a perfect fifth; scale degrees 1 3 5 of a major scale.
Minor triad: minor third with a perfect fifth; scale degrees 1 ♭3 5 of a major scale, or scale degrees 1 3 5 of a minor scale.
Diminished triad: minor third with a diminished fifth; scale degrees 1 ♭3 ♭5 of a major scale.
Augmented triad: major third with an augmented fifth; scale degrees 1 3 ♯5 of a major scale.

Lastly, the pattern of major and minor triads (with the last one being diminished) is what we call diatonic triads. This means that this is the pattern of chord qualities that obtains in any major key without any chromatic alterations.
As such, no matter what major key you're in, the chord built on the third scale degree of a major key will always be minor as long as there aren't any chromatic pitches added in. Similarly, the chord built on the fifth scale degree will always be major.
Note that this pattern of diatonic triads is different in a minor key. For this issue, see Understanding minor key harmony
Answer: Starting from one note, let's say C.
The major part is the 3rd note on, E. It's an interval of a major third.
The minor part is a flat 3rd on, Eb. It's an interval of a minor third.
The other note in both cases is P5 - a perfect fifth.
Onto diminished. There's a m3 (Eb) and a dim5 (Gb), making the Co spelled C Eb Gb.
Now you've added to the question - a different explanation is needed.
In D major, the pattern of diatonic chords is the same pattern as in C, or any of the other ten major keys. Maj, min, min, maj, maj, min, dim. So, triads - on D: D F# A (maj) on E: E B G (min), on F#: F# A C# (min), on G: G B D (Maj), on A: A C# E (maj), on B: B D F# (min), on C#: C# E G (dim).
Note - each triad is made up from notes with letter names a third apart, but all match the criteria for maj., min., or dim.
Answer: Triads are a set of three notes, set intervals away from a root note, the intervals are as follows.
Major Chords are chords with a root note, a Major third above it, and a perfect fifth above the root note
Minor Chords are chords with a root note, minor third above it, and also a perfect fifth above the root.
Augmented chords are chords with Major thirds and augmented fifths
Diminshed chords are chords with a minor third and a diminished fifth
These types of chords are key agnostic, yes you get certain scale degrees where certain chords fit naturally but there are massive amounts of music that are only loosely adhering to a key that can have any manner of chords on the various scale degrees of the scale.
You need to know how to figure them out, not just learn what chords fit at which scale degree.
Answer:
How will this play out for let's say... the key of D?

The notes in D major are: D, E, F♯, G, A, B, and C♯.
The pattern of chords diatonic to the key will be exactly the same as for C (for which the chords are enumerated in the question linked to above), but a tone higher.
From www.piano-keyboard-guide.com/key-of-d.html :

And Neil Meyer's point is worth repeating - just because a piece is 'in D Major', it doesn't necessarily mean that these are the only chords you'll find in the piece!


Encontrar valor de atributo com regex

Question: Recebo uma string por um feed RSS, cuja parte que interessa é a seguinte:
&lt;table feedtag="divinegoblin" ...
Cada pedaço do feed sempre vai ter esse atributo feedtag="...". Gostaria de pegar o valor desse atributo (no caso divinegoblin) com Regex. Não sei quase nada de Regex, estava tentando pegar usando (feedtag), mas não sei como pegar o que está adiante (no caso o que está dentro das aspas). Como posso fazer?
Answer: O jeito mais simples que você pode utilizar é assim:
feedtag="([^"]*)"

Desta forma ele pega tudo o que tem dentro das aspas depois de um feedtag=
Veja funcionando: https://regex101.com/r/BwibaW/2
Comment: Não é melhor colocar `"([^"]*)"` para evitar casar com uma aspas no meio do caminho?
Comment: Obrigado! Funcionou exatamente do jeito que eu queria
Answer: Seguem outras alternativas de encontrar o valor, no snippet abaixo tem um exemplo usando .substring(sei que na pergunta pede por regex) mas achei interessante colocar, e um exemplo utilizando regex, retornando somente o valor dentro das aspas através da captura de grupo.

var a = '&lt;table feedtxag="wesas" feedtag="divinegoblin"';
var conteudo;
conteudo = a.substring(a.indexOf('feedtag="') + 'feedtag="'.length, a.indexOf('"', a.indexOf('feedtag="') + 'feedtag="'.length));
console.log("SUBSTRING: " + conteudo);

var regexResultado = a.match(/feedtag="\s*([^"]*)\s*"/)[1];
console.log("REGEX: " + regexResultado);

Encontrar valor de atributo com regex


Suggest models for prediction based on small sample data

Question: I am not a traditional statistics guy. I am from an electrical engineering background. So, spare me for lack of jargon.
The model is to be used for predicting agricultural output based on previous data. One method is Grey model prediction, which need around 4 to 8 sample data for prediction. Could you think of any other model?
E.g.: I have national agriculture output of sugarcane from 1996 to 2010 on an annual basis. That accounts for 15 data. Now using these data, I wish to design a prediction model and use it to forecast the next 2 or 3 years of national production output of sugarcane.
My confusion is about which model will give me the best forecasting result for such a small amount of data.
Please let me know anything else is lacking in the description.
Thanks.
Comment: It's not even clear what you mean by 'low sample data' (small values, or few data points?), let alone the rest of it. Please clarify extensively. I have no clear idea what you are asking.
Comment: I added the time-series tag and voted for re-opening. This question can be answered now. @ron: I don't know the "Grey model", do you have a reference?
Comment: Can you say more about your data & your situation? I'm not sure if there's enough here to make this question answerable.
Comment: @gung. I have put in some details. Let me know if needed more.
Comment: "Forecasting agricultural output with an improved grey forecasting model based on the genetic algorithm" -by Shang-Ling Ou. @Stephan Kolassa: for your reference.
Comment: @ron: thanks. Well, nothing against *Computers and Electronics in Agriculture* (and I don't have access to the article), but I think the specialized journals for forecasting will be more helpful, i.e., the *International Journal of Forecasting* (in which the M3 competition was published) and the *Journal of Forecasting*.
Answer: You are looking for time series forecasting. I recommend this free textbook.
Histories of 15 yearly data points are not uncommon in time series forecasting. For instance, the very first one of the series used in the classical M3 competition has only 14 data points. Let's use R and look at this dataset.
library(Mcomp)
M3[[1]]
M3[[1]]$x

We can fit an Exponential Smoothing model using ets() (for "Error, Trend, Seasonality"), which attempts to automatically choose the correct model in terms of trend, seasonality and error - seasonality is irrelevant for yearly data. Let's forecast using this model. forecast() will give us a point forecast as well as (by default) 80% and 95% prediction intervals. We can also plot the original series, the point forecasts and the prediction intervals.
ets.model <- ets(M3[[1]]$x)
forecast(ets.model,h=3)
plot(forecast(ets.model,h=3))

Similarly, auto.arima() will try to fit the best ARIMA model:
arima.model <- auto.arima(M3[[1]]$x)
forecast(arima.model,h=3)
plot(forecast(arima.model,h=3))

The textbook I linked to above will bring you up to speed on both Exponential Smoothing and ARIMA, as well as other aspects of forecasting, like model selection and accuracy measurement. As I noted in my comment above, I don't know a "Grey model", and after a couple of years in this field, I would rather suggest using standard methods like Exponential Smoothing and ARIMA than an unknown method - after all, there are reasons why these methods have evolved to be the mainstay in time series forecasting.
Happy forecasting!
Comment: What about the bayseian model. How effective is that? And can that one be used here?
Comment: Bayesian models are certainly possible in forecasting. Essentially, you posit some model and describe the parameters by prior distributions, which will then be updated by the observations. However, I think it would be helpful to first understand "vanilla" forecasting on the one hand and "standard" Bayesian statistics (without time series-related complications) on the other hand before delving into the combination of the two.


How to make a topological subspace Hausdorff

Question: If $X$ is a compact topological space then $C(X)$ is a C* algebra.  I'm not going to attempt to discuss the locally compact case with $C_0(X)$ because usually the definition of that space requires the underlying $X$ to be Hausdorff.  $C(X)$ has a Gel'fand representation, as some $C(Y)$ with Y compact and Hausdorff.  How does Y relate to X?  Is it via some standard process by which one can take a nonHausdorff space and maybe design some strange equivalence relation for which the fact set is $Y$, and Hausdorff?
Comment: http://mathoverflow.net/questions/78175/largest-hausdorff-quotient
Comment: Isn't it just the [Stone–Čech compactification](http://en.wikipedia.org/wiki/Stone%E2%80%93%C4%8Cech_compactification) of $X$ (which isn't actually a compactification in this case)?
Answer: Let $\delta_t$ be the evaluation at the point $t\in X$. It is easy to check that $s\sim t\iff\delta_s=\delta_t$  is an equivalence relation $\sim$ on $X$. Consider $X/\sim$, with the quotient topology (i.e. the smallest topology that makes the quotient map continuous).
Now consider the map $\phi:C(X/\sim)\to C(X)$  given by $\phi(f)(t)=f([t])$, where $[t]$ is the class of $t$ in the quotient. This map is obviously a $*$-homomorphism. It is one-to-one by construction, because if $\phi(f)=0$, then $f([t])=0$ for all $[t]$, i.e. $f=0$. And it is onto: if $g\in C(X)$, then we define a function $g'\in C(X/\sim)$ by $g'([t])=g(t)$; this of course implies that $\phi(g')=g$. All we need to check is that such $g'$ can be defined; this is exactly to say that $g(t)$ does not depend on the value of $g$, and this holds, since $s\sim t$ if and only if $\delta_s=\delta_t$.
The topology on $X/\sim$ is Hausdorff: given $[s]\ne[t]\in X/\sim$, we have that $\delta_s\ne\delta_t$, so there exists $f\in C(X)$ such that $f(s)\ne f(t)$. The construction of the quotient topology guarantees that $f'$, as in the previous paragraph, is continuous; we get that $f'([s])\ne f'([t])$, and so $[s]$ and $[t]$ can be separated.
So, as C$^*$-algebras, $C(Y)\simeq C(X)\simeq C(X/\sim)$. Since $Y$ and $X/\sim$ are Hausdorff, we deduce that $Y$ is homeomorphic to $X/\sim$.
Comment: What exactly is the equivalence relation "non-separable by open sets"? Do you mean $s \sim t$ iff $\delta_s = \delta_t$? Consider the three point space $\{a,b,c\}$ with the topology $\{\emptyset, \{a\}, \{b\}, \{a,b\}, \{a,b,c\}\}$. Then neither $a$ nor $b$ can be separated from $c$ by open sets, but $a$ and $b$ can be separated by open sets.
Comment: You are right, I'm editing the answer accordingly. It is interesting that, in your example, $C(X)$ consists of the constant functions only.
Comment: Nice. If one wants, one could split your construction up into two steps 1) Take the coarsest topology $\sigma$ on $(X,\tau)$ that makes elements of $C(X)$ continuous. Then $(X,\sigma)$ is completely regular and $(X,\tau) \to (X,\sigma)$ is continuous. 2) Take the [Kolmogorov quotient](http://en.wikipedia.org/wiki/Kolmogorov_quotient) of $(X,\sigma)$ and this will be a completely regular $T_0$ space, and in particular it will be Hausdorff. Step 2) is similar in spirit to what you wrote before: two points are equivalent iff they are topologically indistinguishable.
Comment: @MartinArgerami I have just noticed that it is still safe to define the continuous functions vanishing at infinity on a locally compact nonHausdorf space, but that your construction no longer works in that case.  Also, the one point compactification becomes much messier, and the space is no longer the closure of the compactly supported functions on $X$.  Is all of this a reflection that the analogy between compact and locally compact breaks without the presence of the Hausdorf assumption?


Can we apply the sandwich theorem if superior and inferior sequences tend to infinity?

Question: If $\lim_{{n}\to{\infty}} \hspace{1 mm} f(n) = \infty$ and $\lim_{{n}\to{\infty}} \hspace{1 mm} h(n)= \infty$ and $f(n) \le g(n) \le h(n)$. Can we say $\lim_{{n}\to{\infty}} \hspace{1 mm} g(n) = \infty$?
Comment: Yes, this follows from $f(n)\leq g(n)$, you don't even need the sandwich theorem
Comment: $n$ are natural numbers, $x$ are reals, intentional?
Comment: Yes, this means that $f$ and $h$ will "escort" $g$ to $\infty$.
Comment: @HennoBrandsma It was my mistake.
Answer: Yup! Actually you don't need the upper part even.
The proof is simple too, if you just state the definition of divergence to infinity.


request Vimeo private video file as Pro account

Question: I want request my private video file by using video id(my account is Pro). but I don't have a idea how to credential my account in request.
This is what i did!
GET https://api.vimeo.com/videos/{video_id}
body
{
  "grant_type": "client_credentials"
}

header
"Authorization" : "bearer {access_token}"
"Accept" : "application/vnd.vimeo.user+json;version=3.0,application/vnd.vimeo.video+json;version=3.4"
"Content-Type" : "application/json"

and this is resposne about that..
{
    "error": "Something strange occurred. Please contact the app owners.",
    "link": null,
    "developer_message": "No user credentials were provided.",
    "error_code": 8003
}

Answer: You're generating a client_credentials token, which can only retrieve public data on Vimeo. Instead, you need to generate an authenticated token, either via the OAuth workflow or a Personal Access Token on the Vimeo Developer Site. More information here:
https://developer.vimeo.com/api/authentication#using-the-auth-code-grant-step-1
https://developer.vimeo.com/api/guides/start/#generate-access-token
Answer: Generate access_token from your account after adding NEW APP.
then pass access_token in the URL or as a parameter
e.g https://api.vimeo.com/videos?access_token=***********************&links=https://vimeo.com/29474908


Evaluating a limit of $xf(2)$ - $2f(x)/x-2$ as $x$ approaches $2$

Question: I was doing exercises on limit and I came across this question:
find the limit of ( $xf(2)$ - $2f(x)$ ) $/$ ($x-2$) as $x$ approaches 2 given $f(2) = 7$ and $f'(2) = 5$.
so I proceeded this way:
as $ x $ approaches 2, $ xf(2) $ approaches $ 2f(2) $. Therefore,
$xf(2)$ - $2f(x)$ $/$ $x-2$ $ = $ $ 2f(2)$ - $2f(x)$ $/$ $x-2$
Factoring $2$ and since $ lim f(x) - f(a)/x-a $  is $f'(x)$
The limit evaluates to   $2f'(x)$
Is the way I proceeded the right way? How do you do similar questions like:
$ lim$ $ nf(x) - f(a)/x-a $
or
$ lim f(x) - nf(a)/x-a $
Comment: "as $ x $ approaches 0, $ xf(2) $ approaches $ 2f(2) $." -- Pretty sure it doesn't? First there's no $f(2)$ in the limit. Secondly, as $x \to 0$, $x f(x) \to 0 \cdot f(0)$ (and in turn $0$), provided $f$ is "nice enough" anyhow. I feel like there's typos somewhere.
Comment: @ClaudeLeibovici sorry, it is $f'(2) = 5$
Comment: Are you 100% certain that you have $$x f(x) - 2 f(x)$$ in the numerator? This contradicts your idea for a generalization at the end of your post, and your working thus far.
Comment: @EeveeTrainer there were many typos, i have corrected them, Thank you!
Answer: Just rewrite it as follows
$$\frac{xf(2) - 2f(x)}{x-2}= \frac{xf(2) - 2f(2) + 2f(2) - 2f(x)}{x-2}$$
$$= f(2)-2\frac{ f(x) - f(2)}{x-2}\stackrel{x\to 2}{\rightarrow} = 7-2\cdot 5 = -3$$
The idea behind it is to rewrite the expression in a form such that you can use the two given facts

$f(2) = 7$ and
$f'(2) = \lim_{x \to 2}\frac{f(x)-f(2)}{x-2} = 5$

Now, one looks how one can "rediscover" these two facts in the given expression. A possible way I have given above.
Answer: The title says $x \to 2$ but you have changed it to $x \to 0$ in the question. It is more likely that you are asked to find the limit as $ x\to 2$. If you approximate only the numerator you are not approximating the ratio. So your first step is not valid. Apply L'Hopital's Rule to the get the limit as $\lim_{x\to 2} \frac {xf'(x)+f(x)-2f'(x)} {1}=2f'(2)+f(2)-2f'(2)=f(2)=7$.
$\lim_{x \to a} \frac {nf(x)-f(a)} {x-a}=0$ if $nf(a)\neq f(a)$. It is $nf'(a)$ if $nf(a)=f(a)$.
Comment: You can use the fact that $f(x)=f(2)+(x-2)f'(2)+o((x-2))$
Comment: I fell for this trap too but note that the OP states the limit as $x \to 0$, not $2$.
Comment: @EeveeTrainer Thanks for the comment. But it is doubtful if OP copied the question correctly since the title conflicts with the question.
Comment: Yeah I'm inclined to agree. I also agree with your conclusion that given the information they gave it's more likely - in whatever way you wish interpret that - that they meant to find the limit at $2$.
Comment: And based on the most recent edit, seems like it is so. Oh well.
Comment: @KaviRamaMurthy is there any other way to do it without using L'Hopital's Rule?


imageWithContentsOfFile vs imageNamed (imageWithContentsOfFile return a low quality image )

Question: Once, I placed all my pictures in APP Bundle. I used imageNamed function to get an image. Later, I decided to copy some pictures to the Document when app start. So, I could not use imageNamed function to get an image any more. I used imageWithContentsOfFile to get an image:
NSString* documentsDirectoryPath =[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES) objectAtIndex:0];
UIImage* result =[UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.%@", documentsDirectoryPath, fileName, extension]];

However, imageWithContentsOfFile return a low quality image (very fuzzy).
all of my image are 128*128.
I used following code the detect the size of the picture:
NSData * imgData = UIImagePNGRepresentation(image);
NSLog(@"size : %d",[imgData length]);

I found that size of the image returned by imageNamed is 3 times than imageWithContentsOfFile.
I got crazy ... Help me ! Thanks a lot ...
Comment: How are you coping the images to the Documents directory?
Comment: Why can't you get the images using imageNamed after the application has started?
Answer: In the UIImage reference documentation you can see a couple of differences between imageNamed and imageWithContentsOfFile.

imageWithContentsOfFile doesn't cache the image, nor it looks for retina display version (@2x.png).
imageNamed instead does cache the image and also checks to see if there is a @2x version, to load that one when in a retina enabled device.

Knowing this, the most logical explanation that I can think of for your problem is that you are using a retina device and have a retina version of that same image (@2x). That would explain why the image
Answer: I use + (UIImage *)imageWithContentsOfFile:(NSString *)path in order to load images from disk without caching them, to reduce memory footprint.
It seems that this method has changed since iOS 8x. In order to maintain functionality on each iOS version (7x to 9x), I use this simple category on UIImage :
#import <UIKit/UIKit.h>

@interface UIImage (ImageNamedNoCache)

+ (UIImage *)imageNamedNoCache:(NSString *)imageName;

@end

And .m
#import "UIImage+ImageNamedNoCache.h"

#define MAIN_SCREEN                     [UIScreen mainScreen]
#define SYSTEM_VERSION_LESS_THAN(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)

@implementation UIImage (ImageNamedNoCache)

static NSString *bundlePath = nil;

+ (UIImage *)imageNamedNoCache:(NSString *)imageName
{
    if (!bundlePath)
    {
        bundlePath = [[NSBundle mainBundle] bundlePath];
    }

    NSString *imgPath = [bundlePath stringByAppendingPathComponent:imageName];

    if (SYSTEM_VERSION_LESS_THAN(@"8.0"))
    {
        imgPath = [imgPath stringByAppendingFormat:@"@%ldx.png", (long)[MAIN_SCREEN scale]];
    }
    return [UIImage imageWithContentsOfFile:imgPath];
}

@end

Hope that helps ;)


ActiveRecord::RecordNotFound in PracticeController#show Couldn't find Welcome with 'id'=edit

Question: I have created a CURD operation. Whenever i click on edit, show , delete button it raises the error "Couldn't find Welcome with 'id'=edit" "Couldn't find Welcome with 'id'=show" "Couldn't find Welcome with 'id'=destroy". I have been trying a lot to solve these error but i am getting more and more confused. Please Help!
Practice.controller

class PracticeController < ApplicationController
 def index
   @welcome= Welcome.all;
 end

 def show
   @welcome = Welcome.find(params[:id])
 end

 def new
  @welcome= Welcome.new;
 end

 def edit
  @welcome = Welcome.find(params[:id])
 end

 def create
  @welcome=Welcome.new(params.require(:welcome).permit(:name,:address,:city)) ;
   if @welcome.save
  #redirect_to({ action: 'practices' }, alert: "Record saved")
  redirect_to :root
   else
   render :action=>"new"
 end

 def update
  @welcome = Welcome.find(params[:id])

  if @welcome.update(welcome_params)
    redirect_to @welcome
  else
    render 'edit'
   end
 end

 def destroy
  @welcome = Welcome.find(params[:id])
  @welcome.destroy

  redirect_to welcome_path
 end
  end
end

**

Please fill the following details

<%= form_with  scope: :welcome , local: true do |f| -%>
Name:&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp&nbsp<%= f.text_field :name %>

Address:&nbsp &nbsp &nbsp &nbsp&nbsp <%= f.text_area :address %>

City:&nbsp &nbsp &nbsp &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <%= f.text_field :city %>

<%= f.submit "Submit", class: "btn-submit" %>

<% end %>

Listing details

    Name
    Address
     City

  <% @welcome.each do |welcome| %>

      <%= welcome.name %>
      <%= welcome.address %>
   <%= welcome.city %>
      <%= link_to 'Show', {:controller => "practice", :action => "show", :welcome => welcome.id } %>
   <%= link_to 'Edit', {:controller => "practice", :action => "edit", :welcome=> welcome.id } %>
   <%= link_to 'Delete', {:controller => "practice", :action => "destroy", :welcome=> welcome.id },
     method: :delete,
     data:{confirm:'Confirm Delete?'}%>

  <% end %>

**
edit.html.erb

Edit Information

<%= form_with(controller: :action=>"edit", local: true) do |form| %>

    <%= form.label :name %>

    <%= form.text_field :name %>

    <%= form.label :address %>

    <%= form.text_area :address %>

 <%=form.label :city %>

 <%=form.text_field :city %>

    <%= form.submit %>

<% end %>
Answer: Below are problematic lines:
In view
<%= link_to 'Show', {:controller => "practice", :action => "show", :welcome => welcome.id } %>

In controller
def show
         @welcome = Welcome.find(params[:id])
end

You are passing the id parameter in :welcome in view and trying to access the same in controller by :id which is causing the problem. Modify controller as below to fix it.
def show
   @welcome = Welcome.find(params[:welcome])
end

Comment: Hey thanks Pranav, It worked. Show action is now getting execute. But now there is a new error i am getting in edit action.
Comment: If this answer resolves the issue then please mark it as correct answer. Please ask new question with exact error message you are getting so that I can help you. Thanks!


DBGo INSERT INTO via SQL.CommandText

Question: I have taken the habit to use SQL.TEXT variable to initialize my queries in order to avoid two statements: SQL.Clear; SQL.Add( ); using DBExpress.
Using dbGo for a new small project, this makes:
SQL.CommandText := 'INSERT INTO LeaveClass (id,name,color,status) VALUES (1,''Joe'',255,''Ok'')';
ExecSql;

This command breaks with a syntax error. But if we use:
SQL.Clear;
SQL.Add( 'INSERT INTO LeaveClass (id,name,color,status) VALUES (1,''Joe'',255,''Ok'')' );
ExecSql;

It works fine! Well I have wasted some time before catching up this problem and find its way around. What errors do I do? May be the dbGo.ADOQUERY.Sql.Clear makes a deep cleaning that the assignment via dbGo.ADOQUERY.SQL.CommandText doesn't. Weird. Any commands?
Comment: BTW, I hope you are using parameters in your real code...
Comment: What is the type of dbGo.ADOQUERY.Sql?
Comment: Waht type of object are you using? ADOQuery? ADOCommand?
Comment: IMO, it should be `dbGo.ADOQUERY.SQL.Text := 'INSERT ...` or `dbGo.ADOQUERY.CommandText := 'INSERT ...`. Seems there's a mix up...
Comment: You talk about using SQL.Text, but then write something utterly different.
Answer: CommandText really only works for SELECT or other operations that return data (recordsets). It's not designed for ExecSQL or INSERT/DELETE type operations.
Simply use ADOQuery.SQL.Text instead:
ADOQuery1.SQL.Text := 'INSERT INTO LeaveClass (id,name,color,status) VALUES (1,''Joe'',255,''Ok'')';
ADOQuery1.ExecSQL;
ADOQuery1.Close;

Setting the Text property directly automatically replaces what was there before, removing the need for Clear.

DBGo INSERT INTO via SQL.CommandText


How to generate MIDI of a drum score in Lilypond?

Question: I am beginning to experiment with Lilypond, trying to see the possibilities for writing drum scores / lead sheets.
So far I have found the \drums notation, as well as \midi { } command. However, when trying to add the MIDI block inside the drums block, it is reported as invalid.
I am using VSLilyPond extension on Windows.
Answer: It seems that using the full syntax is better in this case:
\score {
    \new DrumStaff {
        \drummode {
            bd4 sn bd sn
        }
    }
    \layout { }
    \midi { }
}

This generates the MIDI file. I wonder if the same is possible with the \drums shorthand syntax.
Edit:
Thanks to the tip, this would be the short-hand syntax. Needing the \score envelope around, with the \midi instructions inside.
\score {
    \drums {
        bd sn bd sn
    }
    \midi { }
}

Answer: \drums is just a shorthand for \context DrumStaff \drummode which is almost like \new DrumStaff \drummode except that it won't start an unnamed DrumStuff if another already exists at the same point of time.  If you are doing drum rolls, you'll at least want the Beat_performer available since version 2.23.5 (which stresses the beats and thus subdivides the rolls), you'll want to wrap the music typeset in a separate score with \midi block into \unfoldRepeats, and you probably want to make use of the \articulate command from the include file articulate.ly.
That should probably cater for most keywords to look up in the documentation.
Comment: Thank you! That's a bunch of new terminology to check out!


How to remove a line break and the number from a text file in Notepad

Question: I got some questions saved as .txt file. I want to remove all question numbers and a line break from it's options and put a TAB space with the question.
Like a QUESTION<tab_space>OPTION1<tab_space>OPTION2<tab_space>OPTION3<tab_space>OPTION4 then a line break and next question things.
my text file is looks like:
11. Lungs are located in the
A) abdominal cavity
B) pericardial cavity
C) peritoneal cavity
D) pleural cavity
12. Which one of the following is the ideal food for newborn babies?
A) Water
C) Honey
B) Sugar
D) Milk
13. Transcription means the synthesis of
A) Lipids
C) DNA
B) Protein
D) RNA

how do I want this is:
Lungs are located in the    abdominal cavity    pericardial cavity  peritoneal cavity   pleural cavity
Which one of the following is the ideal food for newborn babies?    Water   Honey   Sugar   Milk
Transcription means the synthesis of    Lipids  DNA Protein RNA

Am doing this is because, I can then just copy all and paste on EXCEL document, where TAB recognize as next row and LINE_BREAK recognize as next column. Easy copying for me. I just to know how to replace words with notepad, don't know how to remove a line break or those numbers end with a dot (.)
My Aim:

Remove all line breaks
Replace all numbers with a dot(.) at end with a line break [11.]
Replace [A-D] with ')' with a TAB space
Answer: We can do this with two replacements:
Find: (?:^|(?<=\n))\d+\.
Replace: (empty)

Demo
Find: (?:^|\r?\n)[A-Z]+\)
Replace: \t

Demo
And here is a Java demo showing that the replacement is working.


Full text search - Not stopping StopWords

Question: I created a full text index using the SQL Server Full Text wizard but when I pass in a search term it doesn't ignore stopwords.
i.e. This returns rows:
SELECT *
FROM dbo.T_Restaurant AS Restaurant
JOIN dbo.SearchView AS SearchView ON SearchView.id = Restaurant.id
WHERE CONTAINS(SearchView.TotalSearchField, ' indian & bridgwater ')

But this doesn't:
SELECT *
FROM dbo.T_Restaurant AS Restaurant
JOIN dbo.SearchView AS SearchView ON SearchView.id = Restaurant.id
WHERE CONTAINS(SearchView.TotalSearchField, ' indian & in & bridgwater ')

I know that 'in' is a stopword in the English language and yet it doesn't appear to be ignored.  The index is using the System stopword list according to its properties.  Have I missed a step to set the stopword list up?
Many thanks,
Chris.
Answer: Does this FTS syntax work better? I think it will have taken indian & bridgewater to be a phrase rather than looking for the words which is what I think you are trying to do.
SELECT *
FROM dbo.T_Restaurant AS Restaurant
JOIN dbo.SearchView AS SearchView ON SearchView.id = Restaurant.id
WHERE CONTAINS(SearchView.TotalSearchField, '"indian" AND "bridgwater"')

SELECT *
FROM dbo.T_Restaurant AS Restaurant
JOIN dbo.SearchView AS SearchView ON SearchView.id = Restaurant.id
WHERE CONTAINS(SearchView.TotalSearchField, '"indian" AND "IN" AND "bridgwater"')

Comment: :(  Sadly that doesn't work either. Thanks for your input though, much appreciated.
Comment: I can't get into sql server till the morning; what does this return

select * from sys.dm_fts_parser (' "indian & in & bridgewater"  ', 1033, 77,0)

It should show the noisewords that are going in your language - assuming 1033 is your codepage. You can check that with

select [name], alias, lcid from master.sys.syslanguages;
Comment: Thanks for your help so far buddy, I really appreciate your time.  I have run the query you suggested (with an edit for the StopListID linked to my index) and this is what I get (removed a few odd columns):

1 Exact Match indian
2 Noise Word in
3 Exact Match bridgwater

Crazy, it's obviously being recognised as a noise word and yet when I query the DB with the noise word it returns no rows. Grrr!
Comment: Last resort is to check the index direct using the dmv's. I don;t recall the syntax but check http://technet.microsoft.com/en-us/library/cc280607.aspx you can check row by row to see whats in the index.
Comment: I can see all of the indexed words and none of the stopwords are in the list (presumably because the population process strips them out).  I'll do some more digging online tomorrow, as I probably won't have time today.  Many thanks again, your input has been very valued.  This kind of knotty problem is very difficult to get to the bottom of and it's good to get someone else's input.


Not working stylus heading loop before content

Question: Working code:
Stylus
for num, $s in (1..6)
    h{$s+1}
        display inline-block

HTML
h1:before {
  position: relative;
}
h2:before {
  position: relative;
}
h3:before {
  position: relative;
}
h4:before {
  position: relative;
}
h5:before {
  position: relative;
}
h6:before {
  position: relative;
}

Not working code:
Stylus
for num, $s in (1..6)
    h{$s+1}
        &:before
            display inline-block
            content h{$s+1}

How would you do to make the resulting code the next and can be displayed in the before content of the css
HTML
h1:before {
  content: "h1";
}
h2:before {
  content: "h2";
}
h3:before {
  content: "h3";
}
h4:before {
  content: "h4";
}
h5:before {
  content: "h5";
}
h6:before {
  content: "h6";
}

Any possible solution?
Answer: Work code:
Stylus
for $i in (1..6)
    h{$i}
        &:before
            content "h" + $i

HTML
h1:before {
  content: 'h1';
}
h2:before {
  content: 'h2';
}
h3:before {
  content: 'h3';
}
h4:before {
  content: 'h4';
}
h5:before {
  content: 'h5';
}
h6:before {
  content: 'h6';
}


Descriptive test statistics v.s. Probability

Question: n00b question:
Lets say I am looking at a sample of records, say, sales data from several McDonald's restaurants.
Lets say I detect a difference between two groups of McDonalds.
For example, McDonald's stores located in Oregon sell fewer McRibs per month than do stores in Tennessee.
Some descriptive stats (let's assume large outliers have been removed and that the sample size of each group is 2000):
Quantity of McRibs sold in the month of July
Oregon stores:
450 mean, 420 median
Tennessee stores:
700 mean, 520 median
I can conduct significance tests to see if the difference between the two groups is real.
However, is there another way to look at this: based on probability?  For example, the odds that a given Store in Tennessee sells more McRibs than a given store in Oregon?
For example, if 40% of the Tennessee stores actually sell below the Tennessee median, say, 450 McRibs each, meanwhile, 40% of the Oregon stores sell at or above the Oregon mean, also 450 McRibs.
In this scenario, I would write a report concluding that McRibs are much more popular in Tennessee.  This conclusion would be supported by descriptive statistics and tests of significance.
However, in reality, There is a 40% chance that a store in Tennessee sells no more McRibs than the average store in Oregon, weakening the validity of my report.
Thoughts?
edit: grammar
Answer: We can reconstruct your data into a 2 by 2 contingency table. Something like this:
<code>| City      | Above mean (%) | Below mean (%) |
|-----------|:--------------:|:--------------:|
| Tennessee |       60       |       40       |
| Oregon    |       40       |       60       |
</code>
Given this, we can calculate an odds ratio (OR), or preferably a relative risk/risk ratio (RR).
The OR would be the odds of Tennessee divided by the odds of Oregon:
$\frac{60/40}{40/60}\approx2.24$
The RR would be the risk of Tennessee divided by the risk of Oregon:
$\frac{60/(60+40)}{40/(40+60)}=1.5$
Conclusion from RR: sales at or above the mean are 1.5 times more likely to occur in Tennessee than they are to occur in Oregon.
Of course, this is a sample estimate, for which a confidence interval can be obtained. This can be done in the epitools package in R or online using this web calculator.
Comment: quick follow-up:  When 60% of Tennessee is above mean, that is above the Tennessee mean, correct?
Comment: I think I misunderstood your question. One simple solution to make the above meaningful is a single mean for both cities. Another idea is to find a cut-off unique to each city that is meaningful. Saying 60% of stores sold above the mean for a city simply means you have some extremely poor sales in that city. Saying 40% of stores sold below the mean in a city simply means you have some extremely high sales in that city.
Comment: Additionally, even the single overall mean should have some meaningfulness to it. It is better thought of as a cut-off point that has a substantive importance,


Issue concerning the uniqueness of the SDE of Bessel process

Question: I'm reading the book Bessel Processes, Schramm-Loewner Evolution, and the Dyson model of Makoto Katori. In chapter 1, the $D$-dimensional Bessel process $R_t^x$ is introduced and is defined as follows
$$R_t=\|B_t^x\|_2$$
where $B_t^x$ is a $D$-dimensional Brownian motion starting at $x\in\mathbb R^D\setminus\{ 0\}$. One can prove using Ito's formula that
$$R_t^x=\|x\|_2+\int^t_0\frac{1}{R_s^x}\sum_{i=1}^D B^{x_i}_s\,dB_s^{x_i}+\frac{D-1}{2}\int^t_0\frac{1}{R_s^x}\,ds$$
where $B_t^{x_i}$ is the $i$-th component of $B^x_t$.  Also note that Ito's formula only holds until the first hitting time of zero, but for $D\geq 2$ it will never hit zero with probability $1$. Now one can easily argue using Levy's characterization of Brownian motion that the second term of the expression above is a $1$-dimensiona standard Brownian motion, that is
$$\left(\int^t_0\frac{1}{R_s^x}\sum_{i=1}^D B^{x_i}_s\,dB_s^{x_i}\right)_{t\geq
 0}$$
is a standard Brownian motion.
This is all basic, but now the confusion kicks in. Based on the observations above, the book just says that $R_t^x$ solves the SDE
$$\tag{1}dR_t^x=dW_t+\frac{D-1}{2R_t^x}\,dt$$
where $W_t$ is a standard BM different than the $B_t^{x_i}$ for $i=1,...,D$. I be like "What? Wait a minute? Didn't we lose properties about the very definition of $R_t^x$ by saying that?". Let me formulate this. Of course we have this filtered probability space $(\Omega,\mathcal F,\mathcal F_t,\mathbb P)$ in the background.  The problem is

Problem.
  Does the SDE in (1) with initial value $R_0^x=\|x\|_2$ has a strong unique solution in the sense that the solution of the SDE, say $R_t^x$ can be written as $ R_t^x=\|B_t^x\|_2$ for some $D$-dimensional BM $B_t^x$?

So you guys hopefully see that I'm only asking whether the definition of Bessel process and the SDE that it satisfies is consistent. I know that the solution of (1) is unique for $D\geq 2$ through uniqueness results from the book of Revuz-Yor for instance. But how do I make sure that the BM $W_t$ can be decomposed in terms of $B_t^{x_i}$...?
Many thanks! Please let me know if my question is unclear.
Comment: Even the case $D=2$ would be nice...
Comment: What properties are you saying that we lose from defining the Bessel process as the solution to this SDE?
Comment: @RyanGreyling you see that $W_t$ is not just some Brownian motion. It is a specific Brownian motion given in terms of $B_t$. So my concern is whether we lose the fact that the Bessel process is the length of some $D$-dimensional Brownian motion. Does this somehow make sense?
Comment: Can you please use a dummy variable in integration? There is ambiguity when you don't do that.
Comment: @Ian of course, my bad, edited!
Answer: Suppose $B$ is a $d$-dimensional Brownain motion ($d\ge 2$). Define the radial part $R$ as you have, then
$$
A_t:=\int_0^t R^{-2}_s\,ds,\qquad t\ge 0,
$$
and finally the (time-changed) angular part
$$
\Theta_u:={B_{\tau(u)}\over R_{\tau(u)}},\qquad u\ge 0,
$$
where
$$
\tau(u):=\inf\{t>0: A_t>u\}.
$$
Then $R$ is the unique strong soution of (1), with $W$ defined as in the display just above (1), and $\Theta$ is a spherical Brownian motion independent of $R$. (The nature of $\Theta$ can be intuited from the polar-coordinates decomposition of the $d$-dimensioanl Laplacian.)  This independence means that the full $d$-dimensional Brownian motion $B$ cannot be recovered from the Bessel process $R$ (though of course the 1-dimensional Brownian motion $W$ can).
Going the other way, starting with a 1-dimensional Brownian motion $W$ and an independent spherical Brownian motion $\Theta$, one can solve (1) to get $R$, and then invert the above construction using $R$ and $\Theta$ to build a $d$-dimensional Brownian motion
$$
R_t\cdot\Theta_{A_t},\qquad t\ge 0.
$$
For a nice discussion of these things see the first chapter of the first volume of the ** of **Rogers and Williams.
Comment: Correct: In the passage from $B$ to $R$, information about the "angle" of $B$ is lost.
Comment: Many thanks! The answer, as I would expect is above my level. But when you say "going the other way" where $\Theta$ comes from? At that point we only have $W$, or?
Comment: Is the title of the book "Diffusions, Markov process and martingales"?
Comment: Yes to the title of the book.  As to $\Theta$, that has to be supplied independently of $W$.
Comment: Ow wait, I had the directions wrong. My main question is answered in the part "Then $R$ is the unique...", right? So there you say that we cannot say much with $W$ alone? And that leads to the conclusion that we cannot find a unique BM $B$ such that $R=\|B\|_2$?
Comment: WOW! Your last comment!! Simple and beautiful explanation! Many thanks!
Comment: Sorry to disturb you again, at what part exactly of chapter 1? I couldn't find related stuff, do they actually prove stuff with spherical BM or...?
Comment: Sorry, my memory was a little shaky on that reference.  See Chapter IV section 35 in the second edition of R&W.  This is in volume 2.
Comment: yes many thanks!!


Como eu posso usar dois bancos diferentes para uma loja Magento?

Question: Eu uso o sistema multi-store do Magento e tenho duas lojas. Uma eu instalei o tema com sucesso, a outra eu apenas importei os arquivos Skin, App, Media etc, mas não sei como proceder para importar o banco de dados referente a este segundo tema.
O sistema multi-store já está funcionamento corretamente, mas o layout logicamente não funciona apenas com a importação dos arquivos indicados.
Answer: Dois bancos não sera possível.
Você não irá conseguir importar a base demo para a segunda loja, tera de montar sozinho mesmo.
Já passei por isto.


Model most likely coordinates of target using Bayesian

Question: I would like to use a bayesian model to determine which position (X, Y) is most likely the best position to score a goal in soccer. For this I have a dataset of a soccer club with all its goals and shots with X and Y coordinates and the type of shot for some seasons. To make it more clear, imagine we have the following visualization of goals scored at certain positions:

In this plot I didn't show the no goals, but I hope this makes it more clear. As I said I also have the `(1|shotType) of the shot/goal. A goal/shot can be taken in the following ways:

LeftFoot
RightFoot
Head

I was thinking of using a Bayesian Binary Logistic Regression (If you think something is better feel free to let me know) since we have a binary Target (Goal or No goal) and two numeric variable and one grouping variable. So I fitted the following model (result2 -> 0 is no goal and 1 is goal):
library(brms)
fit <- brm(result2 ~ X + Y + (1|shotType),
           data = df,
           family = bernoulli(link = "logit"))
fit
#> Warning: There were 55 divergent transitions after warmup. Increasing
#> adapt_delta above 0.8 may help. See
#> http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
#>  Family: bernoulli
#>   Links: mu = logit
#> Formula: result2 ~ X + Y + (1 | shotType)
#>    Data: df (Number of observations: 2728)
#>   Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
#>          total post-warmup draws = 4000
#>
#> Group-Level Effects:
#> ~shotType (Number of levels: 4)
#>               Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> sd(Intercept)     1.02      0.69     0.24     2.76 1.01      525      771
#>
#> Population-Level Effects:
#>           Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> Intercept   -12.18      1.16   -14.51    -9.96 1.00      988      606
#> X            11.34      1.04     9.27    13.39 1.00     2463     2335
#> Y             0.23      0.47    -0.66     1.13 1.01     2025     2420
#>
#> Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
#> and Tail_ESS are effective sample size measures, and Rhat is the potential
#> scale reduction factor on split chains (at convergence, Rhat = 1).

Created on 2023-11-01 with reprex v2.0.2
But I am now at the point, that I don't understand how to interpet these results. I was assuming you could see a CI of what the best range is of to score a goal, for example X (0.8-0.9) and Y (0.25-0.3) which is like a square (good to know, the X and Y are in range of 0 to 1 and not in meters). So I was wondering if anyone could help me how to interpret these results and if I'm using the right model for determining the most likely positions to score a goal?

Here is some reproducible data of df:
structure(list(result2 = c(0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0,
0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0,
0, 0, 0, 1, 0), X = c(0.736, 0.895, 0.706, 0.901, 0.852, 0.952,
0.959, 0.917, 0.937, 0.763, 0.892, 0.732, 0.933, 0.885, 0.85,
0.852, 0.937, 0.972, 0.917, 0.872, 0.778, 0.84, 0.859, 0.917,
0.809, 0.953, 0.841, 0.917, 0.734, 0.974, 0.877, 0.913, 0.907,
0.952, 0.714, 0.803, 0.907, 0.964, 0.885, 0.759, 0.914, 0.853,
0.907, 0.887, 0.739, 0.943, 0.812, 0.816, 0.822, 0.927, 0.926,
0.913, 0.917, 0.907, 0.9, 0.902, 0.972, 0.78, 0.783, 0.93, 0.756,
0.973, 0.926, 0.78, 0.917, 0.88, 0.958, 0.917, 0.869, 0.876,
0.818, 0.949, 0.916, 0.75, 0.938, 0.727, 0.958, 0.774, 0.923,
0.934, 0.851, 0.743, 0.9, 0.925, 0.98, 0.898, 0.86, 0.78, 0.876,
0.86, 0.785, 0.91, 0.704, 0.729, 0.964, 0.879, 0.869, 0.844,
0.841, 0.883, 0.853, 0.967, 0.95, 0.966, 0.901, 0.903, 0.893,
0.857, 0.85, 0.734, 0.952, 0.873, 0.853, 0.903, 0.773, 0.772,
0.855, 0.8, 0.804, 0.923, 0.839, 0.853, 0.918, 0.93, 0.973, 0.879,
0.815, 0.916, 0.885, 0.897, 0.871, 0.717, 0.905, 0.839, 0.691,
0.76, 0.89, 0.937, 0.844, 0.875, 0.885, 0.893, 0.982, 0.851,
0.906, 0.738, 0.901, 0.888, 0.891, 0.775, 0.873, 0.957, 0.885,
0.844, 0.752, 0.894, 0.876, 0.909, 0.912, 0.761, 0.752, 0.885,
0.849, 0.862, 0.904, 0.857, 0.891, 0.919, 0.796, 0.861, 0.768,
0.755, 0.855, 0.735, 0.763, 0.751, 0.864, 0.768, 0.785, 0.794,
0.91, 0.814, 0.876, 0.909, 0.9, 0.755, 0.833, 0.848, 0.689, 0.845,
0.815, 0.906, 0.797, 0.914, 0.854, 0.808, 0.921, 0.878, 0.734,
0.773, 0.856, 0.97, 0.861, 0.888, 0.972, 0.912, 0.914, 0.911,
0.907, 0.948, 0.876, 0.905, 0.859, 0.721, 0.914, 0.957, 0.721,
0.806, 0.882, 0.963, 0.746, 0.951, 0.905, 0.762, 0.706, 0.955,
0.829, 0.728, 0.889, 0.913, 0.86, 0.811, 0.896, 0.878, 0.942,
0.9, 0.81, 0.875, 0.881, 0.941, 0.746, 0.816, 0.923, 0.894, 0.788,
0.865, 0.864, 0.782, 0.932, 0.856, 0.723, 0.886, 0.92, 0.917,
0.764, 0.968, 0.88, 0.915, 0.774, 0.911, 0.904, 0.743, 0.958,
0.961, 0.867, 0.809, 0.913, 0.927, 0.803, 0.778, 0.952, 0.872,
0.874, 0.875, 0.854, 0.879, 0.885, 0.786, 0.968, 0.863, 0.897,
0.809, 0.927, 0.943, 0.775, 0.782, 0.969, 0.917, 0.879, 0.963,
0.919, 0.86, 0.921, 0.849, 0.905, 0.76, 0.967, 0.692, 0.934,
0.895, 0.767, 0.812, 0.811, 0.958, 0.93, 0.962, 0.741, 0.747,
0.76, 0.853, 0.911, 0.889, 0.811, 0.791, 0.789, 0.867, 0.82,
0.75, 0.872, 0.967, 0.903, 0.846, 0.797, 0.908, 0.905, 0.771,
0.933, 0.72, 0.912, 0.979, 0.885, 0.86, 0.959, 0.977, 0.921,
0.872, 0.9, 0.912, 0.754, 0.836, 0.89, 0.786, 0.832, 0.899, 0.838,
0.808, 0.839, 0.916, 0.861, 0.929, 0.818, 0.902, 0.799, 0.924,
0.963, 0.903, 0.732, 0.869, 0.758, 0.846, 0.872, 0.965, 0.793,
0.728, 0.886, 0.806, 0.823, 0.925, 0.906, 0.96, 0.885, 0.846,
0.806, 0.903, 0.88, 0.883, 0.799, 0.821, 0.883, 0.949, 0.886,
0.865, 0.478, 0.917, 0.876, 0.721, 0.843, 0.866, 0.906, 0.791,
0.954, 0.768, 0.869, 0.906, 0.955, 0.924, 0.893, 0.855, 0.855,
0.862, 0.792, 0.973, 0.907, 0.744, 0.876, 0.838, 0.755, 0.672,
0.909, 0.681, 0.939, 0.756, 0.783, 0.86, 0.895, 0.92, 0.817,
0.855, 0.883, 0.873, 0.872, 0.881, 0.875, 0.902, 0.889, 0.846,
0.727, 0.854, 0.903, 0.916, 0.86, 0.806, 0.893, 0.866, 0.807,
0.974, 0.813, 0.961, 0.905, 0.882, 0.919, 0.758, 0.905, 0.667,
0.929, 0.808, 0.804, 0.967, 0.763, 0.715, 0.786, 0.731, 0.71,
0.775, 0.935, 0.801, 0.91, 0.798, 0.932, 0.773, 0.829, 0.818,
0.961, 0.758, 0.893, 0.753, 0.919, 0.895, 0.873, 0.82, 0.885,
0.93, 0.917, 0.866, 0.848, 0.793, 0.901, 0.885, 0.927, 0.924,
0.855, 0.88, 0.855, 0.863, 0.892, 0.819, 0.829, 0.871, 0.893,
0.909, 0.758, 0.885, 0.786, 0.924, 0.87, 0.72, 0.775, 0.848,
0.983, 0.75), Y = c(0.702, 0.597, 0.479, 0.484, 0.659, 0.34,
0.716, 0.524, 0.439, 0.682, 0.699, 0.515, 0.678, 0.375, 0.277,
0.579, 0.53, 0.543, 0.342, 0.48, 0.434, 0.696, 0.75, 0.355, 0.618,
0.608, 0.299, 0.397, 0.512, 0.417, 0.472, 0.32, 0.371, 0.512,
0.643, 0.532, 0.388, 0.579, 0.5, 0.562, 0.382, 0.748, 0.48, 0.569,
0.617, 0.589, 0.605, 0.355, 0.612, 0.693, 0.767, 0.687, 0.456,
0.593, 0.65, 0.396, 0.68, 0.395, 0.347, 0.437, 0.367, 0.412,
0.287, 0.627, 0.528, 0.555, 0.691, 0.427, 0.367, 0.539, 0.658,
0.567, 0.569, 0.587, 0.458, 0.404, 0.615, 0.495, 0.723, 0.424,
0.539, 0.709, 0.476, 0.6, 0.41, 0.629, 0.606, 0.573, 0.297, 0.72,
0.364, 0.481, 0.482, 0.567, 0.64, 0.551, 0.311, 0.658, 0.608,
0.662, 0.6, 0.416, 0.597, 0.647, 0.485, 0.534, 0.545, 0.521,
0.553, 0.382, 0.569, 0.383, 0.407, 0.326, 0.388, 0.472, 0.543,
0.645, 0.589, 0.521, 0.548, 0.717, 0.539, 0.666, 0.419, 0.33,
0.318, 0.66, 0.5, 0.522, 0.618, 0.585, 0.347, 0.357, 0.565, 0.684,
0.417, 0.502, 0.65, 0.693, 0.5, 0.68, 0.396, 0.569, 0.569, 0.64,
0.476, 0.739, 0.591, 0.394, 0.558, 0.483, 0.274, 0.314, 0.699,
0.47, 0.361, 0.324, 0.546, 0.448, 0.602, 0.5, 0.377, 0.654, 0.721,
0.342, 0.453, 0.473, 0.261, 0.496, 0.713, 0.346, 0.482, 0.623,
0.469, 0.394, 0.623, 0.62, 0.633, 0.579, 0.563, 0.576, 0.536,
0.256, 0.435, 0.496, 0.678, 0.52, 0.579, 0.515, 0.684, 0.392,
0.443, 0.395, 0.383, 0.339, 0.539, 0.482, 0.618, 0.536, 0.599,
0.461, 0.321, 0.418, 0.597, 0.485, 0.436, 0.588, 0.421, 0.419,
0.756, 0.575, 0.592, 0.488, 0.516, 0.56, 0.578, 0.736, 0.587,
0.503, 0.503, 0.587, 0.445, 0.569, 0.576, 0.488, 0.555, 0.433,
0.41, 0.497, 0.545, 0.728, 0.655, 0.328, 0.456, 0.638, 0.439,
0.779, 0.365, 0.563, 0.338, 0.383, 0.449, 0.474, 0.501, 0.629,
0.405, 0.6, 0.486, 0.623, 0.521, 0.597, 0.503, 0.705, 0.376,
0.516, 0.648, 0.52, 0.668, 0.453, 0.678, 0.31, 0.598, 0.582,
0.391, 0.6, 0.38, 0.503, 0.533, 0.664, 0.489, 0.615, 0.306, 0.541,
0.57, 0.623, 0.5, 0.681, 0.499, 0.281, 0.455, 0.51, 0.565, 0.666,
0.333, 0.338, 0.439, 0.343, 0.53, 0.491, 0.5, 0.462, 0.43, 0.519,
0.668, 0.419, 0.466, 0.599, 0.614, 0.645, 0.522, 0.472, 0.491,
0.503, 0.505, 0.466, 0.688, 0.6, 0.727, 0.666, 0.73, 0.6, 0.51,
0.73, 0.696, 0.3, 0.611, 0.672, 0.54, 0.591, 0.487, 0.692, 0.392,
0.493, 0.421, 0.475, 0.576, 0.541, 0.513, 0.567, 0.5, 0.63, 0.612,
0.35, 0.576, 0.503, 0.32, 0.494, 0.366, 0.685, 0.291, 0.491,
0.561, 0.645, 0.623, 0.555, 0.439, 0.272, 0.328, 0.534, 0.538,
0.666, 0.496, 0.564, 0.325, 0.188, 0.416, 0.56, 0.558, 0.423,
0.581, 0.504, 0.407, 0.649, 0.485, 0.324, 0.349, 0.51, 0.596,
0.579, 0.5, 0.558, 0.579, 0.454, 0.34, 0.582, 0.674, 0.431, 0.458,
0.437, 0.664, 0.371, 0.978, 0.562, 0.575, 0.6, 0.554, 0.606,
0.367, 0.358, 0.328, 0.333, 0.604, 0.433, 0.319, 0.46, 0.367,
0.417, 0.376, 0.647, 0.605, 0.343, 0.549, 0.46, 0.611, 0.345,
0.624, 0.629, 0.324, 0.467, 0.567, 0.651, 0.663, 0.611, 0.364,
0.421, 0.445, 0.665, 0.388, 0.369, 0.431, 0.637, 0.709, 0.339,
0.473, 0.747, 0.5, 0.684, 0.701, 0.612, 0.56, 0.456, 0.64, 0.524,
0.684, 0.421, 0.658, 0.49, 0.478, 0.31, 0.434, 0.31, 0.371, 0.299,
0.515, 0.536, 0.567, 0.567, 0.533, 0.534, 0.676, 0.431, 0.452,
0.64, 0.456, 0.573, 0.358, 0.646, 0.695, 0.403, 0.718, 0.611,
0.501, 0.304, 0.423, 0.639, 0.573, 0.614, 0.627, 0.564, 0.5,
0.285, 0.573, 0.557, 0.472, 0.66, 0.358, 0.5, 0.559, 0.668, 0.458,
0.569, 0.384, 0.284, 0.233, 0.328, 0.661, 0.403, 0.482, 0.672,
0.286, 0.5, 0.753, 0.508, 0.548, 0.65, 0.483, 0.266, 0.482, 0.461
), shotType = c("LeftFoot", "RightFoot", "RightFoot", "Head",
"LeftFoot", "RightFoot", "LeftFoot", "Head", "Head", "RightFoot",
"RightFoot", "LeftFoot", "RightFoot", "RightFoot", "RightFoot",
"RightFoot", "OtherBodyPart", "Head", "RightFoot", "RightFoot",
"RightFoot", "RightFoot", "RightFoot", "RightFoot", "RightFoot",
"RightFoot", "LeftFoot", "RightFoot", "LeftFoot", "Head", "Head",
"RightFoot", "Head", "RightFoot", "RightFoot", "RightFoot", "LeftFoot",
"Head", "LeftFoot", "RightFoot", "RightFoot", "RightFoot", "Head",
"RightFoot", "RightFoot", "Head", "RightFoot", "RightFoot", "RightFoot",
"LeftFoot", "LeftFoot", "Head", "OtherBodyPart", "RightFoot",
"LeftFoot", "LeftFoot", "LeftFoot", "RightFoot", "LeftFoot",
"RightFoot", "LeftFoot", "RightFoot", "RightFoot", "RightFoot",
"Head", "LeftFoot", "LeftFoot", "Head", "RightFoot", "LeftFoot",
"LeftFoot", "Head", "LeftFoot", "LeftFoot", "RightFoot", "RightFoot",
"LeftFoot", "RightFoot", "LeftFoot", "Head", "RightFoot", "RightFoot",
"LeftFoot", "Head", "LeftFoot", "LeftFoot", "RightFoot", "RightFoot",
"LeftFoot", "RightFoot", "LeftFoot", "RightFoot", "RightFoot",
"RightFoot", "LeftFoot", "LeftFoot", "LeftFoot", "RightFoot",
"RightFoot", "RightFoot", "RightFoot", "LeftFoot", "Head", "LeftFoot",
"Head", "Head", "Head", "LeftFoot", "LeftFoot", "LeftFoot", "Head",
"LeftFoot", "RightFoot", "RightFoot", "RightFoot", "LeftFoot",
"LeftFoot", "RightFoot", "LeftFoot", "Head", "RightFoot", "LeftFoot",
"Head", "RightFoot", "RightFoot", "LeftFoot", "RightFoot", "RightFoot",
"RightFoot", "Head", "LeftFoot", "RightFoot", "RightFoot", "RightFoot",
"RightFoot", "RightFoot", "LeftFoot", "Head", "LeftFoot", "RightFoot",
"LeftFoot", "LeftFoot", "RightFoot", "RightFoot", "RightFoot",
"RightFoot", "LeftFoot", "LeftFoot", "RightFoot", "RightFoot",
"Head", "LeftFoot", "RightFoot", "RightFoot", "RightFoot", "RightFoot",
"LeftFoot", "RightFoot", "Head", "RightFoot", "LeftFoot", "RightFoot",
"RightFoot", "RightFoot", "RightFoot", "RightFoot", "RightFoot",
"RightFoot", "LeftFoot", "LeftFoot", "LeftFoot", "RightFoot",
"Head", "RightFoot", "RightFoot", "LeftFoot", "RightFoot", "RightFoot",
"RightFoot", "RightFoot", "LeftFoot", "RightFoot", "Head", "RightFoot",
"RightFoot", "LeftFoot", "LeftFoot", "RightFoot", "LeftFoot",
"RightFoot", "RightFoot", "RightFoot", "RightFoot", "LeftFoot",
"LeftFoot", "LeftFoot", "Head", "RightFoot", "RightFoot", "RightFoot",
"RightFoot", "Head", "LeftFoot", "RightFoot", "Head", "Head",
"LeftFoot", "LeftFoot", "Head", "RightFoot", "LeftFoot", "LeftFoot",
"LeftFoot", "RightFoot", "RightFoot", "Head", "RightFoot", "RightFoot",
"LeftFoot", "LeftFoot", "RightFoot", "Head", "RightFoot", "LeftFoot",
"LeftFoot", "RightFoot", "LeftFoot", "RightFoot", "RightFoot",
"RightFoot", "LeftFoot", "LeftFoot", "LeftFoot", "RightFoot",
"LeftFoot", "LeftFoot", "LeftFoot", "LeftFoot", "LeftFoot", "Head",
"LeftFoot", "LeftFoot", "RightFoot", "RightFoot", "LeftFoot",
"RightFoot", "LeftFoot", "RightFoot", "RightFoot", "LeftFoot",
"RightFoot", "RightFoot", "Head", "Head", "RightFoot", "Head",
"LeftFoot", "LeftFoot", "LeftFoot", "RightFoot", "RightFoot",
"RightFoot", "RightFoot", "Head", "RightFoot", "RightFoot", "RightFoot",
"Head", "RightFoot", "RightFoot", "LeftFoot", "LeftFoot", "LeftFoot",
"LeftFoot", "RightFoot", "LeftFoot", "RightFoot", "RightFoot",
"Head", "LeftFoot", "RightFoot", "RightFoot", "RightFoot", "LeftFoot",
"RightFoot", "LeftFoot", "RightFoot", "RightFoot", "RightFoot",
"Head", "Head", "LeftFoot", "LeftFoot", "Head", "LeftFoot", "RightFoot",
"Head", "LeftFoot", "RightFoot", "RightFoot", "LeftFoot", "LeftFoot",
"RightFoot", "RightFoot", "Head", "LeftFoot", "RightFoot", "LeftFoot",
"RightFoot", "RightFoot", "RightFoot", "RightFoot", "RightFoot",
"RightFoot", "RightFoot", "LeftFoot", "RightFoot", "RightFoot",
"RightFoot", "Head", "LeftFoot", "LeftFoot", "LeftFoot", "RightFoot",
"Head", "RightFoot", "Head", "RightFoot", "Head", "RightFoot",
"LeftFoot", "RightFoot", "RightFoot", "RightFoot", "Head", "Head",
"RightFoot", "RightFoot", "LeftFoot", "RightFoot", "LeftFoot",
"LeftFoot", "RightFoot", "RightFoot", "RightFoot", "LeftFoot",
"LeftFoot", "RightFoot", "LeftFoot", "Head", "RightFoot", "LeftFoot",
"RightFoot", "Head", "Head", "RightFoot", "RightFoot", "RightFoot",
"RightFoot", "RightFoot", "LeftFoot", "RightFoot", "RightFoot",
"RightFoot", "Head", "LeftFoot", "RightFoot", "RightFoot", "Head",
"Head", "LeftFoot", "RightFoot", "LeftFoot", "RightFoot", "RightFoot",
"RightFoot", "LeftFoot", "RightFoot", "LeftFoot", "Head", "RightFoot",
"RightFoot", "LeftFoot", "RightFoot", "LeftFoot", "RightFoot",
"LeftFoot", "RightFoot", "LeftFoot", "RightFoot", "RightFoot",
"RightFoot", "RightFoot", "Head", "RightFoot", "Head", "RightFoot",
"RightFoot", "LeftFoot", "RightFoot", "RightFoot", "RightFoot",
"LeftFoot", "LeftFoot", "RightFoot", "LeftFoot", "LeftFoot",
"RightFoot", "RightFoot", "LeftFoot", "Head", "RightFoot", "RightFoot",
"RightFoot", "RightFoot", "RightFoot", "LeftFoot", "LeftFoot",
"LeftFoot", "LeftFoot", "LeftFoot", "LeftFoot", "LeftFoot", "LeftFoot",
"RightFoot", "RightFoot", "RightFoot", "RightFoot", "RightFoot",
"RightFoot", "LeftFoot", "LeftFoot", "RightFoot", "LeftFoot",
"RightFoot", "RightFoot", "RightFoot", "LeftFoot", "Head", "RightFoot",
"Head", "LeftFoot", "LeftFoot", "RightFoot", "Head", "LeftFoot",
"LeftFoot", "LeftFoot", "RightFoot", "RightFoot", "RightFoot",
"RightFoot", "RightFoot", "RightFoot", "Head", "LeftFoot", "LeftFoot",
"RightFoot", "LeftFoot", "LeftFoot", "LeftFoot", "LeftFoot",
"LeftFoot", "LeftFoot", "RightFoot", "RightFoot", "Head", "LeftFoot",
"RightFoot", "RightFoot", "RightFoot", "RightFoot", "LeftFoot",
"RightFoot", "LeftFoot", "RightFoot", "LeftFoot", "RightFoot",
"Head", "RightFoot", "LeftFoot", "LeftFoot", "RightFoot", "RightFoot",
"LeftFoot", "RightFoot", "LeftFoot", "LeftFoot", "LeftFoot",
"Head", "LeftFoot", "LeftFoot", "RightFoot", "Head", "RightFoot",
"RightFoot", "LeftFoot", "RightFoot", "RightFoot", "RightFoot"
)), row.names = c(997L, 691L, 1052L, 713L, 364L, 1413L, 1542L,
1900L, 1418L, 1662L, 1072L, 2001L, 24L, 669L, 292L, 1240L, 1361L,
2308L, 213L, 505L, 1871L, 2573L, 1892L, 207L, 1272L, 1628L, 2099L,
337L, 1448L, 1273L, 454L, 2668L, 100L, 928L, 642L, 1980L, 672L,
732L, 2356L, 1709L, 2713L, 104L, 295L, 2213L, 12L, 1730L, 2567L,
475L, 2471L, 205L, 1884L, 403L, 2082L, 1456L, 1754L, 693L, 1427L,
450L, 1869L, 707L, 2658L, 1308L, 1868L, 2397L, 2277L, 2564L,
420L, 1045L, 184L, 2273L, 2113L, 235L, 1836L, 944L, 2008L, 2144L,
1380L, 549L, 1109L, 498L, 1607L, 1111L, 1657L, 2043L, 587L, 2415L,
1393L, 2449L, 71L, 555L, 1706L, 802L, 1412L, 1890L, 2138L, 2544L,
1951L, 141L, 773L, 1256L, 1745L, 1989L, 2346L, 2098L, 2421L,
2155L, 2112L, 344L, 606L, 795L, 1741L, 2218L, 1119L, 974L, 2360L,
2641L, 2357L, 153L, 1289L, 2115L, 771L, 751L, 1190L, 147L, 182L,
1019L, 302L, 2682L, 150L, 172L, 2286L, 2189L, 2539L, 1633L, 134L,
2663L, 1126L, 2403L, 1330L, 370L, 2568L, 2464L, 272L, 2037L,
698L, 2394L, 232L, 2071L, 442L, 428L, 937L, 2627L, 1422L, 985L,
1860L, 1478L, 136L, 269L, 48L, 374L, 853L, 807L, 1443L, 1209L,
1031L, 2255L, 1761L, 966L, 1493L, 2555L, 1430L, 2728L, 1471L,
167L, 2411L, 2271L, 1705L, 858L, 2100L, 81L, 668L, 948L, 1546L,
654L, 2535L, 1985L, 953L, 2079L, 1797L, 2508L, 421L, 652L, 1760L,
2030L, 2530L, 525L, 1700L, 896L, 1847L, 1554L, 2094L, 2345L,
1629L, 950L, 1202L, 1778L, 1197L, 1866L, 1804L, 2450L, 2662L,
1874L, 2592L, 2118L, 2426L, 933L, 1930L, 596L, 1118L, 1362L,
1454L, 1501L, 2561L, 2052L, 1408L, 2183L, 2106L, 1846L, 338L,
1283L, 1216L, 777L, 2396L, 2461L, 2350L, 2036L, 1453L, 260L,
2691L, 202L, 877L, 378L, 511L, 967L, 494L, 528L, 1849L, 2107L,
1133L, 2153L, 708L, 859L, 2085L, 330L, 783L, 2281L, 59L, 2709L,
746L, 866L, 2369L, 1120L, 1041L, 1434L, 2306L, 1442L, 755L, 2613L,
792L, 1743L, 598L, 2013L, 1410L, 971L, 481L, 2351L, 2027L, 1873L,
1328L, 2048L, 935L, 1219L, 1934L, 198L, 1532L, 629L, 319L, 1947L,
661L, 1496L, 999L, 864L, 51L, 2174L, 2011L, 2574L, 1507L, 2366L,
2515L, 373L, 703L, 479L, 2451L, 473L, 2448L, 765L, 1725L, 814L,
46L, 1092L, 2503L, 124L, 463L, 1178L, 1525L, 1945L, 610L, 701L,
574L, 34L, 1246L, 2047L, 2408L, 638L, 1487L, 2416L, 784L, 2127L,
1131L, 2297L, 1348L, 1902L, 357L, 1245L, 2436L, 1626L, 1230L,
1349L, 1659L, 1363L, 590L, 1187L, 1803L, 177L, 1581L, 246L, 1166L,
1591L, 532L, 1450L, 2163L, 588L, 1966L, 945L, 2509L, 18L, 1834L,
1577L, 2051L, 2181L, 1012L, 1499L, 1864L, 224L, 33L, 893L, 1829L,
2221L, 1914L, 2095L, 2303L, 1823L, 2717L, 1617L, 2130L, 286L,
2628L, 2684L, 440L, 1121L, 2265L, 868L, 1020L, 2191L, 2393L,
523L, 522L, 1472L, 2639L, 1500L, 1795L, 744L, 1560L, 384L, 1769L,
2407L, 1248L, 2643L, 1300L, 2654L, 2531L, 2497L, 80L, 487L, 161L,
259L, 2248L, 1391L, 158L, 212L, 947L, 123L, 684L, 1887L, 759L,
2438L, 1002L, 356L, 145L, 1236L, 743L, 894L, 552L, 2458L, 1415L,
132L, 2237L, 1170L, 1513L, 99L, 1372L, 2223L, 2553L, 1490L, 1086L,
2065L, 2246L, 640L, 1150L, 878L, 1912L, 250L, 924L, 1537L, 382L,
1268L, 1370L, 1903L, 1449L, 2429L, 695L, 149L, 895L, 885L, 2309L,
2075L, 2337L, 2637L, 1586L, 930L, 641L, 1299L, 393L, 1083L, 567L,
242L, 2349L, 1800L, 984L, 307L, 1350L, 2249L, 780L, 2205L, 1876L,
1196L, 2311L, 1508L, 2540L, 1395L, 2669L, 430L, 2062L, 2417L,
1547L, 712L, 30L, 1341L, 367L, 1204L, 1921L, 1529L, 256L, 2190L,
1241L, 1224L, 2251L, 305L, 521L, 1323L), class = "data.frame")

Comment: Just a quick comment: logistic regression assumes that the odds of scoring a goal vary linearly with changes in x-y coordinates on the field. I don't think this is plausible a-priori, and furthermore it won't have a well-defined maximum (the predicted log-odds of goal will be described by a tilted plane). I think the model would need at least also quadratic and interaction terms. Alternatively, something more sophisticated like a generalized addiditve model (GAM).
Comment: Why not say that the best position is the one whose 1-meter circle contains the greatest number of goal shots? That may not be Bayesian but it's as simple as you could want and reasonable enough.
Comment: The best place may be roughly X = 1, Y = 0.5, in front of the middle of the net — and if so, it's probably not worth the time to do elaborate modeling.
Comment: A classic Bayesian example of coordinate inference is "Gull's Lighthouse Problem".  PDFs (including Gull's) and videos discussing a Bayesian coordinate inference problem are available on the internet.
Comment: Bayesian methods are about expressing and manipulating uncertainty of knowledge.  For continuous parameters, such as those in your problem, its not Bayesian in spirit to focus on the most likely ** point **.  See discussion https://stats.stackexchange.com/a/148475/43149
Comment: Have you thought of re-parameterizing it in terms of angle and distance?
Answer:
the best position

You could say that the best position is the position where we have the largest probability of a goal. That is
$$p(goal|x,y)$$
With a Bayesian approach you would compute
$$p(goal|x,y,data)$$
and you could have some parametric model that describes $p(goal|x,y)$ based on a few parameters $\beta_i$ for which we have prior distributions. Then based on the data we can update the distributions for those variables and compute the posterior.
$$f(\beta|data) \propto f(data|\beta) f(\beta)$$
with the given $f(\beta|data)$ you can describe also $p(goal|x,y,data)$ and figure out which place is the best.

The computations are not easy and the choice of model with coëfficiënts $\beta$ and their prior is subjective. I would go instead with MattF's comment and just compute at every point x,y the frequency of goals for all attempts within a certain range.
Comment: Thank you for your clear answer! I was really looking for a way to describe this in an bayesian approach. I will have a further look in the coefficients and MattF's comment, but this brings me in the right direction.


Simultaneous Conditional Probability

Question: I did a quick search, couldn't find an answer that helps me understand this question:
Supposed there is a company with a problem, they can either assign one big team C (30% chance to solve) or two smaller teams A (20% chance) and B (10% chance) to solve it.  If team A solves the problem - team B has a 5% chance to solve the problem. Which team setup is better?
Initial attempt:
P(A) = 0.20, P('A) = 0.80, P(A|B) = 0.10, P('A|B) = 0.90, P(A|'B)= 0.11, P('A|'B) = 0.7888
P(B) = 0.10, P('B) = 0.90, P(B|A) = 0.05, P('B|A) = 0.95, P(B|'A)=0.1125, P('B|'A) = 0.8875
This is where I got stuck and have a few questions:
1) For simultaneous events, with conditional probability, does the sequence of events lead to different probabilities?  As in does Team A succeeding first or not need to be taken into account as well as Team B - leading to total probability of solving the problem = P(B|A)P(A) + P('B|A)P(A) + P(A|B)P(B) + P('A|B)P(B)?
2) If we assume that the team that completes it first will notify the other team, how would we be able to include or combine the earlier probability in?  That is if A finishes it first (P(A) = 0.20) + B finishes it first (P(B) = 0.10) + A doesn't finish it, and B does plus the opposite (P('A AND B) + P(A AND 'B))?
I think I am thinking too much into this problem... would sincerely appreciate your help as I honestly suck at probability questions and would love to learn how to conceptualize these.
Answer: Don't get hung up on which team finishes it "first". This question says nothing about causality, all it does is give you a hint towards what you really want, which is the probability that any team solves it, whether it's $A$, $B$, or both. The question gives you $P(A)$, $P(B)$, and $P(B \mid A)$. The influence of one team finishing "first" on the other team can be due to many complex causal effects, outside the scope of this problem, and none of which are important for the quantity you want.
As the manager, you only care about the quantity:
$$
P(A \lor B) =  P(A) + P(B) - P(A,B).
$$
Note the identity,
$$
P(B \mid A) = \frac{P(A,B)}{P(A)}.
$$
With that, and the knowledge given by the question, you have enough to figure out what you, as the manager, care about.
Comment: Thank you very much!  I was really just thinking too much into this...

Simultaneous Conditional Probability


Prove an entailment is not true via resolution.

Question: Given an entailment $\Sigma ⊨ S$ that I want to prove is false, if I want to prove it with resolution, do I just prove $¬ (\Sigma \implies S)$ instead? If not, how can I do it, still using resolution refutation?
Answer: Careful!
$\Sigma$ is a set of statements ... it makes little sense to make that part of a logic statement.
Consider:
$\Sigma = \{ P \}$
$S = Q$
Then $\neg ( \Sigma \Rightarrow S)$ would be $\neg ( \{ P \} \Rightarrow S)$?!?
OK, but I assume that by '$\neg ( \Sigma \Rightarrow S)$' you mean the statement that you obtain by the negating the conditional, whose antecedent is the conjunction of all statements in $\Sigma$, and whose consequent is $S$. So, in this case that would be $\neg(P \Rightarrow Q)$
(BTW: I am assuming that you use the $\Rightarrow$ as the truth-functional operator called the material implication, rather than as the meta-logical symbol for logical implication ... for otherwise $\neg ( \Sigma \Rightarrow S)$ would already make little sense, as it would be trying to use a meta-logical operator inside a logic expression)
OK, but consider. Using the same $\Sigma$ and $S$ as defined:
It is clear that it is not the case that $\{ P \} \vDash Q$, and hence it is not true that $\Sigma \vDash S$
But it is also not the case that $\neg(P \Rightarrow Q)$, and hence it is not true that '$\neg ( \Sigma \Rightarrow S)$'
So no, you can't prove that some logical entailment does not hold by trying to prove the negation of its corresponding conditional.
Comment: @MaxLi Find a counterexample: find a way to make all statements in $\Sigma$ true, but $S$ false.
Comment: @MaxLi You're welcome!  Are these propositional logic statements, or first-order logic statements?
Comment: @MaxLi No, not really ... and it's rather unorthodox to use resolution as a demonstration of non-entailment .. Typically, in resolution you negate $S$, add that to the set of statements $\Sigma$, and then derive a contradiction, and then that shows that it is impossible for $S$ to be false while all the statements in $\Sigma$ are true, i.e. that would demonstrate that $S$ *is* entailed by $\Sigma$ .... so to show that $S$ is *not* entailed by $\Sigma$, you'd need to show that it is impossible to derive a contradiction ... so you'd have to show that there are no further resolutions to be done
Comment: @MaxLi To take the example I just used: you'd start with clauses $\{ P \}$ and $\{ \neg Q \}$  ... Well, it's obvious that nothing can be resolved from these ... so the contradiction cannot be resolved ... hence we can conclude that $Q$ is not entailed by $\{ P \}$. ... of course, that last inference we can only make if we know that the resolution method is complete (i.e. that for *all* entailmentss it can derive the contradiction from the corresponding clauses) ... but for propositional logic as well as first-order logic it is.
Comment: So how would I do it, still using resolution refutation?
Comment: Ahhhh how did that not come to mind. Thank you. Are there any other ways if it's hard to make all statements true by hand?
Comment: I think it's propositional logic. Oh by the way, I already showed that it's not possible, but my assignment specifically says to use resolution. Is a counterexample really resolution? Thanks again.
Answer: To prove $\Sigma\vDash S$ by resolution, show that the CNF clausal form of $\Sigma\cup\{ \neg S\}$ can be resolved down to emptiness (ie, that the union cannot be satisfied).
Eg:  $p, p\to (q\vee r), r\to q\vDash q$ is proven by resolving $$\{(p), (\neg p,q,r),(\neg r,q),(\neg q)\}\\\{(q,r),(\neg r,q),(\neg q)\}\\\{(q),(\neg q)\}\\\{\}$$
Comment: I think you've misunderstood the question. I want to prove that the entailment does not hold.
Comment: That will be difficult, since it actually does hold.


R file not knitting

Question:
Trying to knit my R file into a pdf? It says the following error message but I dont even have learnr in my library? Really not sure what to do.
The markdown file runs fine, it just wont knit. Any suggestions
I tried downloading the tinytex package but still no luck. Tried installing and loading the tidyverse package and that didnt work either.
This following code seems to be the issue:
knitr::opts_chunk$set(echo = TRUE)

library(tidyverse)
library(knitr)
library(dplyr)
library(psych)
library(apaTables)
library(ggplot2)
library(sandwich)
library(remotes)
library(discovr)
library(ggfortify)
library(papaja)
library(apaTables)

data <-readr::read_csv("C:\\Users\\Licensed\\OneDrive -Copper Beech\\Uni\\diss\\Diss\\data\\happy_data.csv")

#data <- readr::read_csv("data/happy.data_csv")

Comment: It would be better if you could put a reproducible example. It is difficult to help you with the information you provided.
Comment: Thanks for your reply. What kind of information could be helpful? Sorry Im not very good with stuff like this, evidently
Comment: If you could provide the content of your Rmarkdown with fake data, that would be perfect. Also, you errors seems to be related to the loading of the R package learnr. Do you have a bug when you write library(learnr)? It would be better if you could provide code instead of a picture.
Comment: Thank you so much for your patience with me. My code is just short of 700 lines long, should i just add an aspect of it? Or should I add all of it? And no, theres no bug when i write library(learnr). Thank you :)
Comment: You should provide the part of your code for which there is a bug and you should provide information in a way that we can replicate your bug easily. We do not need all your code.
Comment: I have just added it to the original post. Thank you again
Comment: You should provide this code in form of text and not as a picture. If I want to replicate your bug, I can't use a copy and paste. I have to look at your picture and I have to type all your code which is time consuming.
Comment: I think I have added it, I copy and pasted it onto the original post. I will add it here too: `knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(knitr)
library(dplyr)
library(psych)
library(apaTables)
library(ggplot2)
library(sandwich)
library(remotes)
library(discovr)
library(ggfortify)
library(papaja)
library(apaTables)
data <-readr::read_csv("C:\\Users\\Licensed\\OneDrive -Copper Beech\\Uni\\diss\\Diss\\data\\happy_data.csv")

#data <- readr::read_csv("data/happy.data_csv")`
Comment: Is it possible that you want to use the R package discoveR instead of discovr? In your code, you use discovr.
Comment: @EmmanuelHamel, can you post as an answer (and explain how you guessed the problem)?
Comment: Yes, I will do. Also, Ella, welcome to the amazing R community of Stackoverflow!
Answer: I ran
library(tidyverse)
library(knitr)
library(dplyr)
library(psych)
library(apaTables)
library(ggplot2)
library(sandwich)
library(remotes)
library(discovr)
library(ggfortify)
library(papaja)
library(apaTables)

in a Rmarkdown and the R package discovr was not installed on my computer. When I tried to install the R package discovr, it seemed that no R package with this name was available. I checked on google to see if there was a typing mistake in the name discovr and I found the R package discoveR. I suggested to use the R package discoveR instead of discovr.
Comment: OK, thanks. Weird that this doesn't match the error indicated by the OP, but I suspect there is some non-reproducible weirdness going on somewhere ...
Comment: It is possible. It is hard to tell ;)

R file not knitting


Error when trying to log in: ORA-12154

Question: I am using Oracle 10g and PL/SQL Developer for the development. I have already tested from Net Manager that the database can be connected to, but when I tried to connect with PL/SQL Developer there was problem that I do not understand:
ORA-12154: TNS:could not resolve the connect identifier specified

I have already searched for solution for the problem but still it can't be resolved. Any advice?
Answer: This was a hard one.
tnsping works. tnsnames.ora is correct.
This post solved it for me:
http://sambitimes.blogspot.de/2010/10/ora-12154-error-in-windows-7.html
If installation path of PL/SQL-Developer contains brackets, it screws up...
This will not work with win7:
"C:\Program Files (x86)\PLSQL Developer"
this does for me:
"C:\Program Files\PLSQL Developer"
I hope it helps for others.
Comment: Dirk, your answer really helps! I ran into the same issue and fortunately found your answer here. I just moved  the sub dir of plsql developer from  C:\Program Files (x86) to C:\Program Files and it's working now. Thank you and Nore.
Answer: That usually means that the database name you specify is not in the tnsnames.ora file. If you open PL/SQL Developer you will find the option "support info" under the About menu.
This has an entry such as this:
TNS File
  D:\Oracle\Designer\net80\admin\tnsnames.ora

Make sure your database is in this file.
Comment: I think i would use other tools, and i have  try to use Oracle SQL Developer, and its work!, but thanks! :)
Answer: Oracle documentation says:
Cause: A connection to a database or other service was requested using a connect identifier, and the connect identifier specified could not be resolved into a connect descriptor using one of the naming methods configured. For example, if the type of connect identifier used was a net service name then the net service name could not be found in a naming method repository, or the repository could not be located or reached.
Are you trying to connect to the database the same way from Net Manager and PL/SQL Developer?
Comment: yes of course, when i tried from Net Manager, there was successful connected
Comment: I think i would use other tools, and i have  try to use Oracle SQL Developer, and its work!, but thanks! :)

Error when trying to log in: ORA-12154


Distance in 3-space between two parallel vectors

Question: I know these two lines are parallel, but I don't know how to find the distance between them. Any suggestions?

Line 1: (3, 4, 7) + {6, 2, 4}t
Line 2: (-1, 5, -1) + {3, 1, 2}t

I tried creating a triangle composed of an orthogonal line to both lines (the shortest distance between the lines), a hypotenuse that connects the two known points (3, 4, 7) and (-1, 5, -1), and a leg that connects (-1, 5, -1) to the intersection of the orthogonal line on line 2. On line 1, the point (3, 4, 7) was the intersection of the orthogonal line and the hypotenuse.
I'm sorry if that doesn't make any sense, I did my best. I have no idea how to include pictures on this website, this is my first post. And this is not a homework assignment, it's a practice problem for a Multivariable Calculus class. I'm studying for a test we have next week. Any and all help is appreciated!
Comment: Thank you all so much! That makes sense, I really appreciate it.
Answer: The brute force approach is to state the distance between two points, one a point on the first, the other a point on the second line, and then minimize:
$$
d(t_1, t_2) = \lVert L_1(t_1) - L_2(t_2) \rVert \quad (*)
$$
where
$$
L_i(t_i) = a_i + t_i \, b_i
$$
is the parameterized equation of line $i$.
It is a bit easier to do this for the square of the distance
$$
q(t_1, t_2)
= d^2(t_1, t_2)
= \lVert L_1(t_1) - L_2(t_2) \rVert^2
= \sum_{k=1}^3 \left[ \left( L_1(t_1) - L_2(t_2) \right)_k \right]^2
$$
Then calculate where the $t$-gradient of $q$ vanishes to find candidates for local extrema. (So much for the multivariable calculus)
Finally use the found minimizing $t$ parameters to calculate the minimal distance by inserting them into equation $(*)$.
Calculation:
\begin{align}
q(t_1, t_2)
&=
(3 + 6 t_1 - (-1 + 3 t_2))^2 +
(4 + 2 t_1 - (5 + 1 t_2))^2 +
(7 + 4 t_1 - (-1 + 2 t_2))^2 \\
&=
(4 + 6 t_1 - 3 t_2)^2 +
(-1 + 2 t_1 - t_2)^2 +
(8 + 4 t_1 - 2 t_2)^2
\end{align}
\begin{align}
0 = \partial q / \partial t_1
&=
2(4 + 6 t_1 - 3 t_2) (6) +
2(-1 + 2 t_1 - t_2) (2) +
2(8 + 4 t_1 - 2 t_2) (4)
\\
&= 48 - 4 + 64 + (72+8+32) t_1 + (-36-4-16) t_2 \\
&= 108 + 112 t_1 - 56 t_2 \\
0 = \partial q / \partial t_2
&=
2(4 + 6 t_1 - 3 t_2) (-3) +
2(-1 + 2 t_1 - t_2) (-1) +
2(8 + 4 t_1 - 2 t_2) (-2) \\
&= -24+2-32 + (-36-4-16)t_1 + (18+2+8)t_2 \\
&= -54 -56 t_1 + 28 t_2
\end{align}
The gradient has no unique solution but vanishes along the line
$28 t_1 - 14 t_2 = -27$,
so this means the two lines are separated by a constant distance,
they are parallel.
We pick one pair, a simple one is $t_1 = 0$ which leads to $t_2 = 27/14$.
This gives
\begin{align}
q(0,27/2) &= (4-3\cdot 27/14)^2 + (-1 - 27/14)^2 + (8-2\cdot 27/14)^2 \\
&= \frac{(-25)^2 + (-41)^2 + (58)^2}{14^2} \\
&= \frac{5670}{14^2}
\end{align}
which gives $d = \sqrt{5670}/14 = 5.37\dotsb$

(Large version)
Answer: To find the distance between the lines, take any vector between them and project onto the plane perpendicular to them: if the lines are $p + tv$ and $q+tv$, a shortest vector between the lines is
$$(I-\hat{v}\hat{v}^T)(q-p)$$
and the magnitude is the distance. I believe this is very similar to the triangle that you describe in your post.
Answer: $3$-d space is blessed with a cross product. In general try to use the cross product when possible, although it takes some getting used to. In engineering statics, for example, students are taught to think like this and it pays off for the current problem. If two lines are parallel, we can say that
$$\vec r_1=\vec p_1+\vec v_1t_1$$
$$\vec r_2=\vec p_2+\vec v_1t_2$$
You might try to imagine a triangle with vertices at $\vec p_1$, $\vec p_2$, and $\vec q$, the nearest point on $\vec r_1$ to $\vec p_2$. This is a right triangle and the distance we need is
$$\overline{qp_2}=\overline{p_1p_2}\sin\angle p_2p_1q=\left|\frac{(\vec p_2-\vec p_1)\times\vec v_1}{\left|\left|\vec v_1\right|\right|}\right|$$
If the two lines aren't parallel,
$$\vec r_1=\vec p_1+\vec v_1t_1$$
$$\vec r_2=\vec p_2+\vec v_2t_2$$
Then we can view the lines along the line that connects the nearest points on the two lines, $\vec q_1$ and $\vec q_2$. The vector that connects the lines at the nearest points is then $\vec d=\vec q_2-\vec q_1$ and
$$\left|\left|\vec d\right|\right|=\left|\vec d\cdot\frac{\vec v_1\times\vec v_2}{\left|\left|\vec v_1\times\vec v_2\right|\right|}\right|$$
and
$$\begin{align}\vec d\cdot(\vec v_1\times\vec v_2)&=(\vec q_2-\vec q_1)\cdot(\vec v_1\times\vec v_2)=(\vec q_2-\vec q_1+\vec q_1-\vec p_1)\cdot(\vec v_1\times\vec v_2)\\
&=(\vec q_2-\vec p_1)\cdot(\vec v_1\times\vec v_2)=(\vec q_2-\vec q_2+\vec p_2-\vec p_1)\cdot(\vec v_1\times\vec v_2)\\
&=(\vec p_2-\vec p_1)\cdot(\vec v_1\times\vec v_2)\end{align}$$
Where adding mulitples of $\vec v_1$ and $\vec v_2$ was no problem because they are orthogonal to $\vec v_1\times\vec v_2$. So the distance formula become simply
$$\left|\left|\vec d\right|\right|=\left|(\vec p_2-\vec p_1)\cdot\frac{\vec v_1\times\vec v_2}{\left|\left|\vec v_1\times\vec v_2\right|\right|}\right|$$
Just thinking in terms of the cross product make this kind of problem easy to set up without having to remember lots of formulas.


$\lim_{p\to\infty}\sum_{n≥1}\arctan\left(\frac{1}{n^p}\right)=\frac{\pi}{4}$

Question: I was solving simple series involving the function $\arctan(x)$ of the form :
$$\sum \arctan\left(\frac{d}{ax^2+bx+c}\right)$$
where $a,d,b,c$ are constants. This series can be manipulated too by simple substitutions. The basic idea of solving these types was to convert the original sum to a telescoping series by using the relation (for $x,y>0$):
$$\arctan\left(\frac{x-y}{1+xy}\right)=\arctan(x) -\arctan(y)$$
But , for my curiousity , I tried to see if it's possible to evaluate this for higher degree polynomials instead of quadratics. Using online calculators, I observed that :
$$I_{100}≈0.785$$
$$I_{1000}≈0.78538$$
where
$$I_p=\sum_{n≥1}\arctan\left(\frac{1}{n^p}\right)$$
Question:
Can we prove if $$\lim_{p\to\infty}I_p=\frac{\pi}{4}$$ because $$\frac{\pi}{4}≈0.785398$$ which is numerically very close to the sum above ? My knowledge about advanced techniques of calculus to find such sums is very low.
Comment: $\arctan(1/n^p)\to 1/n^p$ for $n>1$ and $p\to\infty$.
Comment: @SidharthGhoshal Sorry, I forgot to mention, $x,y>0$.
Comment: Spelt out more concretely if $u,v$ are rational numbers where $u = \frac{a}{b}, v= \frac{c}{d}$ then $\frac{u+v}{1-uv} = \frac{ac-bd}{ad+bc}$ which looks like multiplication of complex numbers
Comment: @user Thanks sir. But how can I utilise that ?
Comment: $\lim_{p\to\infty}\sum_{n=2}^\infty\frac1{n^p}=0$
Comment: Its just the first term $\text{atan}(1) = \frac{\pi}{4}$. All other arguments go to zero.
Comment: @RolandF Oops ! I see now. It was so simple. Thanks !
Comment: How about monotone convergence theorem?
Comment: It's worth mentioning that $\frac{x+y}{1-xy}$ creates a natural map from $\mathbb{Q} \rightarrow \mathbb{Z}[i]$ so your observation involving sums of arctangents has a related problem of the arctangent of products of complex integers
Comment: @SidharthGhoshal I haven't learnt what natural maps are and couldn't understand your first comment. Thanks for showing me that pattern to complex numbers and giving an insight to your first comment :)
Answer: $$
\lim_{p\to\infty}\sum_{n=1}^\infty\arctan\frac1{n^p}=\arctan{1}+\lim_{p\to\infty}\sum_{n=2}^\infty\arctan\frac1{n^p}=\frac\pi4+0.
$$
The relation
$$
\lim_{p\to\infty}\sum_{n=2}^\infty\arctan\frac1{n^p}=0
$$
follows from summing the inequalities $$0<\arctan\frac1{n^p}<\frac1{n^p}$$
and applying squeeze theorem.


Surface measure of a hypersurface

Question: This is the problem I encountered. $S_{2n}$ is a hypersurface of $\mathbb{R}^{2n}$ which is given by $\{(y_1,y_2,\cdots,y_{2n}):y_{2n}-y_{2n-1}+y_{2n-2}+\cdots+y_2-y_1=\zeta)\}$. Let $dS_{2n}$ be the surface measure on $S_{2n}$. Then is it true that $dS_{2n}d\zeta=dy=dy_1dy_2\cdots dy_{2n}$? Should there be a constant coefficient, like $\sqrt{n}$ added? Thank you for helping!
Comment: It look like $\zeta$ is a parameter, not a variable like the $2n$-$y$'s. I do not understand the $d\zeta$, then.
Comment: @Avitus, as you vary $\zeta$ you foliate (fill up nicely) $\mathbb R^{2n}$ with parallel hyperplanes.
Comment: @Ted I see: so we have a $family$ of hypersurfaces...now I understand, thanks
Answer: Yes, you need a constant. The orthogonal distance from the origin to this hyperplane is $\zeta/\sqrt{2n}$, so the volume element should be $dS_{2n}\,d\zeta/\sqrt{2n}$.
To respond to your further question, you probably won't like this answer. The usual way to get the area measure on a hypersurface is to take the volume element on $\mathbb R^N$ and contract it against the unit normal of the hypersurface. For example, for the plane $ax+by+cz=d$ in $\mathbb R^3$, $dS = (a\,dy\wedge dz + b\,dz\wedge dx + c\,dx\wedge dy)/\sqrt{a^2+b^2+c^2}$. So in your case, it's going to be a sum of $2n$ terms if you want a coordinate expression in terms of the $y$-coordinates:
$$\frac1{\sqrt{2n}}\sum_{i=1}^{2n} dy_1\wedge\dots\wedge\widehat{dy_i}\wedge\dots\wedge dy_{2n}$$
("hat" means omitted). I had thought you wanted this for conceptual applications (like something analogous to spherical coordinates).
Comment: Dear Ted, thank you so much for your answer. Could you please do me a favor by explaining in more details on how one is supposed to consider this kind of calculating surface measure, like giving the explicit expression of $dS_{2n}$? Thank you again!
Comment: Thank you so much! This is exactly what I need. So is there any standard references that involves this? I mean, is it the field of differential geometry or what else that deals with this sort of problems?
Comment: Yes, basics on differentiable manifolds. It's mostly at the level of exercises, so I can't suggest a reference offhand.

Surface measure of a hypersurface


Problem at comparing dates Bash script to Telegram bot

Question: I have a bash script that is comparing 2 dates ( one from a file that is stored in the server and the other using date command), it was working just fine but after the month ended it cannot compare the 2 dates, here is the code:
consult)

                    local FECHA=`curl -s $URL_UPDATE | jq '.result[0].message.text' | awk -F "_" '{print $2}' | tr -d '"'`

                    local DATE=`date "+%d-%m-%y"`

                    if [[ ${FECHA#0} -ge ${DATE#0} ]]; then

                            $SEND"Wrong Date"

                    else

                           $SEND"Right Date"

                    fi

PD: The URL_UPDATE variable is just the Telegram API getUpdates url, I take the first date from the user via Telegram after the _ if the user puts any. About $SEND, is the "send_message" function from the Telegram API.
Comment: Lexical comparison of dates in dd-mm-yy format will of course not work like you hope. This is why we use yyyy-mm-dd format (or seconds since the epoch) for anything which needs to be machine-readable.
Comment: @tripleee I was using that format because the file where i am taking the first date from is in that format, i will try with the seconds since epoch, Thanks.
Answer: [ -ge ] compares numbers. But dates of the format dd-mm-yyyy are not numbers.
If you use the date format yyyymmdd you can compare dates using -ge. You can convert the first date using sed, which can also do the things you did with awk and tr.
local fecha=$(curl -s "$URL_UPDATE" | jq '.result[0].message.text' |
              sed -En 's/^[^_]*_[^_]*(..)-(..)-(....).*/\3\2\1/p')
local date=$(date +%y%m%d)
if (( fecha >= date )); then
  # do stuff
else
  # do stuff
fi

By the way:

Variables in bash should be written in lowercase and not in ALLCAPS, to avoid accidental collision with special environment variables.
$(cmd) is better than `cmd` as it can be nested.
(( var >= var )) is easier to write/read than [[ "$var" -ge "$var" ]].
In your code $SEND"Wrong Date" there is probably a space missing between $SEND and "Wrong date". Also, instead of storing a command inside the variable $SEND, define a function send() { ... }.


What is right way to modify a node field in a multilanguage system (LANGUAGE_NONE or $node->language or ...)

Question: Let's say we want to modify the body field.
$node->body[LANGUAGE_NONE][0]['value'] = "test";

This will work if the node is language neutral (?)
$node->body[$node->language][0]['value'] = "test";

This will work if the node has the same langauge as the field.
But is this always the case? I found nodes where this is not the case:

(Object) stdClass
...
language (String, 2 characters ) de
...
body (Array, 1 element)
  und (Array, 1 element)
        0 (Array, 5 elements)
            value (String, 4 characters ) test

So if this is a correct node, how can we access the body field value?
Answer: field_language() returns the field's display language. You should use code similar to the following one:
$language = field_language('node', $node, 'body');
do_something_with($node->body[$language][0]);

Of course, note that field_language() will determine the right display language ('en' or LANGUAGE_NONE or whatever); if you're modifying fields you might want to modify more than one language.
Comment: Does this mean you'd really need to do `foreach($node->field_name as $languaged_field) { ... }` to update them all? Is there nothing more elegant?
Answer: What's about getting the field value with field_get_items()? Really prefer this solution ...
if ($body = field_get_items('node', $node, 'body')) {
  $my_rendered_content = strip_tags(drupal_render(field_view_value('node', $node, 'body', $body[0])));
}


How to use the filtered data in Pandas?

Question: I am new to Pandas. Below is part of a code. I am trying to use the  df_filtered which is the filtered data having codenum column value =AB123. However from Line 14 if I use df_filtered instead of excel_data_df , it's not giving results. The desired columns are getting picked correctly. But the value filtering is not happening - In codenum col value should be = AB123.  But the  value filtering is not happening and I am getting the entire excel converted to json with chosen columns. Please help understand how to consider/use df_filtered data from Line 14.
PathLink = os.path.join(path, 'test' + '.json') #Path Name Formation
        excel_data_df = pandas.read_excel('input.xlsx',
                                          sheet_name='input_sheet1',
                                          usecols=[4,5,6,18,19], #index starts from 0
                                          names=['codenum', 'name',
                                                  'class',
                                                  'school',
                                                  'city'],
                                           dtype={'codenum': str,
                                                  'name': str,
                                                  'school': str,
                                                  'city': str})  # Excel Read and Column Filtering
        df_filtered = excel_data_df.loc[lambda x: x['codenum'] == 'AB123']    # Row Filtering   -- need to use this further
        excel_data_df.columns = ['Code', 'Student Name', 'Class', 'School Name','City Name'] #renaming columns  -- Line Num 14
        cols_to_keep = ['Student Name', 'Class', 'School Name','City Name'] # columns to keep
        excel_data_df = excel_data_df[cols_to_keep]  # columns to keep
        excel_data_df                                # columns to keep
        json_str = excel_data_df.to_json(PathLink,orient='records',indent=2) #json converted file

Comment: I guess `df_filtered` is empty DataFrame
Comment: If it is not giving you an error it just means there is no row with codenum AB123. Are you sure there is or can you share the excel file?
Answer: First, a small tip; you can remove the use/need of lambda by doing
df_filtered = excel_data_df.loc[excel_data_df["codenum"]=="AB123"]

if you want to get rid of the lambda.
Afterwards, as pointed out in the comments, make sure that it contains samples after the filtering;
df_filtered = excel_data_df.loc[excel_data_df["codenum"]=="AB123"]

if df_filtered.shape[0]: #it contains samples
        cols_to_keep = ['Student Name', 'Class', 'School Name','City Name'] # columns to keep
        excel_data_df = excel_data_df[cols_to_keep]  # columns to keep
        excel_data_df                                # columns to keep
        json_str = excel_data_df.to_json(PathLink,orient='records',indent=2) #json converted file
else: #it does not contain any samples i.e empty dataframe
   print("Filtered data does not contain data")

Comment: Indeed, I prefer the other masking since it makes it more easy for others to quickly see whats going on, instead of having to read how pandas treat the `lambda` function etc. I think its a personal preference
Comment: I believe lambda syntax is easier to write and read because you don't have to repeat the same dataframe name over and over. Also it adds capability to filter piped dataframes without any name so I believe its general use should be encouraged.
Answer: Try the following code below:
df_filtered = excel_data_df[excel_data_df['codenum'] == 'AB123']

If it still not working then "codenum" may not have this value that you are trying to filter out.
Answer: Thanks all for your inputs. Initially it was returning empty dataframe as suggested in above answers and comments. Posting the edited working code based on your inputs for anyone's future reference.
PathLink = os.path.join(path, 'test' + '.json') #Path Name Formation

        excel_data_df = pandas.read_excel('input.xlsx',
                                          sheet_name='input_sheet1',
                                          usecols=[3,5,6,18,19], #index starts from 0 ##  edit 1: corrected index to right column index
                                          names=['codenum', 'name',
                                                  'class',
                                                  'school',
                                                  'city'],
                                           dtype={'codenum': str,
                                                  'name': str,
                                                  'school': str,
                                                  'city': str})  # Excel Read and Column Filtering

        print(excel_data_df['codenum'].unique())  ##edit 1: returns unique values including AB123

        df_filtered = excel_data_df.loc[excel_data_df["codenum"]=='AB123']    # Row Filtering   ##edit 1
        print(df_filtered)  ##edit 1 - to check if expected results are present in filtered data

        df_filtered.columns = ['Code', 'Student Name', 'Class', 'School Name','City Name'] #renaming columns

        if df_filtered.shape[0]: #it contains samples ## edit 1
            cols_to_keep = ['Student Name', 'Class', 'School Name','City Name'] # columns to keep
            df_filtered = df_filtered[cols_to_keep]  # columns to keep
            df_filtered                                # columns to keep
            json_str = df_filtered.to_json(PathLink,orient='records',indent=2) #json converted file
        else: #it does not contain any samples i.e empty dataframe ##edit 1
            print("Filtered data does not contain data")

Answer: The pandas df.loc will return the filtered result.
In your code, you tried to make a filtered but df.loc is not a filter maker.
See the example, the df.loc return the filter result from the origin df.
import pandas as pd

df = pd.DataFrame([[1, "AB123"], [4, "BC123"], [7, "CD123"]],columns=['A', 'B'])

print(df)
#   A      B
#0  1  AB123
#1  4  BC123
#2  7  CD123

print(df.loc[lambda x: x["B"] == "AB123"])
#   A      B
#0  1  AB123

How to use the filtered data in Pandas?