Calculate and return the sum of the geometric series

Assignment Help JAVA Programming
Reference no: EM13852171

To complete this homework assignment, turn in m-files containing the MATLAB code that you generate in response to each problem. Functions should be turned in in separate files. A single script m-file should be turned in. This file should include all scripts that you generate in response  to the problems. In cases where you generate a function in response to the problem, the script fileshould call  this function to demonstrate that it works. Use comments in the script file to indicate which problem each portion of the file is responding to.
1. Write a function repvec that receives a vector and the number of times each element is to be duplicated. The function should then return the resulting vector. Here are some examples of calling the function:

>>repvec(5:-1:1,2)
>>repvec([0 1 0],3)
2. Vectorize the following code:
n = 3;
x = zeros(n);
y = x;
for i = 1:n
x(:,i) = i;
y(i,:) = i;
end
3. Using vectorized code, write a function called geomser that will receive values of r and n and will calculate and return the sum of the geometric series:
1 + r + r2 + r3 + ... + rn
The following examples of calls to this function illustrate what the result should be:
>>geomser(1,5)
>>geomser(2,4)

Reference no: EM13852171

Questions Cloud

Identify the advantages and disadvantages of circuit switch : Identify the advantages and disadvantages of circuit switching and packet switching-X.25, Frame Relay, Asynchronous Transfer Mode2, and Transmission Control Protocol/Internet Protocol (TCP/IP)-regarding performance, speed and throughput potential, an..
Identify strategies for continuing your literature review : Read the second information sheet on ‘Literature Reviews: Staying on Track' to identify strategies for continuing your literature review, and ‘putting it all together'
Review a case for an arson investigation : An insurance company has asked your digital forensics firm to review a case for an arson investigation. The suspected arsonist has already been arrested, but the insurance company wants to determine whether there's any contributory negli- gence on th..
Write all the contents of a java file : Write all the contents of a Java file named 'Restaurant.java'. This file contains the class Restaurant that represents some data about a Restaurant.Every Restaurant is identified by its 3 attributes: a category (like "Chinese" or "Mediterranean"), a ..
Calculate and return the sum of the geometric series : calculate and return the sum of the geometric series
Comprehensive assessment of the 2014 financial statements : The final project for XACC 290 is a 700- to 1,050-word paper in which you provide a comprehensive assessment of the 2014 financial statements of Tootsie Roll Inc. You will focus on assessing the company's Balance Sheet and Income Statement
Describe charge transfer mechanisms in a voltage doubler : Describe the charge transfer mechanisms in a voltage doubler, and show that the output terminal voltage is twice the peak of the input AC source voltage. How would you reverse the polarity of the output voltage in such a circuit?
How are the business and the technology perspectives : Identify in which phase of the development process - How are the business perspectives and the technology perspectives of an informations system related.
Respective velocities of points : Respective velocities of points A (bottom of the wheel), B (top of the wheel) and C (rearmost point of the wheel). Respective accelerations of points A, B and C on the wheel as indicated.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Return only the rows where the shipdate

Write a SELECT statement that returns these columns from the Orders table:

  Create a class named student that has three member variables

Create a class named Student that has three member variables

  Implementation activities of software development

Analysis, design, and implementation activities of software development

  Implement the finite field gf

Write a program called "GF2.java" to implement the finite field GF(p n )where p is a prime number andn is a positive integer.You also need to write four methodsto realize.

  Review the threading

Threading. A considerable amount of time was spent trying to get threading to work properly. Initial designs included a thread called Turn, which would call a subsequent thread for performing communication actions with the LAMP server. Unable to..

  Compute the temperature in centigrade

Compute the temperature in Centigrade - Display the temperatures in both Centrigrade and Fahrenheit with appropriate labels, using the + operator to concatenate the labels with the variables

  Program that allows two players to play tic-tac-toe

Implement a program that allows two players to play tic-tac-toe. Draw the game grid and an indication of whose turn it is (X or O). Upon the next click, check that the mouse click falls into an empty location,

  Write specifications for method which advances date by one

Write specifications for the method which advances any given date by one day. Comprise a statement of purpose, pre- and post-conditions, and description of parameters.

  Application for an animal-fur trimming service

Create an application for an animal-fur trimming service. Write the code for the application. Prompt the user to indicate how many animals. Display the total fee for one year. Be pleasant in your output as it will be expensive.

  Create a gui with a text field and a button

The java program needs to create a GUI with a text field and a button, with an actionlistener. When the button is clicked, whatever text typed into the text field is stored in a variable and written to a text file

  Finally make a java test class in your test class you must

finally create a java test class. in your test class you should at a minimum a construct 200 instances of each subclass

  Java program to find solution of cryptarithmetic puzzle

A solution to puzzle is S=9, R=8, O=0, M=1, Y=2, E=5, N=6, D=7. Write down a java program which finds solution to cryptarithmetic puzzle of: TOO + TOO + TOO + TOO = GOOD.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd