# “How’s everybody doing?”

One of the things I’m always told by my colleagues who visit my classes is that I’m dry, serious, and even scary, and that’s not how they know me outside classroom. So, I’ve been working on different strategies I can use in my classes to make appear more friendly and more approachable in the first sight, even though my students learn that I am, during the semester. Aside from jokes, chitchat, and other small things, my students have shown a great interest in me asking them how they are doing that day, at the beginning of each class. I remember I was going to this dance class and from the very first day the instructor asked: “how’s everyone doing?”, then faced with a quite response, he asked it again and with more energy, the response was much louder this time, but he asked one more time and the class responded in unison and as loud as possible. That already had put all of us in a position that considered ourselves “there”. We were there to learn something and we had to respond. This kept happening everyday and also in a few other occasions when he asked if we’ve learned something or not. So I decided to do the same in my next course. Surprisingly, several students commented on this approach and said that it made the class atmosphere so much more friendlier at the beginning of each day of class. I think I can extend this so much more and learn a few lessons from it.

# Brain networks and the hiking trails

In the neuroscience community there’s a divide on whether there are functional connectivity networks in the brain. This is a very vaguely defined concept, although, one can think of it this way:

Imagine a mountain with several points of interest, places that people are interested in visiting for whatever reason. There are some spots at the bottom of the mountain that people get to the mountain, and start hiking up. If there’s a trail from where they start to where they wanna go, most people will take the trail. The trails define a physical network between various points of the mountain. The daily traffic defines a temporal dynamic network that evolves continuously. It is clear that the physical network of trails is a great indicator of the traffic network. That is, most of the traffic is on the trails.

On the other hand, from time to time there are people who want to explore other things, who want to take a shortcut, or maybe they just get lost; they take paths that are not a trail. These paths are often ignored, since there are nothing important or exciting about them. But there are times that someone takes a new path and finds something interesting, maybe a shorter way to get to another point or a more scenic way which is even longer, maybe there’s a waterfall along the path, maybe it is to a new unexplored area. As more and more people start walking on that path, the grass gets flattened, the vegetation changes and it slowly starts to becoming a trail. While this might cause some other existing trails become obscure and flowers and grass start growing on them and the trail goes away, like it never existed. The traffic network slowly changes the physical network.

The physical network of trails in the mountain are like the neurons being connected to each other via dendrites and axons. Neurons send electrical charges to each other throughout this network, but the charges can sometimes be transmitted via leakage, or other medium. The charges being sent are the people travelling on and off trails. The physical network is called the structural network and the traffic network is one of the instances of a network that some people refer to it as a functional network. Connecting every single pair of points in a mountain to each other via a straight (geodesic) line might make the travels faster and more efficient in terms of time, but it destroys the mountain, it is costly, and most of the trails will remain unused (and probably fade away) as some paths become more popular to travel. Hence, the question that what network is more likely to evolve as the structural network of the brain to get the transmissions done in a timely fashion but also to keep the number of connections to a minimum is an optimization problem that involves two competing parameters to be balanced out.

Picture from the amazing 2009 review paper by Bullmore and Sporns: Complex Brain Networks: Graph Theoretical Analysis of Structural and Functional Systems published in Nature Reviews Neuroscience, 10, 186-198.

This has brought up a lot of questions and experiments with small world graphs, scale free graphs, and even Ramanujan graphs and expanders. One of the best references out there written by one of the most active people in the field is “Networks of the Brain” by Olaf Sporns. And here is a review paper that explains the current (2013) state of the art on the topic. Check them out.

# Playing catch with Poison

My friend asked me this: Put balls into $n$ buckets uniformly at random and count $h$ the number of buckets with at least one ball in them. What is the expected value of number of balls $k$?

Let me do this differently. First the direct questions: Divide a square into $n$ smaller equal squares, and pick $k$ points in the big square uniformly at random. On average how many little squares have at least a point in them?

Here is a little sage demo and a sample output

def random_balls_in_buckets(np,ns,verbose=0):
#np = number of points
#ns = number of subdivisions of each side of the square
P = [(random(),random()) for i in range(np)] #chose the random points

plot_points = points(P,size=20,color='red')
plot_lines = [line([(0,i/ns),(1,i/ns)]) for i in range(ns)]+[line([(i/ns,0),(i/ns,1)]) for i in range(ns)]+[line([(0,1),(1,1)]),line([(1,0),(1,1)])]

A = matrix(ZZ,ns,ns)
for p in P:
i = floor(ns * p[0])
j = floor(ns * p[1])
A[i,j] = 1
nb = sum(sum(A))

if verbose == 1:
text_plot1 = text("number of balls:", (.49,1.1), horizontal_alignment='right', color='red')
text_plot2 = text(str(np), (.51,1.1), horizontal_alignment='left', color='red')
text_plot3 = text("number of buckets:", (.49,1.05), horizontal_alignment='right', color='blue')
text_plot4 = text(str(nb), (.51,1.05), horizontal_alignment='left', color='blue')
(plot_points+sum(plot_lines)+text_plot1+text_plot2+text_plot3+text_plot4).show()

return(nb)

np = 200 #number of points
ns = 10 #number of subdivisions of each side of the square
random_balls_in_buckets(np,ns,verbose=1)

The number of buckets without any balls in them follows the Poison distribution with $\lambda = \frac{k}{n}$, and parameter $0$. We want to count the number of non-empty buckets which will then be $h = n (1 - e^{-\frac{k}{n}})$. So, in order to guess how many balls where there if $h$ buckets are non-empty, all I need to do is to solve the above equation for $k$, which will tell me $k = -n \ln(1-\frac{h}{n})$. For example, if I have 87 non-empty buckets out of a total of 100 buckets, then I have thrown approximately 204 balls.

So, if I repeat the above experiment 1000 times,

#let's try this a few times
nB = [] #list of number of hit buckets for each trial
n = 1000
for i in range(n):
nB += [random_balls_in_buckets(np,ns,verbpse=0)]

P = [(i,nB[i]) for i in range(n)]
histogram = points(P,title='average: '+str(float(mean(nB))), axes_labels=['trial number','number of hit buckets'])
histogram.show()

then I’ll get

One natural question to ask is how many balls shall we throw to be 95% certain that 50% of the buckets are hit? I don’t remember my confidence intervals, but a numerical experiment shows:

ns = 10 #number of subdivisions of each side of the square
nB = [] #list of number of buckets for each trial
n = 1000 #number of points
for np in range(n):
nB += [random_balls_in_buckets(np,ns,verbpse=0)]

P = [(i,nB[i]) for i in range(n)]
histogram = points(P,title='average: '+str(float(mean(nB))), axes_labels=['number of balls','number of hit buckets'])
var('k')
curve = plot(ns^2 * (1-exp(-k/ns^2)) ,(k,0,1000),color='red',thickness=3)
(histogram+curve).show()

Of course the red curve is $h = n (1-e^{-\frac{k}{n}})$.

# What do you do when you are a bullied academic?

This past summer I was given a course in introductory linear algebra to teach. The topics of the course, as usual, start from solving systems of linear equations, and then matrices, determinant and some matrix algebra, then moved to some topics in geometry of $\mathbb{R}^n$, linear transformations, complex numbers, and ended with eigen-things and applications like Markov precesses, and an intro to dynamical systems.

To my surprise, nowhere in the syllabus was a hint of vector spaces, linear independence, basis etc. After I proposed to the course coordinator that I shall talk about these topics, at least to make my own life easier when I’m teaching eigenvectors etc, Claude Laflamme, who I thought was the coordinator of the course, told me I shall not (cannot) do that, and provided no specific reasons.

Then came the textbook, which is an “open” text from a company called “lyryx”. After reviewing the text, I went back to Claude Laflamme, and told him that I want to change the textbook to Gilber Strang’s introduction to linear algebra, as I see no benefit in having students reading the lyryx’s textbook. He insisted that the department insists on using “free” and “open source” books. Later I discovered that in the same semester the calculus had moved from the lyryx books to Stewart’s! I offered to use one of the open texts approved by American Institute of Mathematics (Beezer’s or Hefferon’s) because I love free and open things. It was then we he got serious (mad?) and told me that I am “not allowed” to use any other books unless I show that the part related to it in lyryx’s text is not well written, or is missing, and even it that case I “should” add to the text or edit it, since it is open.

Now, I understand that how open things work, I contribute to open software community, and I use them all the time. For the past 10-12 years I exclusively have used linux operating systems and “tried” to avoid “non-free” software, and slowly I’ve become more and successful in not using them. I write part of code that I use in my everyday computer usage, and I try to contribute as much to other open software (whether by bug report, testing, coding, or by buying coffee for the developers) as I can. But I don’t think that forcing people to use something, and to fix/develop it if it doesn’t do what they need, is a great way of spreading open culture. Personal ideas aside, I believe I have an academic freedom to choose the textbook, and modify the syllabus of a course that I am assigned to teach, and I feel like this has been violated.

It wasn’t until several months later that through a random search on something else, I realised Claude Laflamme is the president of the company lyryx! I highly appreciate a community work to provide better learning experiences for students, and I think we should see a lot more of these movements happening all around, but the thing that I am not very much sure about is if this act by the president of the company, who ironically is in charge of a few courses in the department is legal or not. In either case, I believe such behaviours should be reviewed and regulated.

The part that bothers me personally is that a lot of formal processes at the math department of the Univeristy of Calgary are done behind closed doors, and decisions are made in a case-by-case basis with only a few, and sometimes only one or two, people involved. See my post about decisions about which sessional instructor gets paid how much for each course in the math department, how there is no record of these decisions being made, and no clarifications when I asked about it. Similarly, I never could figure out that Claude Laflamme telling me I am not allowed to change the syllabus and textbook was his personal “recommendation” to me, or it was an “order” from a department official. Again, in either case, I believe either him or the department should be held responsible for it.

To finish the story, towards the end of the semester Claude Laflamme called me in, and told me that “some” of my students aren’t happy that I’m teaching vector spaces, bases, linear independence etc. After I asked about how many, he told me he had received complaints from two students, so he felt that he needs to warn me that I cannot “push” these topics in my assessments, which I obliged! So much for a course design, eh!

So, here is my question: Am I just overreacting to the whole thing? I know about all the political correctness, being a good citizen of the department, and all that jazz. I’m asking about mine vs. department’s rights/responsibilities. Because I feel abused in so many ways and I dunno where I stand legally.

# Octave/MATLAB resources

Andrew Ng in his Corsera course for machine learning provides the following links for resources for Matlab. I have had a terrible time remembering all the syntaxes in matlab (because they are so natural, no?) I’m putting them here so that I can access them later. The credit goes to Andrew Ng.

## Octave Resources

At the Octave command line, typing help followed by a function name displays documentation for a built-in function. For example, help plot will bring up help information for plotting. Further documentation can be found at the Octave documentation pages.

## MATLAB Resources

At the MATLAB command line, typing help followed by a function name displays documentation for a built-in function. For example, help plot will bring up help information for plotting. Further documentation can be found at the MATLAB documentation pages.

MathWorks also has a series of videos about various MATLAB features:

### Introduction to MATLAB

 Learning Module Learning Goals What is MATLAB? Introduce MATLAB The MATLAB Environment Navigate the command line, workspace, directory, and editor MATLAB Variables Use the assignment operator to define scalar variables MATLAB as a Calculator Perform arithmetic calculations with scalars and functions using MATLAB syntax and order of operations. Mathematical Functions Use MATLAB variables for input and output to functions. Examples include: COS, SIN, EXP, and NTHROOT.

### Vectors

 Learning Module Learning Goals Creating Vectors via Concatenation Create vectors by entering individual elements Accessing Elements of a Vector Access specific elements of a vector Vector Arithmetic Perform arithmetic calculations with vectors including element-wise operations Vector Transpose Use the transpose operator to convert between row and column vectors Creating Uniformly Spaced Vectors (The Colon Operator) Use the colon operator syntax to create vectors given the starting and ending values and the size of the interval Creating Uniformly Spaced Vectors (The LINSPACE Function) Use the LINSPACE function to create a vector.

### Visualization

 Learning Module Learning Goals Line Plots Create a line plot of a vector and customize plot markers and colors Annotating Graphs Label axes, add a title, and add a legend to a plot

### Matrices and Arrays

 Learning Module Learning Goals Creating Matrices Create matrices by directly entering scalars Array Creation Functions Create larger matrices and vectors with built in MATLAB functions such as ZEROS and EYE Accessing Elements of an Array Access elements of an array including entire columns or rows using row-column indexing. Array Size and Length Use built-in functions to determine array dimensions Concatenating Arrays Build larger arrays from smaller ones Matrix Multiplication Perform matrix multiplication and interpret error messages related to incompatible dimensions.

### Programming

 Learning Module Learning Goals Using the MATLAB Editor Write a script in the MATLAB Editor, break code into sections to execute, and find help on functions Logical Operators Use relational and logical operators to create logical variables for program control Conditional Data Selection Access and change elements for a vector the meet a specified criteria If-Else Statements Use if-else statements to control which lines of code are evaluated For Loops Repeat a sequence of commands a specified number of times While Loops Repeat a sequence of commands while a specified condition is true

# Why am I not attending JMM, but organizing a session?

For the past couple of years my colleagues and I organize a session at the JMM (Joint Mathematics Meeting). For the past couple of years that I’ve been in Canada I traveled back to US several times for various conferences and for visiting old friends that are like my family here. Last spring that the new US president announced the muslim ban I cancelled all of my plans for traveling to US (2 were planned and 2 were pending), and did not even bother to go for a visa interview. Until this Fall that went for interview for the January meeting. After all, I’m one of the organizers and I need to be there.

Everything was like before. The person interviewing me tried to find out if I have any close relatives in US, and after finding out that it is not the case, he tried to say something meaningful along the lines that: you lived in US before, you have come back several times after moving out, and every thing is fine, but the rules have changed, that was back then and this is now, and the rules are different now, we cannot issue you a visa, because of the presidential proclamations. Reject.

That day I went and bought a season pass to Lake Loiuse ski area. I think I know what I’m doing during the break 🙂

PS. If you are in San Diego, go to our session or emerging topics in graphs and matrices, there is an amazing list of speakers giving talks, including the one and only Fan Chung on A generalized Alon-Boppana bound and weak Ramanujan graphs, as our plenary speaker.

# On defending (human) rights and other issues

1. I’ve moved to US from Iran several years ago. One of the topics that always intrigued me is the history of white vs. native people. At the beginning I was interested in learning more about history. Then slowly I absorbed enough to put it in perspective and move to the current time. I tried to understand what is happening now in this interaction. In short, I can report that white people in general would believe they have done bad deeds to native people, they are sad, and they think something needs to be done to make up for all that ugly past. In practice, no one wants to do anything, after all it wasn’t them who did that bad things. Let the government, or even native people themselves, figure it out. In reality, what happens is that, for example, university of Wyoming makes it free for native high school graduates to attend the university for free. They come to school without having a reasonable high school education that has prepared them for college life. There are not much support for these kids. They fail courses, will go back to their reservations, and become a proof of failure. Aside from personal aspects, on two directions this hurts the whole culture, the public: One, the native people get discouraged from pursuing college degrees as they have many examples of failures and they don’t want to be that. Two, the funding agencies, government, and the general public will believe that even free education cannot help these kids, so there “is” something wrong with them. No body will say it, because of political correctness, duh! But most people think that in their minds.