« first day (207 days earlier)      last day (3011 days later) » 

12:49 AM
The last message was posted 1 hour ago.
1 hour later...
The last message was posted 1 hour ago.
1 hour later...
The last message was posted 1 hour ago.
 
 
9 hours later…
9:51 AM
@flawr The last message was posted 9 hours ago. ;)
 
 
1 hour later…
11:08 AM
1 hour later...
The last message was posted 1 hour ago.
∞ years later...
∞ years before...
HEY GUYS, I AM FROM THE FUTURE!
∞ years later...
 
11:35 AM
@flawr slow weekend?:D
 
@AndrasDeak so.. when are you coming to my uni for a postdoc? :)
 
12:00 PM
@Dev-iL not too soon, I'm afraid:P
 
No worries... I'll be around for at least another year :)
 
@Dev-iL OK:D
 
12:36 PM
@AndrasDeak you moving to Israel? o.0
 
1:14 PM
@Adriaan not that I know of
 
...yet
 
1:28 PM
@flawr sure:P
there's a slight chance that our resident nazi party will form a government in 2018, so who knows:D
 
oh crap
Do you guys have any other ideas here?
6
A: Paint Starry Night, objectively, in 1kB of code

flawrMatlab, score 5388.3 Without any built in compression. The colour depth is reduced such that each pixel can be represented by one printable character. And the resolution is reduced. This is then hardcoded as a string. The code itself reverses the whole process. The resizing operation is using a ...

 
2:08 PM
@flawr Ooh that's an interesting problem :)
I would say fft the hell out of it, trim different parts of the fft, choose version where score (square distance) is minimal
Or basically something similar to JPEG (decompression)
 
2:29 PM
@flawr principal component analysis? Iterated function system coding?
1024 might be too little for the latter, never done that before
Oh, your preproc can be anything, just the actual synthesis should be below 1kB. Not so bad then:)
 
2:47 PM
Well you cannot load any data, everything must be contained within those 1kb
 
@flawr yeah, I've figure it out...
very interesting challenge
 
But principal component analyis might be a keyword.
 
problem with both my suggestions is that you need floats, probably to high precision
 
You can use the SVD to solve least squares problems, right?
 
the IFS one is probably a useless idea, since you'd need to include the IFS data, and then implement looping over it
@flawr an overdetermined mldivide/mrdivide will solve you least squares, even
SVD, I don't know that very much, but possible
 
2:50 PM
I also thought about indexing (like in GIF) where you create a pallete of the most "important" e.g. 64 colours, and then just write down the index of the colour used for each pixel.
 
@AnderBiguri is there an html link in your question on purpose?
@flawr your solution is really cool:) (as always)
 
@flawr I thought about that too, but then you still need to store your colormap somehow
 
3:17 PM
@AndrasDeak Thanks=)
@LuisMendo Wouldnt i"@YqZD] work for this challenge‌​?
Somehow it does not work =/
There must be a way we can use the n-th prime you already implemented it!!!
 
@flawr "2. You must not include a built-in list of prime numbers or primality testing function."
does this not apply?
 
I do not think so.
This function only returns the nth prime
 
Rule 2 still requires clarification. Does it cover nth prime functions? Next prime functions? Factorization? None of this makes use of a list. — Dennis ♦ 5 mins ago
@Dennis To clarify: it covers built in prime functions, next prime function, and factorization. You need to create the prime testing function yourself. — Elliot A. 4 mins ago
--> unclear:)
probably anything built-in with primes is a no-go
 
@flawr This is a really problematic question, since the top n is undefined. Otherwise you can make a tool for unbreakable compression
 
@Dev-iL but the first n are needed...no?
and they're not undefined, just unknown
 
3:29 PM
@AndrasDeak it is not defined in the question.
 
Challenge

You must write a program that takes an input n and outputs the first n prime numbers.
or what do you mean?
 
I meant that perhaps the OP will decide to ask your script to list N+1 primes, where N is the ordinal of the last prime ever computed
...basically list all prime numbers known to man.... and then some
 
@Dev-iL why would they? the goal is the first n...
 
and what happens when n>>1 ?
 
@Dev-iL you wait;)
 
3:31 PM
and what happens when n -> inf?
 
you have to go from 2 upwards anyway
@Dev-iL I really don't see your problem:D
 
It means that the solution has to be an implementation of a formula for primes, and it has to be a perfect formula at that (dunno if one even exists)
 
@Dev-iL how about "go one by one starting from 2 and see if the number is a prime"?
as in "check which smaller numbers divide it"
it doesn't have to be smart, it has to be short
and it's very well defined
the only thing stopping you from computing the N+1'th prime number (where N is the largest known to date) is runtime
 
@AndrasDeak so how would you know the algorithm works for N+1 and doesn't "happen to fail" exactly after N ?
Induction? :D
 
@Dev-iL the algorithm I wrote above is bulletproof
if you take a number, say N+1, then go from 2 to sqrt(N+1) and see if each number divides it, you can tell if there are any non-trivial divisors of N+1
 
3:38 PM
@AndrasDeak That's right
just build something recursive then
 
so we're back to "I don't see your problem":D
 
Given a large enough N, you cannot prove the algorithm work, you can only assume it
 
@Dev-iL hell I can
it's called mathematics:D
 
Who's that??
 
congruence doesn't magically fail after REALMAX
function isprime=is_it_a_prime?(x)
    isprime=true;
    for k=2:floor(sqrt(x))
        if mod(x,k)==0
            isprime=false;
            return
        end
    end
 
3:43 PM
Consider a prime number so large, that the amount of storage it requires constitutes the mass of a black hole, and then it bends not only time and space but also the laws of math, physics and logic?
 
something like this should work up to N=inf
@Dev-iL I think math, physics and logic are resilient with respect to large numbers
I don't think concepts can break the natural sciences
but now I see why I don't get what you're saying
we have a fundamentally different view of concepts:P
 
The code has to be able to output the prime number (and for this it has to compute and store it).. .if your code runs out of memory in the process - you fail... That's how I perceive it...
 
@Dev-iL: You can prove that the algorithm works. You cannot prove that the program works.
 
@Jonas Yes, thank you
 
Similar to how you can prove that two parallel lines never intersect, but you cannot demonstrate it for any two actual lines
 
3:51 PM
So yeah, I was wrong in saying that you must use a prime-generating-function, but I stand firmly behind the need to set some limit on n.. For the reason Jonas mentioned
 
@AndrasDeak just to link to the original image.No specific purpose
 
4:07 PM
@Dev-iL But if n is too large to be represented in the system, then the function cannot be called with that input. If the value is representable and can be passed to the function, then the function will return a correct answer.
 
@beaker I disagree, because prime(n) grows faster than n
 
@Dev-iL sorry, i haven't been keeping up... i thought n was the candidate prime
 
No worries
 
4:32 PM
You guys have anything to add to my comment on this?
0
Q: How expensive are debug conditional statements?

guskenny83I am developing a combinatorial optimisation algorithm in MATLAB, and I have a bunch of conditional statements that basically just check flags that when set to true will print the value of some variable or show a figure of current progress or state of the system so I can see what is happening if ...

 
@flawr You need to add : after i to generate the vector [1,2,...n]. So the code would be i:"@YqZD]. It can be shortened to :"@Yq using implicit input (your very good suggestion), implicit loop-end and implicit display
But I agree with @Andras that the challenge seems to forbid that
 
4:55 PM
I found a pretty short one without prime builtins
0
A: List Prime Numbers

Luis MendoMATL, 16 bytes 2iq:"t`Qtt:\~z2> Try it online!

 
@Dev-iL in principle conditionals can have a measurable overhead in low-level languages if the loop body executing it is very simple
so, in a Monte Carlo code, you should avoid using an if, because that can lead to measurable delays
I don't know if that applies to MATLAB though:)
 
Well then profiling is probably the best course of action
 
you usually want to do something computationally heavy in MATLAB, otherwise you would use a lower-level language for it
@Dev-iL I agree:)
"Premature optimization is the root of all evil" -- Donald Knuth
 
5:23 PM
@Dev-iL come to think of it, the question might be more on-topic on programmers.SE
codereview says that if you don't have an actual code, and your question is more academical in nature, than probably programmers is the site for you
and what I linked FAQ does seem reasonable
 
@AndrasDeak That's very possible.
 
If you have a question about...

    software requirements
    software architecture and design
    algorithm and data structure concepts
    quality assurance and testing
    development methodologies and processes
    software configuration management
    software engineering management
    software licensing
this probably fits in algorithm and development methoodologies?
it's not a clear off-topic one based on the second list in the FAQ:)
 
Question is slightly off topic, but it's a useful one nonetheless...
 
@flawr Very nice challenge!
4
Q: The Möbius Function

flawrThe Möbius Function The Möbius function is an important number theoretic function. Your submission should accept a positive integer n and return the value of the Möbius function evaluated at n. Definition The Möbius function μ(n) is defined as follows: μ(n) = | 1 if n is squarefree and has...

 
5:43 PM
@flawr is there a reason why the function doesn't seem to jump from +-1 to -+1, only through 0?
oops, never mind, it jumps:D
 
5:55 PM
@Dev-iL What is problematic about that?
@LuisMendo Thank you! Is there a way of passing a vector to the n-th prime function? Something like nthprime(1:input('')) I thought 1:iYq should work, but it does not seem to do so. I still have trouble wrapping my mind around the stack architecture=)
 
@LuisMendo would it help if you used accumarray on the vector of prime factors?
you could check if the result has only values <=1
 
@flawr Yes, there is. But : has to go after the number (postfix notation): i:Yq. Or just :Yq (implicit input). This is because : has two meanings in MATL: (1) in numeric literals, as in Matlab: 1:5, 1:2:10 produce what you expect. (2) a function that takes one input x by default, and produces the vector 1:x
 
@LuisMendo oooh, I figured that out!:)
It just took me too long to test it; the older new version of matl has hiccups on matlab as well...
 
@AndrasDeak That's a nice approach, but I think it requires more bytes than my current one, which is any(diff(...)) (two bytes)
 
that, and my computer is constantly thrashing
 
6:05 PM
@AndrasDeak What do you mean by "older new version"? :-D
 
@LuisMendo the one we couldn't get to work interactively in octave
I'll try the new release and see if that runs
 
@AndrasDeak Yes, please. And thank you!
 
@LuisMendo ah, it might have been a hacked-up version of the code
the newest release seems to run matl i: at least:D
how's it going with the vpa garbage issue?
 
@AndrasDeak Yes, I think we changed a few things because of the symbolic problem?
@AndrasDeak Dennis is a real great hacker and solved it in the online compiler
In (offline) Octave the messages only appear the first time
 
@LuisMendo yup
if it's OK on tryitonline, it's OK everywhere;)
 
6:09 PM
so I think it's not important to solve it. What do you think?
Exactly!
:-D
 
@LuisMendo I think Dennis is as canonical as it gets:D
 
Very true. And starred! :-DD
 
anyway, how do you print vpa(pi) with matl?
 
@AndrasDeak vpa is Y$ if I recall correctly
 
thanks
seems legit;)
 
6:10 PM
So: 'pi'Y$ (watch out for quotation symbols)
Be sure to pass a string to vpa, as usual, not the pi (double) constant
 
@LuisMendo yup, I remembered the string, but not the post-fix:D
should <strong> be an issue with octave?
 
Haha. Y'all seem to be having trouble with the postfix. I like that :-PPP
 
it's present in the error
@LuisMendo I've stated it numerous times that stack-based stuff are Greek to me:P
except that I can read the letters in Greek
 
@AndrasDeak Hm. I thought I had solved that. Octave doesn't interpret <strong>
 
@LuisMendo yeah, it doesn't
but I still get the earlier error
due to my ancient octave
 
6:12 PM
@AndrasDeak What error?
 
that's why I asked, if it should've been solved or not:)
 
I'm lost... :-)
What's the error, and does it have <strong>?
 
octave:3> matl i:
> 10
error: structure has no member 'stack'
error: evaluating argument list element number 1
error: evaluating argument list element number 1
error: evaluating argument list element number 1
error: called from:
error:   /home/.../matl_run.m at line 45, column 7
error:   /home/.../matl.m at line 262, column 5
this is my original error, due to old octave
 
Ah, ok
 
this is why I had to use the compiled version
 
6:14 PM
And no <strong> in the error, right?
 
octave:3> matl 'pi'Y$
error: MATL error while processing options: two input strings have identified, but the first string does not begin with <strong>-</strong>
error: called from:
error:   /home/.../matl.m at line 47, column 5
@LuisMendo only in ^ this one
 
Aaaah
Got it
I need to remove those <strong> tags in Octave. I thought I had removed them all
I'll change it for next version
Thanks!!!
 
no prob:)
 
@AndrasDeak and that error was because you didn't have symbolic package, right?
 
@LuisMendo no no, I loaded the symbolic package beforehand
I actually don't know where that error came from:D
 
6:17 PM
What does matl "'pi'Y$" give?
 
the other error!
which means that solves it:)
I'll try compiling it
works!
almost:D
octave:2> matl -c "'pi'Y$"
octave:3> MATLc.m
OctSymPy v2.2.4: this is free software without warranty, see source.
Initializing communication with SymPy using a popen2() pipe.
Some output from the Python subprocess (pid 11741) might appear next.
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> >>>
OctSymPy: Communication established.  SymPy v0.7.6.1.
  3.1415926535897932384626433832795

error: can't perform indexing operations for <unknown type> type
 
The problem is that with matl 'pi'Y$ Octave (or MAtlab) doesn'0t correctly interpret the whole string input
@AndrasDeak Weird. It gives the result, but then an error
 
@LuisMendo indeed:D
I'll peek into the script
user error, I guess:
 
It works on my Octave. Must be a version thing
 
octave:3> MATLc
  3.1415926535897932384626433832795

octave:4> MATLc.m
  3.1415926535897932384626433832795

error: can't perform indexing operations for <unknown type> type
 
6:21 PM
Oooh
 
the file extension confused octave
 
Just that? Hehehe
 
thought I was referring to a struct:)
great
 
So now it works
Yay!
 
@LuisMendo although it still dies on my old octave, interactively; and it still gives me all that garbage:D
but at least the functionality is present:)
and that's what matters
 
6:23 PM
What was the error interactively? (sorry, I'm dense today...)
 
10 mins ago, by Andras Deak
octave:3> matl i:
> 10
error: structure has no member 'stack'
error: evaluating argument list element number 1
error: evaluating argument list element number 1
error: evaluating argument list element number 1
error: called from:
error:   /home/.../matl_run.m at line 45, column 7
error:   /home/.../matl.m at line 262, column 5
and the problem was that at the end of matl(_run?).m there's a try-catch block
and the exception caught by the catch block doesn't have a field in ancient octave
I think
 
Yes. But it shouldn't have got into that catch part anyway
 
@LuisMendo well, the string was empty in the try block
to which you said "dafuq????":) (not these words, exactly)
 
:-D
 
cOutFileNoExt was empty
 
6:33 PM
Can you change line evalin('caller', [cOutFileNoExt ';']); into MATLc and try interactively?
That line should just run the compiled file
 
@LuisMendo I gotta go now for a while, then I will:)
 
Sure! Thanks a lot for all your help in debugging!!
 
6:54 PM
@Andras If variable cOutFileNoExt is empty, the problem may be in MATL.m, line 15, which uses regexprep to remove file extension. Maybe regexprep changed in Octave 4.0.0 compared to your version. Can you replace that line by cOutFileNoExt = 'MATLc'; and try interactively (without -c flag)? Whenever you have time
That's it!!
For compatibility with Matlab, the regexp, regexpi, and regexprep
    functions now process backslash escape sequences in single-quoted pattern
    strings.  In addition, the regexprep function now processes backslash
    escapes in single-quoted replacement strings.  For example,

    regexprep (str, '\t', '\n')

    would search the variable str for a TAB character (escape sequence \t)
    and replace it with a NEWLINE (escape sequence \n).  Previously the
    expression would have searched for a literal '\' followed by 't' and
I was using '\.'. I'll change that for future versions
 
@LuisMendo Ah now I see, so for producing the vector a:b you'd have to write a,b: right?
 
7:33 PM
0
Q: Error on set_param SimulationCommand start - "memory allocation failed or you have no X connection"

Michal GallovicI'm trying to launch a simulink simulation using python script ( mlabwrap as python wrapper for matlab ). I open the simulink *.mdl file using: open_system("thermo","loadonly"); I use set_param to initialize the simulation: set_param("thermo", 'SimulationCommand', 'start'); This throws the ...

no wonder no-one answered him, he's using R2009b...
 
Even I am using a newer version.
 
@flawr tell him that :P
I think even if people knew how to solve that using newer MATLAB versions, they're just too bored/lazy to try on a bloody 6 year old version
 
But I do not think that he gets his error just because of that version.
 
8:19 PM
@flawr That would produce a and then1:b, because function : doesn't "know" it has to take two inputs (it takes one by default). For that you'd need a,b2$:, where 2$ indicates "use 2 inputs". Often you can use a shorter trick. For example, for if a=2you can use bq:Q, becauseq is decrement by 1 and Q is increment by 1
 
octave:2> matl "'pi'Y$"
OctSymPy v2.2.4: this is free software without warranty, see source.
Initializing communication with SymPy using a popen2() pipe.
Some output from the Python subprocess (pid 15113) might appear next.
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> >>>
OctSymPy: Communication established. SymPy v0.7.6.1.
3.1415926535897932384626433832795
:) Which means it's working if I call MATLc directly
 
8:35 PM
@flawr If a and b are number literals such as 3 and 8 you can use 3:8
@AndrasDeak Great! It was that regexprep in old Octave. Thanks a lot!!
 
@LuisMendo Thats a very golfy solution=)
 
@LuisMendo don't mention it:)
 
For the computer graphics guys among us, I think I'm going to post this challenge within the next few days: meta.codegolf.stackexchange.com/a/8186/24877
 
@flawr oooh, nice
my brother loves that feature on photoshop:D
@rayryeng is very image-processing-y, @beaker as well, I think
 
Yeah it is quite cool, I think photoshop added some nice features in the last few years. Also puppet warp
 
8:45 PM
@flawr My knowledge about photoshop:
I just googled puppet warp: impressive!
@flawr I also don't think that people would abide by the voting rules
also, I wanted to comment "Follow-up challenge: write a program that finds the original mask in the output of this challenge";) But I don't want to clutter the sandbox...
 
Haha, that is going to be reeeeally difficult
I guess
cluttering the sandbox? why would anyone do that??
It has only about 68 pages of non-clutter.
 
@flawr I feel that's a very good reason to keep the unconstructive noise down;)
Have you thought about comparing the outputs to some reference images?
I know it's not ideal, since you should keep the reference images to yourself, so it wouldn't be transparent
and the performance of each implementation would vary with the image it's used on, so it's not too fair for multiple reasons
but at least it would have some objective measure of goodness
 
I suspect some output could be close to the original, but still visually very well visible (and vice versa)
Thats why I think that this challenge is going to work well as a popcon.
 
9:06 PM
@flawr possible:)
and even utterly wrong, but funky-looking solutions can get many upvotes
like Deep Dreaming-type stuff
 
9:27 PM
buhbuh, no upvotes (other than the OPs) for an RTFM question :(
I'd expected at least 12
 
Happy now?
 
@flawr Very, but I was that an hour ago after my third beer as well :P
trying out specialty beers ain't so bad
 
 
2 hours later…
11:05 PM
@AndrasDeak It should work now (release 10.2.0). Please give it a try on Octave whenever you have tome (no hurry at all)
 
@LuisMendo you at release 10 already? damn
 
@Adriaan But that's only because each change that potentially breaks old code implies a change in first digit
 
@LuisMendo it looks impressive to the noob though :P
(aka to me)
 
Lui
@Adriaan Still, pretty impresssive
 
:-)
 
11:15 PM
it's bedtime this side of the water. Take care lads.
 
Lui
Night.
 
11:34 PM
I love some people's sense of humour
30
Q: Return 1 - Popularity Contest

LazySloth13The Task Create a function/subroutine which returns 1. You can make it as elaborate as you like, as long as it returns 1. The Rules The entry with the most upvote wins - just like any popularity contest. Good luck!

 
or even X-Y.' ;)
oops
nevermind me:D
been using too much python
bsxfun is the only way:(
 
Lui
@AndrasDeak It's okay, I'd already typed that answer out when I stopped and thought about it :P
lololol I just found the why function.....
The very terrified very bald and tall and tall and smart smart mathematician wanted it.
 
@Lui yeah, that's fun:D
@LuisMendo you've created a HeisenBug
octave:1> pkg load symbolic
octave:2> matl
 > 'pi'Y$
 >
error: structure has no member 'stack'
error: evaluating argument list element number 1
error: evaluating argument list element number 1
error: evaluating argument list element number 1
error: called from:
error:   /home/lou/temp/stackoverflow/matl/matl_run.m at line 45, column 7
error:   /home/lou/temp/stackoverflow/matl/matl.m at line 264, column 5
octave:2> matl
 > 'pi'Y$
 >
OctSymPy v2.2.4: this is free software without warranty, see source.
error on first run, runs on the second
(reproducible)
every second call to matl throws an error:D
 
Lui
@AndrasDeak It's a hidden feature
 
@AndrasDeak Awwww
 
11:50 PM
@LuisMendo every odd call, to be precise:)
 
So now MATL has memory. Great
2
 
@LuisMendo :D
non-Markovian stack-based programming language
cOutFileNoExt is MATLc in both cases
still it's the same error, in the try block
isn't the problem that you're deleting MATLc.m?
 
@AndrasDeak Does that happen without using vpa? A simple program like matl 1?
 
If I comment out line 35 in matl_run.m which deletes the .m file, the HeisenBug disappears
 
@AndrasDeak Interesting!
 
11:54 PM
if I put it back, even matl 1 produces it:)
I don't think you should delete the m file before running it:P
 
Why I am deleting MATLc file there? Shouldn't it be in matl_compile?
Yeah
Let me check
 
it's only in the octave if branch...
and the comments are not very convincing either;)
 
I know :-)
I think that should be in the compiler, not in the runner
 
@LuisMendo that would make sense
 
But why is it working in the online compiler? (Octave)
 
11:58 PM
I still don't get how the file is not deleted every other time:D
@LuisMendo it might handle the exceptions differently, see my previous comment
it doesn't make sense to me to do it every other time, I guess tryitonline treats this differently
 
Tryitonline starts Octave from scratch every time
And it's also been running on my Octave all the time
 

« first day (207 days earlier)      last day (3011 days later) »