1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
dexar [7]
4 years ago
9

14) Modify the method that calculates the sum of the integers between 1 and N. Have the new version match the following recursiv

e definition: The sum of 1 to N is the sum of 1 to (N/2) plus the sum of (N/2 1) to N. Trace your solution using an N of 7.
Physics
1 answer:
Setler [38]4 years ago
8 0

Explanation:

Let solve the program using Java programming language

Method: method means group of statements to perform some operation.

             let call the method sum.

Parameters: list of variables that are use in the method for declaration.

<u>The code</u>

public int sum (int number)

int answer;

if (number == 1)

answer = number;

else

{

int half = number/2;

int span = number - half;

answer = sum(half) + sum(span) + (half * span);

}

answer result;

}

Firstly we defined the method called sum(), the method takes only one parameter which is number and return the answer(sum of  the integers 1 and N).

if the number is equal to 1, so it will return the number and if the number is not equal to 1 it will divide the number by 2 and get the span(span used to shift upper range).And result will add sum of half, sum of span and product of half span.

You might be interested in
An object that is farther from a converging lens than its focal point always has an image that is _____.
bearhunter [10]
Smaller in size (Pt. Sized)
5 0
3 years ago
At each corner of a square of side there are point charges of magnitude Q, 2Q, 3Q, and 4Q
Bad White [126]

Answer:

\displaystyle |F_t|=10.9\ \frac{KQ^2}{l^2}

\displaystyle \theta =68^o

Explanation:

Electrostatic Force

It's the force that appears between two electrical charges q1 q2 when they are placed at a certain distance d. The force can be computed by using the Coulomb's law:

\displaystyle F=\frac{KQ_1Q_2}{d^2}

We have an arrangement of 4 charges as shown in the image below. We need to calculate the total force exerted on the charge 2Q by the other 3 charges. The free body diagram is also shown in the second image provided. The total force on 2Q is the vectorial sum of F1, F2, and F3. All the forces are repulsive, since all the charges have the same sign. Let's compute each force as follows:

\displaystyle |F_1|=\frac{KQ(2Q)}{l^2}=\frac{2KQ^2}{l^2}

\displaystyle |F_2|=\frac{K(2Q)(4Q)}{l^2}=\frac{8KQ^2}{l^2}

The distance between 3Q and 2Q is the diagonal of the rectagle of length l:

\displaystyle |d_3|=\sqrt{l^2+l^2}=\sqrt{2}\ l

The force F3 is

\displaystyle |F_3|=\frac{K(3Q)(2Q)}{(\sqrt{2l)}^2}=\frac{3KQ^2}{l^2}

Each force must be expressed as vectors. F1 is pointed to the right direction, thus its vertical components is zero

\displaystyle \vec{F_1}=\left \langle |F_1|,0 \right \rangle=\left \langle \frac{2KQ^2}{l^2},0 \right \rangle

F2 is pointed upwards and its horizontal component is zero

\displaystyle \vec{F_2}=\left \langle 0,\frac{8KQ^2}{l^2} \right \rangle

F3 has two components because it forms an angle of 45° respect to the horizontal, thus

\displaystyle \vec{F_3}=\left \langle \frac{3KQ^2}{l^2}\ cos45^o,\frac{3KQ2}{l^2} sin45^o\right \rangle

\displaystyle \vec{F_3}=\left \langle \frac{3\sqrt{2}KQ^2}{2l^2},\frac{3\sqrt{2}KQ^2}{2l^2}\right \rangle

Now we compute the total force

\displaystyle \vec{F_t}=\vec{F_1}+\vec{F_2}+\vec{F_3}

\displaystyle \vec{F_t}=\left \langle \frac{2KQ^2}{l^2},0 \right \rangle +\left \langle 0,\frac{8KQ^2}{l^2} \right \rangle + \left \langle \frac{3\sqrt{2}KQ^2}{2l^2},\frac{3\sqrt{2}KQ^2}{2l^2}\right \rangle

\displaystyle \vec{F_t}=\left \langle \left(2+\frac{3\sqrt{2}}{2}\right)\frac{KQ^2}{l^2},\left(8+\frac{3\sqrt{2}}{2}\right) \frac{KQ^2}{l^2}\right \rangle

\displaystyle F_t=\left \langle 4.121,10.121 \right \rangle \frac{KQ^2}{l^2}

Now we compute the magnitude

\boxed{\displaystyle |F_t|=10.9\ \frac{KQ^2}{l^2}}

The direction of the total force is given by

\displaystyle tan\theta =\frac{10.121}{4.121}=2.4558

\boxed{\displaystyle \theta =68^o}

6 0
3 years ago
If a cyclist travels 24 km north, then turns around and cycles 12 km south, the cyclist's displacement is __ km. Enter your answ
Radda [10]
12.
Because why calculating displacement you only take two points in time, in this situation being the initial position and the final position. The distance between these two points is 12 kilometers.
6 0
3 years ago
Read 2 more answers
In a charming 19th-century hotel, an old-style elevator is connected to a counterweight by a cable that passes over a rotating d
melisa1 [442]

Answer:

2.38732 rpm

1.22625 rad/s²

163.292°

Explanation:

g = Acceleration due to gravity = 9.81 m/s²

a = Acceleration = \frac{1}{8}g

d = Diameter of wheel = 2 m

r = Radius of wheel = \frac{d}{2}=\frac{2}{2}=1\ m

v = Speed of elevator = 25 cm/s

Angular speed is given by

\omega=\frac{v}{r}\\\Rightarrow \omega=\frac{0.25}{1}\\\Rightarrow \omega=0.25\ rad/s=0.25\times \frac{60}{2\pi}\\\Rightarrow \omega=2.38732\ rpm

The angular speed of the wheel is 2.38732 rpm

Angular acceleration is given by

\alpha=\frac{a}{r}\\\Rightarrow \alpha=\frac{\frac{1}{8}g}{r}\\\Rightarrow \alpha=\frac{\frac{1}{8}\times 9.81}{1}\\\Rightarrow \alpha=1.22625\ rad/s^2

The angular acceleration of the wheel is 1.22625 rad/s²

Angular displacement is given by

\theta=\frac{s}{r}\\\Rightarrow \theta=\frac{2.85}{1}\\\Rightarrow \theta=2.85\ rad=2.85\times \frac{360}{2\pi}\\ =163.292\ ^{\circ}

The angle the disk turned when it has raised the elevator is 163.292°

4 0
3 years ago
A flat screen is located 0.55 m away from a single slit. Light with a wavelength of 544 nm (in vacuum) shines through the slit a
kobusy [5.1K]

Answer:

Explanation:

The diffraction pattern is given as

Sinθ = mλ/ω

Where m=1,2,3,4....

Now, when m=1

Sinθ = λ/ω

Then,

ω = λ/Sinθ

The width of the central bright fringe is given as

y=2Ltanθ. From trigonometric

Then,

θ=arctan(y/2L)

Given that,

y=0.052m

L=0.55m

θ=arctan(0.052/2×0.55)

θ=arctan(0.0473)

θ=2.71°

Substituting this into

ω = λ/Sinθ

Since λ=544nm=544×10^-9m

Then,

ω = 544×10^-9/Si.2.71

ω = 1.15×10^-5m.

5 0
3 years ago
Other questions:
  • You catch a volleyball (mass 0.270 kg) that is moving downward at 7.50 m/s. In stopping the ball, your hands and the volleyball
    10·1 answer
  • If Anya decides to make the star twice as massive, and not change the length of any crossbar or the location of any object, what
    10·1 answer
  • You throw a softball (of mass 400 g) straight up into the air. it reaches a maximum altitude of 17.3 m and then returns to you.
    6·2 answers
  • Under certain conditions, sandstone will transform into quartzite. What type of rock is quartzite?
    6·1 answer
  • Compound axial member ABC has a uniform diameter of d = 1.50 in. Segment (1) is an aluminum [E1 = 10,000 ksi] alloy rod with a l
    7·1 answer
  • Two equally charged spheres of mass 1.00 g are placed 2.00 cm apart. When released, the initial acceleration of each sphere is 2
    7·1 answer
  • In figures (a)-(d), a block moves to the right in the positive x direction through the displacement Δx while under the influence
    9·1 answer
  • Two identical metallic sphere having unequal opposite charges are are placed
    11·1 answer
  • You want to go swimming, but there is no lifeguard at the beach right now. You are not a good swimmer. The safest thing to do in
    13·1 answer
  • How much heat energy is needed to raise the temperature of 50g of lead by 4.0°c​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!