text:
# Nim Fractals

• Published in 2014
In the collection
We enumerate P-positions in the game of Nim in two different ways. In one series of sequences we enumerate them by the maximum number of counters in a pile. In another series of sequences we enumerate them by the total number of counters. We show that the game of Nim can be viewed as a cellular automaton, where the total number of counters divided by 2 can be considered as a generation in which P-positions are born. We prove that the three-pile Nim sequence enumerated by the total number of counters is a famous toothpick sequence based on the Ulam-Warburton cellular automaton. We introduce 10 new sequences.

## Other information

pages
19

### BibTeX entry

@article{Khovanova2014,
abstract = {We enumerate P-positions in the game of Nim in two different ways. In one series of sequences we enumerate them by the maximum number of counters in a pile. In another series of sequences we enumerate them by the total number of counters.   We show that the game of Nim can be viewed as a cellular automaton, where the total number of counters divided by 2 can be considered as a generation in which P-positions are born. We prove that the three-pile Nim sequence enumerated by the total number of counters is a famous toothpick sequence based on the Ulam-Warburton cellular automaton. We introduce 10 new sequences.},
author = {Khovanova, Tanya and Xiong, Joshua},
month = {may},
pages = 19,
title = {Nim Fractals},
url = {http://arxiv.org/abs/1405.5942 http://arxiv.org/pdf/1405.5942v1},
year = 2014,
archivePrefix = {arXiv},
eprint = {1405.5942},
primaryClass = {math.CO},
urldate = {2014-06-05},
collections = {Games to play with friends}
}


text:
## Interpolation Extrapolation and Curve-Fitting using higher order polynomial

There are numerous cases that you want to transfer data from one location (source grid) onto another locations (destination grid). Let’s say you have measured the concentration of some pollutants along the river every 1km from the river mouth. Now if you want to know what is the concentration at a certain location lets say 3.5km from the river mouth, there is no measured data. and of course you need to interpolate your data to the location that you want to know. Likewise, extrapolation serves the same purpose with this exception that the new location that you want to know about is located outside the region you made measurements or you have data.

Interpolation reproduces the [measured] data at the known location exactly. This means that the interpolant will generate the same data at the source grid. This is used for data driven approach. However, sometimes you want to use a model driven approach. In this case, you won’t reproduce the exact data at the known location; however, you are fitting a curve (model) to your known data set on source grid and estimating the value based on the fitted curve at the destination grid.

There are many methods to perform the above task. Most of them can be shown simply as:

$f_{destination}=P \times f_{source}$

I like to think of P as a projector or a transformation that interpolates/extrapolates/transforms/projects data from a source grid onto a destination grid. What is interesting is that for most of the methods the entries in P depends only on how the points on source and destination grid are located relative to each other. Therefore, as long as the points in source and destination grid have not moved relative to each other, the matrix P is not going to be changed.

This property can be used to perform a more efficient data transfer from one grid onto another. In those cases that your source grid and destination grid is not changing but the data on the source grid is constantly changing and it needs to be projected onto the destination grid, the matrix P can be generated once and after that it is only a matrix multiplication. This happens in many cases, particularly in the solution of Partial Differential Equations (PDEs). Some software packages such as NCL, ESMF, and SCRIP call this matrix, i.e. P, as interpolation weights.

I have recently developed another package in MATLAB which constructs the matrix P based on the chosen degree polynomial in 2D, i.e.:

$f(x_d,y_d)=\sum_{i=0}^{n}{\sum_{j=0}^{n}{a_{i,j}x_d^iy_d^j}}$

n is the degree of the polynomial. If you choose n=1, it would be bilinear interpolation. If you choose n=3 it would be cubic interpolation, if you choose n=4 it would be fourth order Lagrange interpolation. Although you can choose n to be anything that you like, but remember that large n suffers from Runge-Phenomenon.

The command in MATLAB has the following form

 P=ConstructInterpolator(xs,ys,xd,yd,nPoly,nInterp)

where nPoly is the degree of the polynomial, and nInterp tells the program how many point to use to determine the coefficients. Let’s say you have chosen nPoly=4, therefore there would be $(nPoly+1)^2=25$ coefficients, i.e. $a_{i,j}$. If nInterp is set to be 25, then the program looks for the 25 closest points and uses that to determine the coefficients. Depending how the points are distributed you may end up with ill-conditioned or even singular matrices. Therefore, sometimes it is better to use more points than the minimum requirements. Therefore, if you set nInterp to something bigger than 25, in this case, the coefficients are going to be determined using a least-squeare approach. In this case you are actually curve-fitting.

This code can be used to interpolate/extrapolate/curve-fitting on 2D structured grids, unstructured grids, or even scattered data/grids/points. The source and destination grid does not need to be of the same type.

You can download the code from Mathworks file exchange (here). The code is accompanied by some Test_*.m functions. I suggest start running those codes first to get acquainted with the program.

Should you have any questions, feel free to send me an e-mail or ask it here on the blog. I do my best to answer them as quickly as possible. But sometimes I might be late.

This entry was posted in Program. Bookmark the permalink.

format: plain


text:
# mx.symbol.diag¶

## Description¶

Extracts a diagonal or constructs a diagonal array.

diag’s behavior depends on the input array dimensions:

• 1-D arrays: constructs a 2-D array with the input as its diagonal, all other elements are zero.

• N-D arrays: extracts the diagonals of the sub-arrays with axes specified by axis1 and axis2.

The output shape would be decided by removing the axes numbered axis1 and axis2 from the input shape and appending to the result a new axis with the size of the diagonals in question.

For example, when the input shape is (2, 3, 4, 5), axis1 and axis2 are 0 and 2 respectively and k is 0, the resulting shape would be (3, 5, 2).

Example:

x = [[1, 2, 3],
[4, 5, 6]]

diag(x) = [1, 5]

diag(x, k=1) = [2, 6]

diag(x, k=-1) = [4]

x = [1, 2, 3]

diag(x) = [[1, 0, 0],
[0, 2, 0],
[0, 0, 3]]

diag(x, k=1) = [[0, 1, 0],
[0, 0, 2],
[0, 0, 0]]

diag(x, k=-1) = [[0, 0, 0],
[1, 0, 0],
[0, 2, 0]]

x = [[[1, 2],
[3, 4]],

[[5, 6],
[7, 8]]]

diag(x) = [[1, 7],
[2, 8]]

diag(x, k=1) = [[3],
[4]]

diag(x, axis1=-2, axis2=-1) = [[1, 4],
[5, 8]]

## Usage¶

mx.symbol.diag(...)

## Arguments¶

Argument

Description

data

NDArray-or-Symbol.

Input ndarray

k

int, optional, default=’0’.

Diagonal in question. The default is 0. Use k>0 for diagonals above the main diagonal, and k<0 for diagonals below the main diagonal. If input has shape (S0 S1) k must be between -S0 and S1

axis1

int, optional, default=’0’.

The first axis of the sub-arrays of interest. Ignored when the input is a 1-D array.

axis2

int, optional, default=’1’.

The second axis of the sub-arrays of interest. Ignored when the input is a 1-D array.

name

string, optional.

Name of the resulting symbol.

## Value¶

out The result mx.symbol


text:
# integrate

• April 21st 2010, 04:30 PM
bhuang
integrate
Show that the integral of e^(-kx)dx from 0 to 1 is 1/k(1-e^-k).
When I integrate from and calculate from 0 to 1, I get k(1-e^-k) instead of 1/k.

My solution is...

[-ke^(-kx)] upper limit 1, lower limit 0
= -ke^(-k) +k
= k(-e^(-k) +1)

Where did I go wrong?
• April 21st 2010, 04:36 PM
pickslides
$\int e^{-kx}~dx = \frac{-1}{k}e^{-kx} \neq -ke^{-kx}$
• April 21st 2010, 04:54 PM
bhuang
I don't follow...
• April 21st 2010, 05:00 PM
harish21
Quote:

Originally Posted by bhuang
I don't follow...

let $u = -kx \implies du = -k dx$

$\therefore dx = \frac{du}{-k}$

$\int \frac{e^u \times du}{-k} = \frac{-1}{k} e^u$

substitute back u = -kx, you have:

$\frac{-1}{k} e^{-kx}$. Plug in the upper and lower limits in this expression.
• April 21st 2010, 05:08 PM
bhuang
Thanks! I can do it through substitution, but I'm just wondering why the way I did it did not work. I just followed the rule that the derivative of a function in the form: f(x) = e^(g(x)) is e^(g(x)) x g'(x).
• April 21st 2010, 05:20 PM
pickslides
Quote:

Originally Posted by bhuang
Thanks! I can do it through substitution, but I'm just wondering why the way I did it did not work. I just followed the rule that the derivative of a function in the form: f(x) = e^(g(x)) is e^(g(x)) x g'(x).

Because that is the rule for a derivative, you are integrating.
• April 21st 2010, 05:29 PM
bhuang
woooooooooow :| thanks!


text:
# Plot fractional trigonometric functions with the Mittag-Leffler function

Can anyone help please? Im trying to plot the solution $$X$$ of the system as in the paper attached - about fractional calculus which is $$X= [E_{\nu}(2t^{\nu})][2 \cos_{\nu}(3t^{\nu})+4 \sin_{\nu}(3t^{\nu})]$$ where $$E$$ is the Mittag-Leffler function and the defintions of $$\cos_{\nu}$$ and $$\sin_{\nu}$$ are in the paper also.

• Where are you stuck? – Kuba Apr 14 at 11:45
• What is the commands in mathematica to get the graphs of the solution \$ x = [ mittageleffler (2t^v)] [ 2cos _v(3t^v)+4Sin _v(3t^ )] as in the photo ; Thanks – Jojo Apr 14 at 11:58
• Maybe the downvoters can chill a bit, working with the Mittag-Leffler function is not easy, and Jojo is a beginner. – Roman Apr 14 at 18:47
• For future reference, I think it is best to add an opening paragraph before embedding images. I had to scroll through carefully to see that it was not an image-only post. – Carl Lange Apr 14 at 20:30

I'm not sure I'm understanding the notation right, but think that you can express all of these functions in terms of the builtin MittagLefflerE.

For the fractional cosine and sine definitions I'm using $$z=x^{\alpha}$$:

fcos[α_, z_] = Sum[(-z^2)^k/Gamma[1+2*α*k], {k, 0, ∞}]

MittagLefflerE[2 α, -z^2]

fsin[α_, z_] = Sum[(z*(-z^2)^k)/Gamma[(1+α)+2*k*α], {k, 0, ∞}]

z MittagLefflerE[2 α, 1 + α, -z^2]

For the fractional exponential I'm using $$z=i x^{\alpha}$$:

fexp[α_, z_] = fcos[α, z/I] + I*fsin[α, z/I]

MittagLefflerE[2 α, z^2] + z MittagLefflerE[2 α, 1 + α, z^2]

With these we can define your $$X$$-function:

X[ν_, t_] = fexp[ν, 2*t^ν]*(2*fcos[ν, 3*t^ν] + 4*fsin[ν, 3*t^ν])

(2 MittagLefflerE[2 ν, -9 t^(2 ν)] + 12 t^ν MittagLefflerE[2 ν, 1 + ν, -9 t^(2 ν)]) (MittagLefflerE[2 ν, 4 t^(2 ν)] + 2 t^ν MittagLefflerE[2 ν, 1 + ν, 4 t^(2 ν)])

Plot for $$\nu=1$$: using Evaluate to speed up the plotting dramatically,

Plot[Evaluate@X[1, t], {t, 0, 3}]

Plot for $$\nu=0.8$$: much slower as we cannot use the Evaluate trick,

I cannot read the labels on your other plots and so cannot reproduce them. What are their parameters $$\nu$$ and their axis labels?


text:
# zbMATH — the first resource for mathematics

Some new results on hyperstability of the general linear equation in $$(2,\beta)$$-Banach spaces. (English) Zbl 1396.39021
Summary: In this paper, we first introduce the notions of $$(2,\beta)$$-Banach spaces and we will reformulate the fixed point theorem [J. Brzdęk et al., Nonlinear Anal., Theory Methods Appl., Ser. A, Theory Methods 74, No. 17, 6728–6732 (2011; Zbl 1236.39022), Theorem 1] in this space. We also show that this theorem is a very efficient and convenient tool for proving the new hyperstability results of the general linear equation in $$(2,\beta)$$-Banach spaces. Our main results state that, under some weak natural assumptions, functions satisfying the equation approximately (in some sense) must be actually solutions to it. Our results are improvements and generalizations of the main results of M. Piszczek [Aequationes Math. 88, No. 1–2, 163–168 (2014; Zbl 1304.39033)], J. Brzdęk [Acta Math. Hung. 141, No. 1–2, 58–67 (2013; Zbl 1313.39037); Bull. Aust. Math. Soc. 89, No. 1, 33–40 (2014; Zbl 1290.39016)] and A. Bahyrycz and M. Piszczek [Acta Math. Hung. 142, No. 2, 353–365 (2014; Zbl 1299.39022)] in $$(2,\beta)$$-Banach spaces.
##### MSC:
 39B82 Stability, separation, extension, and related topics for functional equations 39B62 Functional inequalities, including subadditivity, convexity, etc. 47H14 Perturbations of nonlinear operators 47H10 Fixed-point theorems
Full Text:
##### References:
 [1] T. Aoki, On the stability of the linear transformation in Banach spaces, J. Math. Soc. Japan 2 (1950), 64–66. · Zbl 0040.35501 [2] A. Bahyrycz and M. Piszczek, Hyperstability of the Jensen functional equation, Acta Math. Hungar. 142 (2014), no. 2, 353–365. · Zbl 1299.39022 [3] D. G. Bourgin, Approximately isometric and multiplicative transformations on contin- uous function rings, Duke Math. J. 16 (1949), 385–397. · Zbl 0033.37702 [4] , Classes of transformations and bordering transformations, Bull. Amer. Math. Soc. 57 (1951), 223–237. · Zbl 0043.32902 [5] J. Brzdęk, Remarks on hyperstability of the Cauchy functional equation, Aequationes Math. 86 (2013), no. 3, 255–267. [6] , Hyperstability of the Cauchy equation on restricted domains, Acta Math. Hungar. 141 (2013), no. 1-2, 58–67. · Zbl 1313.39037 [7] , A hyperstability result for the Cauchy equation, Bull. Aust. Math. Soc. 89 (2014), no. 1, 33–40. · Zbl 1290.39016 [8] , Remarks on stability of some inhomogeneous functional equations, Aequationes Math. 89 (2015), no. 1, 83–96. · Zbl 1316.39011 [9] J. Brzdęk and K. Ciepliński, Hyperstability and superstability, Abstr. Appl. Anal. 2013 (2013), Art. ID 401756, 13 pp. [10] J. Brzdęk, J. Chudziak, and Z. P´ales, A fixed point approach to stability of functional equations, Nonlinear Anal. 74 (2011), no. 17, 6728–6732. · Zbl 1236.39022 [11] J. Brzdęk and A. Pietrzyk, A note on stability of the general linear equation, Aequationes Math. 75 (2008), no. 3, 267–270. · Zbl 1149.39018 [12] Y. J. Cho, P. C. S. Lin, S. S. Kim, and A. Misiak, Theory of 2-inner product spaces, Nova Science Publishers, Inc., Huntington, NY, 2001. · Zbl 1016.46002 [13] Iz. EL-Fassi, Hyperstability of an n-dimensional Jensen type functional equation, Afr. Mat. 27 (2016), no. 7-8, 1377–1389. · Zbl 1381.39027 [14] Iz. EL-Fassi and S. Kabbaj, On the hyperstability of a Cauchy-Jensen type functional equation in Banach spaces, Proyecciones J. Math 34 (2015), no. 4, 359–375. · Zbl 1345.39017 [15] Iz. EL-Fassi, S. Kabbaj, and A. Charifi, Hyperstability of Cauchy-Jensen functional equations, Indag. Math. (N.S.) 27 (2016), no. 3, 855–867. · Zbl 1382.39037 [16] S. Elumalai, Y. J. Cho, and S. S. Kim, Best approximation sets in linear 2-normed spaces, Commun. Korean Math. Soc. 12 (1997), no. 3, 619–629. · Zbl 0944.46003 [17] R. W. Freese and Y. J. Cho, Geometry of linear 2-normed spaces, Nova Science Publishers, Inc., Hauppauge, NY, 2001. · Zbl 1051.46001 [18] S. G¨ahler, Lineare 2-normierte R¨aume, Math. Nachr. 28 (1964), 1–43. [19] , ¨Uber 2-Banach-R¨aume, Math. Nachr. 42 (1969), 335–347. 916IZ. EL-FASSI [20] Z. Gajda, On stability of additive mappings, Internat. J. Math. Math. Sci. 14 (1991), no. 3, 431–434. · Zbl 0739.39013 [21] P. Gˇavruta, A generalization of the Hyers-Ulam-Rassias stability of approximately ad- ditive mappings, J. Math. Anal. Appl. 184 (1994), no. 3, 431–436. [22] E. Gselmann, Hyperstability of a functional equation, Acta Math. Hungar. 124 (2009), no. 1-2, 179–188. · Zbl 1212.39044 [23] D. H. Hyers, On the stability of the linear functional equation, Proc. Nat. Acad. Sci. U. S. A. 27 (1941), 222–224. · JFM 67.0424.01 [24] D. H. Hyers, G. Isac, and T. M. Rassias, Stability of functional equations in sev- eral variables, Progress in Nonlinear Differential Equations and their Applications, 34, Birkh¨auser Boston, Inc., Boston, MA, 1998. [25] S.-M. Jung, Hyers-Ulam Stability of Functional Equation in Mathematical Analysis, Hadronic Press, Palm Harbor, 2001. [26] S.-M. Jung and M. Th. Rassias, A linear functional equation of third order associated with the Fibonacci numbers, Abstr. Appl. Anal. 2014 (2014), Art. ID 137468, 7 pp. [27] S.-M. Jung, M. Th. Rassias, and C. Mortici, On a functional equation of trigonometric type, Appl. Math. Comput. 252 (2015), 294–303. · Zbl 1338.39041 [28] Pl. Kannappan, Functional Equations and Inequalities with Applications, Springer Monographs in Mathematics, Springer, New York, 2009. · Zbl 1178.39032 [29] M. Kuczma, An introduction to the theory of functional equations and inequalities, Prace Naukowe Uniwersytetu Śl¸askiego w Katowicach, 489, Uniwersytet Śl¸aski, Katowice, 1985. · Zbl 0555.39004 [30] Y.-H. Lee, On the stability of the monomial functional equation, Bull. Korean Math. Soc. 45 (2008), no. 2, 397–403. · Zbl 1152.39023 [31] Y.-H. Lee, S.-M. Jung, and M. Th. Rassias, On an n-dimensional mixed type additive and quadratic functional equation, Appl. Math. Comput. 228 (2014), 13–16. · Zbl 1364.39023 [32] G. Maksa and Z. P´ales, Hyperstability of a class of linear functional equations, Acta Math. Acad. Paedagog. Nyh´azi. (N.S.) 17 (2001), no. 2, 107–112. · Zbl 1004.39022 [33] G.V. Milovanović and M.Th. Rassias (eds.), Analytic Number Theory, Approximation Theory and Special Functions, Springer, New York, 2014. [34] M. Piszczek, Remark on hyperstability of the general linear equation, Aequationes Math. 88 (2014), no. 1-2, 163–168. · Zbl 1304.39033 [35] D. Popa, Hyers-Ulam-Rassias stability of the general linear equation, Nonlinear Funct. Anal. Appl. 7 (2002), no. 4, 581–588. · Zbl 1031.39021 [36] , On the stability of the general linear equation, Results Math. 53 (2009), no. 3-4, 383–389. · Zbl 1181.39020 [37] T. M. Rassias, On the stability of the linear mapping in Banach spaces, Proc. Amer. Math. Soc. 72 (1978), no. 2, 297–300. · Zbl 0398.47040 [38] , On a modified Hyers-Ulam sequence, J. Math. Anal. Appl. 158 (1991), no. 1, 106–113. · Zbl 0746.46038 [39] T. M. Rassias and P. Semrl, On the behavior of mappings which do not satisfy Hyers- Ulam stability, Proc. Amer. Math. Soc. 114 (1992), no. 4, 989–993. · Zbl 0761.47004 [40] S. M. Ulam, Problems in Modern Mathematics, Science Editions John Wiley & Sons, Inc., New York, 1964. · Zbl 0137.24201 [41] A. G. White, Jr., 2-Banach spaces, Math. Nachr. 42 (1969), 43–60. · Zbl 0185.20003 [42] D. Zhang, On hyperstability of generalised linear functional equations in several vari- ables, Bull. Aust. Math. Soc. 92 (2015), no. 2, 259–267. · Zbl 1330.39032
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:
Elod P Csirmaz’s Blog: January 2011

## 9 January 2011

### "Petrified" references in Perl -- a third type of references

In Perl, one can use soft / symbolic references to variables by creating a variable that contains the name of the referenced variable:
$ref = "myvar";$$ref = 0; # Sets myvar to 0 Soft/symbolic references are unsafe, as explained here. The other way to create a reference is to initialize the reference as a pointer. This is safer as it is explicit: ref = \myvar;$$ref = 0; # Sets$myvar to 0$hashref = \%myhash;$hashref->{'key'} = 0; # This is the same as ${$hashref}{'key'}$myhash{'key'} = 0; # Has the same effect as the line above These are called hard references, and Perl's OO system is largely based on them. However, there is a third case: when two variables point to the same value without either being a reference. (I haven't found an explicit documentation of this, so I named this case "petrified" references.) This can be achieved this way: *myvar1 = *myvar2;$myvar1 = 0;$myvar2 = 0; # Has the same effect as the line above One can even make a variable point to where a hard reference points to. For example, %myhash2 will point to the anonymous hash referenced by$hashref:
$hashref = {'key' => 0};*myhash2 =$hashref;$myhash2{'key'} = 1; # Note that myhash2 is a hash, not a hashref!$hashref->{'key'} = 1; # Has the same effect as the line above

This is very useful if, for backwards compatibility, one needs to refer to the same value using multiple names, or one needs to cross namespaces.

For some guidance on the * notation, please see section 7 in http://perldoc.perl.org/perlref.html#Making-References.


text:
# Indian reserves climb to $360.2bn at end-March The Reserve Bank of India's (RBI's) foreign exchange reserves grew to$360.2 billion at the end of March, up 2.8% from the end of September, it announced on July 20.

In its half-yearly report, the RBI noted its reserve had remained "more or less constant" over the six months, but had jumped up in March. Import cover increased from 9.8 months to 10.9 months over the period, it added.

#### Latest issue

###### Central Banking Journal

Read the latest edition of the Central Banking journal


text:
## Wikipedia - Chemi-ionization (en) Wikipedia - Ion source (en) Wikipedia - Kjemi-ionisering (no) Wikipedia - Quimioionización (es) chemi-ionization

in mass spectrometry
https://doi.org/10.1351/goldbook.C01044
This refers to a process whereby gaseous molecules are ionized when they interact with other internally excited gaseous molecules or molecular moieties. [email protected]@ and chemical @[email protected] are two terms which should not be used interchangeably.


text:
## C# Tutorial

Methods are a series of statements in a code block that perform a specific task. These statements can be executed by calling the method with the required arguments. The Main() Method is a prerequisite in all C# programs.Method Definition in C#Methods are defined within a class or a structure. The method definition specifies the method name and the parameters types required. When calling the method, the arguments for each parameter is specified.The syntax for method definition is given as follows:AccessSpecifier ReturnType NameOfMethod (ListOfParameters){        // Method Statements }In the above syntax, the AccessSpecifier provides the visibility of the method in the class. The ReturnType is the value returned by the method. The NameOfMethod is the name provided to the method as a unique identifier. ListOfParameters is the list of the parameters in the method.Method Calling in C#A method can be called using its name. For the method calling, the name of the method is followed by parenthesis, even if there are no arguments.The syntax for method calling is given as follows:NameOfMethod (ListOfParameters);In the above syntax, the NameOfMethod is the name provided to the method as a unique identifier. ListOfParameters is the list of the parameters in the method.A program that demonstrates method definition and method calling is given as follows:Source Code: Program to demonstrate method definition and method calling in C#using System; namespace MethodDemo {   class Example {      static void EvenOrOdd(int n)      {          if(n%2 == 0)          Console.WriteLine("{0} is even",n);          else          Console.WriteLine("{0} is odd",n);                }      static void Main(string[] args)      {          EvenOrOdd(5);          EvenOrOdd(8);      }   } }The output of the above program is as follows:5 is odd 8 is evenRecursion in C#Recursive methods are those that call themselves whether directly or indirectly. They are quite useful in solving complex problems as these problems can be expressed as progressively smaller problems until the base case is obtained.A program to find the factorial of a number using recursion is given as follows:Source Code: Program to find factorial of a number using recursion in C#using System; namespace MethodDemo {   class Example {      static int Factorial(int n)      {          if((n==0)||(n==1))          return 1;          else          return n*Factorial(n-1);      }      static void Main(string[] args)      {          Console.WriteLine("Factorial of 5 is {0}",Factorial(5));          Console.WriteLine("Factorial of 8 is {0}",Factorial(8));      }   } }The output of the above program is as follows:Factorial of 5 is 120 Factorial of 8 is 40320Passing By ValueWhen the parameters are passed by value to a method, new memory variables are created for these parameters. The changes done in those memory variables don't reflect back to the original values.A program that demonstrates passing by value is given as follows:Source Code: Program that demonstrates passing by value in C#using System; namespace PassByValueDemo {   class Example {      static void Swap(int m, int n)      {         int temp;         temp = m;         m = n;         n = temp;      }      static void Main(string[] args)      {         int a = 5;         int b = 10;         Console.WriteLine("Passing By Value");         Console.WriteLine("Before Swap method is called");         Console.WriteLine("a = {0}", a);         Console.WriteLine("b = {0}", b);         Swap(a, b);         Console.WriteLine("After Swap method is called");         Console.WriteLine("a = {0}", a);         Console.WriteLine("b = {0}", b);      }   } }The output of the above program is as follows:Passing By Value Before Swap method is called a = 5 b = 10 After Swap method is called a = 5 b = 10In the above output, you can see the values won’t get swapped.Passing By ReferenceWhen the parameters are passed by reference to a method, new memory variables are not created for these parameters. Rather, the reference parameters point to the original parameters so that the changes done in the reference variables reflect back to the original values.The reference parameters can be declared using the ref keyword in C#. A program that demonstrates this is as follows:Source Code: Program that demonstrates passing by reference in C#using System; namespace PassByRefDemo {   class Example {      static void Swap(ref int m, ref int n)      {         int temp;         temp = m;         m = n;         n = temp;      }      static void Main(string[] args)      {         int a = 5;         int b = 10;         Console.WriteLine("Passing By Reference");         Console.WriteLine("Before Swap method is called");         Console.WriteLine("a = {0}", a);         Console.WriteLine("b = {0}", b);         Swap(ref a, ref b);         Console.WriteLine("After Swap method is called");         Console.WriteLine("a = {0}", a);         Console.WriteLine("b = {0}", b);      }   } }The output of the above program is as follows:Passing By Value Before Swap method is called a = 5 b = 10 After Swap method is called a = 10 b = 5In the above output, you can see the values get swapped successfully.Output ParametersThe output parameters are useful in transferring data out of the method. They can be used to return multiple values while the return statement can only return one value at a time. The out keyword is used to declare an output parameter.A program that demonstrates this is as follows:Source Code: Program that demonstrates output parameters in C#using System; namespace OutputDemo {   class Example {      static void OutValue(out int val )      {         val = 7;      }      static void Main(string[] args)      {         int num = 4;         Console.WriteLine("Value of num before calling OutValue: {0}", num);         OutValue(out num);         Console.WriteLine("Value of num after calling OutValue: {0}", num);      }   } }The output of the above program is as follows:Value of num before calling OutValue: 4 Value of num after calling OutValue: 7

# Methods in C#

Methods are a series of statements in a code block that perform a specific task. These statements can be executed by calling the method with the required arguments. The Main() Method is a prerequisite in all C# programs.

## Method Definition in C#

Methods are defined within a class or a structure. The method definition specifies the method name and the parameters types required. When calling the method, the arguments for each parameter is specified.

The syntax for method definition is given as follows:

AccessSpecifier ReturnType NameOfMethod (ListOfParameters)

{
// Method Statements
}

In the above syntax, the AccessSpecifier provides the visibility of the method in the class. The ReturnType is the value returned by the method. The NameOfMethod is the name provided to the method as a unique identifier. ListOfParameters is the list of the parameters in the method.

## Method Calling in C#

A method can be called using its name. For the method calling, the name of the method is followed by parenthesis, even if there are no arguments.

The syntax for method calling is given as follows:

NameOfMethod (ListOfParameters);

In the above syntax, the NameOfMethod is the name provided to the method as a unique identifier. ListOfParameters is the list of the parameters in the method.

A program that demonstrates method definition and method calling is given as follows:

Source Code: Program to demonstrate method definition and method calling in C#

using System;
namespace MethodDemo
{
class Example {
static void EvenOrOdd(int n)
{
if(n%2 == 0)
Console.WriteLine("{0} is even",n);
else
Console.WriteLine("{0} is odd",n);
}
static void Main(string[] args)
{
EvenOrOdd(5);
EvenOrOdd(8);
}
}
}

The output of the above program is as follows:

5 is odd
8 is even

## Recursion in C#

Recursive methods are those that call themselves whether directly or indirectly. They are quite useful in solving complex problems as these problems can be expressed as progressively smaller problems until the base case is obtained.

A program to find the factorial of a number using recursion is given as follows:

Source Code: Program to find factorial of a number using recursion in C#

using System;
namespace MethodDemo
{
class Example {
static int Factorial(int n)
{
if((n==0)||(n==1))
return 1;
else
return n*Factorial(n-1);
}
static void Main(string[] args)
{
Console.WriteLine("Factorial of 5 is {0}",Factorial(5));
Console.WriteLine("Factorial of 8 is {0}",Factorial(8));
}
}
}

The output of the above program is as follows:

Factorial of 5 is 120
Factorial of 8 is 40320

## Passing By Value

When the parameters are passed by value to a method, new memory variables are created for these parameters. The changes done in those memory variables don't reflect back to the original values.

A program that demonstrates passing by value is given as follows:

Source Code: Program that demonstrates passing by value in C#

using System;
namespace PassByValueDemo
{
class Example {
static void Swap(int m, int n)
{
int temp;
temp = m;
m = n;
n = temp;
}
static void Main(string[] args)
{
int a = 5;
int b = 10;
Console.WriteLine("Passing By Value");
Console.WriteLine("Before Swap method is called");
Console.WriteLine("a = {0}", a);
Console.WriteLine("b = {0}", b);
Swap(a, b);
Console.WriteLine("After Swap method is called");
Console.WriteLine("a = {0}", a);
Console.WriteLine("b = {0}", b);
}
}
}

The output of the above program is as follows:

Passing By Value
Before Swap method is called
a = 5
b = 10
After Swap method is called
a = 5
b = 10

In the above output, you can see the values won’t get swapped.

## Passing By Reference

When the parameters are passed by reference to a method, new memory variables are not created for these parameters. Rather, the reference parameters point to the original parameters so that the changes done in the reference variables reflect back to the original values.

The reference parameters can be declared using the ref keyword in C#. A program that demonstrates this is as follows:

Source Code: Program that demonstrates passing by reference in C#

using System;
namespace PassByRefDemo
{
class Example {
static void Swap(ref int m, ref int n)
{
int temp;
temp = m;
m = n;
n = temp;
}
static void Main(string[] args)
{
int a = 5;
int b = 10;
Console.WriteLine("Passing By Reference");
Console.WriteLine("Before Swap method is called");
Console.WriteLine("a = {0}", a);
Console.WriteLine("b = {0}", b);
Swap(ref a, ref b);
Console.WriteLine("After Swap method is called");
Console.WriteLine("a = {0}", a);
Console.WriteLine("b = {0}", b);
}
}
}

The output of the above program is as follows:

Passing By Value
Before Swap method is called
a = 5
b = 10
After Swap method is called
a = 10
b = 5

In the above output, you can see the values get swapped successfully.

## Output Parameters

The output parameters are useful in transferring data out of the method. They can be used to return multiple values while the return statement can only return one value at a time. The out keyword is used to declare an output parameter.

A program that demonstrates this is as follows:

Source Code: Program that demonstrates output parameters in C#

using System;
namespace OutputDemo
{
class Example {
static void OutValue(out int val )
{
val = 7;
}
static void Main(string[] args)
{
int num = 4;
Console.WriteLine("Value of num before calling OutValue: {0}", num);
OutValue(out num);
Console.WriteLine("Value of num after calling OutValue: {0}", num);
}
}
}

The output of the above program is as follows:

Value of num before calling OutValue: 4
Value of num after calling OutValue: 7

## Swift Tutorial

Introduction to Swift Tutorial
13542
Swift Tutorial

Introduction to Swift Tutorial

R Programming

Python Tutorial
5394
Python Tutorial

Python Tutorial


text:
## Goten77 2 years ago if i said differentiate y=2x does that mean take the derivative? or what exactly?

1. hbk19

yes

2. Goten77

well what is it then when you get dy by it self? and have something like dy = 2dx

3. abb0t

separation of variables. take the integral of each.

4. Goten77

something like the differential?

5. UnkleRhaukus

the derivative of a straight line is simply the slope

6. ChmE

Differentiate $y=2x$$\frac{ dy }{ dx }=2$$dy=2dx$that looks familiar Integrate:$\int\limits dy=\int\limits 2 \space dx$$y=2x+C$

7. abb0t

$\int\limits dy = \int\limits 2xdx$

8. Goten77

so differentiate just means put the dy by it self?

9. Goten77

<.< using words that are so similar is not a good idea

10. abb0t

you are basically taking the antiderivative, which in essence is differentiating.


text:
# What is the distribution of the sum of n binary random variables with different probabilities and payoffs each?

Specifically, you can assume we have n random variables $X_i$ ($i \in \{1,2,3,\ldots,n\}$). Each $X_i$ has a probability $P_i$ to payoff $\mathrm{UP}_i$ and probability $Q_i=1-P_i$ to payoff $\mathrm{DOWN}_i$. $S= \sum_i X_i$. What is the probability density and cumulative distribution of $S$?

-
Are the random variables independent? – Dilip Sarwate Aug 2 '12 at 18:28
Yes, you can assume independence – George Pastrana Aug 2 '12 at 18:34
The variable $S$ is a discrete random variable, based on your description. Hence, the concept of probability density is not applicable. Do you mean point mass function, maybe? – Sasha Aug 2 '12 at 18:46
Yes, of course that is what I meant. – George Pastrana Aug 2 '12 at 19:41

Denote up and down states $\{u_i\},\{d_i\}$ for convenience.

In the most generic case, where all $u_i$ and $d_i$ are different, you will have $2^n$ states $X$ of the form

$d_1 + d_2 + ... + d_n,\\ d_1 + d_2 + ... + u_n,\\ d_1 + d_2 + ... + d_{n-2} + u_{n-1} + d_n,\\ d_1 + d_2 + ... + d_{n-2} + u_{n-1} + u_n,\\ \ldots$

with the respected probabilities of

$q_1 * q_2 * ... * q_n,\\ q_1 * q_2 * ... * q_{n-1} * p_n,\\ q_1 * q_2 * ... * p_{n-1} * q_n,\\ q_1 * q_2 * ... * q_{n-1} * p_{n-1} * p_n,\\ \ldots$

and the $X$ would be the support for the pdf. Then you can get the cdf by taking cumulative partial sums of the probabilities, after sorting $X$ in increasing order.

-
By the way, I am familiar with several papers that treat the case of Poisson Binomial distribution (as in Wikepedia article and the references contained therin). This is a somewhat more general problem where I am considering different payoffs as well as different probabilities. – George Pastrana Aug 2 '12 at 19:46


text:
# How to express coprimality as a constraint in an optimization problem over integers?

I am currently working with an optimization problem that is defined over a a set of $D$-dimensional integer vectors where each component is bounded by $M$.

Let us refer to this optimization problem as $P$ and define it as

\begin{align} \begin{split} \min_x & f(x) & \\ \text{st.} &|x_d| \leq M & \text{for } d = 1,\ldots,D \\ &x\in \mathbb{Z}^D & & \end{split} \\ \end{align}

My issue is that $P$ is that it does not have a unique solution due to the way that $f$ is defined. In particular, given that $x^*$ is the minimizing value of $P$, any scalar multiple of this solution $x' = \lambda x^*$ will also be optimal - provided that all of the elements of $x'$ are bounded within $M$.

To illustrate this, consider an example where $D=3$, $M$ = 100, and $x^* = (1,1,1)$ then there are a total of 200 total solutions to $P$ with the form $x'= \lambda(1,1,1)$ where $\lambda \in \{-100,-1,1\ldots,100\}$.

In practice, this slows down my optimization solver. Thus, I would like to obtain the solution that is the 'smallest' possible $x^*$ (i.e. $x^* = (1,1,1)$ in the example above).

I can think of two ways to achieve this:

1) Add a tiny penalty $L_1$ or $L_2$ norms in the objective of $P$.

2) Add constraints to restrict the value of $x$ to a coprime set. This requires that at least two of the components of $x*$ are coprime; that is,$\exists i \neq j \in \{1,\ldots,D\}$ such that $\gcd(x_i,x_j)=1$

I am wondering if it is possible to achieve 2) by formulating a set of smart constraints. That is, can we formulate constraints that restrict $x$ to a coprime set. Ideally, I would like to do this using as few constraints as possible.


text:
# Determinant is linear as a function of each of the rows of the matrix.

Today I heard in a lecture (some video on YouTube) that the determinant is linear as a function of each of the rows of the matrix.

I am not able to understand the above statement. I know that determinant is a special function which assign to each $$x$$ in $$\mathbb K^{n \times n}$$ a scalar. This is the intuitive idea. And this map is not linear as well. One way to see this is to consider the fact that determinant of $$cA$$ is $$c^n\det(A)$$

Can someone please explain what did the person mean by saying that the determinant is linear as a function of each of the rows of matrix?

• I got it. It means that elementary row operations have a linear effect on determinant. Say $A=(r1,r2,...,r_n)$ is a matrix then det of $(r_1,..,cr_j +r_i,..,r_n)$ is nothing but determinant of $(r_1,..,cr_j,..,r_n)$ plus determinant of $(r_1,..,r_i,..,r_n)$.Am I right? – StammeringMathematician Apr 16 at 3:40
• Yes. The fact that is is linear in each row separately gives rise to the combinatorial formula for the determinant. – copper.hat Apr 16 at 3:41

If $$r_1, \ldots r_n$$ are the rows of the matrix and $$r_i = sa+tb$$, where $$s,t$$ are scalars and $$a,b$$ are row vectors, then you have
$$\det\begin{pmatrix}r_1 \\ \vdots \\r_i \\ \vdots \\ r_n\end{pmatrix} = \det\begin{pmatrix}r_1 \\ \vdots \\ sa+tb \\ \vdots \\ r_n\end{pmatrix} = s\det\begin{pmatrix}r_1 \\ \vdots \\ a \\ \vdots \\ r_n\end{pmatrix} + t\det\begin{pmatrix}r_1 \\ \vdots \\ b \\ \vdots \\ r_n\end{pmatrix}$$
This holds for any row $$i=1,\ldots , n$$. And similarly this also applies to columns.
Let $$M$$ be an $$n\times n$$ matrix with rows $$\mathbf{r}_1,\dots,\mathbf{r}_n$$. Then we may think of the determinant as a function of the rows $$\det(M)=\det(\mathbf{r}_1,\dots,\mathbf{r}_n).$$ To say that $$\det$$ is a linear function of the rows means that if we scale a single row by $$c$$, the result is scaled by $$c$$; that is, $$\det(\mathbf{r}_1,\dots,\mathbf{r}_{i-1},c\mathbf{r}_i,\mathbf{r}_{i+1}\dots\mathbf{r}_n)=c\det(\mathbf{r}_1,\dots,\mathbf{r}_n).$$ Similarly if we fix all but one row (say the first), we obtain $$\det(\mathbf{x}+\mathbf{r}_1,\mathbf{r}_2,\dots,\mathbf{r}_n)=\det(\mathbf{x},\dots,\mathbf{r}_n)+\det(\mathbf{r}_1,\dots,\mathbf{r}_n).$$ Your mistake was that you scale all the rows at once; to be linear, you can only do things "one at a time"


text:
## Category Archives: IITJEE Advanced Mathematics

### B.S. in Mathematics: IIT Bombay program:

http://www.math.iitb.ac.in/Academics/bs_programme.php

Note that the admission is through IITJEE Advanced only.

Nalin Pithwa.

### Co-ordinate Geometry : IITJEE Mains practice: some random problems again

Problem 1:

The line $Ax+By+C=0$ cuts the circle $x^{2}+y^{2}+ax+by+c=0$ at P and Q. The line $A^{'}x+B^{'}y+C^{'}=0$ cuts the circle $x^{2}+y^{2}+a^{'}x+b^{'}y+c^{'}=0$ at R and S. If P, Q, R and S are concyclic, prove that

$\left | \begin{array}{ccc} a-a^{'} & b-b^{'} & c-c^{'} \\ A & B & C \\ A^{'} & B^{'} & C^{'} \end{array}\right |=0$.

Solution I;

An equation of a circle through P and Q is $x^{2}+y^{2}+ax+by+c +\lambda (Ax+By+C)=0$…call this equation I.

And, an equation of a circle through R and S is $x^{2}+y^{2}+a^{'}x+b^{'}y + c^{'}+\mu (A^{'}x+B^{'}y+C^{'})=0$…call this equation II.

If P, Q, R and S are concyclic, then I and II represent the same circle for same values of $\lambda$ and $\mu$.

$\Longrightarrow a+ \lambda A=a^{'}+\mu A^{'}$ or $a-a^{'} + \lambda A - \mu A^{'}=0$

so also,

$b + \lambda B = b^{'} + \mu B^{'}$ or $b-b^{'}+\lambda B - \mu B^{'}=0$

$c + \lambda C = c^{'} + \mu C^{'}$ or $c-c^{'} + \lambda C - \mu C^{'}=0$.

Eliminating $\lambda$ and $\mu$, we get the following:

$\left | \begin{array}{ccc} a-a^{'} & A & -A^{'}\\ b-b^{'} & B & -B^{'}\\ c-c^{'} & C & -C^{'} \end{array} \right |=0$, that is,

$\left | \begin{array}{ccc} a-a^{'} & b-b^{'} & c-c^{'} \\ A & B & C \\ A^{'} & B^{'} & C^{'} \end{array}\right |=0$

Problem II:

A straight line is such that the algebraic sum of the perpendiculars falling upon it from any number of fixed points is zero. Show that it always passes through a fixed point.

Solution II:

Let $(x_{i},y_{i})$ where $i=1,2,3,\ldots$ be n fixed points. Let $ax+by+c=0$ be the given line. Thus, as per given hypthesis, we have

$\sum_{i=1}^{n}\frac{ax{i}+by_{i}+c}{\sqrt{(a^{2}+b^{2})}}=0 \Longrightarrow a\sum_{i=1}^{n}x_{i}+b\sum_{i=1}^{n}y_{i}+nc=0 \Longrightarrow a\overline{x}+b\overline{y}+c=0$ where $\overline{x}=\frac{1}{n}\sum_{i=1}^{n}x_{i}$ and $\overline{y}=\frac{}{}\sum_{i=1}^{n}y_{i}$

which shows that the given line passes through the fixed point $(\frac{1}{n}\sum_{i=1}^{n}x_{i}, \frac{1}{n}\sum_{i=1}^{n}y_{i})$.

Problem III:

The straight lines $L \equiv ax+by+c=0$ and $L_{1} \equiv a_{1}x+b_{1}y+c_{1}=0$ are intersecting. Find the straight line $L_{2}$ such that L is the bisector of the angle between $L_{1}$ and $L_{2}$.

Solution III:

Let the equation of the line $L_{2}$ be $L_{1}+ \lambda L=0 \Longrightarrow (a_{1}+\lambda a)x+(b_{1}+\lambda b)y+\lambda c=0$ where the slopes of $L_{2}, L, L_{1}$ are respectively

$-\frac{a_{1}+\lambda a}{b_{1}+\lambda b}, \frac{-a}{b}, -\frac{a_{1}}{b_{1}}$.

Since L is the bisector of the angle between $L_{2}$ and $L_{1}$ we have

$\frac{-(\frac{a_{1}+\lambda a}{b_{1}+\lambda b})+\frac{a}{b}}{1+\frac{a(a_{1}+\lambda a)}{b(b_{1}+\lambda b)}}=\frac{-\frac{a}{b}+\frac{a_{1}}{b_{1}}}{1+\frac{aa_{1}}{bb_{1}}}$

$\Longrightarrow \frac{-b(a_{1}+\lambda a)+a(a_{1}+\lambda b)}{b(b_{1}+\lambda b)+a(a_{1}+\lambda a)}=-\frac{ab_{1}-a_{1}b}{aa_{1}+bb_{1}}$

$\Longrightarrow \frac{ab_{1}-a_{1}b}{\lambda (a^{2}+b^{2})+aa_{1}+bb_{1}} = -\frac{ab_{1}-a_{1}b}{aa_{1}+bb_{1}}$

$\Longrightarrow \lambda = - \frac{2(aa_{1}+bb_{1})}{a^{2}+b^{2}}$

Hence, the equation of the required line $L_{1}$ is $(a^{2}+b^{2})(a_{1}x+b_{1}y+c_{1})=2(aa_{1}+bb_{1})(ax+by+c)$.

Problem IV:

If a, b are real numbers and $c>0$, find the locus represented by $|ay-bx|=c\sqrt{(x-a)^{2}+(y-b)^{2}}$.

PS: Please draw a right angled triangle PMA, with right angle at M, and P being $(x,y)$ and A being $(a,b)$.

Solution IV:

Let $x=a+r\cos {\theta}$ and $y=b+r\sin {\theta}$, then the given equation becomes $a\sin {\theta}-b\cos {\theta}=c$.

$\Longrightarrow r\sin{(\theta-\alpha)}=c$ where $r=\sqrt{a^{2}+b^{2}}$ and $\tan {(\alpha)}=\frac{b}{a}$ which is the slope of $ay-bx$, which in turn implies $\frac{c}{r}=\sin (\theta -\alpha) \leq 1$

$\Longrightarrow c \leq r$, or $c \leq \sqrt{a^{2}+b^{2}}$. The given equation now becomes

$\frac{|ay-bx|}{\sqrt{a^{2}+b^{2}}}=\frac{c}{\sqrt{a^{2}+b^{2}}}\sqrt{(x-a)^{2}+(y-b)^{2}}$….call this as relation I.

If M is the foot of the perpendicular from a point P(x,y) on the line $ay-bx=0$ and A is the point $(a,b)$ which clearly lies on this line, then from relation I, we have

$\frac{PM}{PA}=\frac{c}{\sqrt{a^{2}+b^{2}}}=\sin {(\theta - \alpha)}$. Hence, the locus of P is a straight line through the point $(a,b)$ inclined at an angle $\arcsin {\frac{c}{\sqrt{a^{2}+b^{2}}}}$ with the line $ay-bx=0$.

Problem V:

Find the co-ordinates of the orthocentre of the triangle formed by the lines $y=0$ and $(1+t)x-ty+t(1+t)=0$ and $(1+u)x-uy+u(1+u)=0$, where $t \neq u$, and show that for all values of t and u, the orthocentre lies on the line $x+y=0$.

Solution V:

Let the equation of the side BC be $y=0$. Then, the coordinates of B and C are $(-t,0)$ and $(-u,0)$, respectively, where $(1+t)x-ty+t(1+t)=0$ and $(1+u)x-uy+u(1+u)=0$ are equations of AB and AC, respectively.

PS: Please draw the diagram on your own for a better understanding of the solution presented.

Now, equation of BE is $y={\frac{-u}{1+u}}(x+t)$…let us call this equaiton I.

And, equation of CF is $y=\frac{-t}{1+t}(x+u)$…let us call this equation II.

Solving I and II, we get the following:

$x(\frac{u}{1+u}-\frac{t}{1+t})=\frac{tu}{1+t}-\frac{tu}{1+u}$, which in turn implies that

$x=tu$ and $y=-tu$, so that the orthocentre is the point $(tu,-tu)$ which lies on the line $x+y=0$.

Cheers,

Nalin Pithwa

### Solutions to Birthday Problems: IITJEE Advanced Mathematics

In the following problems, each year is assumed to be consisting of 365 days (no leap year):

Problem 1:

What is the least number of people in a room such that it is more likely than not that at least two people will share the same birthday?

Solution 1:

The probability of the second person having a different birthday from the first person is $\frac{364}{365}$. The probability of the first three persons having different birthdays is $\frac{364}{365} \times \frac{363}{365}$. In this way, the probability of all n persons in a room having different birthdays is $P(n) = \frac{364}{365} \times \frac{363}{365} \times \frac{362}{365} \times \ldots \frac{365-n+1}{365}$. For the value of n, when P(n) falls just below 1/2 is the least number of people in a room when the probability of at least two people having the same birthday becomes greater than one half (that is, more likely than not). Now, one can make the following table:

$\begin{tabular}{|c|c|}\hline N & P(n) \\ \hline 2 & 364/365 \\ \hline 3 & 0.9918 \\ \hline 4 & 0.9836 \\ \hline 5 & 0.9729 \\ \hline 6 & 0.9595 \\ \hline 7 & 0.9438 \\ \hline 8 & 0.9257 \\ \hline 9 & 0.9054 \\ \hline 10 & 0.8830 \\ \hline 11 & 0.8589 \\ \hline 12 & 0.8330 \\ \hline 13 & 0.8056 \\ \hline 14 & 0.7769 \\ \hline 15 & 0.7471 \\ \hline 16 & 0.7164 \\ \hline 17 & 0.6850 \\ \hline 18 &0.6531 \\ \hline 19 & 0.6209 \\ \hline 20 & 0.5886 \\ \hline 21 & 0.5563 \\ \hline 22 & 0.5258 \\ \hline 23 & 0.4956 \\ \hline \end{tabular}$

Thus, the answer is 23. One may say that during a football match with one referee, it is more likely than not that at least two people on the field have the same birthday! 🙂 🙂 🙂

Problem 2:

You are in a conference. What is the least number of people in the conference (besides you) such that it is more likely than not that there is at least another person having the same birthday as yours?

Solution 2:

The probability of the first person having a different birthday from yours is $\frac{364}{365}$. Similarly, the probability of the first two persons not having the same birthday as yours is $\frac{(364)^{2}}{(365)^{2}}$. Thus, the probability of n persons not  having the same birthday as yours is $\frac{(364)^{n}}{(365)^{n}}$. When this value falls below 0.5, then it becomes more likely than not that at least another person has the same birthday as yours. So, the least value of n is obtained from $(\frac{364}{365})^{n}<\frac{1}{2}$. Taking log of both sides, we solve to get $n>252.65$. So, the least number of people required is 253.

Problem 3:

A theatre owner announces that the first person in the queue having the same birthday as the one who has already purchased a ticket will be given a free entry. Where (which position in the queue) should one stand to maximize the chance of earning a free entry?

Solution 3:

For the nth person to earn a free entry, first $(n-1)$ persons must have different birthdays and the nth person must have the same birthday as that of one of these previous $(n-1)$ persons. The probability of such an event can we written as

$P(n) = [\frac{364}{365} \times \frac{363}{365} \times \frac{362}{365} \times \ldots \frac{365-n+2}{365}] \times \frac{n-1}{365}$

For a maximum, we need $P(n) > P(n+1)$. Alternatively, $\frac{P(n)}{P(n+1)} >1$. Using this expression for P(n), we get $\frac{365}{365-n} \times \frac{n-1}{n} >1$. Or, $n^{2}-n-365>0$. For positive n, this inequality is satisfied first for some n between 19 and 20. So, the best place in the queue to get a free entry is the 20th position.

More later,

Nalin Pithwa.

### Birthday Probability Problems: IITJEE Advanced Mathematics

In the following problems, each year is assumed to be consisting of 365 days (no leap year):

1. What is the least number of people in a room such that it is more likely than not that at least two people will share the same birthday?
2. You are in a conference. What is the least number of people in the conference (besides you) such that it is more likely than not that there is at least another person having the same birthday as yours?
3. A theatre owner announces that the first person in the queue having the same birthday as the one who has already purchased a ticket will be given a free entry. Where (which position in the queue) should one stand to maximize the chance of earning a free entry?

I will put up the solutions on this blog tomorrow. First, you need to make a whole-hearted attempt.

Nalin Pithwa.

### Limits that arise frequently

We continue our presentation of basic stuff from Calculus and Analytic Geometry, G B Thomas and Finney, Ninth Edition. My express purpose in presenting these few proofs is to emphasize that Calculus, is not just a recipe of calculation techniques. Or, even, a bit further, math is not just about calculation. I have a feeling that such thinking nurtured/developed at a young age, (while preparing for IITJEE Math, for example) makes one razor sharp.

We verify a few famous limits.

Formula 1:

If $|x|<1$, $\lim_{n \rightarrow \infty}x^{n}=0$

We need to show that to each $\in >0$ there corresponds an integer N so large that $|x^{n}|<\in$ for all n greater than N. Since $\in^{1/n}\rightarrow 1$, while $|x|<1$. there exists an integer N for which $\in^{1/n}>|x|$. In other words,

$|x^{N}|=|x|^{N}<\in$. Call this (I).

This is the integer we seek because, if $|x|<1$, then

$|x^{n}|<|x^{N}|$ for all $n>N$. Call this (II).

Combining I and II produces $|x^{n}|<\in$ for all $n>N$, concluding the proof.

Formula II:

For any number x, $\lim_{n \rightarrow \infty}(1+\frac{x}{n})^{n}=e^{x}$.

Let $a_{n}=(1+\frac{x}{n})^{n}$. Then, $\ln {a_{n}}=\ln{(1+\frac{x}{n})^{n}}=n\ln{(1+\frac{x}{n})}\rightarrow x$,

as we can see by the following application of l’Hopital’s rule, in which we differentiate with respect to n:

$\lim_{n \rightarrow \infty}n\ln{(1+\frac{x}{n})}=\lim_{n \rightarrow \infty}\frac{\ln{(1+x/n)}}{1/n}$, which in turn equals

$\lim_{n \rightarrow \infty}\frac{(\frac{1}{1+x/n}).(-\frac{x}{n^{2}})}{-1/n^{2}}=\lim_{n \rightarrow \infty}\frac{x}{1+x/n}=x$.

Now, let us apply the following theorem with $f(x)=e^{x}$ to the above:

(a theorem for calculating limits of sequences) the continuous function theorem for sequences:

Let $a_{n}$ be a sequence of real numbers. If $\{a_{n}\}$ be a sequence of real numbers. If $a_{n} \rightarrow L$ and if f is a function that is continu0us at L and defined at all $a_{n}$, then $f(a_{n}) \rightarrow f(L)$.

So, in this particular proof, we get the following:

$(1+\frac{x}{n})^{n}=a_{n}=e^{\ln{a_{n}}}\rightarrow e^{x}$.

Formula 3:

For any number x, $\lim_{n \rightarrow \infty}\frac{x^{n}}{n!}=0$

Since $-\frac{|x|^{n}}{n!} \leq \frac{x^{n}}{n!} \leq \frac{|x|^{n}}{n!}$,

all we need to show is that $\frac{|x|^{n}}{n!} \rightarrow 0$. We can then apply the Sandwich Theorem for Sequences (Let $\{a_{n}\}$, $\{b_{n}\}$ and $\{c_{n}\}$ be sequences of real numbers. if $a_{n}\leq b_{n}\leq c_{n}$ holds for all n beyond some index N, and if $\lim_{n\rightarrow \infty}a_{n}=\lim_{n\rightarrow \infty}c_{n}=L$,, then $\lim_{n\rightarrow \infty}b_{n}=L$ also) to  conclude that $\frac{x^{n}}{n!} \rightarrow 0$.

The first step in showing that $|x|^{n}/n! \rightarrow 0$ is to choose an integer $M>|x|$, so that $(|x|/M)<1$. Now, let us the rule (formula 1, mentioned above), so we conclude that:$(|x|/M)^{n}\rightarrow 0$. We then restrict our attention to values of $n>M$. For these values of n, we can write:

$\frac{|x|^{n}}{n!}=\frac{|x|^{n}}{1.2 \ldots M.(M+1)(M+2)\ldots n}$, where there are $(n-M)$ factors in the expression $(M+1)(M+2)\ldots n$, and

the RHS in the above expression is $\leq \frac{|x|^{n}}{M!M^{n-M}}=\frac{|x|^{n}M^{M}}{M!M^{n}}=\frac{M^{M}}{M!}(\frac{|x|}{M})^{n}$. Thus,

$0\leq \frac{|x|^{n}}{n!}\leq \frac{M^{M}}{M!}(\frac{|x|}{M})^{n}$. Now, the constant $\frac{M^{M}}{M!}$ does not change as n increases. Thus, the Sandwich theorem tells us that $\frac{|x|^{n}}{n!} \rightarrow 0$ because $(\frac{|x|}{M})^{n}\rightarrow 0$.

That’s all, folks !!

Aufwiedersehen,

Nalin Pithwa.

### Cauchy’s Mean Value Theorem and the Stronger Form of l’Hopital’s Rule

Reference: Thomas, Finney, 9th edition, Calculus and Analytic Geometry.

Continuing our previous discussion of “theoretical” calculus or “rigorous” calculus, I am reproducing below the proof of the finite limit case of the stronger form of l’Hopital’s Rule :

L’Hopital’s Rule (Stronger Form):

Suppose that

$f(x_{0})=g(x_{0})=0$

and that the functions f and g are both differentiable on an open interval $(a,b)$ that contains the point $x_{0}$. Suppose also that $g^{'} \neq 0$ at every point in $(a,b)$ except possibly at $x_{0}$. Then,

$\lim_{x \rightarrow x_{0}}\frac{f(x)}{g(x)}=\lim_{x \rightarrow x_{0}}\frac{f^{x}}{g^{x}}$ ….call this equation I,

provided the limit on the right exists.

The proof of the stronger form of l’Hopital’s Rule is based on Cauchy’s Mean Value Theorem, a mean value theorem that involves two functions instead of one. We prove Cauchy’s theorem first and then show how it leads to l’Hopital’s Rule.

Cauchy’s Mean Value Theorem:

Suppose that the functions f and g are continuous on $[a,b]$ and differentiable throughout $(a,b)$ and suppose also that $g^{'} \neq 0$ throughout $(a,b)$. Then there exists a number c in $(a,b)$ at which

$\frac{f^{'}(c)}{g^{'}(c)} = \frac{f(b)-f(a)}{g(b)-g(a)}$…call this II.

The ordinary Mean Value Theorem is the case where $g(x)=x$.

Proof of Cauchy’s Mean Value Theorem:

We apply the Mean Value Theorem twice. First we use it to show that $g(a) \neq g(b)$. For if $g(b)$ did equal to $g(a)$, then the Mean Value Theorem would give:

$g^{'}(c)=\frac{g(b)-g(a)}{b-a}=0$ for some c between a and b. This cannot happen because $g^{'}(x) \neq 0$ in $(a,b)$.

We next apply the Mean Value Theorem to the function:

$F(x) = f(x)-f(a)-\frac{f(b)-f(a)}{g(b)-g(a)}[g(x)-g(a)]$.

This function is continuous and differentiable where f and g are, and $F(b) = F(a)=0$. Therefore, there is a number c between a and b for which $F^{'}(c)=0$. In terms of f and g, this says:

$F^{'}(c) = f^{'}(c)-\frac{f(b)-f(a)}{g(b)-g(a)}[g^{'}(c)]=0$, or

$\frac{f^{'}(c)}{g^{'}(c)}=\frac{f(b)-f(a)}{g(b)-g(a)}$, which is II above. QED.

Proof of the Stronger Form of l’Hopital’s Rule:

We first prove I for the case $x \rightarrow x_{o}^{+}$. The method needs no  change to apply to $x \rightarrow x_{0}^{-}$, and the combination of those two cases establishes the result.

Suppose that x lies to the right of $x_{o}$. Then, $g^{'}(x) \neq 0$ and we can apply the Cauchy’s Mean Value Theorem to the closed interval from $x_{0}$ to x. This produces a number c between $x_{0}$ and x such that $\frac{f^{'}(c)}{g^{'}(c)}=\frac{f(x)-f(x_{0})}{g(x)-g(x_{0})}$.

But, $f(x_{0})=g(x_{0})=0$ so that $\frac{f^{'}(c)}{g^{'}(c)}=\frac{f(x)}{g(x)}$.

As x approaches $x_{0}$, c approaches $x_{0}$ because it lies between x and $x_{0}$. Therefore, $\lim_{x \rightarrow x_{0}^{+}}\frac{f(x)}{g(x)}=\lim_{x \rightarrow x_{0}^{+}}\frac{f^{'}(c)}{g^{'}(c)}=\lim_{x \rightarrow x_{0}^{+}}\frac{f^{'}(x)}{g^{'}(x)}$.

This establishes l’Hopital’s Rule for the case where x approaches $x_{0}$ from above. The case where x approaches $x_{0}$ from below is proved by applying Cauchy’s Mean Value Theorem to the closed interval $[x,x_{0}]$, where $x< x_{0}$QED.

### The Sandwich Theorem or Squeeze Play Theorem

It helps to think about the core concepts of Calculus from a young age, if you want to develop your expertise or talents further in math, pure or applied, engineering or mathematical sciences. At a tangible level, it helps you attack more or many questions of the IIT JEE Advanced Mathematics. Let us see if you like the following proof, or can absorb/digest it:

Reference: Calculus and Analytic Geometry by Thomas and Finney, 9th edition.

The Sandwich Theorem:

Suppose that $g(x) \leq f(x) \leq h(x)$ for all x in some open interval containing c, except possibly at $x=c$ itself. Suppose also that $\lim_{x \rightarrow c}g(x)= \lim_{x \rightarrow c}h(x)=L$. Then, $\lim_{x \rightarrow c}f(x)=c$.

Proof for Right Hand Limits:

Suppose $\lim_{x \rightarrow c^{+}}g(x)=\lim_{x \rightarrow c^{+}}h(x)=L$. Then, for any $\in >0$, there exists a $\delta >0$ such that for all x, the inequality $c implies $L-\in and $L-\in ….call this (I)

These inequalities combine with the inequality $g(x) \leq f(x) \leq h(x)$ to give

$L-\in

$L-\in

$-\in ….call this (II)

Therefore, for all x, the inequality $c implies $|f(x)-L|<\in$. …call this (III)

Proof for LeftHand Limits:

Suppose $\lim_{x \rightarrow c^{-}} g(x)=\lim_{x \rightarrow c^{-}}=L$. Then, for $\in >0$ there exists a $\delta >0$ such that for all x, the inequality $c-\delta implies $L-\in and $L-\in …call this (IV).

We conclude as before that for all x, $c-\delta implies $|f(x)-L|<\in$.

Proof for Two sided Limits:

If $\lim_{x \rightarrow c}g(x) = \lim_{x \rightarrow c}h(x)=L$, then $g(x)$ and $h(x)$ both approach L as $x \rightarrow c^{+}$ and as $x \rightarrow c^{-}$ so $\lim_{x \rightarrow c^{+}}f(x)=L$ and $\lim_{x \rightarrow c^{-}}f(x)=L$. Hence, $\lim_{x \rightarrow c}f(x)=L$. QED.

Let me know your feedback on such stuff,

Nalin Pithwa

### Maxima and Minima using calculus

Problem:

The vertices of an $(n+1)$-gon lie  on the sides of a regular n-gon and divide its perimeter into  parts of equal length. How should one construct the $(n+1)-$ gon so that its area is :

(a) maximum

(b) minimum

Hint only:

[One of the golden rule of solving problems in math/physics is to draw diagrams, as had benn emphasized by the maverick American physics Nobel Laureate, Richard Feynman. He expounded this technique even in software development. So, in the present problem, first draw several diagrams.]

There exists a side $B_{1}B_{2}$ of the $(n+1)$ -gon that lies entirely on a side $A_{1}A_{2}$ of the n-gon. Let $b=B_{1}B_{2}$ and $b=A_{1}A_{2}$. Show that $b=\frac{n}{n+1}a$. Then, for $x=A_{1}B_{1}$, we have $0 \leq x \leq \frac{n}{n+1}$ and the area S of the $(n+1)$ -gon is given by

$S(x)=\frac{\sin{\phi}}{2}\Sigma_{i=1}^{n}(\frac{i-1}{n+1}a+x)(\frac{n-i+1}{n+1}a-x)$

where $\phi=\angle{A_{1}A_{2}A_{3}}$. Thus, $S(x)$ is a quadratic function of x. Show that $S(x)$ is a minimal when $x=0$ or $x=\frac{a}{n+1}$ and $S(x)$ is maximal when $x=\frac{a}{2(n+1)}$.

Let me know if you have any trouble when you attempt it,

-Nalin Pithwa

### Triangle inequality and max-min

Here is a problem I culled from Prof. Titu Andreescu’s literature (Geometric maxima and minima) for IITJEE Mathematics:

Problem:

Find the greatest real number k such that for any triple of positive numbers a, b, c such that $kabc > a^{3}+b^{3}+c^{3}$, there exists a triangle with side lengths a, b, c.

Solution:

We have to find the greatest real number k such that for any a, b, $c > 0$ with $a + b \leq c$, we have $kabc \leq a^{3}+b^{3}+c^{3}$. First take $b=a$ and $c=2a$. Then, $2ka^{3} \leq 10a^{3}$, that is, $k \leq 5$. Conversely, let $k=5$. Set $c=a+b+x$, where $x \geq 0$. Then,

$a^{3}+b^{3}+c^{3}-5abc =2(a+b)(a-b)^{2}+(ab+3a^{2}+3b^{2})x+3(a+b)x^{2}+x^{3} \geq 0$.

QED.

More later,

Nalin Pithwa

### Maxima and minima — using calculus — for IITJEE Advanced Mathematics

Problem:

The length of the edge of the cube $ABCDA_{1}B_{1}C_{1}D_{1}$ is 1. Two points M and N move along the line segments AB and $A_{1}D_{1}$, respectively, in such a way that at any time t $(0 \leq t < \infty)$ we have $BM = |\sin{t}|$ and $D_{1}N=|\sin(\sqrt{2}t)|$. Show that MN has no maximum.

Proof:

Clearly, $MN \geq MA_{1} \geq AA_{1} =1$. If $MN=1$ for some t, then $M=A$ and $N=A_{1}$, which is equivalent to $|\sin{t}|=1$ and $|\sin{\sqrt{2}t}|=1$. Consequently, $t=\frac{\pi}{2}+k\pi$ and $\sqrt{2}t=\frac{\pi}{2}+n\pi$ for some integers k and n, which implies $\sqrt{2}=\frac{2n+1}{2k+1}$, a contradiction since $\sqrt{2}$ is irrational. This is why $MN >1$ for any t.

We will now show that MN can be made arbitrarily close to 1. For any integer k, set $t_{k}=\frac{\pi}{2}+k\pi$. Then, $|\sin{t_{k}}|=1$, so at any time $t_{k}$, the point M is at A. To show that N can be arbitrarily close to $A_{1}$ at times $t_{k}$, it is enough to show that $|\sin(\sqrt{2}t_{k})|$ can be arbitrarily close to 1 for appropriate choices of k.

We are now going to use Kronecker’s theorem:

If $\alpha$ is an irrational number, then the set of numbers of the form $ma+n$where m is a positive integer while n is an arbitrary integer, is dense in the set of all real numbers. The latter means that every non-empty open interval (regardless of how small it is) contains a number of the form $ma+n$.

Since $\sqrt{2}$ is irrational, we can use Kronecker’s theorem with $\alpha=\sqrt{2}$. Then, for $x=\frac{1-\sqrt{2}}{2}$, and any $\delta>0$, there exist integer $k \geq 1$ and $n_{k}$ such  that $k\sqrt{2}-n_{k} \in (x-\delta, x+\delta)$. That is, for $\in_{k}=\sqrt{2}k+\frac{\sqrt{2}}{2}-\frac{1}{2}-n_{k}$ we have $|\in_{k}|<\delta$. Since $\sqrt{2}(k+\frac{1}{2})=\frac{1}{2}+n_{k}+\in_{k}$, we have

$|\sin(\sqrt{2}t_{k})|=|\sin \pi \sqrt{2}(k+\frac{1}{2})|=|\sin(\frac{\pi}{2}+n_{k}\pi+\in_{k}\pi)|=|\cos{(\pi \in_{k})}|$.

It remains to note that $|\cos{(\delta\pi)}|$ tends to 1 as $\delta$ tends to 0.

Hence, MN can be made arbitrarily close to 1.

Ref: Geometric Problems on Maxima and Minima by Titu Andreescu, Oleg Mushkarov, and Luchezar Stoyanov.

Thanks to Prof Andreescu, et al !

Nalin Pithwa


text:
User controller with method to display user profiles

I have few questions. Sorry if title is not a good fit. I could not think of a good one. I have read online about maintainability and elegance of the code. I have also seen few examples of DRY principal. I would like to ask

What is maintainability in PHP perspective? How to make code more elegant few examples will be appreciated? Finally How to use DRY principal in best possible manner?

I have a code piece which I would like to make maintainable, elegant and run DRY principal on it if possible. Sorry Its been years, I have not done coding. Looking for clear and concise answers.

Here is my code:

<?php

/**
* I have used this function because I am not Allowed to
* Change UserService.php Otherwise using namespaces is best way.
*/
require_once("UserService.php");

class UserController extends UserService {

/**
* This function gets the values
* like name, surname and date
*/
public function showUserAction() {

//this checks Whether the request if Post or not and dealt according.
try {
$is_active = htmlspecialchars(isset($_POST["active"]) ? $_POST["active"] : NULL);$from       = strtotime(isset($_POST["from"]) ?$_POST["from"] : NULL);
$to = strtotime(isset($_POST["to"]) ? $_POST["to"] : NULL);$name       = htmlspecialchars(isset($_POST["name"]) ?$_POST["name"] : NULL);
$surname = htmlspecialchars(isset($_POST["surname"]) ? $_POST["surname"] : NULL);$sort_by    = isset($_GET["sortby"]) ?$_GET["sortby"] : NULL;
$sort_col = isset($_GET["sortcol"]) ? $_GET["sortcol"] : NULL; //retrieving the data from parent$user_data = $this->getAllUsers();$sort = $sort_by === 'asc' ? 'desc' : 'asc'; if($sort_by != NULL && $sort_col != NULL) { // according to my defined behavior when ASC will be passed it will sort the array in ascending order and in reverse order if the DESC is passed usort($user_data, fn($a,$b) =>
//strnatcmp: compares the strings in natural order and it is Case Sensitive
$sort_by === 'asc' ? strnatcmp($a->{$sort_col},$b->{$sort_col}) : strnatcmp($b->{$sort_col},$a->{$sort_col})); } //printing the html, if this is not done. I could have to use O(n2). which is worst case scenario$table =    "
" .
"
" . "" . "ID" . "	".
"" . "Name" . "	" . "" . "Surname" . "	" . "" . "Active" . "	" . "" . "Last Login" . "	" . "" . "Picture" . "	" . "" . "Rating" . "	" . "
";
echo $table; //showing the data in rows foreach ($user_data as $data) { echo "
" . "" .$data->id . "	";
echo "" . $data->name . "	"; echo "" .$data->surname . "	";
echo "" . $data->active . "	"; echo "" .$data->last_login . "	";

$filename =$data->picture;
//Set width and height of the picture
$width = 100;$height = 100;

//get dimensions of the picture
list($width_orig,$height_orig) = getimagesize($filename);$ratio_orig = $width_orig/$height_orig;

if ($width/$height > $ratio_orig) {$width = $height*$ratio_orig;
} else {
$height =$width/$ratio_orig; } //Resample the image$image_p = imagecreatetruecolor($width,$height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p,$image, 0, 0, 0, 0, $width,$height, $width_orig,$height_orig);

// storing the images in thumbnails directory for reusability
$thumb = 'data/thumbnails/'.basename($filename);
imagejpeg($image_p,$thumb , 100);
echo "" . "" . "	"; imagedestroy($image_p);
imagedestroy($image); echo "" .$data->rating . "	" . "
";

//show the images, name, surname and last_login
echo "
". "" . "
Name: " .$data->name . "
" .
"
Surname: " . $data->surname . "
" . "
Last Login: " .$data->last_login . "
"
."
";
}
} catch (Throwable $t) { echo "The Following Errors must be solved : " .$t->getMessage();
}
}
}

$users = new UserController();$users->showUserAction();

• are you using some kind of MVC framework for your application? Feb 1, 2022 at 16:44
• Welcome to Code Review! I changed the title so that it describes what the code does per site goals: "State what your code does in your title, not your main concerns about it.". Feel free to edit and give it a different title if there is something more appropriate. Feb 1, 2022 at 16:57
• @Vogel612 kind of, I have one file UserService.php and other is UserController.php both have one function. UserService fetches the data and UserController displays it. Feb 1, 2022 at 17:33

• In your posted script, the following variables have no purpose and should be removed: $is_active, $from, $to, $name, $surname. This prevents me needing to explain why calling htmlspecialchars() on a null value is meaningless. • The $v = isset($v) ?$v : null pattern is replaceable with the null coalescing operator $v =$_GET['v'] ?? null;.
• Instead of $user_data, use a variable name that indicates that its payload will contain multiple users' data, perhaps $all_users.
• Loose comparisons like $sort_by != NULL can be simplified to $sort_by in the condition which is also a loose, falsey comparison.
• I don't know what the $sort_col values are like, but you may want to try the replacement of iterated strnatcmp() calls with the spaceship operator -- $a->{$sort_col} <=>$b->{$sort_col}. If this lets you down, then stay with strnatcmp(). • Rather than re-calling strnatcmp() to do the reverse sorting direction, you can declare a variable to hold 1 for asc and -1 for desc, then multiply the integer returned by the three-way comparison by this factor to adjust the sorting direction. • I think that $sort should be better named $toggled_sort because you are inverting the value to be used in the html links to be later rendered. • You can build potentially shorter hyperlinks by not requiring the ascending sorting direction to be declared in the url. If there is a sorting column and no sorting direct, assume ascending sorting. • You may be only quickly drafting this script, but the border attribute is now an obsolete attribute and should be replace with proper css styling. • I find it to be unpredictable in terms of UX, then if I sort on one column, then decide to sort on a different column -- that column's sorting direction will be the opposite of the first column's sorting direction. In other words, whenever a new column is to be sorted, it should default to ascending. This means you will need to build this logic into the code. • To avoid messy concatenation while building your HTML markup, use template strings with placeholders so that you can printf(). This will keep your script very readable and easier to maintain. • You should DEFINITELY not be resizing all of your users' images on every display of your users. The thumb creation should be done only once -- at time of upload. You do not want to be exhausting resources and slowing down page load times by adding this action in this script. • As a overarching critique, I do not like the generation of HTML within a controller. HTML generation is the role of the view. This means we should (almost) never see echoing from a controller. • If you want to receive POSTed data somewhere, handle it with a script that is not decided to display users. Property separation of responsibilities will help you to form more professional projects. • It is invalid markup to jam a
 inside of a
 element (after the
 of each iteration), this needs to be redesigned. • If you plan to use concatenation, there is no reason to concatenate static strings to static strings, just write them together and only concatenate when you have something non-static to append. Here are some untested suggestions: Controller: public function showUsers(): void {$all_users = $this->getAllUsers();$sort_col = $_GET["sortcol"] ?? null;$sort_by = $_GET["sortby"] ?? null; if ($sort_col) {
$direction =$sort_by === 'desc' ? -1 : 1;
usort($all_users, fn($a, $b) =>$direction * ($a->{$sort_col} <=> $b->{$sort_col}));
}
sendToUserView(compact(['all_users', 'sort_col', 'sort_by']));
}

View:

$table_template = <<<HTML

 ID	 Name	 Surname	 Active	 Last Login	 Picture	 Rating
 %s
 HTML;$row_template = <<<HTML

%d
%s
%s
%s
%s

%s

HTML;

$rows = array_map($all_users,
fn($user) => sprintf($row_template,
$user->id$user->name
$user->surname$user->active
$user->last_login$user->thumb
$user->rating ) ); printf($table_template,
$sort_col === 'name' &&$sort_by !== 'desc' ? '&sortby=desc' : '',
$sort_col === 'rating' &&$sort_by !== 'desc' ? '&sortby=desc' : '',
implode("\n", \$rows)
);


text:
# Harmonic Overdose

Algebra Level 5

If $M=\sum_{n=1}^{1728}H_{n}H_{1729-n}$ and $E=2\sum_{n=1}^{1728}[H_{n}(\frac{1729-n}{n+1})]$ where $H_{n}=\sum_{n=1}^{n}\frac{1}{n}$. Find $\frac{1729M}{E}+\frac{1729E}{M}$

×


text:
CSES Problem Set

# Subarray Sums I

CSES - Subarray Sums ICSES - Subarray Sums I

 Time limit: 1.00 s Memory limit: 512 MB

Given an array of $n$ positive integers, your task is to count the number of subarrays having sum $x$.

Input

The first input line has two integers $n$ and $x$: the size of the array and the target sum $x$.

The next line has $n$ integers $a_1,a_2,\dots,a_n$: the contents of the array.

Output

Print one integer: the required number of subarrays.

Constraints
• $1 \le n \le 2 \cdot 10^5$
• $1 \le x,a_i \le 10^9$
Example

Input:
5 7 2 4 1 2 7

Output:
3


text:
totally revamped, still TOTALly TRASH

# The $$n$$-th time is the charm

## Contents

What do you know?

$\ln x = \int_{-\infty}^x \frac 1 y \, dy$

With plots:

import matplotlib.pyplot as plt

plt.figure()
plt.plot([0,1,2,3,4], [1,2,3,4,5])
plt.title('This is an example figure')

And references even!1

TODOs:

• Read the Pijul SHA to generate the footer correctly. It is probably possible to adapt this: githash
• Refurbish the template to include links to other platforms (Twitter etc.)
• Generate CV as PDF and HTML
• Clean up the Haskell source, also looking at this The code is discussed here I want to be able to combine with other compilers without triple somersaults:
• Try to create a pandoc-bokeh filter based on pandoc-pyplot.

### References

(1) Thom, A. J. W. Stochastic Coupled Cluster Theory. Phys. Rev. Lett. 2010, 105 (26), 263004. https://doi.org/10.1103/PhysRevLett.105.263004.


text:
# RMO 2015

Find number of triplets of integers $$a,b,c$$ such that $$a^{2}= bc +1$$ and $$b^{2} = ac + 1$$

×


text:
×

# 90 is not equal 90

Given that $$AB=DC,DA$$perpendicular to $$AB$$ . Let M and N be the perpendicular bisector of $$AD$$ and $$BC$$ respectively. These two perpendicular bisector intersect in $$E$$. Joining $$AE,ED,EB,EC$$ since $$EM$$ is perpendicular bisector $$AE=ED$$ since $$EN$$ is perpendicular bisector $$EB=EC$$ $$\triangle EAB=\triangle EDC$$ (SSS) $$\angle EAB=\angle EDC$$ $$\angle EAD=\angle EDA$$ we have $$\angle MAB=\angle MDC$$ obviously it is impossible.

Note by Choi Chakfung
1 year, 10 months ago

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold
- bulleted- list
• bulleted
• list
1. numbered2. list
1. numbered
2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1paragraph 2

paragraph 1

paragraph 2

[example link](https://brilliant.org)example link
> This is a quote
This is a quote
    # I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
MathAppears as
Remember to wrap math in $$...$$ or $...$ to ensure proper formatting.
2 \times 3 $$2 \times 3$$
2^{34} $$2^{34}$$
a_{i-1} $$a_{i-1}$$
\frac{2}{3} $$\frac{2}{3}$$
\sqrt{2} $$\sqrt{2}$$
\sum_{i=1}^3 $$\sum_{i=1}^3$$
\sin \theta $$\sin \theta$$
\boxed{123} $$\boxed{123}$$

Sort by:

Here's an accurate graphic of how it should look like

We can see that $$\Delta ABE$$ is congruent with $$\Delta DCE$$, and the paradox then vanishes.

- 1 year, 10 months ago

×


text:
How to add spoiler tags, edit posts, add images etc. How to - a user's guide to the new version of Boards
Mods please check the Moderators Group for an important update on Mod tools. If you do not have access to the group, please PM Niamh. Thanks!

# Latex Table Problem

• Registered Users Posts: 5,695 ✭✭✭

Hi folks. I could do with a bit of help. I have the following code for a table. What I want is for the text in the cells to be centred vertically as well as horizontally. Any help would be appreciated!

\begin{document}
\begin{center}
{\footnotesize
\begin{tabular}{ | p{2cm} | c | c | c | c | c | c |}
\hline
Time in days from previous earthquake & $0\leq x< 100$ & $100\leq x< 200$ & $200\leq x< 300$ & $300\leq x< 400$ & $400\leq x< 500$ \\ \hline
Number of earthquakes & 31 & 24 & 12 & 14 & 8 \\ \hline
\end{tabular}
}
\end{center}
\end{document}

• The default c or 'center' command should do that already for you. Is there any particular reason to use the p(2cm)? I'd just use |c| all the way let LaTeX decide the spacing distances it requires.

hth

• I need the P{2cm} to make latex wrap the text in the first column. It will push the table off the page if I don't.

The c centres the text horizontally for me but I don't know how to centre it vertically too. That's my problem.

• Ack! My bad. Should have seen that. Apologies.

Well such is the excitement of my saturday night I spent the last hour tweaking and messing with the tabular environment and I (sorta) stumbled upon a solution.

\begin{tabular}{ | p{2.5cm} | c | c | c | c | c | c |}
\hline
Time in days &&&&&\\
from previous
& $0\leq x< 100$ & $100\leq x< 200$ & $200\leq x< 300$ & $300\leq x< 400$ & $400\leq x< 500$ \\
earthquake &&&&&\\
\hline

In so far as I can tell without changing package there's no other solution. Changing package and the best option seems tabu, but reading up on the documentation implies it's no longer supported so you may end up writing a document only to find a few months down the road it doesn't render correctly.
Failing that there was tabulary which kind of did what you want but the inequalities looked really ugly. Fugly actually.

Most aesthetic solution I got is above but I may return to this in a wee while.

• Thanks for your efforts. In the end I scoured the internet for some existing code to rob!

This seems to work perfectly although there is a lot of stuff in the code that I am not familiar with.

\begin{table}[h]
\begin{center}
{\footnotesize
\begin{tabular}{| >{\centering\arraybackslash}m{0.8in} | >{\centering\arraybackslash}m{0.8in} | >{\centering\arraybackslash}m{0.9in} | >{\centering\arraybackslash}m{0.9in} |>{\centering\arraybackslash}m{0.9in} |>{\centering\arraybackslash}m{0.9in} |}\hline
Time in days from previous earthquake & $0\leq x< 100$ & $100\leq x< 200$ & $200\leq x< 300$ & $300\leq x< 400$ & $400\leq x< 500$\\[0ex] \hline
Number of earthquakes & 31 & 24 & 12 & 14 & 8 \\[0ex] \hline
\end{tabular}
}
\end{center}
\end{table}


text:
# Figure 7

 Resolution of $t_{\rm{ev}}^{\rm{TOF}}$ (top) and $t_{\rm{ev}}^{\rm{Best}}$ (bottom) as a function of the TOF track multiplicity for pp collisions at $\sqrt{s}$= 7 TeV (star), p-Pb collisions at $\sqrt{s_{\rm NN}}$= 5.02 TeV (circle) and Pb-Pb collisions at $\sqrt{s_{\rm NN}}$= 2.76 TeV (square). As a reference, TOF track multiplicity=15 corresponds to 50% V0A multiplicity class in p-Pb and 80% centrality class in Pb-Pb.


text:
I got it working the problem was that .pyrc was not in the home
directory which I thought was %appdata% when in reality it is actually
in  c:\users\user which incidentally seems to wreak havoc with emacs'
initialization since it does in fact search %appdata% like expected.
There does not seem to be a way to specify where Pry should look for
its' initialization file so I have to start emacs before passing
anything through Pry even .emacslient "foo.rb" exhibits this annoying
behavior.

On Fri, Nov 11, 2011 at 7:08 PM, Josh Cheek <josh.cheek / gmail.com> wrote:
> On Fri, Nov 11, 2011 at 11:33 AM, Kevin <darkintent / gmail.com> wrote:
>
>> Does anyone know the correct way to configure Pry's editor variable on
>> Windows? I use Emacs so I took the wiki entry Pry.config.editor = proc { |
>> file, line| "emacsclient +#{line} #{file}" }
>>
>> However when I run the edit command the script is executed rather than
>> being opened in Emacs. Am I missing something?
>>
>
>
> I just gave that a try (I'm on Mac, though) and it worked for me. It also
> seems to be what the docs say to do (
> https://github.com/pry/pry/wiki/Editor-integration#wiki-Set_editor)
>
> So, some things to look at is do you have the emacs server started? (On
> mine, at least, I needed to start a server)
>
> Is the emacsclient in your path? (ie does it work if you run it from the
> command line, outside of pry?)
>
> Are you invoking it with the edit-method command? (
> https://github.com/pry/pry/wiki/Editor-integration#wiki-Edit_method)
>


text:
## LSU Historical Dissertations and Theses

1989

Dissertation

#### Degree Name

Doctor of Philosophy (PhD)

Chris H. Greene

#### Abstract

A new model for a class of heteronuclear diatomic molecules is presented. This model readily combines multichannel quantum defect theory (MQDT) with a nonperturbative Fermi-type analysis. Applications to a series of alkali-He dimers, such as CsHe, have shown that this very simple model can give results (e.g. Born-Oppenheimer potential curves) very close to those from more elaborated methods (e.g. $\ell$-dependent pseudopotential method). Applications to heteronuclear rare gas dimers, such as ArXe, give the first detailed interpretation and classification of some of the observed spectra, which are too complicated to be studied by conventional molecular methods. Another MQDT application is also presented. The photoionization of HD is studied with a method that has been well developed for H$\sb2$. The use of the same method as that for H$\sb2$ results in the conclusion that the g-u mixing effect in HD is negligible in energy regions far from dissociation thresholds. Some experimental observations of HD photoionization are accounted for in great detail by this theoretical study.

110

COinS


text:
# Maybe important notice for WS 2300 La-crosse

• Hi all
If you use batteries only for power to console ,and to remote sensor.
Maybe you have notice this : if the batteries is at low level,you can to have
yet data to display (all the data work very fine) ,but suddenly it can to cut
the comunication with pc .
This problem i had this days,and i saw my batteries it is very low level ,i
measurement it one by one with a multimeter and it show only 0,9 volt every one
.It was alcaline batteries.
After i replace it and the comunicate with pc comes again and all it is ok .

Best regards from Greece
Dimitris


text:
RUS  ENG JOURNALS   PEOPLE   ORGANISATIONS   CONFERENCES   SEMINARS   VIDEO LIBRARY   PERSONAL OFFICE
 General information Latest issue Archive Impact factor Guidelines for authors Submit a manuscript Search papers Search references RSS Latest issue Current issues Archive issues What is RSS

 TMF: Year: Volume: Issue: Page: Find

 TMF, 2017, Volume 192, Number 1, Pages 89–102 (Mi tmf9280)

Ultraviolet divergences in $D=8$ $N=1$ supersymmetric Yang–Mills theory

D. I. Kazakovab, D. E. Vlasenkoc

a Bogoliubov Laboratory of Theoretical Physics, Joint Institute for Nuclear Research, Dubna, Moscow Oblast, Russia
b Moscow Institute of Physics and Technology (State University), Dolgoprudny, Moscow region, Moscow Oblast, Russia
c Physics Faculty, Southern Federal University, Rostov-on-Don, Russia

Abstract: We consider the leading and subleading UV divergences for the four-point on-shell scattering amplitudes in the $D=8$ $N=1$ supersymmetric Yang–Mills theory in the planar limit for ladder-type diagrams. We obtain recurrence relations that allow obtaining the leading and subleading divergences in all loops purely algebraically starting from the one-loop diagrams (for the leading poles) and the two-loop diagrams (for the subleading poles). We sum the leading and subleading divergences over all loops using differential equations that are generalizations of the renormalization group equations to nonrenormalizable theories. We discuss the properties of the obtained solutions and the dependence of the constructed counterterms on the scheme.

Keywords: amplitude, maximal supersymmetry, UV divergence.

 Funding Agency Grant Number Russian Foundation for Basic Research 17-02-0087217-0232-00837 This research was supported by by the Russian Foundation for Basic Research (Grant Nos. 14-02-00494 and 17-0232-00837).

DOI: https://doi.org/10.4213/tmf9280

Full text: PDF file (571 kB)
First page: PDF file
References: PDF file   HTML file

English version:
Theoretical and Mathematical Physics, 2017, 192:1, 1016–1027

Citation: D. I. Kazakov, D. E. Vlasenko, “Ultraviolet divergences in $D=8$ $N=1$ supersymmetric Yang–Mills theory”, TMF, 192:1 (2017), 89–102; Theoret. and Math. Phys., 192:1 (2017), 1016–1027

Citation in format AMSBIB
\Bibitem{KazVla17}
\by D.~I.~Kazakov, D.~E.~Vlasenko
\paper Ultraviolet divergences in $D=8$ $N=1$ supersymmetric Yang--Mills
theory
\jour TMF
\yr 2017
\vol 192
\issue 1
\pages 89--102
\mathnet{http://mi.mathnet.ru/tmf9280}
\crossref{https://doi.org/10.4213/tmf9280}
\elib{http://elibrary.ru/item.asp?id=29438858}
\transl
\jour Theoret. and Math. Phys.
\yr 2017
\vol 192
\issue 1
\pages 1016--1027
\crossref{https://doi.org/10.1134/S0040577917070066}


text:
# Identify the type of planning used to develop multiple-year plans based on a situational analysis, competitive assessments, and external factors of the organization.

###### Question:

Identify the type of planning used to develop multiple-year plans based on a situational analysis, competitive assessments, and external factors of the organization.

### "The general legal doctrine that holds one person responsible for the torts committed by another because of the relationship they have to each other is _______________"

"The general legal doctrine that holds one person responsible for the torts committed by another because of the relationship they have to each other is _______________"...

### Write V- 5in simplest radical form

Write V- 5in simplest radical form...

### What parts of the world are not included? Why do you think they are not included

What parts of the world are not included? Why do you think they are not included...

### What does the term lockout/ragout refer to?

What does the term lockout/ragout refer to?...

### Personal Stress1. Identify and then address the problemThe current thing that consistently stresses me out is

Personal Stress1. Identify and then address the problemThe current thing that consistently stresses me out is...

### Helppp?? tysvmmmmmmmmmmmmmm

Helppp?? tysvmmmmmmmmmmmmmm...

### The sum of a rational number and an irrational number ?

The sum of a rational number and an irrational number ?...

### Why is agriculture in grasslands more productive than agriculture in rainforests?

Why is agriculture in grasslands more productive than agriculture in rainforests?...

### Car A began a journey from a point at 9 am, traveling at 30 mph. At 10 am car B started traveling from the same point at 40 mph in the same direction as car A. At what time will car B pass car A?

Car A began a journey from a point at 9 am, traveling at 30 mph. At 10 am car B started traveling from the same point at 40 mph in the same direction as car A. At what time will car B pass car A?...

### 12 is a Prime number true or false

12 is a Prime number true or false...

### What is the circumference of a circle with a diameter of 21 m? (use for pi) 88 m 22 m 66 m 44 m

What is the circumference of a circle with a diameter of 21 m? (use for pi) 88 m 22 m 66 m 44 m...

### Why might leadership be over glorified

Why might leadership be over glorified...

### A scientist needs 10 liters of a 20% acid solution for an experiment, but she has only a 5% solution and a 40% solution. To the nearest tenth of a liter, about how many liters of the 5% and the 40% solutions should she mix to get the solution she needs?A) Choose the equation to match the situation. A. (0.20)(10) = 0.05x + 0.40x B. (0.20)(10) = 0.05x + 0.40(10 – x) C. (0.20)(10) = 0.05(10) + 0.40(10 – x) D. (0.20)(10) = 0.05(10 – x) + 0.40(10 – x)B) Solution ??? liters of 5% ??? liters of 40%

A scientist needs 10 liters of a 20% acid solution for an experiment, but she has only a 5% solution and a 40% solution. To the nearest tenth of a liter, about how many liters of the 5% and the 40% solutions should she mix to get the solution she needs?A) Choose the equation to match the situation. ...

### Why is it important to keep people's "intersections" or complex identities in mind?

Why is it important to keep people's "intersections" or complex identities in mind?...

### Jorge will flip two quarters at the same time. Complete the tree diagram, and then list the sample space of this compound event. Use H for heads and I for tails.

Jorge will flip two quarters at the same time. Complete the tree diagram, and then list the sample space of this compound event. Use H for heads and I for tails....

### What happens to most of the nitrogen in a plant when the plant dies

what happens to most of the nitrogen in a plant when the plant dies...


text:
1. Test comparison

Resolving a list of exercise these two exercises I could not

Determined using the comparison test

1) $\sum_{n=1}^{\infty} \frac{(n+1)}{n^3}$

2) $\sum_{n=0}^{\infty} \frac{n^2+1}{n^3+1}$

2. Originally Posted by Apprentice123
Resolving a list of exercise these two exercises I could not

Determined using the comparison test

1) $\sum_{n=1}^{\infty} \frac{(n+1)}{n^3}$

2) $\sum_{n=0}^{\infty} \frac{n^2+1}{n^3+1}$
The limit comparison test says that:

• If the limit of a[n]/b[n] is positive, then the sum of a[n] converges if and only if the sum of b[n] converges.
• If the limit of a[n]/b[n] is zero, and the sum of b[n] converges, then the sum of a[n] also converges.
• If the limit of a[n]/b[n] is infinite, and the sum of b[n] diverges, then the sum of a[n] also diverges.

For the first one, compare it to $\frac{1}{n^2}$. $\lim_{n\to\infty}\frac{\frac{(n+1)}{n^3}}{\frac{1} {n^2}} = 1$, so the sum converges because $\sum_{n=1}^{\infty}\frac{1}{n^2}$ does.

For the second one, compare it to $\frac{1}{n+1}$. $\lim_{n\to\infty}\frac{\frac{n^2+1}{n^3+1}}{\frac{ 1}{n+1}}=1$, so the sum diverges because $\sum_{n=0}^{\infty}\frac{1}{n+1}$ does.

3. Originally Posted by redsoxfan325
The limit comparison test says that:

• If the limit of a[n]/b[n] is positive, then the sum of a[n] converges if and only if the sum of b[n] converges.
• If the limit of a[n]/b[n] is zero, and the sum of b[n] converges, then the sum of a[n] also converges.
• If the limit of a[n]/b[n] is infinite, and the sum of b[n] diverges, then the sum of a[n] also diverges.

For the first one, compare it to $\frac{1}{n^2}$. $\lim_{n\to\infty}\frac{\frac{(n+1)}{n^3}}{\frac{1} {n^2}} = 1$, so the sum converges because $\sum_{n=1}^{\infty}\frac{1}{n^2}$ does.

For the second one, compare it to $\frac{1}{n+1}$. $\lim_{n\to\infty}\frac{\frac{n^2+1}{n^3+1}}{\frac{ 1}{n+1}}=1$, so the sum diverges because $\sum_{n=0}^{\infty}\frac{1}{n+1}$ does.

Thank you very much

4. i read comparison test, so we can actually use the direct comparison test.

1) $\frac{n+1}{n^{3}}\le \frac{2n}{n^{3}}=\frac{2}{n^{2}}.$

2) $\frac{n^{2}+1}{n^{3}+1}>\frac{n^{2}}{2n^{3}}=\frac {1}{2n}.$

As long as $n\ge1.$

5. Originally Posted by Krizalid
i read comparison test, so we can actually use the direct comparison test.

1) $\frac{n+1}{n^{3}}\le \frac{2n}{n^{3}}=\frac{2}{n^{2}}.$

2) $\frac{n^{2}+1}{n^{3}+1}>\frac{n^{2}}{2n^{3}}=\frac {1}{2n}.$

As long as $n\ge1.$
I have a doubt.
If I have one series $a_n$ I want to determine the convergence, found that the series $b_n$ is convergent, but $b_n$ > $a_n$ up to a value of n, not for all values of n. The series $a_n$ is convergent ?

6. Originally Posted by Apprentice123
I have a doubt.
If I have one series $a_n$ I want to determine the convergence, found that the series $b_n$ is convergent, but $b_n$ > $a_n$ up to a value of n, not for all values of n. The series $a_n$ is convergent ?
Not necessarily. If you are comparing $a_n$ to $b_n$ and you know that $b_n$ converges, $a_n\leq b_n$ for all but finitely many $n$ will tell you that $a_n$ converges.

For example, say $b_n$ converges. You compare $a_n$ to $b_n$ and find:

1.) $\left\{\begin{array}{lr}a_nb_n &: n>1000\end{array}\right\}$ $a_n$ does not necessarily converge.

2.) $\left\{\begin{array}{lr}a_n>b_n &: n\leq 1000\\a_n1000\end{array}\right\}$ $a_n$ will converge.

Note that my choice of 1000 was arbitrary.

7. Originally Posted by redsoxfan325
Not necessarily. If you are comparing $a_n$ to $b_n$ and you know that $b_n$ converges, $a_n\leq b_n$ for all but finitely many $n$ will tell you that $a_n$ converges.

For example, say $b_n$ converges. You compare $a_n$ to $b_n$ and find:

1.) $\left\{\begin{array}{lr}a_nb_n &: n>1000\end{array}\right\}$ $a_n$ does not necessarily converge.

2.) $\left\{\begin{array}{lr}a_n>b_n &: n\leq 1000\\a_n1000\end{array}\right\}$ $a_n$ will converge.

Note that my choice of 1000 was arbitrary.

If not for all but finitely many I can not say that converge?

8. No. It could possibly converge, but the comparison test does not prove it.

9. Originally Posted by redsoxfan325
No. It could possibly converge, but the comparison test does not prove it.
Thank you.

This series converge?

$\sum_{n=2}^{\infty} \frac{1}{n\sqrt{n^2-1}}$

10. Originally Posted by Apprentice123
Thank you.

This series converge?

$\sum_{n=2}^{\infty} \frac{1}{n\sqrt{n^2-1}}$
Try the limit comparison test with $b_n=\frac{1}{n^2}$.

$\lim_{n\to\infty}\frac{\frac{1}{n\sqrt{n^2-1}}}{\frac{1}{n^2}} = ???$

11. Originally Posted by redsoxfan325
Try the limit comparison test with $b_n=\frac{1}{n^2}$.

$\lim_{n\to\infty}\frac{\frac{1}{n\sqrt{n^2-1}}}{\frac{1}{n^2}} = ???$
This limit is not a number

12. Originally Posted by Apprentice123
This limit is not a number
$\lim_{n\to\infty}\frac{\frac{1}{n\sqrt{n^2-1}}}{\frac{1}{n^2}} = \lim_{n\to\infty}\frac{n}{\sqrt{n^2-1}} = \lim_{n\to\infty}\frac{n}{n\sqrt{1-1/n^2}} = \lim_{n\to\infty}\frac{1}{\sqrt{1-1/n^2}}=\frac{1}{\sqrt{1-0}}=1$

So $a_n$ converges because $b_n$ does.

13. Originally Posted by redsoxfan325
$\lim_{n\to\infty}\frac{\frac{1}{n\sqrt{n^2-1}}}{\frac{1}{n^2}} = \lim_{n\to\infty}\frac{n}{\sqrt{n^2-1}} = \lim_{n\to\infty}\frac{n}{n\sqrt{1-1/n^2}} = \lim_{n\to\infty}\frac{1}{\sqrt{1-1/n^2}}=\frac{1}{\sqrt{1-0}}=1$

So $a_n$ converges because $b_n$ does.
Thank you


text:
you are viewing a single comment's thread.

[–] 0 points1 point

sorry, this has been archived and can no longer be voted on

I suppose you could use the dirac measure. But non trivially you could look at things like the lp space and the sequence of reciprocals e.g. (1/k) or (1/p_k) with p_k the kth prime, both of these have infinite norm in l1 but are bounded in l2. You could for instance show that the sequence 1/F_k is bounded in l1 where F_k is the kth Perrin pseudo prime. Or even stronger something like 1/log(F_p) is bounded in lp for some p<∞. The connection to measure theory here is that you can define the norm of the lp space as an integral over Z using the counting measure.

Edit: some motivation why this may be useful: if the sequence 1/F_p is bounded in l1 then it must grow faster than the sequence of prime numbers such that lim_n->∞ p_n/F_n = 0 (If not you could find constants C1, C2 such that C1 p_n < F_n < C2 p_n for large enough n which would make the norm of 1/F_n unbounded).