Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB CODING: PLEASE NOTE THERE ARE 2 INPUTS and 2 OUTPUTS The Collatz Conjecture is a famous mathematical problem that was first presentedin1930s.It is straight

MATLAB CODING: PLEASE NOTE THERE ARE 2 INPUTS and 2 OUTPUTS

The Collatz Conjecture is a famous mathematical problem that was first presentedin1930s.It is straight forward to understand but remains unproven.The problem states that you can create a sequence from any positive integer that will eventually end in1 by following this process:

- Select a positive integer.

- If that integer is even,divide it by 2,but if it is odd,then multiply it by3 and then add 1.

- Repeat this process on each result until you reach 1.

An integers Collatz sequence is the list of numbers that are created by this process.For example,the sequence for 6 is 6,3, 10,5,16,8,4,2,1

This sequence has eight steps(i.e.,number of calculations to reach 1)

You are an engineer who works for a STEM(Science,Technology,Engineering,andMathematics) education firm. Your group is designing algebra educational apps and wants to include a game based on the Collatz Conjecture. Your task is to create a user-defined function to create a vector of sequential positive integers and then build a second vector that contains the number of Collatz-sequence steps for each integer in the first vector.Your user- defined function must:

- Accept as input arguments the initial positive integer and the total number of integers in the sequential vector.

- Create the vector of sequential integers that starts with the initial positive integer input and increments by1until the vector has the total number of elements, including the initial integer, that was set in the input arguments.

- For each element in the integer vector,determine the number of Collatz-sequence steps and store that information in another vector.

- Plot the number of steps versus the integer values.Format the plot for technical presentation,including a reference to the first and last integers in the integers vector.

- Return as output arguments the vector of integers and the vector of corresponding steps.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

how do you know if dividends are paid

Answered: 1 week ago

Question

1. How is the newspaper help to our daily life?

Answered: 1 week ago

Question

1. Prepare a short profile of Mikhail Zoshchenko ?

Answered: 1 week ago

Question

What is psychology disorder?

Answered: 1 week ago