Go Back   MacRumors Forums > Apple Systems and Services > Mac Basics and Help

Thread Tools Search this Thread Display Modes
Old Nov 8, 2012, 04:24 PM   #1
macrumors newbie
Join Date: Jun 2011
Matlab help

At my University we have been set the task of creating the Collatz Conjecture on Matlab. Where you take a positive integer and if the number is odd multiply it by 3 and add 1, if it is even divide it by two. Apply the same rule to the number you just generated and keep repeating the rule until you eventually reach 1. Here is the question:
1. "given an integer, n, as an input, generates the Collatz sequence for n, terminating when (if) the sequence reaches 1. It should then print the sequence to the screen along with the length of the sequence and the highest number to appear in the sequence. "
If there is anyone out there who can help it would be much appreciated.
rokusho1 is offline   0 Reply With Quote
Old Nov 8, 2012, 05:52 PM   #2
macrumors 6502a
Join Date: Jun 2012
Given that MATLAB can handle C, and that you can write pretty hefty programs right inside it, I'd suggest that you broaden your search to include programming websites where C/C++ is well known.

I would wager that it would be relatively simple to write such a thing in C and have MATLAB execute it.

(Sadly I am not a programmer, and it is beyond me - I'm a practical inorganic chemist and I use MATLAB for cftool and other such graphing abilities, but I've seen some of the stuff that the physical chemistry guys do with it that tells me it's possible).
joe-h2o is offline   0 Reply With Quote
Old Nov 8, 2012, 06:19 PM   #3
macrumors 603
Join Date: Aug 2009
Please answer this question: What Have You Tried?

The simplest thing to try is googling. If I google the most obvious search terms, Collatz Conjecture on Matlab, taking directly from the first sentence of your post, I see plenty of results.

But if you're doing this as homework or a project for which you'll receive credit, I suspect that more than simply googling, copying, and pasting is called for.
chown33 is offline   0 Reply With Quote

MacRumors Forums > Apple Systems and Services > Mac Basics and Help

matlab, programing

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
matlab for mac fahad5022 Mac Applications and Mac App Store 2 Oct 19, 2013 06:03 PM
Matlab 2013: What can it be used for? MacNoobGuy Mac Basics and Help 3 Sep 24, 2013 12:15 PM
Matlab interpolation dukebound85 Mac Programming 11 Jun 20, 2013 07:14 PM
Matlab, Java, C++ ? iRyu Mac Programming 12 Oct 23, 2012 01:08 PM
Matlab Download ahendri5 OS X 10.8 Mountain Lion 3 Oct 2, 2012 05:11 PM

Forum Jump

All times are GMT -5. The time now is 11:37 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2015, MacRumors.com, LLC