text:
Merging Overlapping DNA segments into 1 complete segment

Did this challenge for an employer (not under an NDA or anything) for a junior python-related position and wasn't selected. Unfortunately they couldn't offer feedback, and as this was my first stab at doing something in python, I really have no idea if maybe I missed something and it's not totally correct, or maybe it doesn't follow best practices in concern to Python. My overall runtime did end up being $\mathcal{O}(n^2)$ but couldn't think of a way to improve it. Anyways, I would appreciate any sort of feedback.

Challenge:

1. The input is at most 50 DNA sequences (i.e, the character set is limited to T/C/G/A) whose length does not exceed 1000 characters.
2. The sequences are given in FASTA format. These sequences are all different fragments of one chromosome.
3. The specific set of sequences you will get satisfy a very unique property: there exists a unique way to reconstruct the entire chromosome from these reads by gluing together pairs of reads that overlap by more than half their length. An example set of input strings is attached.
4. The output of your program should be this unique sequence that contains each of the given input strings as a substring.

My overall approach (assuming no redundant DNA segments) is to start off with a random sequence A and find other sequences containing A[0-X] that also overlap with sequence A. As I overlap, A[0-X] will keep changing. Once A[0-X] stops changing, I switch over to the other side of A and do the same thing.

Pseudocode of algorithm:

Start off with a random sequence A and find other sequences containing A[0-X].

Go through the list of sequences one by one
If a sequence B contains substring A[0-X]
Check for an overlap on the left end of sequence B
if there's an overlap combine the sequences
Re-assign new A[0-X]
A[0-X] hasn't changed? switch to other end of the sequence (looking at A[length-X, length])

At this point (built off of two ends as far as I can go) I know I have the entire piece, so leftover segments would just be enveloped completely.

Main function:

X = 10 # the length we're testing

def main():
# prompt user to open file
filename = input("Enter filename with same format as example.txt\n")

# try to open file and read it's contents

# if we succeeded
if sequences != None:

# build off of one sequence
checkSequence = sequences[0]
del sequences[0] # delete it from list

# build off of left end of checkSequence
checkSequence, sequences = buildAlgorithm(checkSequence, sequences, 0) # print(len(sequences))
# build off of right end of checkSequence
checkSequence, sequences = buildAlgorithm(checkSequence, sequences, 1) # print(len(sequences))

# write final sequence to file
fileCheckSequence = open('output.txt', 'w')
fileCheckSequence.write(checkSequence)
fileCheckSequence.close()

# write leftovers to file as well
fileCheckList = open('leftovers.txt', 'w')
for val in sequences:
fileCheckList.write(val)
fileCheckList.write("\n")
fileCheckSequence.close()
sys.exit(0)

Main work:

"""
Facilitates the search and adding on of sequences
Input:
checkSequence: Total sequence so far
sequences: list of sequences not used yet
flag: 0-> build off right end 1->build off left end
Output:
checkSequence, sequences
"""
def buildAlgorithm(checkSequence, sequences, flag):
if flag == 0:
keySequence = checkSequence[:X] # grab first 10 characters
else:
keySequence = checkSequence[-X:] # grab last 10 characters
# reverse for convenience, puts search value at 0
reverseKey = keySequence[::-1] # extended slice O(len(slice))

idx = 0 # counter for list of sequences
i = X-1 # counter for each individual sequence

# Go through and check for a matching sequence
while idx < len(sequences):
val = sequences[idx]
while i < len(val): # Not Boyer Moore, but has the whole word shift , grows O(n)
# start comparing at the Xth letter of sequence
cs = val[i]
ks = reverseKey[0] # end value of keySequence
# compare two letters
if cs == ks:
# if they match, compare entire chunks
if compareTwoSequences(val, reverseKey, i): # grows O(n)
beforeSequence = keySequence
"""
double check they can fit together, then compare
right or left chunk depending on if we're building
off right or left ends
"""
if flag == 0: # compare right part of sequence
if compareOverlap(checkSequence, val, i, 0): # grows O(n)
checkSequence = overlapSequences(checkSequence, val, i, 0)
keySequence = checkSequence[:X] # new keySequence
del sequences[idx] # delete that sequence
idx = 0
# it means we didn't accomplish anything, we're done
if beforeSequence == keySequence:
return checkSequence, sequences
else:
reverseKey = keySequence[::-1]
else: # compare left part of sequence
if compareOverlap(checkSequence, val, i, 1): # grows O(n)
checkSequence = overlapSequences(checkSequence, val, i, 1)
keySequence = checkSequence[-X:] # new keySequence
del sequences[idx] # delete that sequence
idx = 0 # start idx back to 0
# don't need to do it this time around
reverseKey = keySequence[::-1]
else:
# if not, check if cs is in subsequence at all
if not checkCs(reverseKey, cs):
i+=10 # skip over 10 spaces
i+=1
i = X-1 # reset position of i
idx+=1 # evaluate next sequence
return checkSequence, sequences

The rest of the functions:

"""
Checks whether a character exists within a given sequence
Input:
keySequence: given sequence
cs: character to search for
Output:
True (character exists within sequence), False (character DNE within  sequence)
"""
def checkCs(keySequence, cs):
idx = 0
while idx < len(keySequence):
if cs == keySequence[idx]:
return True
idx+=1
#if we got here, cs isn't in keySequence
return False

"""
Checks whether a given sequence exists in a longer sequence
Input:
checkSequence: longer sequence
reverseKey: short sequence who's length dictates X
i: index from where to start on longer sequence
Output:
True (they match), False (they do not match)
"""
def compareTwoSequences(checkSequence, reverseKey, i):
cs = checkSequence[i]
ks = reverseKey[0]

idx = 0

# compare starting from i and 0
while idx < len(reverseKey):
cs = checkSequence[i]
ks = reverseKey[idx]
if cs != ks:
return False
else:
idx+=1
i-=1

# if we made it here, they match
return True

"""
Checks if a beginning or end chunk of a shorter sequence exists in a longer     sequence
Input:
checkSequence: longer sequence
valSequence: shorter sequence
i: index of starting position for shorter sequence
flag: 0 (check beginning), 1 (check end)
Output:
True (they math), False (they do not match)
"""
def compareOverlap(checkSequence, valSequence, i, flag):
idx = i
# compare forward
if flag == 0:
idx1 = X-1
while idx < len(valSequence):
if valSequence[idx] != checkSequence[idx1]:
return False
idx+=1
idx1+=1
# compare backward
else:
idx1 = len(checkSequence) - 1
while idx > 0:
if valSequence[idx] != checkSequence[idx1]:
return False
idx-=1
idx1-=1
return True

"""
Combined two sequences where they overlap
Input:
checkSequence: original sequence
val: smaller sequence that will be added to checkSequence
i: index of val, where overlap starts
flag: 0 (overlap forwards), 1 (overlap backwards)
Output:
new compiled sequence
"""
def overlapSequences(checkSequence, val, i, flag):
sequenceChunk = ""
# overlap forward
if flag == 0:
idx = 0
while idx < i-9:
sequenceChunk = sequenceChunk + val[idx]
idx+=1
checkSequence = sequenceChunk + checkSequence
# overlap backwards
else:
idx = i+1
while idx < len(val):
sequenceChunk = sequenceChunk + val[idx]
idx+=1
checkSequence = checkSequence + sequenceChunk
return checkSequence

"""
Reads in file to extract sequences and input them into a list
Input: filename
Output: list of sequences or error
"""
try:
in_file = open(filename + ".txt", "r")
print ("File opened successfully\n")

sequenceBlock = "" # container for sequence
sequences = [] # list for sequence blocks, 50 of them this time around

while line:
# if we hit >Rosalind_#### line
if line[0] == ">":
# make sure there's something to store
if sequenceBlock:
# print("sequence block: " + sequenceBlock + "\n")
sequences.append(sequenceBlock)
sequenceBlock = "" # reset block
# else just add it to the sequence block
else:
sequenceBlock = sequenceBlock + line
# get the next line
line = in_file.readline().rstrip() # get rid of any trailing whitespaces

# add in the last sequence
sequences.append(sequenceBlock)

# when we're done, return this list
return sequences
in_file.close()
except IOError:
print("Cannot open file! See example.txt\n")
return None

I think primarily refactoring and readability are the issues here. It's quite hard to read what's going on here. In part, that's because you're doing a complex algorithm, but there's a lot more you could be doing to help people follow what your code does.

You have excessively long functions. buildAlgorithm is the entire algorithm in one function. Ideally, each function would have one specific job to do. Even if each function you write is only used once, it's worthwhile. Having a collection of smaller functions allows you to test easier, make changes easier and extend functionality.

However you definitely have repeat code. Your sequence comparisons should be a function. This isn't the right syntax, but you should refactor to something like this:

def compare():
checkSequence = overlapSequences(checkSequence, val, i, 0)
keySequence = checkSequence[:X] # new keySequence
del sequences[idx] # delete that sequence
idx = 0
# it means we didn't accomplish anything, we're done
if beforeSequence == keySequence:
return checkSequence, sequences
else:
reverseKey = keySequence[::-1]

Which could then be called like this:

if flag == 0: # compare right part of sequence
if compareOverlap(checkSequence, val, i, 0): # grows O(n)
compare()
else:
if compareOverlap(checkSequence, val, i, 1): # grows O(n)
compare(reverse=True)

This makes code much more readable too. You tend to use a lot of comments, but good function names and refactoring would help readability much more. As would good variable names. Part of why I didn't try to make your function valid is I would've needed to try discern what val, i, X and idx were. All names that mean practically the same thing, and tell me nothing about their use.

X = 10 # the length we're testing

Should be

TEST_LENGTH = 10

Now you don't need a comment, and every time this value is used you'll have a clearer understanding of what it's meant to be.


text:
# How do you write an algebraic expression for the phrase "a number subtracted from 18"?

$18 - x$
$18 - x$
where $x$ is a number.

format: plain


text:
# activation energy for diffusion of carbon in 1020 steel

Home > rock crusher machinery for sales > activation energy for diffusion of carbon in 1020 steel

### Evaluation of carbon diffusion in heat treatment of H13 ...

01/04/2015· Through this equation, it was found that the carbon activation energy is 20200 J/mol, which gives the carbon diffusivity in H13 steel to be somewhere around 1.97 × …Cited by: 11

### Comparison of the Activation Energies of the Formation of ...

The value of boron activation energy for SAE 1020 steel was estimated as 183.15 kJ/mol. The comparisons were made between the empirical values of the …

### Diffusion of carbon in stainless steels - ScienceDirect

steel = 0.19 exp (−37 400/RT). The activation energy for the diffusion of carbon in steels has been explained on the basis of alloying effect of the constituents in steels. The activation energy for the diffusion of carbon in steels has been explained on the basis of alloying effect of the constituents in …Cited by: 99

### Chapter 5: Diffusion in Solids

example: carbon _ iron self-diffusion: D=3x10-21 m2/s interdiffusion: D=2.4x10-12 m2/s Factors That Influence Diffusion Chapter 5 - 16 Diffusion and Temperature • Diffusion coefficient increases with increasing T. D = D o exp-Q d RT = pre-exponential [m2/s] = diffusion coefficient [m2/s] = activation energy [J/mol or eV/atom] = gas constant [8.314 J/mol-K]

### CARBON DIFFUSION COEFFICIENT IN ALLOYED FERRITE

diffusion activation energy calculated using (8) (in the temperature range of 350÷850°C) is ~ 89.1 kJ/mol. It is noticeably higher than the corresponding activation energy in

### Diffusivity of carbon in iron and steels at high ...

09/07/2008· We have measuredthe diffusivity of carbonin steel from 975 to 1075 °C up to 1.3% carbonconcentration by the steady‐state method. Our results are in agreement with previous measurementsof Smith and Wells, Batz, and Mehl in the regime of low temperatures and carbonconcentrations.Cited by: 129

### CHAPTER 8: Diffusion

For interstitial diffusion, E a is related to the energy required to move a dopant atom from one interstitial site to another. The values of E a are between 0.5 to 1.5 eV in both Si and GaAs. For vacancy diffusion, E a is related to both the energies of motion and formation of vacancies. Hence, E a for vacancy diffusion is larger than that for interstitial diffusion and is usually between 3 to 5 eV. For fast

### Diffusion of Cu in mild steel - ScienceDirect

PROCEDURE The thin-layer method (g~e) was used to measure the diffusivity of Cu in mild steel 1020 (00 per cent carbon) in which carbon was the main interstitial impurity present. A thin sheet of steel 1020 (thickness of 0020 in.) was cut into specimens of 1 X 1 cm. The specimens were annealed then polished. 64CU was obtained by activating Cu ...

### (c) A 1020 steel gear of nominal carbon content of | Chegg.com

(c) A 1020 steel gear of nominal carbon content of 0.2wt.% is be hardened through a carburizing heat treatment for 2 hours to increase its carbon concentration at a depth of 0.5 mm (from the surface) to 0.4 wt%. Assume that the carbon content at the surface is 0.9 wt.%, determine the heat treatment temperature that is required in this case.

### CARBON DIFFUSION COEFFICIENT IN ALLOYED FERRITE

Data used for calculating activation energies for carbon diffusion in 'pure' (a) and alloyed ferrite (Fe-X) (b−e) on the basis of experimental data [9] Table 1. Activation energy of carbon diffusion in the ferrite'pure' and Fe-wt.%X alloys (X = Si, Ni, Mo, Cr) Alloy

### The Activation Energy of the Static Fatigue (Creep of Steel)

Jan 26, 2005· The activation energy determined for steel corresponds to activation energy for the diffusion of sulfur in iron but corresponds also to the half of the sublimation enthalpy for iron. Therefore, the rate limiting step of the creep of steel at elevated temperatures may be a diffusion of interstitial atoms as well as a quasi-sublimation.

### Carbon Diffusion and Carburizing Parameter Selection ...

Sep 16, 2016· Diffusion theory indicates that the diffusion coefficient is determined by activation energy for diffusion and temperature: Equation 6 Where D 0 is a temperature-independent pre-exponential (m 2 /s), Q is the activation energy for diffusion (J/mol), R is the gas constant, 8.314 J/mol·K, and T is the absolute temperature ( K ).

### Mat Sci Homework 6 Solutions FA2013 - Olin

Textbook Problems: Diffusion 1. Let’s harden some steel by adding carbon near the surface! A carburizing process is carried out on a 0.10% C steel by introducing 1.0% C at the surface at 980 ºC. At this temperature, the iron has a face-centered cubic (fcc) crystal structure.

### Diffusion of carbon in bcc Fe in the presence of Si

tally determined C and Si diffusivities in bcc Fe, according to Pascheto and Johari30 for C the frequency prefactor D 0=6.61 10−7 m2/s and diffusion activation energy 31E=0.83 eV whereas ...

### (PDF) Carbon Diffusion Coefficient in Complexly Alloyed ...

A quantitative physical model for the calculation of the сarbon volume diffusion coefficient (CDC) in austenite containing both carbon and substitution alloying elements (SAE) was developed. The thermodynamic factor of CDC is calculated with an

### Diffusion | PDF | Diffusion | Activation Energy

Effect of Temperature on Diffusion • Dependence of rate of diffusion on temperature is given by D = Diffusivity m2/S Q D0 = Proportionality constant m2/S D D0 e RT Q = Activation energy of diffusing species J/mol Q R = Molar gas constant = 8.314 J/mol.K or ln D ln D0 T = Temperature (K) RT Q or log 10 D log 10 D0 2.303RT

### (PDF) CARBON DIFFUSION COEFFICIENT IN ALLOYED FERRITE

The determined activation energy of de-C in SiMo ductile iron was 182 kJ/mol at temperatures above 750 °C. This value is higher than 125 kJ/mol activation energy of carbon diffusion in 3.6% Si ...

### An Empirical Model for Carbon Diffusion in Austenite ...

Carbon diffusivity, D, in austenite is generally described by an Arrhenius equation of the form..... (1) where D0 is the diffusivity coefficient, Q is the activation energy of carbon diffusion in austenite, R is the gas constant, and T is absolute temperature. Values of D0 and Q can be determined from carbon diffusivity measurements at differ ...

### Diffusion of carbon in stainless steels - NASA/ADS

Using residual activity technique, diffusion of carbon-14 in 304, 347 and 316 steels has been studied in the temperature range of 450-1200°C. The temperature dependence of diffusivity could be expressed as Dc/304 s. steel = 6.18 exp (-44 610/ RT); Dc/347 s. steel = 0.35 exp (-40 140/ RT); Dc/316 s. steel = 0.19 exp (-37 400/ RT). The activation energy for the diffusion of carbon in steels has ...

### Diffusion and trapping of hydrogen in carbon steel at ...

Dec 01, 2020· 1. Introduction. The presence of interstitial hydrogen in steel produces a marked embrittlement that poses a severe risk to the integrity of structural components , .. Some papers have dealt experimentally with the hydrogen diffusion coefficient within the iron lattice , , .On the one hand, the experiments show a high dispersion due to different variables such as the test method, the purity of ...

### Diffusion | Materials Science and Engineering: An…

An FCC iron-carbon alloy initially containing 0.55 wt $\%$ C is exposed to an oxygen-rich and virtually carbon-free atmosphere at $1325 \mathrm{K}$ $\left(1052^{\circ} \mathrm{C}\right) .$ Under these circumstances the carbon diffuses from the alloy and reacts at the surface with the oxygen in the atmosphere that is, the carbon concentration at ...

### Diffusion of Cu in mild steel - ScienceDirect

PROCEDURE The thin-layer method (g~e) was used to measure the diffusivity of Cu in mild steel 1020 (00 per cent carbon) in which carbon was the main interstitial impurity present. A thin sheet of steel 1020 (thickness of 0020 in.) was cut into specimens of 1 X 1 cm. The specimens were annealed then polished. 64CU was obtained by activating Cu ...

### (c) A 1020 steel gear of nominal carbon content of | Chegg.com

(c) A 1020 steel gear of nominal carbon content of 0.2wt.% is be hardened through a carburizing heat treatment for 2 hours to increase its carbon concentration at a depth of 0.5 mm (from the surface) to 0.4 wt%. Assume that the carbon content at the surface is 0.9 wt.%, determine the heat treatment temperature that is required in this case.

### CARBON DIFFUSION COEFFICIENT IN ALLOYED FERRITE

Data used for calculating activation energies for carbon diffusion in 'pure' (a) and alloyed ferrite (Fe-X) (b−e) on the basis of experimental data [9] Table 1. Activation energy of carbon diffusion in the ferrite'pure' and Fe-wt.%X alloys (X = Si, Ni, Mo, Cr) Alloy

### The Activation Energy of the Static Fatigue (Creep of Steel)

Jan 26, 2005· The activation energy determined for steel corresponds to activation energy for the diffusion of sulfur in iron but corresponds also to the half of the sublimation enthalpy for iron. Therefore, the rate limiting step of the creep of steel at elevated temperatures may be a diffusion of interstitial atoms as well as a quasi-sublimation.

### Carbon Diffusion and Carburizing Parameter Selection ...

Sep 16, 2016· Diffusion theory indicates that the diffusion coefficient is determined by activation energy for diffusion and temperature: Equation 6 Where D 0 is a temperature-independent pre-exponential (m 2 /s), Q is the activation energy for diffusion (J/mol), R is the gas constant, 8.314 J/mol·K, and T is the absolute temperature ( K ).

### Mat Sci Homework 6 Solutions FA2013 - Olin

Textbook Problems: Diffusion 1. Let’s harden some steel by adding carbon near the surface! A carburizing process is carried out on a 0.10% C steel by introducing 1.0% C at the surface at 980 ºC. At this temperature, the iron has a face-centered cubic (fcc) crystal structure.

### Diffusion of carbon in bcc Fe in the presence of Si

tally determined C and Si diffusivities in bcc Fe, according to Pascheto and Johari30 for C the frequency prefactor D 0=6.61 10−7 m2/s and diffusion activation energy 31E=0.83 eV whereas ...

### (PDF) Carbon Diffusion Coefficient in Complexly Alloyed ...

A quantitative physical model for the calculation of the сarbon volume diffusion coefficient (CDC) in austenite containing both carbon and substitution alloying elements (SAE) was developed. The thermodynamic factor of CDC is calculated with an

### Diffusion | PDF | Diffusion | Activation Energy

Effect of Temperature on Diffusion • Dependence of rate of diffusion on temperature is given by D = Diffusivity m2/S Q D0 = Proportionality constant m2/S D D0 e RT Q = Activation energy of diffusing species J/mol Q R = Molar gas constant = 8.314 J/mol.K or ln D ln D0 T = Temperature (K) RT Q or log 10 D log 10 D0 2.303RT

### (PDF) CARBON DIFFUSION COEFFICIENT IN ALLOYED FERRITE

The determined activation energy of de-C in SiMo ductile iron was 182 kJ/mol at temperatures above 750 °C. This value is higher than 125 kJ/mol activation energy of carbon diffusion in 3.6% Si ...

### An Empirical Model for Carbon Diffusion in Austenite ...

Carbon diffusivity, D, in austenite is generally described by an Arrhenius equation of the form..... (1) where D0 is the diffusivity coefficient, Q is the activation energy of carbon diffusion in austenite, R is the gas constant, and T is absolute temperature. Values of D0 and Q can be determined from carbon diffusivity measurements at differ ...

### Diffusion of carbon in stainless steels - NASA/ADS

Using residual activity technique, diffusion of carbon-14 in 304, 347 and 316 steels has been studied in the temperature range of 450-1200°C. The temperature dependence of diffusivity could be expressed as Dc/304 s. steel = 6.18 exp (-44 610/ RT); Dc/347 s. steel = 0.35 exp (-40 140/ RT); Dc/316 s. steel = 0.19 exp (-37 400/ RT). The activation energy for the diffusion of carbon in steels has ...

### Diffusion and trapping of hydrogen in carbon steel at ...

Dec 01, 2020· 1. Introduction. The presence of interstitial hydrogen in steel produces a marked embrittlement that poses a severe risk to the integrity of structural components , .. Some papers have dealt experimentally with the hydrogen diffusion coefficient within the iron lattice , , .On the one hand, the experiments show a high dispersion due to different variables such as the test method, the purity of ...

### Diffusion | Materials Science and Engineering: An…

An FCC iron-carbon alloy initially containing 0.55 wt $\%$ C is exposed to an oxygen-rich and virtually carbon-free atmosphere at $1325 \mathrm{K}$ $\left(1052^{\circ} \mathrm{C}\right) .$ Under these circumstances the carbon diffuses from the alloy and reacts at the surface with the oxygen in the atmosphere that is, the carbon concentration at ...


text:
Answer
Comment
Share
Q)

# Which of the following statement is incorrect about cockroach :-

$\begin{array}{1 1}(A)\;\text{Nocturnal vision has more sensitivity & less resolution}\\(B)\;\text{Blood from cockroach's heart is pumped posteriorly}\\(C)\;\text{Malpighian tubules helps in removal of excretory product from hemolymph}\\(D)\;\text{In females 7th segment is boat shaped}\end{array}$

## 1 Answer

Comment
A)
Need homework help? Click here.
Blood is pumped anteriorly by cockroach's heart.
Hence (B) is the correct answer.


text:
# Search by Topic

#### Resources tagged with Mathematical reasoning & proof similar to Pick's Quadratics:

Filter by: Content type:
Stage:
Challenge level:

### There are 186 results

Broad Topics > Using, Applying and Reasoning about Mathematics > Mathematical reasoning & proof

### Matter of Scale

##### Stage: 4 Challenge Level:

Prove Pythagoras' Theorem using enlargements and scale factors.

### Proof of Pick's Theorem

##### Stage: 5 Challenge Level:

Follow the hints and prove Pick's Theorem.

### Pent

##### Stage: 4 and 5 Challenge Level:

The diagram shows a regular pentagon with sides of unit length. Find all the angles in the diagram. Prove that the quadrilateral shown in red is a rhombus.

##### Stage: 5 Challenge Level:

Find all positive integers a and b for which the two equations: x^2-ax+b = 0 and x^2-bx+a = 0 both have positive integer solutions.

### Some Circuits in Graph or Network Theory

##### Stage: 4 and 5

Eulerian and Hamiltonian circuits are defined with some simple examples and a couple of puzzles to illustrate Hamiltonian circuits.

### Sperner's Lemma

##### Stage: 5

An article about the strategy for playing The Triangle Game which appears on the NRICH site. It contains a simple lemma about labelling a grid of equilateral triangles within a triangular frame.

### The Great Weights Puzzle

##### Stage: 4 Challenge Level:

You have twelve weights, one of which is different from the rest. Using just 3 weighings, can you identify which weight is the odd one out, and whether it is heavier or lighter than the rest?

### To Prove or Not to Prove

##### Stage: 4 and 5

A serious but easily readable discussion of proof in mathematics with some amusing stories and some interesting examples.

### Continued Fractions II

##### Stage: 5

In this article we show that every whole number can be written as a continued fraction of the form k/(1+k/(1+k/...)).

### Salinon

##### Stage: 4 Challenge Level:

This shape comprises four semi-circles. What is the relationship between the area of the shaded region and the area of the circle on AB as diameter?

### Plus or Minus

##### Stage: 5 Challenge Level:

Make and prove a conjecture about the value of the product of the Fibonacci numbers $F_{n+1}F_{n-1}$.

### Folding Squares

##### Stage: 4 Challenge Level:

The diagonal of a square intersects the line joining one of the unused corners to the midpoint of the opposite side. What do you notice about the line segments produced?

##### Stage: 4 Challenge Level:

Four jewellers share their stock. Can you work out the relative values of their gems?

### Mechanical Integration

##### Stage: 5 Challenge Level:

To find the integral of a polynomial, evaluate it at some special points and add multiples of these values.

### Multiplication Square

##### Stage: 4 Challenge Level:

Pick a square within a multiplication square and add the numbers on each diagonal. What do you notice?

### Impossible Sandwiches

##### Stage: 3, 4 and 5

In this 7-sandwich: 7 1 3 1 6 4 3 5 7 2 4 6 2 5 there are 7 numbers between the 7s, 6 between the 6s etc. The article shows which values of n can make n-sandwiches and which cannot.

### Where Do We Get Our Feet Wet?

##### Stage: 5

Professor Korner has generously supported school mathematics for more than 30 years and has been a good friend to NRICH since it started.

### For What?

##### Stage: 4 Challenge Level:

Prove that if the integer n is divisible by 4 then it can be written as the difference of two squares.

### Pair Squares

##### Stage: 5 Challenge Level:

The sum of any two of the numbers 2, 34 and 47 is a perfect square. Choose three square numbers and find sets of three integers with this property. Generalise to four integers.

### Target Six

##### Stage: 5 Challenge Level:

Show that x = 1 is a solution of the equation x^(3/2) - 8x^(-3/2) = 7 and find all other solutions.

### Proof: A Brief Historical Survey

##### Stage: 4 and 5

If you think that mathematical proof is really clearcut and universal then you should read this article.

### Leonardo's Problem

##### Stage: 4 and 5 Challenge Level:

A, B & C own a half, a third and a sixth of a coin collection. Each grab some coins, return some, then share equally what they had put back, finishing with their own share. How rich are they?

### Water Pistols

##### Stage: 5 Challenge Level:

With n people anywhere in a field each shoots a water pistol at the nearest person. In general who gets wet? What difference does it make if n is odd or even?

### Polite Numbers

##### Stage: 5 Challenge Level:

A polite number can be written as the sum of two or more consecutive positive integers. Find the consecutive sums giving the polite numbers 544 and 424. What characterizes impolite numbers?

### Proof Sorter - Quadratic Equation

##### Stage: 4 and 5 Challenge Level:

This is an interactivity in which you have to sort the steps in the completion of the square into the correct order to prove the formula for the solutions of quadratic equations.

### Towering Trapeziums

##### Stage: 4 Challenge Level:

Can you find the areas of the trapezia in this sequence?

### Golden Eggs

##### Stage: 5 Challenge Level:

Find a connection between the shape of a special ellipse and an infinite string of nested square roots.

### Ordered Sums

##### Stage: 4 Challenge Level:

Let a(n) be the number of ways of expressing the integer n as an ordered sum of 1's and 2's. Let b(n) be the number of ways of expressing n as an ordered sum of integers greater than 1. (i) Calculate. . . .

##### Stage: 5 Challenge Level:

Find all real solutions of the equation (x^2-7x+11)^(x^2-11x+30) = 1.

### Iffy Logic

##### Stage: 4 and 5 Challenge Level:

Can you rearrange the cards to make a series of correct mathematical statements?

### Advent Calendar 2011 - Secondary

##### Stage: 3, 4 and 5 Challenge Level:

Advent Calendar 2011 - a mathematical activity for each day during the run-up to Christmas.

### Dodgy Proofs

##### Stage: 5 Challenge Level:

These proofs are wrong. Can you see why?

### Whole Number Dynamics I

##### Stage: 4 and 5

The first of five articles concentrating on whole number dynamics, ideas of general dynamical systems are introduced and seen in concrete cases.

### Picturing Pythagorean Triples

##### Stage: 4 and 5

This article discusses how every Pythagorean triple (a, b, c) can be illustrated by a square and an L shape within another square. You are invited to find some triples for yourself.

### Whole Number Dynamics II

##### Stage: 4 and 5

This article extends the discussions in "Whole number dynamics I". Continuing the proof that, for all starting points, the Happy Number sequence goes into a loop or homes in on a fixed point.

### On the Importance of Pedantry

##### Stage: 5

A introduction to how patterns can be deceiving, and what is and is not a proof.

### More Number Sandwiches

##### Stage: 3 and 4 Challenge Level:

When is it impossible to make number sandwiches?

### Long Short

##### Stage: 4 Challenge Level:

What can you say about the lengths of the sides of a quadrilateral whose vertices are on a unit circle?

### Whole Number Dynamics IV

##### Stage: 4 and 5

Start with any whole number N, write N as a multiple of 10 plus a remainder R and produce a new whole number N'. Repeat. What happens?

### Whole Number Dynamics III

##### Stage: 4 and 5

In this third of five articles we prove that whatever whole number we start with for the Happy Number sequence we will always end up with some set of numbers being repeated over and over again.

### Magic Squares II

##### Stage: 4 and 5

An article which gives an account of some properties of magic squares.

### Diverging

##### Stage: 5 Challenge Level:

Show that for natural numbers x and y if x/y > 1 then x/y>(x+1)/(y+1}>1. Hence prove that the product for i=1 to n of [(2i)/(2i-1)] tends to infinity as n tends to infinity.

### An Introduction to Number Theory

##### Stage: 5

An introduction to some beautiful results of Number Theory

### Contrary Logic

##### Stage: 5 Challenge Level:

Can you invert the logic to prove these statements?

### Binomial

##### Stage: 5 Challenge Level:

By considering powers of (1+x), show that the sum of the squares of the binomial coefficients from 0 to n is 2nCn

### Rhombus in Rectangle

##### Stage: 4 Challenge Level:

Take any rectangle ABCD such that AB > BC. The point P is on AB and Q is on CD. Show that there is exactly one position of P and Q such that APCQ is a rhombus.

### Fitting In

##### Stage: 4 Challenge Level:

The largest square which fits into a circle is ABCD and EFGH is a square with G and H on the line CD and E and F on the circumference of the circle. Show that AB = 5EF. Similarly the largest. . . .

### Folding Fractions

##### Stage: 4 Challenge Level:

What fractions can you divide the diagonal of a square into by simple folding?

### Tree Graphs

##### Stage: 5 Challenge Level:

A connected graph is a graph in which we can get from any vertex to any other by travelling along the edges. A tree is a connected graph with no closed circuits (or loops. Prove that every tree has. . . .


text:
+0

# I have no idea how to do this

0
30
3

How many positive four-digit integers n have the property that the three-digit number obtained by removing the leftmost digit is one-ninth of n?

Guest Aug 9, 2018

#1
+19834
+1

How many positive four-digit integers n have the property that the three-digit number obtained by removing

the leftmost digit is one-ninth of n?

$$\begin{array}{|lrcll|} \hline (1) & n_4 &=& 10^3a + n_3 \\ \\ \hline \\ (2) & n_3 &=& \dfrac{n_4}{9} \\\\ & 9n_3 &=& n_4 \\\\ & 9n_3 &=& 10^3a + n_3 \\\\ & 8n_3 &=& 10^3a \quad & | \quad : 8 \\\\ & \mathbf{n_3} & \mathbf{=} & \mathbf{125a} \\ \hline \end{array}$$

$$\begin{array}{|r|c|l|l|} \hline & n_3=125a & \\ a & n_3\lt 1000 & n_4 &\\ \hline 1 & 125 & 1125 & \frac{1125}{9} = 125 \\ 2 & 250 & 2250 & \frac{2250}{9} = 250 \\ 3 & 375 & 3375 & \frac{3375}{9} = 375 \\ 4 & 500 & 4500 & \frac{4500}{9} = 500 \\ 5 & 625 & 5625 & \frac{5625}{9} = 625 \\ 6 & 750 & 6750 & \frac{6750}{9} = 750 \\ 7 & 875 & 7875 & \frac{7875}{9} = 875 \\ \hline \end{array}$$

heureka  Aug 10, 2018
#1
+19834
+1

How many positive four-digit integers n have the property that the three-digit number obtained by removing

the leftmost digit is one-ninth of n?

$$\begin{array}{|lrcll|} \hline (1) & n_4 &=& 10^3a + n_3 \\ \\ \hline \\ (2) & n_3 &=& \dfrac{n_4}{9} \\\\ & 9n_3 &=& n_4 \\\\ & 9n_3 &=& 10^3a + n_3 \\\\ & 8n_3 &=& 10^3a \quad & | \quad : 8 \\\\ & \mathbf{n_3} & \mathbf{=} & \mathbf{125a} \\ \hline \end{array}$$

$$\begin{array}{|r|c|l|l|} \hline & n_3=125a & \\ a & n_3\lt 1000 & n_4 &\\ \hline 1 & 125 & 1125 & \frac{1125}{9} = 125 \\ 2 & 250 & 2250 & \frac{2250}{9} = 250 \\ 3 & 375 & 3375 & \frac{3375}{9} = 375 \\ 4 & 500 & 4500 & \frac{4500}{9} = 500 \\ 5 & 625 & 5625 & \frac{5625}{9} = 625 \\ 6 & 750 & 6750 & \frac{6750}{9} = 750 \\ 7 & 875 & 7875 & \frac{7875}{9} = 875 \\ \hline \end{array}$$

heureka  Aug 10, 2018
#2
+87629
+1

Very nice, heureka  !!!!

CPhill  Aug 11, 2018
#3
+19834
0

Thank you, CPhill

heureka  Aug 13, 2018


text:
# Full-Length SSAT Upper Level Math Practice Test

Taking a Full-length SSAT Upper-Level Math practice test is the best way to help you get familiar with the test format and feel more confident. Not only will this help you measure your exam readiness and solidify the concepts you’ve learned, but it is the best way to simulate test day.
To help you get the best out of this complete and realistic SSAT Upper-Level Math practice test and prepare your mind and body for the actual test, we recommend that you treat this practice test as a real test. Prepare scratch papers, a pencil, a timer, and a calculator and take the test in one sitting and follow the time limits to the minute.
Take the following full-length SSAT Upper-Level Math practice test to simulate the test day experience. After you’ve finished, score your tests using the answer keys.
Good luck!

## The Absolute Best Book to Ace the SSAT Upper Level Math Test

Time to refine your Math skill with a practice test

Take a REAL ISEE Upper-Level Mathematics test to simulate the test day experience. After you’ve finished, score your test using the answer key.

Before You Start

• You’ll need a pencil, a calculator, and a timer to take the test.
• It’s okay to guess. You won’t lose any points if you’re wrong. So be sure to answer every question.
• After you’ve finished the test, review the answer key to see where you went wrong.
• Calculators are permitted for HiSET Math Test.
• The HiSET Mathematics test contains a formula sheet, which displays formulas relating to geometric measurement and certain algebra concepts. Formulas are provided to test- takers so that they may focus on application, rather than the memorization, of formulas.
• For each multiple-choice question, there are five possible answers. Choose which one is best.

Good Luck!

## Best SSAT Upper Level Math Prep Resource for 2022

$49.99 Satisfied 78 Students ## SSAT Upper Level Math Practice Test ### SSAT Upper Level Practice TestQuantitative Reasoning 1- How many tiles of $$6 cm^2$$ are needed to cover a floor of dimension $$9 cm$$ by $$36 cm$$? A. 11 B. 20 C. 36 D. 42 E. 54 2- A school wants to give each of its 31 top students a football ball. If the balls are in boxes of four, how many boxes of balls do they need to purchase? A. 4 B. 5 C. 6 D. 7 E. 8 3- If $$\frac{35}{A} + 2=7$$, then $$35+A=$$ ? A. 6 B. 12 C. 25 D. 42 E. 46 4- A shaft rotates 400 times in 6 seconds. How many times does it rotate in 15 seconds? A. 950 B. 1000 C. 1125 D. 1250 E. 1300 5- Which of the following statements is correct, according to the graph below? A. Number of books sold in April was twice the number of books sold in July. B. Number of books sold in July was less than half the number of books sold in May. C. Number of books sold in June was half the number of books sold in April. D. Number of books sold in July was equal to the number of books sold in April plus the number of books sold in June. E. More books were sold in July than in April. 6- Jack earns$756 for his first 54 hours of work in a week and is then paid 1.5 times his regular hourly rate for any additional hours. This week, Jack needs $924 to pay his rent, bills, and other expenses. How many hours must he work to make enough money this week? A. 40 B. 48 C. 55 D. 62 E. 68 7- What is the value of the sum of the tens and thousandths in number $$6,684.76342$$? A. 5 B. 9 C. 11 D. 14 E. 16 8- If $$160 \%$$ of a number is 80, then what is the $$70 \%$$ of that number? A. 35 B. 50 C. 60 D. 70 E. 85 9- $$18.236÷0.004$$? A. 455.0059 B. 455.09 C. 455.59 D. 455.9 E. 4559 10- The average weight of 12 girls in a class is 55 kg and the average weight of 21 boys in the same class is 59 kg. What is the average weight of all the 33 students in that class? A. 50 B. 51.28 C. 55.88 D. 56.9 E. 57.54 11- If $$3≤x<6$$, what is the minimum value of the following expression? $$3x+5$$ A. 5 B. 8 C. 10 D. 14 E. 23 12- If $$x∎y=\sqrt{x^2+y}$$, what is the value of $$6∎13$$? A. $$\sqrt{22}$$ B. 5 C. 6 D. 6.5 E. 7 13- $$\frac{2 \frac{2}{3} + \frac{1}{6}}{3 \frac{3}{4} – \frac{11}{4}}$$ is approximately equal to. A. 1.33 B. 2.6 C. 2.83 D. 3.33 E. 6.67 14- There are two equal tanks of water. If $$\frac{1}{8}$$ of a tank contains 350 liters of water, what is the capacity of the two tanks of water together? A. 1500 B. 2600 C. 3800 D. 4950 E. 5600 15- David’s current age is 58 years, and Ava’s current age is 10 years old. In how many years David’s age will be 3 times Ava’s age? A. 4 B. 6 C. 8 D. 10 E. 14 16- Four-kilogram apple and four-kilogram orange cost$26.4. If a one-kilogram apple costs $4.6 how much does one-kilogram orange cost? A.$1.5

B. $2 C.$2.5

D. $3.5 E.$4

17- What is the value of $$x$$ in the following figure?

A. 150

B. 145

C. 125

D. 115

E. 105

18- What is the answer of$$9.5÷0.25$$?

A. 38

B. 40

C. 48

D. 52

E. 60

19- Michelle and Alec can finish a job together in 140 minutes. If Michelle can do the job by herself in 7 hours, how many minutes does it take Alec to finish the job?

A. 180

B. 190

C. 195

D. 210

E. 220

20- A football team won exactly $$60\%$$ of the games it played during the last session. Which of the following could be the total number of games the team played last season?

A. 11

B. 16

C. 19

D. 23

E. 35

21- What is the slope of a line that is perpendicular to the line $$8x-4y=24$$?

A. $$-2$$

B. $$-\frac{1}{2}$$

C. 4

D. 12

E. 14

22- A cruise line ship left Port A and traveled 7 miles due west and then 24 miles due north. At this point, what is the shortest distance from the cruise to port A?

A. 10 miles

B. 15 miles

C. 20 miles

D. 25 miles

E. 30 miles

23- The Jackson Library is ordering some bookshelves. If $$x$$ is the number of bookshelves the library wants to order, which each costs $200 and there is a one-time delivery charge of$600, which of the following represents the total cost, in the dollar, per bookshelf?

A. $$200x+600$$

B. $$2100+600x$$

C. $$\frac{200x+600}{100}$$

D. $$\frac{200x+600}{x}$$

E. $$200x-600$$

24- The sum of four different negative integers is $$-40$$. If the smallest of these integers is $$-9$$, what is the largest possible value of one of the other five integers?

A. $$-14$$

B. $$-16$$

C. $$-18$$

D. $$-19$$

E. $$-21$$

25- The width of a box is one-third of its length. The height of the box is one-third of its width. If the length of the box is 36 cm, what is the volume of the box?

A. 95 cm$$^3$$

B. 192 cm$$^3$$

C. 238 cm$$^3$$

D. 1008 cm$$^3$$

E. 1980 cm$$^3$$

26- When number 87,436 is divided by 287, the result is closest to?

A. 3

B. 30

C. 305

D. 350

E. 400

27- If the perimeter of the following figure be 30, what is the value of $$x$$?

A. 2

B. 3

C. 6

D. 9

E. 12

28- There are 14 marbles in bag A and 22 marbles in bag B. If the sum of the marbles in both bags will be shared equally between two children, how many marbles bag A has less than the marbles that each child will receive?

A. 2

B. 3

C. 4

D. 5

E. 6

29- If Jason’s mark is k more than Alex’s, and Jason’s mark is 20, which of the following can be Alex’s mark?

A. $$20+k$$

B. $$k-20$$

C. $$\frac{k}{20}$$

D. 20k

E. $$20-k$$

30- Which of the following expression is not equal to 8?

A. $$16×\frac{1}{2}$$

B. $$40×\frac{1}{5}$$

C. $$4×\frac{8}{4}$$

D. $$6×\frac{8}{6}$$

E. $$8×\frac{1}{8}$$

31- The price of a sofa is decreased by $$50\%$$ to $405. What was its original price? A.$480

B. $520 C.$560

D. $600 E.$810

32- $$860-6 \frac{8}{13}=$$?

A. $$842 \frac{7}{13}$$

B. $$842 \frac{8}{13}$$

C. $$850 \frac{1}{15}$$

D. $$851 \frac{8}{15}$$

E. $$853 \frac{5}{13}$$

33- A driver rests one hour and 5 minutes for every 8 hours driving. How many minutes will he rest if he drives 32 hours?

A. 3 hours and 36 minutes

B. 4 hours and 12 minutes

C. 4 hours and 45 minutes

D. 5 hours and 36 minutes

E. 6 hours

34- To paint a wall with the area of 48m$$^2$$, how many liters of paint do we need if each liter of paint is enough to paint a wall with the dimension of 96 cm$$×$$100 cm?

A. 50

B. 100

C. 150

D. 200

E. 250

35- What is the missing term in the given sequence? 3, 5, 9, 17, 33, _, 129

A. 56

B. 65

C. 73

D. 85

E. 90

Questions 11 to 12 are based on the following graph

A library has 960 books that include Mathematics, Physics, Chemistry, English, and History.
Use the following graph to answer questions 11 to 12.

36- What is the product of the number of Mathematics and number of English books?

A. 17,640

B. 26,460

C. 41,472

D. 56,124

E. 59,324

37- What are the values of angle $$α$$ and $$β$$ respectively?

A. $$90^\circ , 54^\circ$$

B. $$120^\circ , 36^\circ$$

C. $$120^\circ , 45^\circ$$

D. $$108^\circ , 54^\circ$$

E. $$108^\circ , 45^\circ$$

38- Find the perimeter of the following shape.

A. 21

B. 22

C. 23

D. 24

E. 25

39- If $$a×b$$ is divisible by 4, which of the following expression must also be divisible by 4?

A. $$a+b$$

B. $$3a-b$$

C. $$a-3b$$

D. $$\frac{a}{3.5b}$$

E. $$4×a×b$$

40- The capacity of a red box is $$50\%$$ bigger than the capacity of a blue box. If the red box can hold 45 equal-sized books, how many of the same books can the blue box hold?

A. 9

B. 15

C. 21

D. 25

E. 30

41- If the area of the following rectangular ABCD is 200, and E is the midpoint of AB, what is the area of the shaded part?

A. 25

B. 50

C. 100

D. 120

E. 125

42- There are 48.3 liters of gas in a car fuel tank. In the first week and second week of April, the car uses 7.96 and 18.21 liters of gas respectively. If the car was parked in the third week of April and 16.47 liters of gas will be added to the fuel tank, how many liters of gas are in the fuel tank of the car?

A. 21.41

B. 25.9

C. 27

D. 38.6

E.71.61

43- If $$6x+y=36$$ and $$x-z=9$$, what is the value of $$x$$?

A. 0

B. 5

C. 10

D. 20

☐E. it cannot be determined from the information given

44- If $$5y+6<51$$, then $$y$$ could be equal to?

A. 9

B. 11

C. 11.5

D. 12

E. 14

45- What is the average circumference of figure A and area of figure B? ($$π=3$$)

A. 54

B. 62

C. 75

D. 80

E. 83

46- In the following figure, point $$Q$$ lies on line $$n$$, what is the value of y if $$x = 25$$?

A. 15

B. 25

C. 40

D. 45

E. 55

47- Which of the following could be the value of $$x$$ if $$\frac{2}{7}+x>3$$?

A. $$\frac{1}{2}$$

B. $$\frac{3}{5}$$

C. $$\frac{4}{5}$$

D. $$\frac{4}{3}$$

E. $$\frac{10}{3}$$

48- A number is chosen at random from 8 to 17. Find the probability of not selecting a composite number. (A composite number is a number that is divisible by itself, 1 and at least one other whole number)

A. $$\frac{1}{25}$$

B. $$\frac{3}{10}$$

C. $$\frac{9}{25}$$

D. 3

E. 4.25

49- $$432÷4=$$?

A. $$\frac{400}{4}×\frac{30}{4}×\frac{2}{4}$$

B. $$400+\frac{30}{4}+\frac{2}{4}$$

C. $$\frac{400}{4}+\frac{30}{4}+\frac{2}{4}$$

D. $$\frac{400}{4}÷\frac{30}{4}÷\frac{2}{4}$$

E. $$\frac{4}{4}+\frac{3}{4}+\frac{2}{4}$$

50- If a gas tank can hold 36 gallons, how many gallons does it contain when it is $$\frac{4}{6}$$ full?

A. 10

B. 12.5

C. 15

D. 18

E. 24

## The Best Books to Ace the SSAT Upper Level Math Test

$15.99 Satisfied 91 Students$11.99
Satisfied 150 Students
$11.99 Satisfied 125 Students ## Answers and Explanations ### More math articles ### What people say about "Full-Length SSAT Upper Level Math Practice Test"? No one replied yet. X 52% OFF Limited time only! Save Over 52% SAVE$40

It was $76.99 now it is$36.99


text:
# Comp Sci at Stuyvesant with D. Holmes

Content
Zoom steps for joining a remote session
chat communicate during class sessions
Requires logging into Google with your @stuy.edu account and
enrolling during class. If you missed your class on enrollment day, email Holmes as described here.
notes notes by Holmes to augment some lessons, starting with a syllabus
hw Check for a new homework assignment after 3:30 on every class day.
Piazza Piazza forum, for communicating among students and instructor(s)
How to succeed with Piazza, especially for issues with homework
hw server for submitting homework answers. See these FAQs.

# homework teaches success

Students succeed in this course by understanding the homework. You are unlikely to learn new material at the pace of this course merely by attending class, even if that worked in middle school. Whether you judge success by mastery of the course material, or judge success by grades, understanding the homework is apparently required. To acquire that understanding, you must practice the thinking, look for patterns, find your errors, and revise erroneous attempts. Homework exercises all of those necessities.

Homework requires 20–30 minutes per day for a typical student in an introductory course, and up to 60 minutes per day in the advanced placement course. It commonly takes less for a student with experience in programming, but more for a student who is struggling or catching up.

There are six key elements to doing homework completely and correctly. These apply to many courses in high school and college:

• Struggle solo with a problem. When confronted by something they don't understand, beginning programmers should struggle on their own for at least 10 minutes, which initially feels like a very long time. More experienced programmers spend longer on their own, perhaps half an hour.

• Seek help but not answers for problems that remain. The best programmers seek help eventually; that helps makes them the best.

• Incorporate help to produce correct results. This means returning to "struggle solo", but armed with more knowledge.

• Test your work  A correct-looking solution that has not been tested is almost certainly wrong.

• Compare your work with posted solutions. If the posted solution leaves you with questions, ask them.

• Re-do parts of the homework based on your comparison. Merely reading correct answers leaves lots of us unable to create correct answers. So if the "compare" step shows that your initial understanding was faulty, and if the topic is at all interesting, shut any display of the right answers and recreate those answers yourself.

Tests in this course aim to assess the extent to which a student understands the homework. People motivated by grades can boost them via the do–compare–re-do sequence.

## keeping up is easier than catching up

Keeping up with homework assignments is challenging but crucial in computer science courses, for several reasons:

• Undone homework piles up. Many students find it challenging to fit each day's homework into full or over-full schedules, and skipping a day doubles the problem. Longer delays are many times worse.

• It is in doing homework that students actually learn the material presented in a day's class. The longer the delay between the presentation of the material and the homework, the less you remember from the class. It is easier to do Monday's homework at 4 pm than 11 pm. It is easier to do Friday's homework on Friday than on Sunday. Delays make homework harder.

• Here's the most important issue: understanding classes depends on your having learned previous classes' material, by doing the associated homework. Without that learning, succeeding classes can be worse than worthless to you, because they confuse you instead of teaching you. The confusion makes the next homework more difficult, in a rapid, downward spiral.

## homework omits repetition

In fifth grade, math homework typically involves many repetitions of similar problems. Students can learn by repeating similar work until patterns become obvious. Each problem requires only a minute to solve.

That model fails in problem-solving courses like this one, where the problems are larger. It can easily take 10 or 15 minutes to write a program, test it to find errors, and fix those errors. So an assignment that is aimed to take half an hour should require writing at most three such programs. Students can no longer rely on absorbing a pattern through repetition.

Instead, be thoughtful about the problems. Do the significant work that can be required to understand the question. Struggle solo with the solutions, rather than immediately asking for assistance. Write down questions that occur to you, and take the initiative and responsibility to seek answers.

## understand homework solutions

You are responsible for understanding solutions for homework problems by reviewing answers to them. Students and I collaborate on posting answers, usually on Piazza. There are good reasons to study these solutions:

• You learn little from incomplete or erroneous homework. I lack the time to check your work routinely and completely. That responsibility devolves to you.

• Programmers learn by reading other programmers' work. I have learned that way for many years, with no end in sight. Posted solutions are imperfect and occasionally outright wrong, but one also learns from rejecting and correcting others' ideas.

• Learning from others' solutions is efficient. If you did the homework, it takes only a few minutes to compare your solutions to those posted, more if the solutions are better than yours, less if they are similar. If you failed to do the homework, reading others' solutions is slower and less educational, but still better than nothing.

## "My computer (or internet connection) broke, so I can't do the homework."

Computer failure happens to everyone eventually. I would like to express my sympathy by lifting the requirement to do homework while awaiting repair or replacement. But from the point of view of keeping up with the homework, a broken computer provides no relief from the problems of falling behind. Students must find a way to keep up. Here are some strategies:

• Do the homework with a classmate, on their computer. It is usually more educational and often more fun to work with a friend, even when your computer works. Of course, if you work with someone else on the homework, you must cite that cooperation in your submissions.

• Share a computer with a family member. Most homework requires only a browser and an installation of a processor for the relevant language (DrRacket, NetLogo, Python, or Java). Installing a language processor is straightforward. Modern operating systems allow a family member to establish a guest account that preserves their privacy while allowing a student to share the working computer.

• Go to the CS Dojo, where there are plenty of computers. Bring a pair of headphones or ear buds if the homework requires listening to Mr. Brooks's videos.

Whatever approach you take, rise to the challenge of keeping up while repairing your computer.

A broken internet connection requires similar thinking. You can use a computer at school, including those in the library and CS Dojo. You can submit homework by carrying it to school on a USB drive and submitting it from school.

## corrections on the homework server are shown as late submissions

The homework server records the time of the last submission to each homework slot. So if you submit homework on time, but subsequently submit a correction to it, the homework server will show the submission as late. That happens even if the correction is that you originally submitted the homework to the wrong homework slot, and you re-submit it to the correct slot.

Corrections are helpful. Correcting the content of homework is a great way to learn. Correcting which slot holds which homework helps me if I review it.

The apparent lateness is such a minor problem that you can ignore it. To keep the record straight, you can include a comment with the re-submission, telling me that the original was on time. But look at this from my perspective: I use the timeliness to alert me to students who are falling behind in the course, to spot where a conversation might be helpful. A rare lateness is harmless, so neither of us should spend much effort to avoid a rare appearance of lateness.

Re-submissions overwrite the comments from previous submissions. So if the existing comment has valuable information, copy it before re-submitting, and include the copy in the re-submission.

## rubric for most homework

Homework is graded with a denominator of 3. The basic grades are…

• 3:  meeting expectations, on grade-level.
• 2:  missing a chunk
• 1:  missing several chunks
• 0:  no submission or submission without effort

Small errors are expected, since most homework aims to develop thinking, not demonstrate mastery. So minor errors are compatible with a grade of 3/3. For submissions that surpass expectations, there is a 10% bonus, resulting in a grade of 3.3/3.

Late homework is worth 1 point less than a comparable on-time submission.

# how else to succeed

## recommendation: work with a classmate

Working on the homework with another student can help significantly. Some people mistakenly expect that the benefit derives solely from sharing knowledge. But other factors probably outweigh that sharing:

• Working with another person fosters questions and answers. Verbalizing questions and answers fosters the hard thinking that is necessary for learning.

• Some people think more productively in company, as discussed here.

• The discipline of working with another person supplements the self discipline required to work alone. If you — like most of us — find it difficult to push away distractions and focus on work we want to accomplish, you may find it easier to make an appointment with a classmate to work together, ideally at the CS Dojo. Then your natural politeness and disinclination to abandon an appointment will augment your self discipline.

• For those of us who enjoy teamwork, working with others is more fun than working solo.

• Sharing knowledge is easier when working in pairs.

Stuy's CS teachers strongly encourage you to experiment and improve at working in pairs.

Some caveats:

• "Working on" homework is not the same as "copying" homework. Copying involves no thinking and helps little in computer science courses. You need not believe me; ask someone with bad grades who tried it.

• Academic honesty requires that you understand and be able to explain your submissions, and that you identify sources of help. For example, it is always a pleasure to read comments like "I worked with Brian Kernighan on this task, and I completely understand the results." Submitting another's work without giving credit is cheating.

## keep up when you miss a lesson

As with homework, it is easier to keep up than catch up with the content of lessons. If you miss a day or are confused by a lesson, take remedial action quickly.

The best way to catch up is to sit with another student from your class to go over their notes, while taking notes yourself. Both of you are likely to benefit; a person who teaches learns from the process, clarifying their own thinking. (I know; I learn from this effect every day.)

The web page on "notes from class" shows some class materials. Those materials can augment or correct your recollection of what you heard in class. They cover only fragments of lessons, however, so you will need notes by a student.

## good students seek help

Too many Stuy students are reluctant to seek help, perhaps because middle school was easy for them. In better high schools and colleges, good students seek help; weak students don't.

Know these sources of help:

• Ask and answer questions in class. This is so helpful that it merits its own section.

• Participants in this course will be enrolled in Piazza, a web forum in which students pose and answer questions, obviating the challenges of meeting in person. It has aided communication and learning for hundreds of thousands of students in colleges.

• Your classmates — especially those in classes I lead — have thought about and solved issues you face. Ask a few for their approach, pick one you can emulate, and practice it. Copying an effective technique is easier than inventing one.

• At the Comp Sci Dojo, successful comp sci students offer help in an environment conducive to doing comp sci homework, Monday–Thursday, 2:40–4:40. Bookmark it in your browser, to make returning there easy.

When I visit the Dojo, I usually recognize students there who are among the best in their classes, working in an environment that they have found fun and conducive to success. But don't believe me. Check out the Spec article on "Decoding the CS Dojo".

• I answer questions. Here is how to make an appointment.

• ARISTA offers one-on-one peer tutoring in all subjects, given by students. There is no charge for the tutoring, but it takes time. I know only a little about it. Results seem to depend heavily on the interaction between the two students involved.

## class and community participation

Asking questions or proposing answers helps the askers and answerers. Askers benefit because they do the hard thinking necessary to identify misunderstandings. Answerers benefit because they do the hard thinking necessary to verbalize their understanding. In addition, participating in class helps participants stay engaged with the class. Both questions and answers help me assess how well concepts are being communicated.

Many students are initially reluctant to reveal their confusion. Such reluctance is understandable since no one likes being wrong. You can help: work on making class a hospitable environment for the ego-sacrifice of asking questions and proposing answers that could be wrong.

Explaining another student's question to me helps both of us. You must have experience with this already: A helpful and brave student says "I don't understand". The teacher starts to re-explain whatever they regard as the hardest part of the material. But every other student in the room knows that the problem was a term that the questioner had not heard before, often because the term was new to lots of people. In that case, please jump in with an interruption like "No, Mr. Holmes, the issue might be the term x." Everybody wins.

The Piazza on-line forum extends participation beyond the class time. Participating via Piazza is particularly valuable for people who are disinclined to speak during class.

## notes help, if used well

Each lesson's aims are displayed as questions, which you are asked to record. Knowing the aims in advance helps you recognize the answers as the lesson covers them. If we both do our jobs well, you should be able to answer those questions after the class.

Many Stuy students found notes superfluous in middle school. Material was presented slowly enough, and with enough repetition, that they learned it during class, with no need to refer back to it. However, as you rise through increasingly challenging education, eventually you will reach a level at which you can no longer get by on being a fast learner, because everyone in your class learns as fast as you do, and the pace of the class is sped up accordingly. When you reach that level, learning requires thinking about the material after class, independently. Independent thinking requires recalling the material. Successful students take notes that aid that recollection.

To benefit from notes, good students improve them after classes, reminding themselves of the questions, and identifying the answers.

In fact, if you do not review your notes, or if you store them un-read until the night before an exam, you are likely to learn more by listening and thinking hard during class, without the distraction of taking notes.

Apollo Robbins will convince you in 9 minutes that copying from the board interferes with learning, because you can't think about two things at once. Way cool.

Do your review and answering before you start the homework. That timing helps with the homework, because the homework aims to exercise material from the most recent class. The alternative to review-before-homework is more work for less learning. There are often many ways to solve computer problems, and lessons often base new techniques on those taught previously. Homework after the later lessons aims to exercise the new learning. But students who have not reviewed a lesson forget it. Instead, such students try to apply old lessons to new problems. That involves more work than using the newly-taught techniques, and forsakes the opportunity to learn the new techniques.

Algebra students are often introduced to solving quadratic equations by factoring. Later, they are taught the quadratic formula, which is helpful when the solutions are fractions or complex numbers. Pity the student who ignores the aim of the lesson on the formula, and works hard on the homework trying to guess the factors of x2x–1=0. The effort will be fruitless and it won't help the student understand the formula.

In summary:

• Bring your notebook with you to do the homework, so you can start by reminding yourself of the material that the homework addresses.
• Use the new material from class to solve the homework problems, so that the new material becomes meaningful to you.

Probably you have been told how to succeed at reading comprehension under time pressure. Often the techniques include…

• Read the questions before the passage, so you will recognize the parts of the passage that merit attention.
• Answer the questions and move on.

Maybe that is "how to succeed at reading comprehension on a standardized test".
Certainly it is "how to fail at reading comprehension in computer science and math".

Comprehension in this subject requires multiple close readings. Here is a typical sequence for understanding a programming problem:

Successful students read differently in different subjects. I learned that only in grad school. Maybe you can learn it sooner. Teachers never told me this before then, presumably because lots of teachers are as ignorant as I was, and for a similar reason: a single reading style had long worked for me in the subjects I liked best, and I got by in the other subjects.

New students routinely complain that my writing is hard to read. I may be a particularly bad writer, but there is also another issue: reading computer science text requires serious concentration on every word. Two examples:

• When I answer tests written by another comp sci teacher, I have to the read each problem 2 or 3 times, even though I have already spent a long time thinking about constructing these kinds of problems.

• I asked a group of comp sci teachers whether they needed multiple readings, and they gave me the "Duh" look. Unless you are much better at computer science than those teachers, imitate them.

Communication is hard. Readers must expect to do their share of the work.

## how to write

Problems posed in this course routinely ask for answers in good English sentences. The responses are routinely hard to read, often because they ramble, or constitute only sentence fragments, or lack antecedents for pronouns.

Problems posed in this course routinely impose word limits. Weak students routinely violate those limits.

Avoid these errors by drafting an answer on scrap paper or a word processor. I cannot answer a hard question in a single draft; it is optimistic, prideful, or foolish for you to expect that you can.

Save words by omitting echoes of my question. For example, if asked "What advantages derive from clear writing?", it is redundant to start your answer with "There are many advantages to clear writing. For example, one should practice clear writing because...". Eleven words wasted. "Omit needless words."

Students have taught me why they make these errors: writing a lot, quickly and poorly, succeeds in other courses. That approach fails in this course.

## 2020-10-26: DOE makes grades irrelevant

According to this memo, families can decide that the grade for any course this semester can be removed from a student’s record.

Caveat: this memo is alleged to be written by the Department of Education (the "DOE"). But the link above leads to a copy published on the web site of the teacher's union. According to the New York Post, "DOE spokeswoman Miranda Barbot would not comment on the grading memo."

On a personal note:

• I welcome the de-emphasis of grades, since I think many Stuyvesant students focus on grades to an extent that harms their education and mental health. I am optimistic that the change can help concerned parents, too.

• I aim to help students who are interested in computer science and/or are interested in improving as students in courses like this one. I align my efforts with those aims, while also cooperating with school policies.

There will presumably be more discussion of these developments in class and on Piazza. I am certainly thinking about how the policy can benefit learning about comp sci and being a student.

## grading plan from before 2020-10-26

Many Stuyvesant students focus on grades to an extent that harms their education and mental health. To ameliorate this distressing proclivity, the course's grading seeks to align higher grades with good practices for learning, as well as the school's policies. Spend your efforts on improving as a student; let the grades take care of themselves.

At the start of the term, the grading makes two assumptions:

• The wide range of students' interest and success in this course will resemble previous semesters'. If that assumption is borne out, the course average will resemble historical averages. For introductory courses the average grade has been close to 90.

• Until a student has an opportunity to demonstrate their interest and success, the best assumption about any particular student is that they will earn the average grade for every graded homework, every larger assessment, and for classwork/ participation.

The principal reason to assume average-ness is that the average is my best guess. A Bayesian might call it a prior. You might take a similar approach if asked for your best guess of the temperature next July 4th, with a response like "Recent years averaged 90°."

A common alternative for a guess at a student's eventual grade is the average of the grades they earned by the time the guess is made. That is reasonable towards the end of the term, but is typically unstable early in the term. Baseball announcers commonly eschew giving batting averages early in the season for the same reason.

The average-of-grades-so-far is equivalent to predicting that a student's future grades will match their past grades. Historically, this approach induced stress in grade-obsessed students who were new to courses like this one. Learning how to succeed in courses like this one is a major goal here. Implicitly assuming that a student will fail to improve contradicts my experience and outlook.

A student or caregiver who prefers an alternative approach can calculate it, since they can see the actual grades.

As each of a student's actual grades becomes available, it will replace a grade of 90% that was assumed initially. So by the end of the term, a student's course grade will reflect only their work, with no remnant of the original assumption.

You can play with example calculations posted here. The example is simplified to make it tractable:

simplification in the sample reality at Stuy
2 marking periods 3
1 higher-weight summative assessment per marking period about 2 per marking period
actual grades through homework_2, shown in black;
assumed grades of 90% thereafter, shown in gray
from assuming all grades of 90%
to all actual grades by student

About one homework assignment per week will be graded lightly, aiming to assess whether each submission shows substantial understanding of the material. For details of the scoring, see the section titled rubric for most homework.

Grades on individual assessments are posted on JupiterEd, where both students and parents/ caregivers can see them. Ignore JupiterEd's calculations from the grades, like the one they label "Semester Total" Those calculations mean nothing in this course. JupiterEd is used only to report the values that I calculate in another system. I calculate combined grades in the other system and post them, too, towards the end of JupiterEd's list, under the headings "homeworks", "summatives", "Classwork/ Participation", and "semester grade".

Classical testing fails during remote learning, so I expect to give no tests this semester. The fundamental issue is the impossibility of providing reasonable curbs on cheating by dishonest students. Honest students deserve a reasonably equitable environment, and no teacher wants to provide hard-to-resist temptations to cheat.

"What can replace tests for higher-weight grading during remote learning?" is the most-discussed question bothering the computer science teachers. The answer, pretty clearly, is "Nothing." When we gave tests, I had reasonable confidence in distinguishing between students who earned a 95% versus those who earned a 90%. The course average across all students was around 90%. Students who earned the much-higher grade of 95% usually exhibited sustained interest and effort that exceeded that of a typical student. Without tests, students, caregivers, teachers, and administrators must accept the inevitable reduction in the accuracy of grading. For perspective, notice that this inaccuracy ranks low in the list of harms caused by this epidemic.

Instead of testing, I aim to provide more detailed grading for summative homework. The results will be weighted more heavily in the grading for the semester. That is, when a grading opportunity aligns with a homework assignment that students can be expected to understand well, I will write a detailed rubric, like the rubrics formerly used for tests.

Publishing a rubric for summative assessments usually requires providing most or all of the answers. So once a rubric is published, a submission for one of these assessments can be worth no more than half credit, even if a student can somehow demonstrate that they understand the topic fully, and did not merely copy answers.

When homework assigns reading, the initial grading for that assignment reflects an assumption that the student did the reading. If a student's subsequent actions demonstrate ignorance of the content, the grade on the homework will decrease.

For example, hw00 asks students to read the class home page, since it contains my best advice for succeeding in this course and others like it. Part of that advice gives instructions for writing email that helps both you and me. So if a student sends me email that demonstrates ignorance of those instructions, their grade on the homework goes down.

The notes here show the leading grading ideas so far. Necessarily, these ideas are under development, open to improved ideas from any source, or changes in my understanding of the administration's directives, or realities that diverge from my expectations. About all I am certain of is my good intent and my need for others' help and patience.

The categories in the grading are explained here. Questions? Comments? Suggestions? Discuss them on Piazza.

Figure out how you erred on homework, especially homework that is graded with a detailed rubric and weighted heavily. That is educational because that work focuses on the elements of the course that I think are important.

In heavier-weighted grading, I create a rubric to promote consistency, so that similar errors by different students are graded similarly. I publish the rubric with the grades. It can communicate the parts of a problem I regard as important and it often lists common errors.

Initial work on figuring out errors must be done by students, without my help, mostly for the educational benefit. So do not ask me for help until you have thought, asked, and experimented to correct your work.

To find the error in your answers, try some of these steps:

• Re-read the problem. It is common for people to notice instructions that they overlooked initially. This is easily the most common answer to grading questions.

• Consult with classmates, either in person, via Piazza, or at the CS Dojo.

• Identify the important parts of the question, by reading the rubric.

• Consult the usual sources of help.

## disputing judgment

When you and I agree that an answer is wrong, please respect my efforts toward fairness and consistency, by accepting my judgment of the penalty.

If the penalty seems high, estimate the fraction of the important parts of the problem you did correctly, as identified in the rubric. For example, if you decide you did an 18-point problem about half right, then a score between 8 and 12 is probably close enough. Contesting the grade is probably not worth the time and risk of requesting that the entire assessment be re-graded.

If you insist on disputing my judgment, within two school days of the publication of the grade and rubric, write a paragraph explaining the alleged error. Resubmit your work to me, with the explanation. I will re-grade the whole assessment. I will correct all grading errors I find, in both directions. Your grade may go up or down.

## extra credit: points for perspicuity

Students can earn points for perspicuity. If a piece of code or English is so clearly and tersely written that I can verify its correctness in a single reading, it can be worth extra credit. Clear writing is hard in any language, however, so achieving it normally requires drafting the answer and editing the initial drafts.

Students who focus on grades occasionally ask for opportunities to earn extra credit to compensate for low grades. I know of no work outside the curriculum to recommend as a remedy. Instead, whatever time a student wants to devote to improving their grade in this course should be devoted to learning the course material and preparing appropriately for the next assessment. My best advice on doing so is in this document.

# Holmes's schedule

period activity
1 teaching 1intro
2 teaching 1intro
3 teaching 1intro
4 learning from Mr. Dyrland-Weaver's class
5 usually available
6 teaching 1intro
7 teaching 1intro
8 usually available
9 usually available
10 usually available
office hours usually available
after school usually available

To make an appointment to talk in person, send email. Tell me…

• the topic(s) you want to discuss
• an estimate of the length of the meeting
• the date and period for two times when you can meet with me.

I will respond with whether I can meet then.

Courtesy requires keeping your appointments, or — second best — alerting me in advance if you intend to break an appointment.

I work in room 307. You can call me there in the periods when the schedule above shows "usually available". Do not call when I am teaching! Extension 3070

# email helps communication

Use standard English, the way you would in a paper submitted for a grade in an English class, including full sentences, verbs, paragraphs, courtesy, organized thoughts, re-reading, revision, spell-checking, and all the other techniques you know for communicating effectively.

Do not use abbreviations from texting, like "ur". Do not omit punctuation, as in "dont". Such shortcuts are fine when texting with friends, but they are inappropriate in more formal communication, like ours.

Use the subject field of your email to maintain threads that bind related messages together, thereby distinguishing one conversation from others. Indicate content and purpose. A subject like "help!" or "homework" is useless; it tells the reader nothing except that the author is too lazy to help the reader understand the issue. Expect bad results from telling the reader that.

1 1
2 2
3 3
6 6
7 7

Put your name in the message, perhaps by configuring your email client's display name.

The first sentence of your email should tell the reader why you are writing or what you want. It should answer the reader's implicit question, "Why should I make the large effort to understand the rest of this email?"

For that reason, business-related emails like ours should not start with "I hope you're having a nice day", nor any of its variants.

In subsequent paragraphs, provide background, explanation, or amplification.

People occasionally try other ways to communicate with me that work less well than the email accounts shown above. Avoid these:

• The Department of Education has created a separate email account for my use at the domain schools.nyc.gov. But it is inconvenient to use.

• The homework server has a facility for leaving comments about the homework. But do not rely on my seeing a comment you leave there, because I read only as many of those comments as time permits.

The main use I make of those comments is to understand how long an assignment took, and whether most commentators report success or puzzlement. I skim comments to acquire an overall impression.

So for best results when you want individual attention, use the appropriate email address from the list above.

Whitelist email from the domain @DavidMHolmes.net, telling your email program that email from that domain should not be considered junk or spam. You may find good advice by searching the web for
     whitelist
followed by the name of your email program, like
     whitelist gmail

# classroom routines

It is widely observed that time is the most critical scarce resource in a class is time. As a student, the scarcity rarely occurred to me; I just had to keep up. But in leading a class, the scarcity rankles constantly. Can we delve far enough into a question to understand why people find it interesting? How much easier will the homework be if more of it is done in pairs in class? What's so cool about tail recursion optimization, and why should I care?

So it is worth establishing routines that save time and disruption.

## arrive before the late bell

Class begins at the late bell.

## start of class

Your objective at the start of each class is to enter a mental and physical state in which you are ready to contribute and learn.

• Readiness to make notes requires starting a new page in your notebook with the day's date, and having 2 writing utensils of different colors on the table.
• Stow all other belongings under the table, clearing the aisle between tables.
• Foster mental readiness by recording the day's must-ask questions then working on the start-of-class assignment. (a.k.a. the do-now)

Arrive before the late bell, so that you are working on these tasks by the time it rings. Successful sophomores have assimilated this timing; I make it explicit here to avoiding embarrassing anyone who has not learned it yet.

I have sympathy for people who are only now jettisoning the impression from middle school that time before the late bell is free for socializing, because I remember making the transition.

But the absurdity of this misconception becomes apparent if you think about college classes. For example, in the first year at a medium-sized university, I was privileged to hear David Wilkinson take time out from his widely-recognized work studying how background radiation supports the big bang theory to teach physics to beginners. And Burton Malkiel had just left President Ford's Council of Economic Advisers to teach Econ 101 to a few hundred first-years. When people like that take 50 minutes to explain what they think you should know, you don't squander the first three looking for a seat and a pencil. Students probably don't make it that far unless they have learned how to prepare to learn.

My teaching falls far short of those teachers', but you can certainly read a clock as well as their students.

The start-of-class assignment typically asks you to…

• read the must-ask questions you recorded for the previous class; and

You are welcome — indeed, it is probably better — to work in pairs with an immediate neighbor, augmenting each other's notes and jointly identifying answers. If you missed the previous class, seeking help from a classmate is necessary, not just optional.

By this stage in your scholastic career you know the appropriate voice level for group work. As a rule of thumb, if I can distinguish your voice over your colleagues', you are too loud. Learn to murmur.

As adherents of the Cornell note-taking system [1] [2] know, the review contemplated here is actually too little too late. By the time they start college, good students develop the self-discipline to review notes without prompting. That review is most profitably done soon after each day's class. In college, there will be no do-now, no teacher-designed exercises to help students recall the context of the previous class. Instead, successful students do that review on their own initiative, on a schedule that works for them.

While you are in high school, learn about and experiment with study techniques. To help with that experimentation, I assign techniques, such as the beginning-of-class reviews. By the time you reach college, you want to have internalized the techniques that work for you.

Start-of-class routines typically finish within 3 minutes of the late bell, depending on the opening assignment. Four minutes represents 10% of a 41-minute period, so you can appreciate the need for discipline.

I cannot address individual concerns before lessons. At that time I am trying to start the class as speedily as possible, so attending to individual concerns would delay the entire rest of the class. If you need individual attention for less than a minute — for example, to add a signature to an absence note — wait until the do-now is under way. For longer conversations, make an appointment. Sometimes I can also talk after classes.

# absence

## yours

### partial day

I teach your course several times a day. Students who plan to miss a class can ask permission to attend one of the other classes.

### whole day

When you are absent, it is your responsibility to catch up. Ask a reliable classmate to review their notes with you. Ideally, do this at the CS Dojo, for access to more help if questions arise. I regret that I cannot afford the time to tutor individual students. One benefit of your accepting this responsibility is that I rarely need to object to a student's missing a class for musical or sports conflicts, or to make up a test in another subject, etc.

## mine

When I am absent, I usually post instructions in the class notes. Look there and remind your neighbors to do so.

# etiquette

## independent learning and showing off

Everyone is welcome to learn extra topics on their own, and to use it on homework or tests. One of the great aspects of computer science courses is that you can learn any amount more on your own, and benefit from it, whether the amount is small or large. Every semester there are a handful of students whose interest in the material leads them on, and it is a pleasure to see.

But in class and Piazza, don't introduce digressions that hurt — rather than benefit — the class as a whole. Independent learning is great, as long as it is, well, independent.

This kind of self-restraint is tougher than it sounds, since it is natural to want to show off extra learning. Showing off is unattractive as well as distracting. Instead, independent learners occasionally ask quick questions after class on material they have been studying on their own, without distracting anyone or showing off in the slightest. Sometimes I can help by pointing them to appropriate documentation.

The temptation seems particularly acute on the homework solutions that students are asked to post. The solutions should present the simplest possible answer to the homework problems, so as to help someone who was a little confused by the presentation in class. Introducing new material is likely to further confuse such a person. In one semester this kind of showing off rendered Piazza posts unusably dense for many students and me. Keep that from happening.

Rather than Piazza, you are encouraged to participate in public forums like the StackOverflow community, which is like Piazza for pros. No one there will think you are showing off, not least because the pros there are really impressive. Here, for example, is a posting on StackOverflow by a great Stuy student. The question was answered by Seth Tisue, who was then the lead developer of NetLogo! Also notice how polite most people are on StackOverflow, including both the student in the original posting, Mr. Tisue in his generous response, and the student again in saying "thank you". If only life were like this.

To burnish your reputation within the class in a positive way, I recommend answering questions, in class and on Piazza, without condescension or outside-the-syllabus material. You can help lots of people by writing high-quality, well-tested hints or answers to questions about the material.

Answering a question posed by another student is also very helpful. The questioner thereby hears the answer phrased differently from the way I might phrase it. That difference is valuable because the questioner was left confused by my original phrasing, so hearing different phrasing is likely to help them. Everybody wins.

People who enjoy learning about computer science will feel rewarded by taking more comp sci courses at Stuy or participating in the comp sci community outside classes. The other classes and activities are led by people whose great teaching inspired me to want to join them. Both activities will give you the company of independent learners who are nice people, and who share your interests. Learning in the company of good students is why you went to Stuy, whether you knew that in advance or not.

I cannot accept material gifts from students or their families. Students regularly give me gifts of their attention, their effort, their patience, their opinions, and their advice on becoming a better teacher, all of which are valuable to me. Let's keep material gifts out of this.

There are many reasonable views on this issue; the "no gifts" policy is just mine. Here are two others:

• O. Henry's gem-like 1905 short story, "Gift of the Magi" will enliven your life much longer than most parts of this course.

• And if O. Henry's vision of the power and beauty of gifts leaves you emotionally drained, switch to NYC Charter §2604(b)(5). That'll straighten you right out.

• It Gets Better. This site's main aim is "empowerment of LGBTQ+ youth", but its three-word assertion applies to anyone who has noticed that high school is tough socially. One of the first videos I watched was by a person named — and I am not making this up — Dave Holmes. His 6-minute video remains a favorite.

• Ubuntu setup and rescue on StuyCS's systems

• Syllabuses appear on the department's web site. These are necessarily works in progress, as we learn to adapt previous years' syllabuses to students' capacities in this semester's remote learning.

• Stuyvesant Computer Science web site, including grading policy.


text:
# zbMATH — the first resource for mathematics

On Nemyckii operators and integral representation of local functionals. (English) Zbl 0536.47027
In this paper, given a measure space $$(\Omega,\mathfrak F,\mu)$$ and a functional $$F(u,B)$$ defined for $$\mu$$-measurable functions $$u$$ and $$\mu$$-measurable sets $$B$$, we study the problem of representing $$F$$ in the integral form $F(u,B)=\int_{B}f(x,u(x))\,d\mu(x)$ for a suitable integrand $$f$$. The main result of the paper is the following.
Suppose that $$F$$ satisfies the following conditions $$(1\leq p<+\infty)$$:
1) $$F(\cdot,\Omega)$$ is lower semicontinuous with respect to the strong $$L^ p(\Omega,\mathbb R^ n)$$ topology;
2) $$F$$ is local on $${\mathfrak F}$$ (i.e. $$u|_ B=v|_ B \mu$$-a.e. $$\Rightarrow F(u,B)=F(v,B));$$
3) $$F(u,\cdot)$$ is finitely additive on $$\mathfrak F$$ for every $$u\in L^ p(\Omega;{\mathbb R}^ n);$$
4) $$F(0,B)=0$$ for every $$B\in {\mathfrak F}$$.
Then we have $$F(u,B)=\int_{B}f(x,u(x))\,d\mu(x),$$ where $$f(x,s)$$ is a measurable function, lower semicontinuous in $$s$$, and such that $$f(x,s)\geq -[a(x)+b| s|^ p]$$ $$(a\in L^ 1(\Omega)$$, $$b\geq 0).$$
In Section 3 we show by a counterexample that hypothesis 1) cannot be dropped.
An interesting consequence of our result is the following.
Let $$T:L^ p(\Omega,{\mathbb R}^ n)\to L^ q(\Omega,{\mathbb R}^ m)$$ be a continuous mapping which is locally defined (i.e. $$u=v$$ $$\mu$$-a.e. on $$B\Rightarrow Tu=Tv$$ $$\mu$$-a.e. on $$B$$). Then $$T$$ is a Nemyckii operator, that is $$(Tu)(x)=f(x,u(x)),$$ where $$f$$ is a Carathéodory function such that $$| f(x,s)| \leq a(x)+b| s|^{p/q}$$ $$(a\in L^ q(\Omega), b\geq 0)$$.

##### MSC:
 47B38 Linear operators on function spaces (general) 46G10 Vector-valued measures and integration 47Gxx Integral, integro-differential, and pseudodifferential operators


text: # Tag Info


text:
DGtal  1.1.beta
Digital Surface Regularization

Author(s) of this documentation:
David Coeurjolly

Part of the Geometry package.

This part of the manual describes classes and functions related to the regularization of digital surfaces: Given an input normal vector field attached to digital surface surfels, the regularization outputs a piecewise smooth quadrangulated surface such that each quad is as perpendicular as possible to the input normal vector field. For more details, please refer to [27] and [28].

Related example: geometry/surfaces/testDigitalSurfaceRegularization.cpp

# Introduction

If $$P$$ denotes the vertices of the input digital surface, $$F$$ the set of (quadrilateral) faces and $$n_f$$ an estimated normal vector on the face $$f$$, we want the quad surface vertex positions $$P^*$$ that minimizes the following energy function:

$\mathcal{E}(P) := \alpha \sum_{i=1}^{n} \|p_i - \hat{p}_i\|^2 + \beta \sum_{f\in F} \sum_{{e_j} \in \partial{f} } ( e_j \cdot n_{f} )^2 + \gamma \sum_{i=1}^{n} \|\hat{p}_i - \hat{b}_i\|^2\,.$

where $$"\cdot"$$ is the standard $$\mathbb{R}^3$$ scalar product, $$e_j\in \partial{f}$$ is an edge of the face $$f$$ (and is equal to some $$p_k - p_l$$) and $$\hat{b}_i$$ is the barycenter of the vertices adjacent to $$\hat{p}_i$$.

The energy function is convex and can be minimized by solving a linear system as described in [27]. This minimization scheme is available in the DGtalTools (see volSurfaceRegularization). In this implementation, we consider an iterative scheme (gradient descent strategy) which allows us a finer control of the process.

# Main usages

Starting from an implicit digital surface:

typedef Shortcuts<Z3i::KSpace> SH3;
typedef ShortcutsGeometry<Z3i::KSpace> SHG3;
auto params = SH3::defaultParameters()
params( "polynomial", "goursat" )( "gridstep", 1.0)("verbose", 0);
auto implicit_shape = SH3::makeImplicitShape3D ( params );
auto digitized_shape = SH3::makeDigitizedImplicitShape3D( implicit_shape, params );
auto K = SH3::getKSpace( params );

with the following geometry (with a gridstep set to 0.3):

Input digital surface.

The regularization class instance can be set up using the following syntax:

auto surface = SH3::makeDigitalSurface( digitized_shape, K, params );
auto surfels = SH3::getSurfelRange( surface, params );
DigitalSurfaceRegularization<SH3::DigitalSurface> regul(surface);
regul.init();
regul.attachConvolvedTrivialNormalVectors(params);

The DigitalSurfaceRegularization::init() method sets some default values for the $$\alpha$$, $$\beta$$ and $$\gamma$$ parameters. Such parameters can be either chosen as global values (e.g. init(alpha,beta,gamma)), or as local weights. In the latter case, the user must specify a vector of $$\alpha[i]$$, $$\beta[i]$$ and $$\gamma[i]$$ values, one per digital surface pointels (see Local control). In this example, the normal vector field attached to the surfels is a trivial normal estimator whose normals are given by local convolution of input quad normals. We can now minimize the energy as follows:

auto finalenergy = regul.regularize();

Note that the user can specify the number of steps of the gradient descent as well as the initial learning rate. Note that if the DigitalSurfaceRegularization::regularize() method is called another time, the descent starts from the previous results (aka warm restart). Using the default settings (and the trivial normal vectors), we obtain the following reconstruction.

Regularized digital surface (trivial normal vectors).
Note
The regularized position can be retrieved using the getREgularizedPosition() method. E.g.
auto regularizedPosition = regul.getRegularizedPositions();
auto original = regul.getOriginalPositions();
Warning
At this point, the digital surface must be closed.

A key ingredient of the approach is to be able to change the input normal bundle. One can consider normal vectors from Integral invariant curvature estimator 2D/3D. Normal vectors can be attached using either a functor, a function or a lambda. For example, using Shortcuts (for the impatient developper)

auto ii_normals = SHG3::getIINormalVectors(digitized_shape, surfels, params);
DigitalSurfaceRegularization<SH3::DigitalSurface> regul(surface);
regul.init();
auto surfelIndex = regul.getSurfelIndex();
regul.attachNormalVectors([&](SH3::SCell &c){ return ii_normals[ surfelIndex[c] ];} );

to obtain

Regularized digital surface (II normal vectors).

For piecewise smooth reconstruction, one can consider preprocessing of the normal vector field using Piecewise-smooth approximation using a discrete calculus model of Ambrosio-Tortorelli functional

# Local control

As discussed above, the user can control the weights $$\alpha$$, $$\beta$$ and $$\gamma$$ per digital surface vertex. For instance using the following weights:

DigitalSurfaceRegularization<SH3::DigitalSurface> regul3(surface);
for(auto i = 0 ; i < original.size(); ++i)
if (original[i][0]<0.0)
{
alphas[i] = 4.0;
betas[i] = 0.0000001;
gammas[i] = 0.0;
}
regul3.init(alphas,betas,gammas);
regul3.attachConvolvedTrivialNormalVectors(params);
energybis = regul3.regularize();

we obtain a regularization with a locally adapted data attachment term.

Regularization with local data attachment weight.