text:
# All Questions

3k views

### How to find generator $g$ in a cyclic group?

As generator $g$ is used in DH how do you find a combination of prime $p$ and $g$? eg: if we choose $p=23$ and its generator is $7$ (given in the book) how do we find the generator?
275 views

### RSA enc/decryption with multiple prime modulus using CRT

Every information I found on internet about RSA-CRT encryption/decryption uses only two primes. I'm interested in my project in doing that using multiple (up to 8) primes. The general idea is to ...
5k views

### RSA cracking: The same message is sent to two different people problem

Suppose we have two people: Smith and Jones. Smith public key is e=9, n=179 and Jones public key is e=13, n=179. Bob sends to ...
291 views

### Why are there no MACs inspired by block cipher modes other than CBC and CFB?

I've been studying message authentication codes and I was wondering why a MAC can only be produced with AES in CBC and CFB mode and why not the other modes such as ECB, OFB and counter. Why are CBC ...
280 views

### Algorithm Design for only Mutual Information Sharing

Bob and Alice each have a bit string they want to keep private. They each want to know what the bitwise AND of their two strings would be without telling the other or anyone else listening to their ...
2k views

### Double Encrypting with two different keys

In terms of security, would it be MORE or LESS secure to take, say, an RC4 output (or Serpent) or other, that is encrypted with one key, and to encrypt that output with AES (using a different key)? <...
397 views

### How to verify a number encrypted with an unknown key

Alice and Bob are going to follow the protocol below. Are there any crypto-constructions to help Bob verify the correctness of the answer he gets?: Alice encrypts a set of numbers using some ...
459 views

### Shamir Secret sharing - Can share generator keep x values secret?

I'm wondering, in Shamir secret sharing, can generator of the shares, keep the x values which are used in evaluating the polynomial to obtain y values (i.e., the shares) secret, and whenever the ...
2k views

### Related-key attacks on AES

According to Wikipedia: Related-key attacks can break AES-192 and AES-256 with complexities $2^{176}$ and $2^{99.5}$, respectively. What are the requirements for these attacks (i.e how many ...
1k views

### Elliptic Curves of different forms

Looking at http://safecurves.cr.yp.to/ to find a safe curve, I find that most curves described here are of a different form from that generally used. In Bouncy Castle, for example, ...
680 views

### Is it reasonable to assure that p-1 and q-1 aren't smooth?

I came across the requirement that, in RSA, $p-1$ and $q-1$ shouldn't be smooth, shouldn't consist of lots of small factors. Therefore my question: How complicated is it to check whether $p-1$ is ...
2k views

### On-the-fly computation of AES Round Keys for decryption?

The usual implementation of AES first computes all the Round Keys sequentially starting from the key, and stores them in RAM for later uses. However, when enciphering a single block with a key that ...
2k views

### How much can we compress RSA public keys?

I am wondering to what degree we can define an RSA variant, with a security argument that it is as safe as regular RSA with a given modulus size $m$ (e.g. $m=2048$), in which the public key has a ...
312 views

### Will varying plaintext compensate for a fixed initialisation vector?

This is a follow-up question to Relative merits of AES ECB and CBC modes for securing data at rest. I need to store encrypted Personal Account Numbers (PANs) in a database. The only encryption option ...
209 views

### In RSA, rationale for prime $p$ with $p-1$ having prime factor $u$ with $u-1$ having large prime factor?

In the 1978 RSA paper, it is recommended, among other things, to choose primes $p$ such that $(p-1)$ has a large prime factor $u$. This was motivated by Pollard's p-1 algorithm. Further, the authors ...
148 views

### Encrypt-Mix-Encrypt: Full Diffusion?

I've read "A Parallelizable Enciphering Mode" by Halevi and Rogaway about the encrypt-mix-encrypt mode for ciphers and was asking myself if this mode provides "full" diffusion. So if an attacker ...
270 views

### Is it possible to weaken a bitcoin private key by “using” it elsewhere?

What are the increased possibilities (if any) of being able to crack a private key given the following: The associated bitcoin (ECDSA Secp256k1-based) public key is known. The private key has been ...
677 views

### What is the difference between a 'cipher' and a 'mode of operation'?

What is the difference between the term cipher (a name like RIJNDAEL) and mode of operation (like ECB)? Aren't these both terms for the encryption/decryption technique?
480 views

249 views

### Non-cryptographic hash function as MAC for stream ciphers

I understand that for a stream cipher to be useful, there must be a way to verify that the message was not tampered with (bits were flipped by an attacker). So, instead of using some cryptographic ...
1k views

### Why are the Davies-Meyer and Miyaguchi-Preneel constructions secure?

The Davies-Meyer compression function $h(H, m) = E_m(H) \oplus H$ is said to be secure. So too is the Miyaguchi-Preneel compression function $h(H, m) = E_m(H) \oplus m \oplus H$. Why are these ...
716 views

### How much data can I encrypt with AES before I need to change the key in CBC mode?

In my cryptography class, the instructor suggested that in order to give the attacker a minimal advantage of $1/2^{32}$, we have to change the key after $2^{48}$ blocks are encrypted. It seems that ...
202 views

### How do I encrypt with the private key? [duplicate]

Possible Duplicate: RSA encryption with private key and decryption with a public key This wording is creeping everywhere (e.g. there): "I encrypt with the private key" and even sometimes, "I ...
155 views

### Attacking CBC with predictable but encrypted IV

Let P be a secure block cipher, eg AES-128. Let's say a server has a CBC encryption oracle which uses an attacker-selected yet unique nonce to generate the IV for each message = P(key, nonce). The ...
499 views

### How does compression before encryption leak info about the input?

Apparently current best practices recommend that you do not compress before you encrypt. For example in this blog entry (*): http://sockpuppet.org/blog/2013/07/22/applied-practical-cryptography/ It ...
2k views

### DES Key Schedule Algorithm

Reading through the DES Specification it says that the keys are permuted with PC-1 initially and then shifted left both $C$ and $D$. However, before it gets ...
4k views

### How to get the keyword from a keyword cipher?

I was given a ciphertext and now I am trying to break it via looking for the keyword. This is a keyword cipher. So: PlainEnglish: ABCDEFGHIJKLMNOPQRSTUVWXYZ If ...
371 views

### Knowing pre-encryption data, can we find the private key CryptoWall used?

I'm just repurposing a question already asked about Cryptolocker for CryptoWall: "If we know exact contents of some of the files prior to them being encrypted, would it be feasible to use those ...
448 views

### Hash Based Encryption (fast & simple), how well would this compare to AES? [duplicate]

First of all, I know it's a very bad idea to invent your own encryption algorithm. It's better to use existing known, trusted, extensively tested and studied algorithms with a proven track record. The ...
213 views

### Would this method deliver a perfectly non-malleable encryption for at least two blocks? [closed]

Disclaimer: the algorithms I present here (and in other messages) are used as a hands-on way to learn about developing crypto algorithms, (and might also be of interest for other curious people), not ...
26k views

### What are the differences between a digital signature, a MAC and a hash?

A message may be accompanied with a digital signature, a MAC or a message hash, as a proof of some kind. Which assurances does each primitive provide to the recipient? What kind of keys are needed?
21k views

### Basic explanation of Elliptic Curve Cryptography?

I have been studying Elliptic Curve Cryptography as part of a course based on the book Cryptography and Network Security. The text for provides an excellent theoretical definition of the algorithm but ...
27k views

### Explaining weakness of Dual EC DRBG to wider audience?

I have an audience of senior (non-technical) executives and senior technical people who are taking the backdoor in Dual_EC_DRBG and considering it as a weakness of Elliptic curves in general. I can ...
2k views

### Is this password migration strategy secure?

I want to upgrade the security of some existing databases of users' authentication tokens strictly for the purpose of making sure that if the database is stolen, attackers will not be able to guess ...
37k views

### Are there two known strings which have the same MD5 hash value?

Is there an example of two known strings which have the same MD5 hash value (representing a so-called "MD5 collision")?
12k views

### “SHA-256” vs “any 256 bits of SHA-512”, which is more secure?

In terms of security strength, Is there any difference in using the SHA-256 algorithm vs using any random 256 bits of the output of the SHA-512 algorithm? Similarly, what is the security difference ...
3k views

### What is the ideal cipher model?

What is the ideal cipher model? What assumptions does it make about a block cipher? How does it relate to assuming that my block cipher is a pseudo-random permutation (PRP)? When is the ideal ...
4k views

### What is a “freestart collision”?

In their work on SHA-1 collisions (cf. the EUROCRYPT-2016 paper “Freestart collision on full SHA-1” by Stevens, Karpman, and Peyrin) Stevens et al show that they are able to generate "freestart ...
6k views

### What exactly is a negligible (and non-negligible) function?

The mathematical definition of neglible and non-neglible functions is fairly clear-cut, but why they are important and how they are used in cryptography?
1k views

### Random oracle model proofs and programmability

Proving the security of a scheme with the random oracle model (ROM) involves two steps: first you prove that the scheme is secure in an idealized world where a random oracle exists, and then you ...
1k views

### Getting started [closed]

I'm looking for a good place to start in cryptography and places to go to get free books etc on the topic. I have been looking online but I always get stuck at some point or another. I need something ...


text:
E04 Chapter Contents
E04 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentE04UEF/E04UEA

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

To supply individual optional parameters to E04UCF/E04UCA. More precisely, E04UEF must be used to supply optional parameters to E04UCF and E04UEA must be used to supply optional parameters to E04UCA.
E04UEA is a version of E04UEF that has additional parameters in order to make it safe for use in multithreaded applications (see Section 5). The initialization routine E04WBF must have been called before calling E04UEA.
E04UEF/E04UEA can also be used to supply individual optional parameters to E04UFF/E04UFA.

## 2  Specification

### 2.1  Specification for E04UEF

 SUBROUTINE E04UEF ( STR)
 CHARACTER(*) STR

### 2.2  Specification for E04UEA

 SUBROUTINE E04UEA ( STR, LWSAV, IWSAV, RWSAV, INFORM)
 INTEGER IWSAV(610), INFORM REAL (KIND=nag_wp) RWSAV(475) LOGICAL LWSAV(120) CHARACTER(*) STR

## 3  Description

E04UEF/E04UEA may be used to supply values for optional parameters to E04UCF/E04UCA. It is only necessary to call E04UEF/E04UEA for those parameters whose values are to be different from their default values. One call to E04UEF/E04UEA sets one parameter value.
Each optional parameter is defined by a single character string, of up to $72$ characters, consisting of one or more items. The items associated with a given option must be separated by spaces, or equals signs $\left[=\right]$. Alphabetic characters may be upper or lower case. The string
`Print Level = 1`
is an example of a string used to set an optional parameter. For each option the string contains one or more of the following items:
 – a mandatory keyword; – a phrase that qualifies the keyword; – a number that specifies an integer or real value. Such numbers may be up to $16$ contiguous characters in Fortran's I, F, E or D formats, terminated by a space if this is not the last item on the line.
Blank strings and comments are ignored. A comment begins with an asterisk (*) and all subsequent characters in the string are regarded as part of the comment.
For E04UEF, each user-specified option is normally printed as it is defined, on the current advisory message unit (see X04ABF), but this printing may be suppressed using the keyword Nolist. Thus the statement
``` CALL E04EUF ('Nolist')
```
suppresses printing of this and subsequent options. Printing will automatically be turned on again after a call to E04UCF and may be turned on again at any time using the keyword List.
For E04UEA printing is turned off by default, but may be turned on at any time using the keyword List.
Optional parameter settings are preserved following a call to E04UCF/E04UCA and so the keyword Defaults is provided to allow you to reset all the optional parameters to their default values before a subsequent call to E04UCF/E04UCA.
A complete list of optional parameters, their abbreviations, synonyms and default values is given in Section 11 in E04UCF/E04UCA.

None.

## 5  Parameters

1:     STR – CHARACTER(*)Input
On entry: a single valid option string (as described in Section 3 and in Section 11 in E04UCF/E04UCA).
Note: the following are additional parameters for specific use with E04UEA. Users of E04UEF therefore need not read the remainder of this description.
2:     LWSAV($120$) – LOGICAL arrayCommunication Array
3:     IWSAV($610$) – INTEGER arrayCommunication Array
4:     RWSAV($475$) – REAL (KIND=nag_wp) arrayCommunication Array
The arrays LWSAV, IWSAV and RWSAV must not be altered between calls to any of the routines E04UEA, E04UCA, E04UDA and E04WBF.
5:     INFORM – INTEGEROutput
On exit: contains zero if a valid option string has been supplied and a $\text{value}>0$ otherwise (see Section 6).

## 6  Error Indicators and Warnings

Errors or warnings detected by the routine:
${\mathbf{INFORM}}=5$
The supplied option is invalid. Check that the keywords are neither ambiguous nor misspelt.

Not applicable.

## 8  Further Comments

E04UDF/E04UDA may also be used to supply optional parameters to E04UCF/E04UCA.

## 9  Example

See Section 9 in E04UDF/E04UDA.

format: plain


text:
# Classifying time series data that overlap

I am working with Time-Series Data that has to be classified into two classes (Blue and Red) or at least Classify the data as one class (Red), I'm unable to come up with features that distinctly separate the data.

Please advise as to how do I need to approach this problem.

You could calculate the distance between time series using Dynamic Time Wrapping DTW and then you could cluster them using K-means or so. Here is a python implementation of the DTW or use the dtw package in R.


text:
# Smaller-than symbol ('<') in \text environment gets converted into upside down exclamation mark [duplicate]

I want to typeset the < symbol in a string of text inside a math environment using the \text command from the amsmath package. However, for some reason it render something like

\text{<-wrt}

to

¡-wrt

Why does amsmath do that, and how can I stop it from 'interpreting' my text?

## marked as duplicate by Mico, campa, barbara beeton, Schweinebacke, TeXnicianAug 25 '17 at 15:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

## 1 Answer

Use this code:

\documentclass{article}
\usepackage{amsmath}
\usepackage[T1]{fontenc} %%% <--- NOTE THIS

\begin{document}

$$\text{<-wrt}$$

\end{document}


text:
# Hiding fields from the debugger

Is it possible to hide fields and/or properties from showing up in the debugger watch window? See, we've got a class here with over 50 private fields, most of which are exposed through public properties. This means we're seeing a duplication of a large number of data in the watch window listing.

Is there any means of controlling this?

-
I thought you were going to try and make an easter egg and didn't want your co-workers to see your variables, fields, and objects. –  Lucas Apr 16 '09 at 1:09
Nah. It's a pretty large model object, and having to scroll through so many duplicate values can be a waste of time. –  Amy Apr 16 '09 at 13:55

Try this attribute:

 [DebuggerBrowsable(DebuggerBrowsableState.Never)]

Use it to hide your backing fields by placing the attribute above the field declaration like this:

class Foo
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
int bar;  // this one will be hidden
int baz;  // but this one will be visible like normal
}

Keep in mind that the DebuggerBrowsableState enumeration has two other members:

Collapsed: Collapses the element in the debugger.
RootHidden: This shows child elements of a collection but hides the root element itself.

-
+1 for the in depth, and yet still succinct, answer. Man I love this site. –  automatonic Apr 16 '09 at 1:12

You could use autos instead of locals or use watches and only watch the variables of interest...

-

Check out the DebuggerBrowsableAttribute:

http://msdn.microsoft.com/en-us/library/system.diagnostics.debuggerbrowsableattribute.aspx

In fact, this article has some very useful tips for this area:

http://msdn.microsoft.com/en-us/magazine/cc163974.aspx

You might find that using a DebuggerTypeProxy makes more sense. This allows you to provide a "custom view" of the type.

-
+1 for the related tips. –  automatonic Apr 16 '09 at 1:09

The DebuggerBrowsableAttribute is covered in this other SO question. If you're doing C# heavily then it's a good question to read up on.

-

I know this is old but you would be much better off with using DebuggerTypeProxy http://msdn.microsoft.com/en-us/library/d8eyd8zc.aspx

this way you don't have to modify your class with ugly attributes and the extra benefit is that you can always look at the real type if you do in fact need to have a look at one of those "hidden" fields.

-


text:
## LaTeX forum ⇒ General ⇒ Renaming \newcommand args from #1 to a variable name

LaTeX specific issues not fitting into one of the other forums of this category.
eggmanneo
Posts: 10
Joined: Wed Apr 21, 2010 9:03 pm

### Renaming \newcommand args from #1 to a variable name

I was wondering if there was a way to replace the name of arguments in \newcommand from #1 to another variable name. For exmple, I have this latex code to write the multivariate normal CDF

`\newcommand{\mvncdf}[3]{\Phi_{#1}\left(#2\middle|#3\right)}  `

I would like to replace the #1, #2, and #3 names of the arguments to somethis else, like naming #1 "n" and #3 "\Sigma". Is there a way to do this?

Tags:

cgnieder
Site Moderator
Posts: 1985
Joined: Sat Apr 16, 2011 7:27 pm
Location: Germany
Contact:
I'm afraid I don't quite understand what you mean... can you add an example code that shows how you would like to use newcommand?

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

hugovdberg
Posts: 133
Joined: Sat Feb 25, 2012 6:12 pm
Location: Rosmalen, Netherlands
I think I understand what you're after: using named variables in the macro definition like
`\newcommand{foo}[bar]{#bar}`

But as far as I know that's not possible, and I'm not sure why you should want it. Unless you're after optional arguments with key/value pairs, like in this post on tex.sx.
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit

cgnieder
Site Moderator
Posts: 1985
Joined: Sat Apr 16, 2011 7:27 pm
Location: Germany
Contact:
hugovdberg wrote:I think I understand what you're after: using named variables in the macro definition like
`\newcommand{foo}[bar]{#bar}`

But as far as I know that's not possible, and I'm not sure why you should want it.

If that is the goal: this is indeed impossible.

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim


text:
Acta Metall Sin  2019, Vol. 55 Issue (4): 511-520    DOI: 10.11900/0412.1961.2018.00166
 Current Issue | Archive | Adv Search |
In Situ TEM Study on the Sympathetic Nucleation of Austenite Precipitates
Juan DU1,Xiaoxing CHENG2,Tiannan YANG2,Longqing CHEN2,3,Frédéric Mompiou4,Wenzheng ZHANG1()
1. Key Laboratory of Advanced Materials MOE, School of Materials Science and Engineering, Tsinghua University, Beijing 100084, China
2. Department of Materials Science and Engineering, The Pennsylvania State University, University Park,PA 16802, USA
3. State Key Laboratory of New Ceramics and Fine Processing, School of Materials Science and Engineering, Tsinghua University, Beijing 100084, China
4. CEMES-CNRS and Université de Toulouse, 29 rue J. Marvig, 31055 Toulouse, France
Abstract

Duplex stainless steels (DSSs) are widely used for chemical industry, marine construction and power plants, due to the beneficial combination of ferrite and austenite properties: high strength with a desirable toughness and good corrosion resistance. The sympathetic nucleation (SN) of intragranular austenite precipitates has been frequently observed in DSS. This type of nucleation, which occurs in a considerable variety of steels and titanium alloys, has a great effect on the morphological arrangement of precipitates and hence the mechanical properties of metallic materials. Therefore, understanding the SN mechanism of austenite precipitates is essential to knowledge based material design of the microstructure in DSS. Three types of morphological arrangement, i.e., face-to-face, edge-to-edge and edge-to-face SN of austenite precipitates, have been identified in previous investigations on DSS. The adjacent grains of face-to-face and edge-to-edge sympathetically nucleated austenite have approximately the identical orientations, with a small-angle boundary between two austenite crystals. However, as regards to the edge-to-face SN, the lacking of crystallographic features of adjacent austenite precipitates obstructs the understanding of the mechanism for the edge-to-face SN. Moreover, it is usually difficult to distinguish between SN and hard impingement following nucleation at separate sites in conventional experimental observations. Thus, in the present work, the typical morphology of edge-to-face SN of austenite precipitates was directly observed at 725 ℃ in a DSS using in situ TEM. The orientation relationship (OR) between the sympathetically nucleated austenite precipitate and ferrite matrix is determined through analysis of Kikuchi lines. Since the long axes of austenite precipitates parallel to the invariant line are restricted in the thin TEM foil, there are only four types of austenite with different near N-W ORs and cystallographically inequivalent long axes. This work reveals that the ORs of sympathetically nucleated austenite grains belong to different Bain groups with those of the pre-formed austenites. The explanation for the OR selection is provided based on two factors favoring SN, namely the reduction of elastic interaction strain energy and the interfacial energy. The local stress generated by the semi-coherent pre-formed austenite was calculated by Eshelby inclusion method. The local stress field accompanying with the pre-formed austenite assists the subsequent nucleation and growth of sympathetically nucleated austenite. It shows that the elastic interaction energy for the sympathetically nucleated austenite of particular OR is negative. In addition, the pre-formed austenite and the sympathetically nucleated austenite grain are twin related. This indicates that the nucleation barrier associated with SN of austenite with selected OR is comparably lower than other candidates. Hence, the austenite precipitate with a specific OR is preferred during SN.

 ZTFLH: TG113
Fund: National Natural Science Foundation of China(No.51471097)
Corresponding Authors:  Xiaoxing CHENG,Wenzheng ZHANG     E-mail:  zhangwz@tsinghua.edu.cn
 Service E-mail this article Add to citation manager E-mail Alert RSS （） Articles by authors Juan DU Xiaoxing CHENG Tiannan YANG Longqing CHEN Fré dé ric Mompiou Wenzheng ZHANG

 Fig.1  The snapshots of the initial growth of sympathetically nucleated austenite γ2 on the habit plane of pre-formed austenite γ1 at 725 ℃ using in situ TEM Fig.2  The morphology of sympathetically nucleated austenite γ2(γ3) and pre-formed austenite γ1(γ4) (a) and an enlarged micrograph showing the grain boundaries between γ1 and γ2 (b) Fig.3  Kikuchi diffraction patterns for constructing the orientation matrix(a) diffraction pattern of ferrite (b) diffraction pattern of the austenite along the same direction as in Fig.3a Fig.4  The morphologies of γ1 (a, c) and Kikuchi diffraction patterns (b, d) for determining the long axis of γ1 along the beam direction of [$0.94ˉ0.32ˉ$0.09]b (a, b) and the beam direction of [$1ˉ1ˉ1$]b (c, d) Fig.5  The habit plane (HP) of γ1 viewed in an edge-on condition (a) and Kikuchi pattern of ferrite matrix (b) Fig.6  A stereographic projection around [001]b showing the long axes of austenite γ1~γ4 (Δ) with the foil normal (fn, +), plotted with three possible cones of unextended lines Fig.7  Configuration of austenite and ferrite matrix for the calculation of the strain field created by pre-formed austenite Fig.8  Distributions of mutual elastic strain energy density between sympathetically nucleated austenite and local stress created by pre-formed austenite


text:
# zbMATH — the first resource for mathematics

Geometric ergodicity of the Bayesian Lasso. (English) Zbl 1349.60124
Summary: Consider the standard linear model $$\mathbf y=X\beta+\sigma\epsilon$$, where the components of $$\epsilon$$ are iid standard normal errors. [T. Park and G. Casella, J. Am. Stat. Assoc. 103, No. 482, 681–686 (2008; Zbl 1330.62292)] consider a Bayesian treatment of this model with a Laplace/Inverse-Gamma prior on $$(\beta,\sigma)$$. They introduce a Data Augmentation approach that can be used to explore the resulting intractable posterior density, and call it the Bayesian lasso algorithm. In this paper, the Markov chain underlying the Bayesian lasso algorithm is shown to be geometrically ergodic, for arbitrary values of the sample size $$n$$ and the number of variables $$p$$. This is important, as geometric ergodicity provides theoretical justification for the use of Markov chain CLT, which can then be used to obtain asymptotic standard errors for Markov chain based estimates of posterior quantities. M. Kyung et al. [Bayesian Anal. 5, No. 2, 369–411 (2010; Zbl 1330.62289)] provide a proof of geometric ergodicity for the restricted case $$n\geq p$$, but as we explain in this paper, their proof is incorrect. Our approach is different and more direct, and enables us to establish geometric ergodicity for arbitrary $$n$$ and $$p$$.

##### MSC:
 60J22 Computational methods in Markov chains 60F05 Central limit and other weak theorems 62J07 Ridge regression; shrinkage estimators (Lasso) 62F15 Bayesian inference
Full Text:
##### References:
 [1] Asmussen, S. and Glynn, P.W. (2011). A new proof of convergence of MCMC via the ergodic theorem, Statistics & Probability Letters 81 , 1482-1485. · Zbl 1232.65015 [2] Bednorz, W. and Latuszynski, K. (2007). A few remarks on “Fixed-Width Output Analysis for Markov Chain Monte Carlo” by Jones et al., JASA 102 , 1485-1486. [3] Bae, K. and Mallick, B.K. (2004). Gene selection using a two-level hierarchical Bayesian model, Bioinformatics 20 , 3423-3430. [4] Bhattacharya, A., Pati, D., Pillai, N.S., and Dunson, D.B. (2012). Bayesian shrinkage, arXiv · Zbl 1419.62050 [5] Carvalho, C.M., Polson, N.G., and Scott, J.G. (2009). Handling sparsity via the horseshoe, Journal of Machine Learning Research W & CP 5 , 73-80. [6] Carvalho, C.M., Polson, N.G., and Scott, J.G. (2010). The horseshoe estimator for sparse signals, Biometrika 97 , 465-480. · Zbl 1406.62021 [7] Figueiredo, M.A.T. (2003). Adaptive sparseness for supervised learning, IEEE Transactions on Pattern Analysis and Machine Intelligence 25 , 1150-1159. [8] Flegal, J.M., Haran, M., and Jones, G.M. (2008). Markov chain Monte Carlo: Can we trust the third significant figure? Statistical Science 23 , 250-260. · Zbl 1327.62017 [9] Flegal, J.M. and Jones, G.L. (2010). Batch means and spectral variance estimators in Markov chain Monte Carlo, Annals of Statistics 38 , 1034-1070. · Zbl 1184.62161 [10] Griffin, J.E. and Brown, P.J. (2010). Inference with normal-gamma prior distributions in regression problems, Bayesian Analysis 5 , 171-188. · Zbl 1330.62128 [11] Jones, G.L., Haran, M., Caffo, B.S., and Neath, R. (2006). Fixed-width output analysis for Markov chain Monte Carlo, Journal of the American Statistical Association 101 , 1537-1547. · Zbl 1171.62316 [12] Kyung, M., Gill, J., Ghosh, M., and Casella, G. (2010). Penalized regression, standard errors and Bayesian lassos, Bayesian Analysis 5 , 369-412. · Zbl 1330.62289 [13] Meyn, S.P. and Tweedie, R.L. (1993). Markov Chains and Stochastic Stability , Springer-Verlag, London. · Zbl 0925.60001 [14] Park, T. and Casella, G. (2008). The Bayesian lasso, Journal of the American Statistical Association 103 , 681-686. · Zbl 1330.62292 [15] Polson, N.G. and Scott, J.G. (2010). Shrink globally, act locally: Sparse Bayesian regularization and prediction, Bayesian Statistics 9 , J.M. Bernardo, M.J. Bayarri, J.O. Berger, A.P. Dawid, D. Heckerman, A.F.M. Smith, and M. West, eds., Oxford University Press, New York. [16] Roberts, G.O. and Rosenthal, J.S. (1998). Markov chain Monte Carlo: Some practical implications of theoretical results (with discussion), Canadian Journal of Statistics 26 , 5-31. · Zbl 0920.62105 [17] Roberts, G.O. and Rosenthal, J.S. (2004). General state space Markov chains and MCMC algorithms, Probability Surveys , 20-71. · Zbl 1189.60131 [18] Rosenthal, J.S. (1995). Minorization conditions and convergence rates for Markov chain Monte Carlo, JASA 90 , 558-566. · Zbl 0824.60077 [19] Tibshirani, R. (1996). Regression shrinkage and selection via the lasso, Journal of the Royal Statistical Society B 58 , 267-288. · Zbl 0850.62538 [20] Yuan, M., and Lin, Y. (2005). Efficient empirical Bayes variable selection and esimation in linear models, Journal of the American Statistical Association 100 , 1215-1225. · Zbl 1117.62453
This reference list is based on information provided by the publisher or from digital mathematics libraries. Its items are heuristically matched to zbMATH identifiers and may contain data conversion errors. It attempts to reflect the references listed in the original paper as accurately as possible without claiming the completeness or perfect precision of the matching.


text:
Simple Chemistry: Nitric Acid

1. May 27, 2007

ritwik06

Why does oxidizing nature of nitric acid gets reduced on dilution?

2. May 27, 2007

f(x)

When the acid is diluted, the volume over which H+ ions disperse get a larger volume, hence per unit volume, the oxidizing nature decreases

3. May 28, 2007

ritwik06

H+ ions are responsible for reducing nature, so why oxidizing nature decreases?

4. May 29, 2007

chemisttree

What do you mean by 'oxidizing nature'? Rate of oxidation?

5. May 29, 2007

Stevedye56

Do you mean why is a subastance being oxidized the reducing agent?

6. May 30, 2007

ritwik06

I am sorry! I got it. Thanks a lot to all of you!!!!

7. Jun 2, 2007

ritwik06

I was muddled. Nitric acid dissociates to give H+ ions. right? but additon of H+ to something ould lead to reduction. But nitric acid is actually an oxidizing agent. how come?????

8. Jun 3, 2007

chemisttree

What is the oxidation # for nitrogen in the nitrate ion? Is it unusual?

9. Jun 3, 2007

ritwik06

I dont know. I cant make out what you are talking about.

10. Jun 3, 2007

chemisttree

Oxygen usually has an oxidation number (I'll call it a 'charge') of -2. There are three of them (oxygens in nitrate) and there is one negative charge left over. What is the charge on nitrogen required to balance all but one of these negative charges?

Nitrogen usually has an oxidation number of -3...

11. Jun 3, 2007

f(x)

no, H+ itself gets reduced while the other substance loses e- and gets oxidized
. As $HNO_3$ is diluted, it loses oxidizing tendency and behaves more as an acid.

12. Jun 5, 2007

ritwik06

The charge of Nitrogen should be +5. Yes, nitride ion has charge -3. So what do I deduce from this?

13. Jun 5, 2007

chemisttree

The oxidative property of nitric acid comes from the nitrate ion. The proton doesn't counteract this at all. I don't know of any reactions where H+ is a reducing agent or where it could lead to reduction.

14. Jun 5, 2007

ritwik06

I think you are true, the oxidation property comes from the nitrate ion. And moreover we arent talking about H+ ions' "reducing" property.

But sir, please do tell me that when nitrogen in nitrate has oxidation # +5, then how does it effect the oxidizing nature???

15. Jun 5, 2007

chemisttree

Any atom at a high oxidation state can behave as an oxidant. Normally nitrogen has a -3 oxidation state. In nitrate it is +5. Thats EIGHT ELECTRONS higher than it normally occurs. Any atom that is capable of lowering its oxidation state by eight electrons is DEFINITELY an oxidant. In gunpowder, KNO3 is the oxidant. The nitrogen-containing product is N2. That is a 5 electron change which is still a pretty stout oxidation.

Dilution doesn't change that. It slows it down.


text:
Recent Changes in Sandbox Web retrieved at 07:37 (GMT)

Statistics for Sandbox Web Month: Topic views: Topic saves: File uploads: Most popular topic views: Top viewers: Top contributors...
Web Notification This is a subscription service to be automatically notified by e mail when topics change in this 1 web. This is a convenient service, so you do...
Title Article text. This is an example of the \LaTeX rendering possibilities using the LatexModePlugin. The singular value decomposition of a matrix %$A$% is defined...
Title The singular value decomposition of a matrix %$A$% is defined as \begin{displaymath} A U \Sigma V^H \end{displaymath} where %$U$% and %$V$% are both matrices...
Comments Example comment topic for CommentPluginExamples return Target comment output 1 TWikiContributor 03 Dec 2006 Target comment output 2 TWikiContributor...
Use this web to try out TWiki. Go ahead and add or delete some stuff. Walk through the 1 to learn the basics of TWiki. We recommend to sign your contributions with...
JQueryPlugin #187; Examples for JQueryPlugin Include the jQuery javascript and theme we need: Dialog Default, no options Hello, World! Create Dialog Close Title...
JQueryPlugin #187; JQuery Plugin Examples Demo of the TWikiWidgets implemented by the JQueryPlugin. Buttons Toggles Lorem ipsum dolor sit amet, consectetuer...
Sandbox Web Preferences The following settings are web preferences of the Sandbox web. These preferences override the site level preferences in ....
Top Menu of Sandbox Web This topic defines the menu structure of the Sandbox web, used by the TopMenuSkin. 1 Web Create New Topic...
Testing EmptyPlugin SOME EXAMPLES OF THE PLUGIN Related: .EmptyPlugin
Template Example Example template topic for CommentPluginExamples:templatetopic. : Include generic comment templates:
1 Web Create New Topic Index Search Changes Notifications RSS Feed Statistics Preferences
TWikis Sandbox web The Sandbox Web of TWiki. TWiki is an Enterprise Collaboration Platform.
/Sandbox The 1 web of TWiki. TWiki is a Web Based Collaboration Platform for the Enterprise.

Show 10, 20, 50, 100, 500, 1000 results per page, or show all.

Related topics: RSS feed, ATOM feed, WebNotify, site changes, site map

This topic: Sandbox > WebChanges
Topic revision: r1 - 2006-11-15 - TWikiContributor

Copyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback


text:
# Thread: A Tricky Fibonacci Sequence Identity

1. ## A Tricky Fibonacci Sequence Identity

The Fibonacci Sequence is define as Fn=Fn-2 + Fn-1 where F0=0 and F1=1;

Suppose that a Fibonacci number Fn is divisible by some positive integer d, and Fn+1=k (2).

Show that Fn (congruent) kF0 (mod d) and Fn+1 (congruent) kF1 (mod d).

I tried to use the given information i.e d|Fn --> Fn=dL for some L (1)

and I used the definition of Fn and the given Fn+1=k and added both equation (1) and (2) to arrive at an identity similar but different to what is required.

Can you kindly shed some light on this matter!

Thanks

2. $d\mid F_n\implies F_n\equiv 0 \bmod{d}$ and $F_0=0$...

$F_1=1$ and $F_{n+1}=k \implies F_{n+1}\equiv k\bmod{d}$. Can you see why?

3. Hmm.. I'm a little concused as to why Fn+1- k / d ??

Cna you explain why please?

Thanks

4. Is it because Fn cong 0 mod can be modified to Fn+1 cong k*F0 mod d ?


text:
## 4. Exponential family

The Exponential family of distributions can be written as:

η: natural parameter (vector)
T(y): sufficient statistic (vector), usually T(y) = y
a(η): log partition function
e−a(η): normalization constant

By fixing a, b and T, p(y; η) defines a set of distributions which vary by  η
As we vary η, we get different distributions within the set

Bernoulli (classification regression) and Gaussian (logistic regression) examples can be expressed within the exponential family

Proof: Bernoulli Regression
We need to find values of a,b and T such that as we vary η, we get different distributions of y and prove that every member of the Bernoulli set has a corresponding member in the Exponential family

Bernoulli distribution with a mean (φ), specifies a distribution over y ∈ {0, 1}
p(y = 1;φ) = φ; p(y = 0;φ) = 1−φ

The Bernoulli distribution:

We can map these components to a,b, T via

Now that we have values for a,b and T, we can find a value in one distribution and map to another

Proof: Gaussian Regression
We set σ2 = 1 since the value of σ2 had no effect on our final choice of θ and hθ(x)

We similarly can map a,b and T

#### Poisson distribution

Good for counts (visitors, hits) > lots of individual people and each has a minute chance of turning up in your count

Generalized Learning Model
A way to model y given some value of y and η

Where η is a linear
Where η is a vector

Multinomial
Example where there are multiple categories of data (ie. ebay listing)
Can we come up with a decision boundary that separates categories?

## 3. Logistic regression

Binary Classification
Classification problems differ from regression problems in that takes on only a small number of discrete values. In the case of binary classification, y takes on values of ∈ {0, 1}.

### Logistic Regression algorithm

We define our hypothesis h(x) as follows:

where

This is a sigmoid OR logistic function, which is rotationally symmetric

Estimating the output of the function:

We can restate this as

With this, we can define the likelihood function as:

=  =

We can state the log likelihood as:
=

To maximize log likelihood, we create a learning algorithm that updates as follows:

Note that this is the inverse of the gradient descent rule commonly applied to Linear regression to reduce the cost function. In this case, we’re trying to maximize the log likelihood.

Given that

### Perceptron Algorithm

We modify the logistic learning algorithm to force an output of 1 or 0

We determine a hypothesis of

We redefine g as

We change the gradient ascent update rule to become

### Newton’s Method

Given a function : R 􏰀→ R, we want to find a value of θ so that f(θ)=0

If we want to maximize the likelihood function l(θ), the maxima of l correspond to points where its first derivative l′(θ) is zero.

By letting f(θ) = l′(θ), we derive the update rule

Vectorization of Newton’s method
The above formula applies to scalar value of θ. We update the formula to a vectorized format using the Newton-Raphson method:

H is an n-by-n matrix called the Hessian

When Newton’s method is applied to maximize the logistic regression log likelihood function l(θ), the resulting method is also called Fisher scoring.


text:
Detail publikace

# New explicit integral criteria for the existence of positive solutions to the linear advanced equation $\dot x(t) = c (t) x (t + \tau)$

Originální název

New explicit integral criteria for the existence of positive solutions to the linear advanced equation $\dot x(t) = c (t) x (t + \tau)$

Anglický název

New explicit integral criteria for the existence of positive solutions to the linear advanced equation $\dot x(t) = c (t) x (t + \tau)$

Jazyk

en

Originální abstrakt

The paper is devoted to the investigation of a linear differential equation with advanced argument $y'(t)=c(t)y(t+\tau)$ where $\tau>0$ is a constant advanced argument and the function $c\colon [t_0,\infty)\to [0,\infty)$, $t_0\in \bR$ is bounded and locally Lipschitz continuous. New explicit integral criteria for the existence of a positive solution in terms of $c$ and $\tau$ are derived and their efficiency is demonstrated.

Anglický abstrakt

The paper is devoted to the investigation of a linear differential equation with advanced argument $y'(t)=c(t)y(t+\tau)$ where $\tau>0$ is a constant advanced argument and the function $c\colon [t_0,\infty)\to [0,\infty)$, $t_0\in \bR$ is bounded and locally Lipschitz continuous. New explicit integral criteria for the existence of a positive solution in terms of $c$ and $\tau$ are derived and their efficiency is demonstrated.

BibTex

@article{BUT110580,
author="Josef {Diblík} and Mária {Kúdelčíková}",
title="New explicit integral criteria for the existence of positive solutions to the linear advanced equation $\dot x(t) = c (t) x (t + \tau)$",
annote="The paper is devoted to the investigation of a linear differential equation with advanced argument $y'(t)=c(t)y(t+\tau)$ where $\tau>0$ is a constant advanced argument
and the function $c\colon [t_0,\infty)\to [0,\infty)$, $t_0\in \bR$ is bounded and locally Lipschitz continuous. New explicit integral criteria for the existence of a positive solution in terms of $c$ and $\tau$ are derived and their efficiency is demonstrated.",
}


text:
The spectrum of the infinite tree

The spectral norm of the infinite ${d}$-regular tree is ${2 \sqrt {d-1}}$. We will see what this means and how to prove it.

When talking about the expansion of random graphs, abobut the construction of Ramanujan expanders, as well as about sparsifiers, community detection, and several other problems, the number ${2 \sqrt{d-1}}$ comes up often, where ${d}$ is the degree of the graph, for reasons that tend to be related to properties of the infinite ${d}$-regular tree.

If ${G}$ is a ${d}$-regular graph, ${A}$ is its adjacency matrix and

$\displaystyle d = \lambda_1 \geq \lambda_2 \geq \cdots \geq \lambda_n \geq -d$

are the eigenvalues of ${A}$ in non-increasing order, then a measure of the expansion of ${G}$ is the parameter

$\displaystyle \sigma_2 = \max_{i=2,\ldots,n} \ | \lambda_i | = \max \{ | \lambda_2 | , | \lambda_n| \}$

which is the second largest singular value of ${A}$. One way to think about the above parameter is that the “best possible ${d}$-regular expander,” if we allow weights, is the graph whose adjacency matrix is ${\frac dn J}$, where ${J}$ is the matrix with ones in every entry. The parameter ${\sigma_2}$ measures the distance between ${A}$ and ${\frac dn J}$ according to the spectral norm. (The spectral norm is a good one to consider when talking about graphs, because it bounds the cut norm, it is efficiently computable, and so on.)

If ${G}$ is ${d}$-regular and bipartite, then ${\lambda_n = -d}$ and an appropriate measure of expansion is ${\max_{i=2,\ldots,n-1} |\lambda_i|}$, which is just ${\lambda_2}$.

Nilli proved that, in a ${d}$-regular graph, ${\lambda_2 \geq 2 \sqrt{d-1} - O( \sqrt d / diam(G))}$, where ${diam(G) \geq \log_d n}$ is the diameter of ${G}$. Nilli’s construction is a variant of the way you prove that the spectral norm of the infinite tree is at least ${2\sqrt {d-1}}$. Lubotzky, Phillips and Sarnak call a ${d}$-regular graph Ramanujan if ${\sigma_2 \leq 2 \sqrt {d-1}}$ (or if ${\lambda_2 \leq 2 \sqrt{d-1}}$ in the case of bipartite graphs). So Ramanujan graphs are the best possible expanders from the point of view of the spectral definition.

Lubotzky, Phillips and Sarnak given an efficient construction of an infinite family of ${d}$-regular Ramanujan graphs when ${d-1}$ is prime and ${d-1 \equiv 1 \pmod 4}$, and this has been generalized by Morgenstern to all ${d}$ such that ${d-1}$ is a prime power.

Marcus, Spielman and Srivastava show the existence of infinitely many Ramanujan bipartite expanders for every degree. (For degree ${d}$, their construction gives graphs with any number of nodes of the form ${d \cdot 2^k}$.) Their proof uses the fact that the spectral norm of the infinite ${d}$-regular tree is at most ${2 \sqrt {d-1}}$.

Friedman, in an outstanding tour the force, has given a 128-page proof of a conjecture of Alon, that a random ${d}$-regular graph will satisfy, with high probability, ${\sigma_2 \leq 2 \sqrt {d -1} + o_n(1)}$. His paper is long, in part, because everything is explained very well. I am taking the analysis of the spectral norm of the infinite tree presented in this post from his paper.

(Notice that it is still an open question to construct, or even to prove the existence of, an infinite family of non-bipartite Ramanujan graphs of degree, say, ${d=7}$, or to show, for any degree at all, (except 2!) that Ramanujan graphs of that degree exist for all number of vertices in a dense sets of integers.)

Now let’s talk about the spectrum of the infinite tree. First of all, although finite trees are terrible expanders, it is intuitive that an infinite tree is an excellent expander. For an infinite graph ${G=(V,E)}$ with a countable number of vertices and finite degree we can define the (non-normalized) expansion as

$\displaystyle \phi(G) = \inf_{S \ \rm finite} \ \ \frac {E(S,V-S)}{ |S|}$

In a ${d}$-regular infinite tree, the expansion is ${d-1}$, because, if we take any set ${S}$ of ${n}$ vertices, there are at most ${n-1}$ edges in the subgraph induced by ${S}$ (because it’s a forest with ${n}$ vertices) and so there are at least ${dn - n + 1}$ edges leaving ${S}$. It is easy to see that every other infinite ${d}$-regular graph has expansion at most ${d-1}$ because, for every ${n}$, we can run a DFS for ${n}$ steps starting from an arbitrary vertex ${v}$ until we either discover ${n}$ vertices reachable from ${v}$ (including ${v}$), or we find a connected component of size ${\leq n}$. In the former case, let ${S}$ be the ${n}$ vertices found by the DFS: the set ${S}$ induces a connected subgraph, so there are ${\geq n-1}$ edges inside ${S}$ and ${\leq dn - n +1}$ edges leaving ${S}$. In the latter case, the expansion is zero.

What about the spectral expansion of the infinite tree? If ${G=(V,E)}$ is a finite ${d}$-regular graph, then the largest eigenvalue of its adjacency matrix is ${d}$, and the corresponding eigenvector is the vector ${(1,\ldots,1)}$. By the spectral theorem we have

$\displaystyle \sigma_2 = \max_{x \in {\mathbb R}^V \ : \ \sum_v x_v = 0} \ \ \frac { | 2 \sum_{\{ u,v\} \in E} x_u x_v | } {\sum_v x_v^2}$

When we have an infinite ${d}$-regular graph, the all-1 vector is not an eigenvector any more (because it has infinite norm), and the relevant quantity becomes the spectral norm

$\displaystyle \sigma (G) = \sup_{x \in {\mathbb R}^V : \ \sum_v x_v^2 < \infty } \ \ \frac { | 2 \sum_{\{ u,v\} \in E} x_u x_v | } {\sum_v x_v^2}$

We will not need it, but I should remark that there is a Cheeger inequality for infinite graphs, which is actually slightly easier to prove than for finite graphs.

Since we want to prove that, for the infinite ${d}$-regular tree ${T= ( V,E)}$ we have ${\sigma \leq 2 \sqrt { d-1}}$, we need to argue that for every vector ${x \in {\mathbb R}^V}$ such that ${\sum_v x_v^2 < \infty }$ we have

$\displaystyle 2| \sum_{\{ u,v \} \in E} x_u x_v | \leq 2 \sqrt { d -1 } \cdot \sum_v x_v^2 \ \ \ \ \ (1)$

If we fix a root ${r}$, so that we can talk about the parent and the children of each node, and if we call ${C_u}$ the set of children of ${v}$, then we want to show

$\displaystyle 2 | \sum_u \sum_{v\in C_u} x_u x_v | \leq 2 \sqrt { d -1 } \cdot \sum_v x_v^2 \ \ \ \ \ (2)$

Since we have an inequality with a summation on the left-hand-side and a square root on the right-hand-side, this looks like a job for Cauchy-Schwarz! The trick to get a one-line proof is to use the right way to break things up. One thing that comes to mind is to use ${2|x_u x_v| \leq x_u^2 + x_v^2}$, but this does not go anywhere, and it would give an upper bound of ${d \sum_v x_v^2}$. This means that the bound ${2|x_u x_v| \leq x_u^2 + x_v^2}$ is often loose, which must happen because ${x_u}$ and ${x_v}$ are often different in magnitude. To see why this should be the case, note that if we call ${c:= \sum_v x^2_v}$, considering that there are ${d\cdot (d-1)^{t-1}}$ vertices at distance ${t}$ from the root, the typical vertex ${v}$ at distance ${t}$ from the root satisfies ${x_v^2 = O(1/(d-1)^t)}$, and we may think that if ${x_v}$ is a child of ${x_u}$ it should often be the case that ${x^2_v}$ is about a factor of ${(d-1)}$ smaller than ${x_u^2}$. If that were the case, then a tighter form of Cauchy-Schwarz would be ${2 |x_u| \cdot |x_v| \leq \frac 1 {\sqrt {d-1}} x_u^2 + \sqrt{d-1} x_v^2}$. Let us try that bound:

$\displaystyle 2 \left| \sum_u \sum_{v\in C_u} x_u x_v \right| \leq \sum_u \sum_{v \in C_u} \frac 1 {\sqrt {d-1}} x_u^2 + \sqrt{d-1} x_v^2$

$\displaystyle = \frac d {\sqrt {d-1}} x_r^2 + \sum_{v \neq r} \left( \frac 1 {\sqrt {d-1}} \cdot (d-1) + \sqrt{d-1} \right) x_v^2$

$\displaystyle \leq 2 \sum_v \sqrt{d-1} x_v^2$

which works! To justify the identity in the middle line, note that, in the sum, the root appears ${d}$ times as a parent and never as a child, and every other vertex appears once as a child and ${d-1}$ times as a parent.

This proves that the spectral norm of the infinite ${d}$-regular tree is at most ${2 \sqrt {d-1}}$. To prove that it is at least this much, for every ${\epsilon >0}$ we must find a vector ${x}$ such that

$\displaystyle \left| \sum_u \sum_{v\in C_u} x_u x_v \right| \geq ( 2 \sqrt { d -1 } -\epsilon) \cdot \sum_v x_v^2$

For such vectors, the Cauchy-Schwarz argument about is nearly tight, so it means that in such vectors, if ${u}$ is the parent of ${v}$, then ${|x_u|}$ needs to be about ${\sqrt {d-1}}$ times larger than ${|x_v|}$. So let us start from this condition: we pick a vertex ${r}$ to be the root and we set ${x_r = 1}$, if ${v}$ is a child of ${r}$ we set ${x_v = 1/\sqrt d}$, and if ${v}$ is at distance ${t>1}$ from the root we set ${x_v = 1/ ( \sqrt { d \cdot (d-1)^{t-1}} )}$. This means that if we sum ${x_v^2}$ over all the vertices at distance ${t}$ from the root we get ${1}$, for all ${t}$, which means that ${\sum_v x_v^2 = \infty}$. So let us cut off the construction at some distance ${k}$, so that ${x}$ is defined as follows:

• ${x_r = 1}$
• ${x_v = \frac 1 {\sqrt{ d (d-1)^{t-1}}}}$ if ${v}$ is at distance ${t}$ from ${r}$ and ${1\leq t \leq k-1}$
• ${x_v = 0}$ if ${v}$ is at distance ${\geq k}$ from ${r}$.

We immediately see

$\displaystyle \sum_v x_v^2 = k$

Then we do the calculations and we see that

$\displaystyle \sum_u \sum_{v\in C_u} x_u x_v = \sqrt d + \sum_{t=1}^{k-2} d \cdot (d-1)^{t-1} \cdot \frac {1}{\sqrt{d \cdot (d-1)^{t-1}}} \cdot \frac {1}{\sqrt{d \cdot (d-1)^{t}}}$

$\displaystyle \sqrt d + (k-2) \sqrt {d-1 } \geq (k-1) \sqrt {d-1}$

so, for every ${k}$, we can construct a vector ${x}$ such that

$\displaystyle 2 \sum_u \sum_{v\in C_u} | x_u x_v | \geq 2 \cdot \frac {k-1}{k} \cdot \sqrt{d-1} \sum_v x_v^2$

and we are done!

3 thoughts on “The spectrum of the infinite tree”

1. Most results in spectral graph theory seem to rely on the gap between the largest eingenvalue and the second largest (in absolute value).
Do you know any result where one needs to go beyond the the second largest eigenvalue and look also for instance at the 3rd largest?

2. Pingback: The Alon-Boppana Theorem | in theory


text:
# Reflect a complex number about an arbitrary axis

This should be really obvious, but I can't quite get my head round it:

I have a complex number $z$. I want to reflect it about an axis specified by an angle $\theta$.

I thought, this should simply be, rotate $z$ by $\theta$, flip it (conj), then rotate by $-\theta$.

But this just gives $z^* (e^{-i\theta})^* e^{i\theta}$...

but this can't be right - as it's just $z^*$ rotated by angle $2\theta$, surely?

-
Well, you need to make up your mind as to whether you want to reflect your rotated entity about either the real or imaginary axis... –  Ｊ. Ｍ. Feb 8 '12 at 16:50
On that note: you're familiar with the matrix route for doing this operation to points? That is easily translatable to complex notation... –  Ｊ. Ｍ. Feb 8 '12 at 16:51
If I am not mistaken, wouldn't a+ib reflected about x axis be a - ib and about y axis be -a + ib ? –  Inquest Feb 8 '12 at 16:53

Indeed, it's just $z^*$ rotated by $2\theta$... And it's almost the right answer! You know that a symmetry composed with a rotation is still a symmetry, and you know that an (orthogonal) symmetry is characterized by its fixed points. So you want to get a symmetry that fixes the axis spanned by $e^{i\theta}$ (as an $\mathbb{R}$ vector space); an easy way to do that is, as you've noticed, to rotate by $-\theta$ (and not $\theta$ actually), flip over the real line (conjugation) and then rotate by $\theta$. So you get $(ze^{-i\theta})^* e^{i\theta} = z^* e^{2i\theta}$. It is easily checked that this fixes $e^{i\theta}$, and it's an orthogonal symmetry, therefore it's the one you're looking for.


text:
اخبار برگزیده

12 ژانویه 2021

10 ژانویه 2021

10 ژانویه 2021

center frequency calculator

0.03*N+870.000. The LC bandpass calculator helps to dimension the components based on the required cutoff frequencies. If you have no particular preference within a given ham radio band, then simply enter its center frequency (i.e. The RC band pass works through the composition of high pass and low pass filters as well as these two elements. When an inductor or capacitor are placed in series or parallel they will have a resonant frequency which is determined by the design equation below. m. Click here to view image. A frequency table corresponds to an organized table that contains the different values that are in the sample along with the frequencies of those values (how many times each value appears in the sample). Channel Number. Instantly Quote and Order PCB's. Wavelength. It also calculates series and parallel damping factor. This calculator includes 1/1 octave band frequency, noise level summation (Add dB / dB plus), dB(A) (dBA), etc. The user can select single tone or a modulated carrier input signal and can observe aliasing in up to 10 Nyquist zones. Frequency table calculator A frequency is the number of times a data value occurs. The two components filter out very high and very low frequencies. 1024-1323. The formula for calculating the high cutoff frequency is, frequency= 1/2πR 2 C2 All the frequencies in between these 2 cutoff frequency points form the passband of the bandpass filter circuit. We explain the functionality of the bandpass and explain how to calculate a bandpass filter. Additionally, the unit of angular frequency is rad/s, precisely the same as for the angular velocity. For example, 100 ppm of 100 MHz represents a variation in frequency of 10 kHz. 1 Center Frequencies and High/Low Frequency Limits for Octave Bands, 1/2- and 1/3-Octave Bands Octave Bands: The audio spectrum from ~ 20 Hz to ~ 20 KHz can be divided up into ~ 11 octave bands.   |   In electrical engineering and telecommunications, the center frequency of a filter or channel is a measure of a central frequency between the upper and lower cutoff frequencies.It is usually defined as either the arithmetic mean or the geometric mean of the lower cutoff frequency and the upper cutoff frequency of a band-pass system or a band-stop system. It is the energy carried by photons with a certain electromagnetic wavelength and frequency. 5G NR ARFCN to Frequency conversion. However, I am not sure how these two function works, especially the feval function, the source code is not public. Home » Online Calculators » Band Pass Filter Calculator. 7.15 for the 40 meter band). Calculation. By the ratio of the resistors to the capacitors thus the frequency band can be determined, which passes through the filter. The APC Formula Calculator allows users to easily calculate the frequency constant, resonance frequency, capacitance, dielectric constant, static displacement, and static voltage of many piezoelectric ceramic elements. Question: Calculate And Design The GPS L2 Passband, Center Frequency=1575.42 MHz MHz ,1.496.65 – 1654.2 MHz And Z0 = 50 Ω , N=3 With The Response Type Of Butterworth (maximally Flat Amplitude) By Using ADS C) Calculate The Poles Of The Filter. The series connection of several bandpasses, the order can be further increased if necessary. RC Low Pass Filter Calculator. 3.55). The bandpass has active and passive filters. This is the simplest way to build a bandpass filter. At a medium frequency, most of the input voltage $$V_{in}$$ penetrates to the output. Calculate resistance in ohms, frequency in Hz, or capacitance in uF by entering the other two values. For example, if ten students score 90 in statistics, then score 90 has a frequency of 10. As we can see, it is denoted by the same letter. A band pass is used, for example, in loudspeaker construction. If we set/define the 7th octave band’s center frequency to be 7 1000 f ctr Hz, then all lower center frequencies for octave bands can be defined from each other using the formula 1 2 It is calculated as: Band 66 : The range 2180-2200 MHz of the DL operating band is restricted to E-UTRA operation when carrier aggregation is configured This helps improve sound because all frequencies outside a certain range of the speaker cannot be transmitted cleanly. Calculation of the center frequency. If frequency folding occurs, a message is placed next to the LSB "Lower" frequency area. X. Width. 3.55). For the ratio of capacitances and inductances:eval(ez_write_tag([[250,250],'electronicbase_net-large-mobile-banner-2','ezslot_15',113,'0','0']));eval(ez_write_tag([[250,250],'electronicbase_net-large-mobile-banner-2','ezslot_16',113,'0','1'])); $$Z = R_0 = \sqrt{\frac{L_1}{C_2}} = \sqrt{\frac{L_2}{C_2}}$$. This calculator computes the following values from a data set: … Photons are nothing but light particles. The first stage of the filter will be the high pass stage that uses the capacitor to block any DC biasing from the source. 384. This depends on both the LO bandwidth (tuning range) and the IF bandwidth. The equation for this relationship is. The filter effect is amplified by this.eval(ez_write_tag([[250,250],'electronicbase_net-leader-1','ezslot_17',112,'0','0']));eval(ez_write_tag([[250,250],'electronicbase_net-leader-1','ezslot_18',112,'0','1'])); The 2nd order bandpass filter has twice as much edge steepness as a 1st order filter. E X A M P L E S 1) What is the resonant frequency for an LC circuit with a .039 microfarad capacitor and a 1.5 Henry inductor? And RLC or LC (where R=0) circuit consists of a resistor, inductor and capacitor, and can oscillate at a resonant frequency which is determined by the natural rate at at which the capacitor and inductor exchange energy. With these two cutoff frequencies, the center frequency $$\mathbf{f_0}$$ and the bandwidth $$\mathbf{B}$$ of the entire filter can then be determined. I assume that your signal is real (since you are talking about a maximum, not well defined in the complex domain). Preferred Channel Number. And RLC or LC (where R=0) circuit consists of a resistor, inductor and capacitor, and can oscillate at a resonant frequency which is determined by the natural rate at at which the capacitor and inductor exchange energy. Low-Frequency Acoustic Center Calculator . Prof. John Vanderkooy In 2010 Prof. John Vanderkooy presented an AES paper offering analytical proof and compelling evidence that the acoustic center for low frequencies resides in front of the loudspeaker at a distance of approximately two-thirds of the baffle radius. It will help you to convert the number of the 5G NR GSCN (Global Synchronization Channel Number) to the 5G NR SS ref (SSB) frequency and back (5G NR SS ref frequency to 5G NR GSCN) 5G NR SSref (SSB) Frequency to GSCN Calculator M DATA (1) In order to obtain the ARFCN/UARFCN/EARFCN, you will need to enter "Field Test Mode" … All rights reserved. This makes it possible to build a band pass filter easily. Antenna design calculators category is a curation of 84 web resources on , Parallel Square Conductor Transmission Line Calculator, Analysis Of Antenna Mast Strength and Bending Stress, Full Wave Loop Antenna Calculator. This cascading together of a low and a high pass passive filters produces a low “Q-factor” type filter circuit which has a wide pass band. Quantity. R; R W 3KO RE W JKO 3KO CA HH 30 NF 3KO 2K03R C 20 PF If the frequency continues to increase, $$X_L$$ is larger and $$X_C$$ gets smaller. This calculator can determine the resonant frequency of an LC circuit which basically is a circuit consisting of an inductor and a capacitor and is also known as a tuned circuit. Can you tell me the reason? Frequency to Wavelength Calculator. Choose any number between the minimum and maximum frequency limits of the analyzer. The relation between EARFCN and the carrier frequency in MHz for the uplink is given by the following equation where FUL_low and NOffs-UL are given in Table 5.7.3-1 and NUL is the uplink EARFCN. For example, you calculate the relative frequency of prices between $3.50 and$3.74 as 6/20 to get 0.30 (30 percent). The output voltage $$V_{out}$$ is tapped here parallel to the resistor. For example, if a center frequency varies from 100 MHz to 100.01 MHz, this 10 kHz frequency variation represents 100 ppm. The output voltage $$V_{out}$$ tapped parallel to these two components increases as the input frequency approaches the center frequency. It also calculates series and parallel damping factor. Resources listed under Antenna Calculators category belongs to Antennas main collection, and get reviewed and rated by amateur radio operators. The energy of light (E) is defined in the form of photons. Enter your desired frequency (MHz) of operation (i.e. $$\frac{V_{out}}{V_{in}} = \frac{1}{\frac{LC}{s^2 + s \frac{1}{RC} + \frac{1}{LC}}}$$. Formula – band pass filter calculation SENS:FREQ:CENT 1000000. sense2:frequency:center 1mhz. Band: Name: Mode: Band overlap: Full (MFBI) Partial: FR1: n1: 2100: FDD: n65, n84: n66: n2: 1900 PCS The bandpass can be performed in different orders, bandpass 1st order forms the basic variant. Another example of application are receivers of radio signals, which are restricted to a reception area with the bandpass. The maximum and minimum frequencies are therefore 100.01 and 99.99 MHz, respectively. Length. PPM Calculator × Errors ... f is the center frequency (in Hz), df is the peak frequency variation (in Hz), and 10 6 is 1000000 (e.g. The so-called Butterworth filter simply consists of an inductor with which a capacitor is connected in series. If a high frequency is applied, the voltage drops above the low-pass filter. Enter numbers below as integers, decimals, or use scientific notation (for example, enter 1500 as 1500, 1.5e3, or 1.5E3). Enter numbers below as integers, decimals, or use scientific notation (for example, enter 1500 as 1500, 1.5e3, or 1.5E3). (Read-Write) Sets the center frequency of the analyzer. The interconnection is identical to the RC bandpass 1st order, only the resistors are replaced by inductors. Specifically, scale is inversely proportional to frequency with the constant of proportionality being the center frequency of the wavelet. An RF input frequency whose fundamental IF response would be one-third the desired IF frequency would constitute a 3x3 response. The formula is: $$f_0 = \sqrt{f_{H} \cdot f_{L}}$$ RC band stop filter calculator The center frequency is when the impedance of the whole circuit is real, hence: Calculation of the cut off frequencies. Get all the value for equation: The calculator will then compute the resistor R1, capacitor C1, resistor R2, capacitor C2, resistor R3, and resistor R4. publications. Calculator is based on 3GPP TS 38.104 Release 15 specification. The result is then expressed as either a fraction or a percentage. Related Resources. Center Frequency for Forward Channel N (MHz) Center Frequency for Reverse Channel N (MHz) US Cellular: 1-799. The notion of centroid could be more pertinent. In addition, our bandpass calculator reduces the effort thereof. 5G frequency band and nr-arfcn calculator. This article shows you different circuit variants of passive bandpass filters. Then the band pass filter transfer function applies:eval(ez_write_tag([[580,400],'electronicbase_net-box-4','ezslot_8',109,'0','0'])); $$\frac{V_{out}}{V_{in}} = \frac{1}{3 + j \left( \omega R C – \frac{1}{\omega R C} \right)}$$. This tool illustrates the aliasing effects of an input signal and its harmonics when digitized by an ADC. The formula for calculating the frequencies is: The RC bandpass calculator makes it easy for anyone to build a bandpass filter. Tapped behind both filters similar to the 5G NR frequency calculator is based 3GPP! Lower cutoff frequency next to the two cutoff frequencies, the center frequency calculator makes it possible to build bandpass... Circuit or pass band filter circuit a look at the definition of the center frequency calculator can not be cleanly. Pass filter calculator is the number of times a data value occurs a. ) But you calculation only use the NDL to calculation FDL and ful observe aliasing in to... The definition of the whole circuit is present when no reinforcing element is used, for example, ppm... The series center frequency calculator of several bandpasses, the unit of angular frequency: ω = 2 * π *,. And get reviewed and rated by amateur radio operators CENT 1000000. sense2: frequency: ω = *. One-Third the desired cutoff frequency of prices between $3.75 and$ equals! Reactance \ ( X_C\ ) behaves inversely the user can select single tone or a.. Off frequencies minimum frequencies are therefore 100.01 and 99.99 MHz, respectively built with certain! Calculate the resonant frequency of 10 other frequency control devices specify their frequency variation in frequency over the capacitor block! 0 to 65535 and equation between LTE carrier frequency ( MHz ) of the output without much attenuation you,... What to solve for frequency folding occurs, a capacitor, and a RC high-pass, each 1st order so... Speed of light from frequency calculator is based on the required components for the cutoff! A resistor RC high-pass, each 1st order, so two resistors and capacitors... For one bandpass, each 1st order, only the resistors to the LSB  Lower '' area! Again, the cut off frequencies in its simplest form, consists of a bandpass or notch filter functionality. Values are identical: calculation of the high pass stage that uses the capacitor certain range of the cutoff... Application are receivers of radio signals, which passes through the composition high! Energy carried by photons with a certain frequency band can be further increased if necessary ) inversion,... … RLC resonant frequency calculator to calculate the required components for the angular.! The simplest way to build a band pass is used to calculate the resonant frequency of circuits. Parallel to the LSB  Lower '' frequency area Cell band fact that the inductance reacts much faster the... Amateur radio operators { in } \ ) penetrates to the capacitors thus the frequency continues to increase \... As you remarked, the voltage drops above the Lower Sideband area can see, it seems that filter... As these two frequencies is 2 ps ( that is, 1/99.99MHz - 1/100.01MHz.... Capacitances and two equal capacitors are selected for one bandpass capacitor is connected series... C1, resistor R3, and you get letter statistics voices per over. The form below, press calculate letter frequency button, and you get letter statistics specify! Applied, the order can be performed in different orders, bandpass 1st order forms the variant. Selected for one bandpass to convert between ppm and Hz in uF by the... Resistors and capacitors then expressed as either a fraction or a percentage for data sampled at 1 kHz frequencies! Range 0 to 65535 and equation between LTE carrier frequency ( spectral ) occurs... ( NUL – NOffs-UL ) But you calculation only use the calculators below convert!, only the resistors to the output voltage \ ( X_L\ ) of the analyzer ful = +... Calculator helps to dimension the components based on 3GPP TS 38.104 Release 15.! Count of the op amp bandpass filter circuit designates a component for filtering.... Share the sound calculator ( dB calculator ) rule can be determined, which are restricted a... Reception area with the low-pass over the capacitor to block any DC biasing from the source a. When digitized by an ADC only use the calculators below to convert between ppm and Hz \ X_L\... Filter simply consists of an inductor, a message is placed next the. Two inductors N ( MHz ) US Cellular: 1-799 a 2nd order bandpass is usually built with circuit... Represents 100 ppm capacitances and two equal capacitors are selected for one bandpass is, 1/99.99MHz - 1/100.01MHz.. Thus the frequency band is identical to the two components filter out very and! Resistances of high and low pass filters or notch filter 2 * π *,... The two cutoff frequencies, especially the feval function, the voltage across the resistor R1, capacitor,! ( Read-Write ) Sets the center frequency is when the impedance of the input frequency band and it... Frequency band of the input frequency band pass filter calculator passes through filter. Frequency or centre carrier certain electromagnetic wavelength and frequency frequency represents the midpoint in... … RLC resonant frequency calculator is based on the required cutoff frequencies of filter! Is placed next to the capacitors thus the frequency ( add dB, dB ( a ) INERTANCE. Ndl to calculation FDL and ful a message is place above the Lower Sideband area radio operators 0.1 ( –. The fact that the wavemngr and feval functions are used over the capacitor are simply connected in.. See, it is the number of times a data value occurs the change is that the.!, resistor R3, and a capacitance as notch filters or band pass ” comes from the source ful... Band pass filters radio signals, which are restricted to a reception area with the online calculator you calculate!: ω = 2 * π * f, Where f is the simplest way to build bandpass... Of two capacitances and two equal resistors and two inductors be the high increases... Increase, \ ( V_ { in } \ ) penetrates to the LSB  Lower '' area! Resistor R4 circuit variants of passive bandpass filters converts 5G NR-ARFCN to 5G frequency whole circuit is present no. In uF by entering the other op amp bandpass filter filter lets only a frequency! = FUL_low + 0.1 ( NUL – NOffs-UL ) But you calculation use... This makes it possible to build a bandpass filter circuit ( a ) ) INERTANCE the... Angular velocity are talking about a maximum, not the increments to solve for frequency folding occurs a... In meters a RC high-pass, each 1st order, so two and. Not public frequency limits of the two resistance values are identical maximum if center frequency fact the. Calculators » band pass through and attenuates frequencies below and above determines the height of the center frequency calculator! 3Ko CA HH 30 NF 3KO 2K03R c 20 PF calculation of the lets... Operation is similar to the output voltage \ ( V_ { out } \ ) penetrates to 5G! To CDMA frequency Assignment ; Cell band 38.104 Release 15 specification with voices! The analyzer would be one-third the desired if frequency folding occurs, a second order bandpass usually... It to output upper and Lower sidebands by the geometric average of the bandpass can be derived 20... Construct a vector of scales with 32 voices per octave over 5 octaves for sampled! Larger and \ ( V_ { out } \ ) penetrates to the 5G NR frequency below to convert ppm. Resistors and capacitors ) of operation ( i.e octave band frequency data in Decibel (. The feval function, the relative frequency of a band-pass filter is given the. ” comes from the source code is not evident single tone or a modulated input! Of center frequency of 10 kHz 1 < num > center frequency, then simply enter its center.... R1, capacitor C2, resistor R3, and resistor R4 of 100 MHz represents a variation in units parts! C2, resistor R2, capacitor C2, resistor R2, capacitor C1, R2! Resistors are replaced by inductors a set of numerical values capacitors are selected for one bandpass formula... How these two frequencies is 2 ps ( that is, 1/99.99MHz - 1/100.01MHz ) it for! It can limit the frequency band can be derived 19024. dB calculator ) out } )! And feval functions are used fact center frequency calculator the inductance reacts much faster to the change is the... Pf calculation of the filter lets only a certain frequency band of angular! The bandpass can be performed in different orders, bandpass 1st order, only resistors... Can not be transmitted cleanly and rated by amateur radio operators the if bandwidth Acoustic center.! You have no particular preference within a data-set calculator you can calculate the resonant frequency calculator to compute statistical from... Db ( a ) ) INERTANCE share the sound calculator ( add dB, dB ( a ) INERTANCE! Other frequency control devices specify their frequency variation represents 100 ppm of 100 represents! Moved to www.sqimway.comwww.sqimway.com 5G frequency band and NR-ARFCN calculator 100 MHz represents variation... Components filter out very high and low pass filters as well as these two.... A combination of high-pass and low-pass filters 2K03R c 20 PF calculation of the high and! Then simply enter its center frequency calculation of the resistors to the voltage... Resistors with inductors, the source a component for filtering frequencies harmonics when digitized by ADC! Filter will be the high pass stage that uses the capacitor the high pass and low pass filters resistance impedance... Aliasing effects of an RC low-pass and a resistor  Lower '' frequency area name any! Block any DC biasing from the fact that the inductance reacts much faster to the LSB  ''. Uf by entering the other two values reason for the desired cutoff frequency below to convert ppm!


text:
## Blowing up an arc

Lines intersect as they pass through a point, but you don’t want them to? Blow it up!

Remove a neighborhood of the point.

And sew back in a punctured projective space.

For a point on a surface like we have here, we sew back in a Mobius band.

Now cross this with $I=[-1,1]$.

Okay, so we sewed in a twisted $I$ bundle over the punctured projective space. But, c’mon, why not?

Now let’s round it out…

… and reinterpret. We blow up a trivial 1-strand tangle to get a solid torus, the complement of the trivial knot. What happens when we blow up a knotted 1-strand tangle?

Update: One more picture.

~ by Ken Baker on September 14, 2008.

### 5 Responses to “Blowing up an arc”

1. This is easily the best visualization of what blowing up does. I can just barely wrap my brain around it without the pictures. Too bad you can’t show a blowup of a point in 3-space.

2. Sounds like a challenge…

3. These are extremely nice pictures! Which program did you use to draw these?

4. Hi Sirof. These were drawn using Rhino3D. (Actually it’s a pre-beta version for the Mac that I’m using. They’re in the process of porting it.) Rhino as well as other 3D modelers these days have functions that allow you to deform and distort objects with control. So for the thickened Mobius band, I made a thickened rectangle, put in a 180 twist, and then bent it around a circle.

Other pictures on this blog are done with SketchUp.

5. [...] This post, for example, perfectly illustrates the notion of blowing up a point on a manifold. [...]


text:
Volume 396 - The 38th International Symposium on Lattice Field Theory (LATTICE2021) - Oral presentation
Finite temperature QCD with physical $(u/d, s, c)$ domain-wall quarks
T.W. Chiu*, Y.C. Chen and T.H. Hsieh
Full text: pdf
Pre-published on: May 16, 2022
Published on:
Abstract
In order to understand the role of QCD in the early universe,
we perform hybrid Monte-Carlo simulation of lattice QCD with
$N_f=2+1+1$ optimal domain-wall quarks at the physical point,
on the $64^3 \times (6,8,10,12,16,20,64)$ lattices,
each with three lattice spacings,
in which the lattice spacings and the bare quark masses are determined on the $64^4$ lattices.
The resulting gauge ensembles provide a basis for studying finite temperature QCD with $N_f=2+1+1$ domain-wall quarks at the physical point. In this Proceeding,
we present our first result on the topological susceptibility of the QCD vacuum.
The topological charge of each gauge configuration
is measured by the clover charge in the Wilson flow
at the same flow time in physical units,
and the topological susceptibility $\chi_t(a,T)$ is determined for each ensemble
with lattice spacing $a$ and temperature $T$.
Using the topological susceptibility $\chi_t(a,T)$ of 15 gauge ensembles with three lattice spacings and different temperatures in the range $T \sim 155-516$~MeV,
we extract the topological susceptibility $\chi_t(T)$ in the continuum limit.
DOI: https://doi.org/10.22323/1.396.0574
How to cite

Metadata are provided both in "article" format (very similar to INSPIRE) as this helps creating very compact bibliographies which can be beneficial to authors and readers, and in "proceeding" format which is more detailed and complete.

Open Access


text:
# Verifying if a car is a sports car based on speed and horse power

I have an assignment where I am required to verify if a car is a sports car or not by minimum max speed and minimum horse power. I have finished the program and it works great. I was just wanting to see if you can review my assignment and see if there is room for improvement.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Project3
{
class sportsCar
{
public int _maxSpeed = 0;
public int _horsepower = 0;
private static int _MinimumRequiredSpeed = 150;
private static int _MinimumRequiredHorsepower = 250;

public bool IsSportsCar()
{
if ((_maxSpeed >= _MinimumRequiredSpeed) && (_horsepower >= _MinimumRequiredHorsepower))
return true;
else
return false;
}
public void maxSpeed(int newmaxSpeed)
{
_maxSpeed = newmaxSpeed;
}
public void horsepower(int newhorsepower)
{
_horsepower = newhorsepower;
}
}

class Program
{
static void Main(string[] args)
{
sportsCar car = new sportsCar();

Console.Write("What is the max speed? ");
Console.Write("What is the max horsepower? ");

car.maxSpeed(newmaxSpeed);
car.horsepower(newhorsepower);

bool sportCar = car.IsSportsCar();
if (sportCar == true)
{
Console.WriteLine("This is Definately a Sports Car");
}
else
{
Console.WriteLine("This is NOT a Sports Car");
}
}
}
}

_maxSpeed and _horsePower should be private.

You have (confusingly named) setter methods for public variables, but no getters. That makes for an odd interface.

In C# you by convention use properties for getters and setters. So instead of

public int _maxSpeed = 0;
public int _horsepower = 0;
public void maxSpeed(int newmaxSpeed)
{
_maxSpeed = newmaxSpeed;
}
public void horsepower(int newhorsepower)
{
_horsepower = newhorsepower;
}

You have

public int MaxSpeed { get; set; }
public int HorsePower { get; set; }

Since these values are unlikely to change, you could make the type immutable:

class Car
{

public Car( int maxSpeed, int horsePower )
{
MaxSpeed = maxSpeed;
HorsePower = horsePower;
}
}

Instead of checking a boolean expression and then returning a literal true or false, just return the expression instead. Booleans are a type just like any other. Also, you don't need the comparison to true or false for the same reason.

if( someCondition == true )
return true;
else
return false;

You have

if( someCondition )
return true;
else
return false;

or better yet

return someCondition;

So

return _maxSpeed >= _MinimumRequiredSpeed &&
_horsepower >= _MinimumRequiredHorsepower;

Whenever you take user input you need to check it. Your program will crash if the user enters something that is not a number. You can check this by using TryParse instead of Parse.

int horsePower;
do
{
}
while( !int.TryParse( input, out horsePower ) );

Other than that it is fine, keep at it ;)

The other answerers caught most of the issues I can see, however here are a couple of small ones:

• In C# (well, .NET) you should follow the standard naming conventions. In particular, classes, properties and methods should be PascalCased.

• You spelt "definitely" wrong ;)

Here's how I would clean it up (explanations below):

namespace Project3
{
using System;

internal sealed class SportsCar
{
private const int MinimumRequiredSpeed = 150;
private const int MinimumRequiredHorsepower = 250;

public SportsCar(int maxSpeed, int horsepower)
{
this.maxSpeed = maxSpeed;
this.horsepower = horsepower;
}

public bool IsSportsCar()
{
return (this.maxSpeed >= MinimumRequiredSpeed) && (this.horsepower >= MinimumRequiredHorsepower);
}

public int MaxSpeed
{
get
{
return this.maxSpeed;
}
}

public int Horsepower
{
get
{
return this.horsepower;
}
}
}

internal static class Program
{
private static void Main()
{
Console.Write("What is the max speed? ");
int newmaxSpeed;
{
Console.WriteLine("Invalid max speed!");
return;
}

Console.Write("What is the max horsepower? ");
int newhorsepower;
{
Console.WriteLine("Invalid max horsepower!");
return;
}

SportsCar car = new SportsCar(newmaxSpeed, newhorsepower);
bool sportCar = car.IsSportsCar();
if (sportCar)
{
Console.WriteLine("This is Definitely a Sports Car");
}
else
{
Console.WriteLine("This is NOT a Sports Car");
}
}
}
}

• Removed underscores from variable names. I personally don't like them, but that's up to you (or your team standards).
• Changed name of class to 'SportsCar' to meet .NET naming guidelines (classes should be initial caps in a form known as PascalCasing).
• The MinimumRequired variables are constant, so they are declared as const.
• Since the maxSpeed and horsepower should be invariant for a Car, I made them readonly and settable via the constructor.
• Consequently, they are now private but accessible via getter properties.
• The IsSportsCar method is simplified since the evaluation is already a boolean construct (i.e. no need for a return true and return false as it evaluates as such).
• Made the class sealed so no classes can inherit from it. By default, I seal all my classes and only remove the sealant if design dictates it.
• The Program class is now static since it only contains a single static method.
• Employed use of int.TryParse() in place of int.Parse() in order to allow program execution be smoother if an invalid input is typed.
• Removed extraneous 'using' directives.
• Fixed spelling of "Definitely".

I'd also add liberal amounts of commenting. .NET has a really good documentation system which allows for "XML Comments" at the class, variable, property and method level which would look something like this:

    /// <summary>
/// Determines whether this particular car meets the criteria of being a sports car.  Its maximum speed must
/// be at least MinimumRequiredSpeed AND the horsepower must be at least MinimumRequiredHorsepower.
/// </summary>
/// <returns>
/// <c>true</c> if this car is a sports car; otherwise, <c>false</c>.
/// </returns>
public bool IsSportsCar()
{
return (this.maxSpeed >= MinimumRequiredSpeed) && (this.horsepower >= MinimumRequiredHorsepower);
}

That's just an example, do not underestimate the power of in-code commenting as well.

One last thing I thought of. There's an object oriented principle known as SRP, or Single Responsibility Principle. It means that each class you design should have one and only one purpose which is rather limited in scope. The same thing can be said for methods themselves. You never know when you might need to refactor logic out of a method to use elsewhere. So even though this is a trivial example, you might want to look into rewriting IsSportsCar() into three separate methods:

    public bool IsSportsCar()
{
return this.MeetsMinimumSpeedRequirements() && this.MeetsMinimumHorsepowerRequirements();
}

private bool MeetsMinimumSpeedRequirements()
{
return this.maxSpeed >= MinimumRequiredSpeed;
}

private bool MeetsMinimumHorsepowerRequirements()
{
return this.horsepower >= MinimumRequiredHorsepower;
}

Now, if your SportsCar ever needs to do some checks against only speed or horsepower, you have it logically separated out.

Best of luck!

You code looks reasonable, but I would have couple of relatively minor suggestions:

• Did you consider what happens when user enters an invalid number? I.e. a string that contains letters or even a string that can be interpreted as a number but is not in valid range (e.g. is negative or too large to be applicable to any real-life car)? So, you might want to look at handling potential exceptions from int.Parse and also to define some sort of acceptable range of values. If you really want to impress your teacher, make this range configurable (using Properties.Settings mechanism). The maxSpeed method is where you would check the range validity.
• Make _maxSpeed (and _horsepower) private.
• The naming of maxSpeed (and horsepower) is slightly misleading. On the first glance, it looked like it would return the max speed, not set it. Only after visually "parsing" the method signature and/or the way it is called, it becomes clear that this is actually a setter - the name alone dos not suggest its purpose. So either change the name to setMaxSpeed, or use a write-only property (and a "real" setter).
• Rename sportsCar to just car, since, after all, IsSportsCar is not guaranteed to always return true.
• Not all of your using directives are necessary.
• -1 (or it would be, if I had the rep): while your answer is useful (though not complete), I find it a very bad suggestion to start the property name with a verb, since it is not a method; also, in C# usually class properties and methods start with caps, and local variables start with low caps. Oct 18 '11 at 7:32
• @ANeves They aren't properties, they are setter methods. Oct 21 '11 at 2:47
• @KirkBroadhurst, I don't understand how "setter methods" can mean anything other than properties. Can you explain? Oct 21 '11 at 4:15
• @ANeves Well, the second sentence of your link explains it somewhat -"Properties can be used as though they are public data members". It is were a property, you would be able to assign directly to it like maxSpeed = value, rather than maxSpeed(value). See Using Properties - "To the user of an object, a property appears to be a field, accessing the property requires exactly the same syntax." Oct 21 '11 at 4:27
• @KirkBroadhurst ooooh, sorry, I just noticed I've been assuming that OP was using properties!... while OP was actually using "setter methods" as you said. But then, my comment would then be something like: -1: while your answer is useful (though not complete), I find it a very bad suggestion to use "setter methods" instead of properties; also, in C# usually class properties and methods are in CamelCase, and local variables in lowCamelCase. Oct 21 '11 at 5:58
SportsCar mySportsCar = New Sportscar();
If (mySportsCar.IsSportsCar())
{
//...

Well... Doesn't that look odd? I wouldn't expect a SportsCar to be anything but a sportscar. This isn't a SportsCar class. It's a Car class with a IsSportsCar() method. You could either rename the class, or create a constructor that validates the horsepower and speed upon creation.

I'm going to add a slight modification to Jesse C. Slicer's answer. If either the speed or horsepower are not sufficient, we'll throw an exception.

        private const int MinimumRequiredSpeed = 150;
private const int MinimumRequiredHorsepower = 250;

public SportsCar(int maxSpeed, int horsepower)
{
If (maxSpeed < MinimumRequiredSpeed)
{
throw New ArgumentException("Too slow to be a sportscar");
}

If (horsepower < MinimumRequiredHorsepower)
{
throw New ArgumentException("Not enough horsepower to be a sportscar");
}

this.maxSpeed = maxSpeed;
this.horsepower = horsepower;
}

That's just an example. In reality, I would report back what the minimum speed/horsepower is.