Meekail Z.

BS Math, BS Computer Science and MS Artificial Intelligence student at UGA

Tutor Satisfaction Guarantee

Java Programming

TutorMe

Question:

Write a method titled FB that accepts a an integer and outputs "fizz" if the number is divisible by 3, "buzz" if the number is divisible by 5, "fizzbuzz" if the number is divisible by both 3 and 5, otherwise just the number itself.

Meekail Z.

Answer:

private string FB(int n){ String s=""; if(n%3==0) s+="fizz"; if(n%5==0) s+="buzz"; if(s.length()==0) s+=n; return s; } The fizzbuzz test is a bit different than most because it doesn't fit into most new programmer's paradigm of "If then..." since all the conditions are to be evaluated at all times. Note that one can brute force an "If then..." solution to this, but really there's no winner in that situation. The approach featured here makes it so no evaluation (n%3, n%5,...) is required more than once, minimizing operational intensity. It utilizes the fact that Strings in Java act as containers for characters. Note that was the problem to ask for "buzzfizz" instead of "fizzbuzz", all that needs to be done is to switch the order of the first two if blocks. The last conditional is in place to check whether or not the given number is divisible by 3 or 5. Although you could manually check this, if it were divisible by either, the value of s would then be either fizz, buzz, or fizzbuzz. If it is still the original empty string we initialized it to, then that means that the given number did not meet any of the conditions, and we should output the number itself. Note that there are many other approaches to solving this problem, and the gains from such optimization might seem negligible in this code snippet, but in larger fully functioning projects, tiny optimizations build up, and the benefit to functionality, readability, and ultimately ease of debugging truly pay off.

Calculus

TutorMe

Question:

Rewrite the following in terms of an integral and evaluate$(\lim_{n\to\infty}\sum_{i=0}^{n}\frac{1}{n+i}=?$)

Meekail Z.

Answer:

$(\lim_{n\to\infty}\sum_{i=0}^{n}\frac{1}{n+i}=\lim_{n\to\infty}\sum_{i=0}^{n}\frac{1}{n}\frac{1}{1+\frac{i}{n}}=\int_{0}^{1}\frac{1}{1+x}dx=\ln(1+x)|_{0}^1=\ln(2)-\ln(1)=\ln(2)$) First, we rewrite the original summation into a form that can be substituted for an integral. The general form is $$\lim_{n\to\infty}\sum_{i=0}^{n}f(x_i)\frac{b-a}{n}=\int_{a}^af(x)dx$$ where $$x_i$$ for $$i=1,2,...,n$$ represents points the the partitioned interval $$[a,b]$$. This goes back to our original idea of an integral as a sum of infinitely many infinitely narrow rectangles. In this case, we let $$x_i=\frac{i}{n}$$ which leads to evenly spaced points on the interval $$[0,1]$$, which leads us to set $$a=0,b=1$$ so that the bounds of our integral and sum match. Conveniently, $$\frac{b-a}{n}=\frac{1}{n}$$ making our conversion to an integral easier, although ultimately it would have common down to scaling by a constant, which isn't an issue. Now we rewrite $$\lim_{n\to\infty}\sum_{i=0}^{n}\frac{1}{n}\frac{1}{1+\frac{i}{n}}=\int_{0}^{1}\frac{1}{1+x}dx$$ and all that's left to do is evaluate the right hand side, finding $$\int_{0}^{1}\frac{1}{1+x}dx=\ln(1+x)|_{0}^1=\ln(2)-\ln(1)=\ln(2)$$

Physics

TutorMe

Question:

Every single day, you play your favorite vinyl track. You've played it so much that you know it rotates at a constant rate when being played. One day, a little ladybug joins you for your daily jam and crawls onto the vinyl record at its outer edge. As you play your record, the ladybug walks radially inward towards the center of the record at a constant rate. As the ladybug crawls towards the center, what is happening to its angular velocity, linear velocity, linear momentum, angular momentum, and angular acceleration?

Meekail Z.

Answer:

The ladybug's angular velocity is the rate at which it is being rotated about the center of the disk. Since the ladybug is only moving radially inward towards the center of rotation, in this case, the center of the disk, it rotates at the exact same rate as the disk itself which is constant. This means that the ladybug's angular velocity is also constant ($$\omega=k_1$$). Its linear velocity is directly proportional to both its angular velocity and its radial distance from the center of the disk ($$v= \omega r$$). Since the angular velocity is constant, we care only about the distance from the center of the disk. Since that distance is decreasing, the linear velocity is also decreasing. Its linear momentum is proportional to its mass and linear velocity ($$p=mv$$). Since its mass is constant we care only about its linear velocity. As we just established, its linear velocity is decreasing, and so its linear momentum is also decreasing. Next, we have its angular momentum, which is proportional to its mass, linear velocity and radial distance ($$L=pr=mvr$$). Since the mass is constant, we care only about the other two factors, both of which we've established are decreasing. This means that its angular momentum is also decreasing. Its angular acceleration is the rate at which its angular velocity changes with respect to time ($$\alpha = \frac{d\omega}{dt}$$) but since its angular velocity is constant, its angular acceleration is simply 0 ($$\alpha = \frac{d\omega}{dt}=\frac{d}{dt}k=0$$)

Send a message explaining your

needs and Meekail will reply soon.

needs and Meekail will reply soon.

Contact Meekail

Ready now? Request a lesson.

Start Session

FAQs

What is a lesson?

A lesson is virtual lesson space on our platform where you and a tutor can communicate.
You'll have the option to communicate using video/audio as well as text chat.
You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.

How do I begin a lesson?

If the tutor is currently online, you can click the "Start Session" button above.
If they are offline, you can always send them a message to schedule a lesson.

Who are TutorMe tutors?

Many of our tutors are current college students or recent graduates of top-tier universities
like MIT, Harvard and USC.
TutorMe has thousands of top-quality tutors available to work with you.