Dangit, Conic. Stop dropping updates late at night. I have to sleep.
Within the first 20 options of n and c1, the peak is n=18, c1=19.
Within the first 500, n=484 c1=311.
Matlabbery:
%Matthew Miller
%1/16/22
%Calculates max qdot for a range of n and c1 values
%to do more I’d have to optimize a time-dependent progression
%I may do that later
%pdot = q1*q2*q
%qdot = m3Factor * s_n(chi)/sin(chi)
%s_n(chi) = chi * PI(k=1:n)(1-(chi/(k*pi))^2)
%==========================================================================
%start fresh
clear c1 n chi sinterm s_n M I qdot n_max c1_max
%==========================================================================
%human entry
dimension = 36;
%not sure what to do with these yet
q1=1;
q2=1;
c1=1;
c2=1;
c3=1;
m1=0; %Milestone upgrade 1 level (0, 1, 2, 3, or 4)
m2=0; %Milestone upgrade 2 level (0 or 1)
m3=1; %Milestone upgrade 3 level (0, 1, 2, or 3)
%==========================================================================
%prelim calculations
n=1:dimension; %X axis
c1=1:dimension; %Y axis
m1Factor = q1^(1+0.01*m1); %precalculate
m2Factor = c3^m2; %precalculate
m3Factor = 3^m3; %precalculate
chi = zeros(dimension,dimension); %preallocate for speed
sinterm = zeros(dimension,dimension); %preallocate for speed
s_n = zeros(dimension,dimension); %preallocate for speed
qdot = zeros(dimension,dimension); %preallocate for speed
%==========================================================================
%generate variables
%Normally I’d do all these with functions, but that’s harder to read
%chi
for n_index=1:length(n) %X
for c1_index=1:length(c1) %Y
chi(n_index,c1_index) = pi.*c1(c1_index).*n(n_index)./(c1(c1_index)+n(n_index)./m3Factor)+1; %x=n, y=c1
end
end
%sin(chi)
for n_index=1:length(n) %X
for c1_index=1:length(c1) %Y
sinterm(n_index,c1_index) = sin(chi(n_index,c1_index));
end
end
%s_n(chi)
for n_index=1:length(n) %X
for c1_index=1:length(c1) %Y
s_n(n_index,c1_index) = chi(n_index,c1_index);
for k = 1:length(n_index) %Big Pi
s_n(n_index,c1_index)=s_n(n_index,c1_index)*(1-(chi(n_index,c1_index)/(k*pi))^2);
end
end
end
%qdot(chi)
for n_index=1:length(n) %X
for c1_index=1:length(c1) %Y
qdot(n_index,c1_index)=s_n(n_index,c1_index)/sinterm(n_index,c1_index);
end
end
%==========================================================================
%find max qdot
[M,I] = max(qdot(:));
[n_max, c1_max] = ind2sub(size(qdot),I); %Maximum values
%waterfall(qdot(1:10,1:10));
I bounce between writing concise, readable, and optimized code. Text file here.
For no update, c1 is 1 (start value). Level 0
For each update until level 50, c1 increases by 1.
For each update from level 51 to level 100, c1 increases by 2.
For each update from level 101 to level 150, c1 increases by 4.
Etc.
So I would initialize the c1 array, that is later used in c1(c1_index) roughly like this:
c1 = [2];
sum = 2;
for c1_index=1:(dimension – 1) % -1 because we already have one element initially
mult_fifty = idivide(c1_index, 50); % for every multiple of 50 updates, additional c1 value is doubled
sum = sum + 2^mult_fifty;
c1 = [c1 ; sum];
end
Does that make sense? The final result is then the index, of course which is the level of the upgrade and not the value of c1.
That does make sense. Gilles sent me a link to github which has the source, but I haven’t really dug through it yet.
Oh god, how can I format comments like code?
In Windows, select section and Ctrl + T. In Linux it’s something else, but there’s an option to change the shortcuts to Windows native, so I always do that.
I wrote some code myself and used the exact same approximation that the original Javascript code is using. The result is boring, sorry. The optimum is at the max for n and c1. But at least it is clear that upgrades for c1 become a bit pointless after a while (they still make it better but not by much).
https://imgur.com/fcvJOs9.png
Post your code, please. I’d like to see it.