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

  Write a client code that creates two objects

Write a Java program that (1) Defines a base/super class A, a subclass B (inherits from A), and a subclass C (inherits from B).

  Write a program that assigns seats on an airplane

Prepare a program that teaches arithmetic to a young child. The program tests subtraction and addition. Write a program that assigns seats on an airplane.

  Console application for a small car servicing company

Develop a program for the service department staff - Console application for a small car servicing company

  Create your listarray class

Create your ListArray class that is functionally similar to the formal Java ArrayList Utility class. here are the requirements

  Write a java program to calculate the ideal weight

Write a java program to calculate the ideal weight when you enter the age and height of user

  Design an adt for a two-color

Design an ADT for a two-color, double-stack ADT that consists of two stacks one "red" and one "blue" and has as its operations color-coded versions of the regular stack ADT operations.

  Return a reverse queue

represent my queue object as a parameter, what the program should be doing. It should return a reverse queue

  What is an illustration of a hypothesis test please explain

what is an example of a hypothesis test? please describe the context of the problemissue that you encountered what the

  Create a class named blooddata

Create a class named BloodData that includes fields that hold a blood type (the four blood types are O, A, B, and AB) and an Rh factor

  Tic-tac-toe game assignment

Assignment 1(Java): Tic-Tac-Toe Game (Assignment 1 is attached),  Use the concepts and scenario from Assignment 1 and continue with the tic-tac-toe game design and development.  Section 1: Java Program File, The following method, numPaths, is suppos..

  The program should ask the user to enter the student'' answer

Your program should store these correct answers in an array. (Store each question's correct answer in an element of a string array.) the program should ask the user to enter the student's answers for each of the 20 questions, which should be stored i..

  Create a new android application project

You have been hired to create a mobile application for Healthy Life, a local organic bakery and grocery store. The main screen should state the name of the person who owns the phone. Create a new Android Application Project

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