[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Home]
4Archive logo
Using matlab...
If images are not shown try to refresh the page. If you like this website, please disable any AdBlock software!

You are currently reading a thread in /g/ - Technology

Thread replies: 14
Thread images: 1
Using matlab...
I need to write a code that can calculate the Indian king chess rise riddle and display it in an array as the chess board.

My problem is i can't make an array thats (1,0) cause that's wrong, but i need to be able to get the previous square to get calculated or it all won't work.

How can i get an array to calculate the previous numbers with the first number included without it being x(1,0) at the start?

X=zeros(8,8);
X(1,1) = 1;
For i = 1 : 8
For j = 1 : 8
X(i,j+1) = x(i,j-1) + x(i,j-1);
End
X(i,1) = x(i-1,5);
End
Disp(x);
>>
It's a bad idea to let others do your homework, especially in programming, because this way you won't learn it ever.
But as a tip, have you thought of using an if-statement for that special case?
>>
>>52233835
There was a way that i can't find that we use j-1+1 to make it happen, its what i want.
But i guess this will work too.
Just removed the -1 and made the j+1 is the one to get changed.

X=zeros(8,8);
X(1,1) = 1;
For i = 1 : 8
For j = 1 : 8
X(i,j+1) = x(i,j) + x(i,j);
End
X(i,1) = x(i-1,5);
End
Disp(x);
>>
>>52233998
I'll take that back it doesn't work.
Now the problem is after cause it'll be x(1,9) which is not available and isn't needed.

I'm a civil engineer
We have to take this course but its not that much use to us.
But i can't find a way of making this work and the google isn't helping.
>>
>>52233765
Dude, /g/ is illiterate. De facto consumer electronics.
>>52234075
I'm EE and had like 4x2 hours of it and only ever copied stuff from others. It's useless.
>>
MATLAB pro here. Can you formulate your problem in a way that I can understand? I am not familiar with the Indian King Chess riddle and I don't feel like educating myself at this very moment.
>>
>>52235722
Anyway, here's the code:

X = reshape(1:64, [8 8])';
foo = @(t)(power(2,t));
res = foo(X);
disp(res)


First line constructs a 8x8 matrix with the numbers 1-64.

Second line creates a function that basically does 2^x, where x is the input.

Third line applies the function to the matrix.

Voila!
>>
>>52235983
Much more readable than >>52233998 and >>52233765
What do you use MATLAB for and for how long?
Have you used octave or other alternatives around Python and Julia? Any opinion on them?
>>
>>52236178
I've been using exclusively Julia for about 2 years now. Octave is complete shit, it's good only for porting very exotic and unique libraries/toolboxes. Python is pretty shit too. Seriously, either use Julia or sell your soul to MathWorks. That being said, if you are considering doing serious work in academia or in the industry, then you will almost surely have to work with MATLAB, which is a pity. If you have the opportunity, talk with your manager for potential switch to Julia. Remind them that:
>it's well-documented
>completely free
>MIT license
>good PR
>>
>>52236259
If you don't mind me asking more questions..

What kind of work are you doing?
Industry or academia? If industry, what qualifications would you say are best to get into your kind of work or similar work around (scientific) computation? Any other recommendations?
What environment do you use? (OS, IDE/REPL?)

I am doing my bachelor in math and that's the kind of work I want to do when I complete my master.
>>
>>52235722
It says that the indian king was playing chess with some peasant and the peasant won, so the indian king told him to ask for anything.

He told him : if the first square had 1 rise pieces the second had 2 rise pieces and third square had 4... (prev num + prev num = new num) i want the amount of rise that will be in the last square.

He sent him to jail after that, for making fun of him asking for a couple of rise pieces. (he thought)

Turns out the amount of rise that was in the last square equals the amount of rise all India produces for 4 year.
>>
>>52236928
I am working something completely unrelated now, but 2 years ago I worked briefly for one of the top 10 largest companies (revenue wise) in the world, doing mathematical modelling of their systems (I don't want to reveal more). Good mathematicians are always sought, the 300k starting meme is not THAT much exaggerated. It's hard to tell about qualifications, as good positions like this usually look for well-rounded individuals, but obviously you need experience with the tools of the trade, pretty much just MATLAB. There are some certificates that are supposed to help you, I didn't have any of them. Then again, I did a lot, and I mean A LOT of MATLAB in school and I was recruited right after graduation. So I could easily demonstrate my ability. That's what you've got to show -- that you capable of understanding real world problems and providing actual solutions, not doing fizzbuzz and whatnot.

We used almost exclusively Windows with MATLAB enterprise license, but there were some stations with RedHat Enterprise running (and MATLAB environment, of course).

If you are Masters student, great. Focus your work on software modelling and then you'll have stuff to show to prospective employers. The money could be really great and it's really a different world if you get in the right position.
>>
>>52237222
Of yeah, forgot:

When I say MATLAB, I really mean MATLAB+Simulink+all the popular toolboxes
>>
>>52237256
Thanks a lot. I'll definitely do more in that area.
Thread replies: 14
Thread images: 1
Thread DB ID: 367507



[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Search | Home]

[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Search | Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the shown content originated from that site. This means that 4Archive shows their content, archived. If you need information for a Poster - contact them.
If a post contains personal/copyrighted/illegal content, then use the post's [Report] link! If a post is not removed within 24h contact me at wtabusse@gmail.com with the post's information.