I respect matlab. But I hate to program in matlab. It's shit. You know it. I know it. Everyone knows it.
>>58791992
I do not know it.
http://www.gnu.org/software/octave/
>>58791992
matlab isn't a programming language.
>>58792051
I've had a fucking awful time to get it to work with symbolic stuff, x=7 or something, it's annoying as hell because I'd rather stay at home and do the work here than go to my class and work there.
>>58792065
but it is
>Matlab
>Not one of the most powerful tools available to man
Sorry that you're a skrub.
>>58792091
Have you ever seen any programming videos on the MATLAB youtube channel.
>>58792096
this to be honest
>>58792113
how is their retarded youtube channel relevant?
> not using Python+Numpy+Scipy+younameit
>>58792130
>official youtube channel for serious engineering software
>retarded
NEETS please leave
>>58792096
not him, but matlab is a piece of crap, desu
>still using MATLAB when you could use >>58792132
cls yourself
But why is matlab so shit compared to things like >>58792132 ?
R + ggplot2 reporting in
>>58792293
Hello my fellow patrician.
>>58791992
vector programming is love, vector programming is life
matlab was there first, no?
>>58791992
When I hear people talk about Matlab I feel like everyone else is using Matlab for writing high performance applications, games with graphic acceleration. It is slow but it's good enough for what it does which is modelling and simulation, because you need a very straightforward language to do these since you'll be doing the thinking about the model (not the language you're implementing it with) most of the time anyway.
And even then most of the things that are slow in Matlab (for loops for example) usually have an alternative for special cases that run much faster.
>>58792132
> Not using Torch7 + LuaJIT
>>58792051
>>58792089
EE friend of mine told me that it's really easy to connect it to microcontrollers and sensors.
>>58792386
apl
>>58791992
Matlab is literally the easiest programming language. You just have pay attention to the function signatures, and to save the files before running, and everything afterward is idiotproof.
Anyone used Maxima?
https://en.wikipedia.org/wiki/Maxima_(software)
Haha no, MATLAB is great.
I'll show you an implementation I made 8 years ago of the solution to the problem described in chapter 5 of this book: https://www.ime.usp.br/~jstern/books/evli.pdf
The technique employed is called simulated annealing with heuristic acceleration, and a genetic programming algorithm also described in that chapter of the book was also used.
Here's the code:
File: annealing.mat#!/usr/bin/octave -qf
% File: annealing.mat
Smax = 200;
[args, cnt] = sscanf(fgetl(stdin), "%f", 5);
b = args(1);
m = args(2);
n = args(3);
params = eval(fgetl(stdin));
A = eval(fgetl(stdin));
x = eval(fgetl(stdin));
W = [];
unsh = ones(1, b+1);
unsv = ones(m, 1);
aux = (x*unsh == unsv*(1:b+1));
for i=1:n
W = [W, sum((A(:,i) != 0)*unsh & aux)'];
endfor
cardq = sum(W(1:b, :) > 0);
sk = sum(aux);
hk = (sk(1:b) .- m/b).^2;
c = sum((cardq >= 2));
r = sk(b+1);
cost = params(1)*sum(hk) + params(2)*c + params(3)*r;
phiroot = sqrt((1+sqrt(5))/2);
invtemp = args(4);
mu = args(5);
step = ceil(log2(Smax * m * n)^phiroot);
eps1 = 1/log(step);
eps2 = eps1 + 1/(m*n);
minrate = 1/step;
accepted = 0;
u = sum(cardq(cardq > 1));
heuristiccost = cost + u/mu;
for s=1:Smax
if rem(s, step) == 0
if ( (invtemp > 1) && (accepted/step < minrate) )
break;
else
accepted = 0;
endif
invtemp += eps1*invtemp;
mu += eps2*mu;
endif
row = unidrnd(m);
newcolour = unidrnd(b);
newcolour += (newcolour >= x(row));
W(newcolour, :) = W(newcolour, :) .+ A(row, :);
W(x(row), :) = W(x(row), :) .- A(row, :);
cardq = sum(W(1:b, :) > 0);
sk(newcolour)++;
sk(x(row))--;
hk = (sk(1:b) .- m/b).^2;
c = sum((cardq >= 2));
r = sk(b+1);
Too long, will continue in a follow up post.
>>58793003
absolut shit tier coding
Second half of file annealing.mat:newcost = params(1)*sum(hk) + params(2)*c + params(3)*r;
u = sum(cardq(cardq > 1));
newheuristiccost = newcost + u/mu;
hdelta = newheuristiccost - heuristiccost;
metropolis = e ^ (-invtemp * hdelta);
if ( (hdelta <= 0) || (rand() <= metropolis) ) % accepted
x(row) = newcolour;
cost = newcost;
heuristiccost = newheuristiccost;
accepted++;
else % rejected
W(newcolour, :) = W(newcolour, :) .- A(row, :);
W(x(row), :) = W(x(row), :) .+ A(row, :);
sk(newcolour)--;
sk(x(row))++;
endif
endfor
y = zeros(m, 1) + (x == (b + 1))*(b + 1);
[colours, ix] = sort(sk(1:b));
for j=1:(b)
y += (x == ix(b+1-j))*j;
endfor
printf("%.17g %.17g %.17g\n", cost, invtemp, mu);
printf([ mat2str(x), "\n" ]);
exit(0)
First part of file main.mat. It applies some process-level parallelism, inter-process communication isn't very efficient though:#!/usr/bin/octave -qf
% File: main.mat
inputfile = "in.txt";
outputfile = "out.txt";
if (nargin() > 0)
inputfile= argv(){1};
endif
inputdata = fopen(inputfile, "r");
params = sscanf(fgetl(inputdata), "%f %f %f", 3);
[m, n] = sscanf(fgetl(inputdata), "%f %f", "C");
b = sscanf(fgetl(inputdata), "%f", 1);
matrixpos = fscanf(inputdata, "%d");
matrixrows = matrixpos(linspace(1, length(matrixpos)-1, length(matrixpos)/2));
matrixcols = matrixpos(linspace(2, length(matrixpos), length(matrixpos)/2));
A = sparse(matrixrows, matrixcols, 1, m, n);
nind = 20;
individuals = [];
x = unidrnd(b+1, m, nind);
outputdata = fopen(outputfile, "w");
temp = 1E-6;
mu = 1E-6;
iter = 0;
while nind > 1
for i=1:nind
To be continued...
>>58793037
Feel free to improve it/do better.
File annealing.mat continued:[individuals(i).inputdata, individuals(i).outputdata, individuals(i).pid] = popen2("./annealing.mat");
fprintf(individuals(i).inputdata, "%.17g %.17g %.17g %.17g %.17g\n", b, m, n, temp, mu);
fprintf(individuals(i).inputdata, [ mat2str(params), "\n" ]);
fprintf(individuals(i).inputdata, [ mat2str(A), "\n" ]);
fprintf(individuals(i).inputdata, [ mat2str(x(:, i)), "\n" ]);
fclose(individuals(i).inputdata);
endfor
cost = [];
for i=1:nind
waitpid(individuals(i).pid);
[args, cnt] = sscanf(fgetl(individuals(i).outputdata), "%d %f %f", 3);
cost(i) = args(1);
if args(2) > temp
temp = args(2);
endif
if args(3) > mu
mu = args(3);
endif
x(:, i) = eval(fgetl(individuals(i).outputdata));
fclose(individuals(i).outputdata);
endfor
[best, ibest] = min(cost);
fprintf(outputdata, "%g\n", best);
fprintf(outputdata, "%d\n", m);
fprintf(outputdata, "%d ", x(:, ibest));
fputs(outputdata, "\n");
costvar = var(cost);
nselec = floor(log10(costvar));
if (nselec > (nind/2))
nselec = floor(nind/2);
endif
if (nselec > 10)
nselec = 10;
endif
selection = rand(1, nind);
adapt = best./cost;
[ord, isel] = sort(adapt .* selection);
seleclow = isel(length(isel)-(nselec-1):length(isel));
>>58793003
>University of Sao Paolo
That explains it
I meant file main.mat here >>58793053.
Finally, last part of file main.mat:remainingind = x(:, isel(1:length(isel)-(nselec)));
selection = rand(1, nind-(nselec));
adapt = min(remaining)./(remaining.*remaining);
[ord, isel] = sort(adapt .* selection);
selechigh = isel(length(isel)-(nselec-1):length(isel));
for i=1:nselec
U = unidrnd(2, m, 1);
nind++;
x = [x, x(:, seleclow(i)).*(U == 1) + remainingind(:, selechigh(i)).*(U == 2)];
endfor
deaths = iter;
if(deaths > nind)
break;
endif
for j=1:deaths
[worst, iworst] = max(cost);
x = x(:,[1:(iworst-1), (iworst+1):nind--]);
endfor
iter++;
endwhile
fclose(outputdata);
exit(0)
>>58791992
Are you shit at linear algebra? Tho I understand Mathematica is superior
>>58793074
What are you trying to prove with all this?
>>58793430
some complex problems are easily solved with matlab?
not him, but this is something that i believe
Matlab is second to none in Control system and it has pretty solid Image Processing toolbox too, and it's free.
If you work in R&D matlab is surely a great choice.
>>58792293
hello friendo