# Tutor profile: Andy L.

## Questions

### Subject: Organic Chemistry

In class, my professor said that a Friedel-Crafts alkylation and a Friedel-Crafts acylation can have the same product in the end if you just reduce one as a second step. What did he mean by that and by one of them is safer in lab?

These two mechanisms are very similar and it's easy to mix them up. Alkylation is the process of attaching an alkyl group (a chain of carbons) to a benzene ring; acylation is the process of attaching an acyl group (a carboxylic acid derivative). If you use alkylation with alkyl halides of 3 carbons or more, there will be a rearrangement of the hydrogens to form a secondary carbocation. This will most likely lead to a final product you don't want. This can be avoided with the acylation process. To create the desired product of the previous example, we use an acid chloride of the same number of carbons, which when reacted with the benzene and catalyst, cannot rearrange. The reduction step comes in to remove the unwanted C=O bonds, which leaves us with the desired final product of the failed alkylation. Acylation is "safer" in lab because you can get better yields with it since there is no risk of rearrangement to affect the end yields.

### Subject: Calculus

Can you explain how to take a partial derivative.

All of the rules you already know relating to derivatives apply to taking partial derivatives, with the addition of one thing: treat the other variable(s) as constants. If we have a function with two variables in it, for example [f(x,y) = x^2 + xy + y^2], and we want to take the partial derivative with respect to x; first, look at all of the terms and find the terms with non-x terms ( any term with a y in it). Here, the second and third terms have y's. Treat these y's as constants. Now differentiate. d/dx of x^2 is 2x, nothing new there. d/dx of xy, which is just x times a constant, is just the constant. If that's confusing, what's the derivative of 17x? Just the constant 17, right? Lastly, d/dx of y^2, a constant, is just zero. If that's confusing what is the derivative of 100 or 2 or -36 or 1,234,567,890? Just zero. So as you can see, when we have more than just one variable, we ignore them and demote them to the status of a constant and differentiate with respect to the variable we are focused on.

### Subject: C++ Programming

In File I/O, what is the importance of a prime read?

First of all, remember that when we read a file, we have to know the format of the data in the file. If the file format is in int, then a string, then a float; we have to set up variables to correctly store these values as they are "read in". As we learn the process of file i/o, we need to understand the grand scheme of it all follows a fairly simple template: read the file line by line, store the data in variables, process the data, output it, read the next line. The prime read is important for setting up this pattern. It allows us to easily read a file through the use of a while loop- since this allows us to recursively read a file line by line for as many lines as there are in the file (a for loop would require the knowledge of the length of the file, which in practice may not be known). Since a while loop requires the "iteration step" to occur at the end of the loop, an error will be thrown in the first pass if there is no prime read since the variables are all null and the program wants to process them.

## Contact tutor

needs and Andy will reply soon.