« first day (268 days earlier)      last day (4206 days later) » 

12:56 AM
Can the one who downvoted this here please give a comment why?
 
1:08 AM
@halirutan Your avatar is bald and you wrote too much math. Look for someone whose girlfriend was stolen by a bald mathematician
 
@belisarius I already tried but the SE search is very limited ;-)
 
@halirutan :D Really no idea. One shouldn't care much about those things
 
@belisarius I don't care, but obviously either I made a mistake or someone did not understand my approach because I explained not good enough. Both things can be fixed.
 
@halirutan Anyone with good will should say "please explain" in case the argument is abstruse. Or "you are wrong" in the other case.
in any case I think there is no satisfactory solution for getting the closed expression in those cases
Which is frustrating, of course
Mma version 18, perhaps
 
@belisarius If you simplify the last formula by putting the products together and throwing the Exp out, you really get the closed form for this special expression.
But an answer which works for all kind of such things.. I have no idea.
 
1:19 AM
@halirutan I mean the general case, with SUM or Product.
 
@belisarius ahh, yes.
 
 
5 hours later…
5:57 AM
Is there a way to ensure that wolfram alpha groups queries correctly?
As an example, (500-424)GB/15.6MB/s works, and some time from now works
but (500-424)GB/15.6MB/s from now does not work
Is there a way to "group" the query so that the last query works?
 
 
5 hours later…
11:09 AM
@rm-rf I'd run Interpolation[] on the data points and differentiate the resulting InterpolatingFunction[] myself...
 
11:53 AM
Hi @Mark!
 
acl
@Mr.Wizard are you around?
about this question, I believe that it is asking something other than what is answered in the one you closed it as an exact duplicate of
 
Hey acl, so how'd you do with those factorials?
 
acl
@J.M. no progress yet; we're doing two separate calculations with that person and until this morning we were concentrating on the other one
I have decided to simply insert a precalculated table of the first few integer factorials though. this should be enough
(insert into my compiled function I mean)
@Mr.Wizard I believe that this question stems from trying to think in matlab terms, where you save a file named eg "hi.m" and then you have a function named "hi" defined in your workspace
So, I think the answer "save all your functions in mathematica .m files, then read them with << before using them in .nb files" is more in the spirit of the question than DumpSave and the like.
 
12:14 PM
@acl ...or, if OP is sufficiently adventurous, s/he can edit init.m to add a few definitions...
 
acl
@J.M. indeed; the point I am making is that this seems to be more of a "how can have functions persist between sessions, like in matlab" question.
the other one is more "how do I make this complicated object with internal structure persist", which isn't the same.
also the simplest solution to the question at hand is to use .m files, and I think it's worth having an answer in place for people coming from matlab and trying to adjust
 
 
2 hours later…
2:06 PM
@acl I've reopened it... please answer with that and you can point to Mr.Wizard's answer for the rest of the save/load operations
 
acl
@rm-rf no time right now... I'll let someone else do that
 
Ok, I left a comment... hopefully someone will write it
@J.M. You still here?
 
@rm-rf Now I am.
 
2:22 PM
@J.M. Do you know something about jointly minimizing two constraints f(x) and g(x)?
I know that if they're convex (or even generally), you could write something like a f(x) + b g(x) and optimize that, but in my case, I can't really pick values for a and b...
 
@rm-rf If they're both nonlinear... it's a tough problem.
Unfortunately I don't know what's state-of-the-art for those.
I'm told there are better methods these days than setting up a penalty function.
 
Hmm..
facepalm... eff that. I see a simple solution to my problem now. Lesson: never resort to heavy optimization algorithms when it can be done with some basic calculus :)
Now those equations... they're going to be nasty, but at least, I needn't sell snake oil to get the idea across :)
 
2:42 PM
@rm-rf ...just how "simple" were these constraints, then? :)
 
3:06 PM
@J.M. something like minimize_x f(x) and df/dx s.t. x > B (lower bound). f is monotonic increasing. The problem I initially had was that f(x) and df/dx were vastly differing in magnitude, so a sensible linear combination of the objectives will need to be taken. However, I looked at the plots again, I realized (from domain knowledge) that I actually needed the inflection point
The optimal point is somewhere in the flat part of both curves
 
acl
3:18 PM
@rm-rf how many dimensions?
oh, 1d?
x is a scalar?
 
x is a scalar, yes, but the equations are terribly messy... they are matrix equations and x enters the picture as (A + x I)^p for p={-3,-2,-1} (I is the identity matrix)
 
acl
@rm-rf ok I see. anyway, problem solved, so I'll go back to my own problems :)
 
:)
 
 
2 hours later…
acl
5:55 PM
pedants annoy me well beyond any reasonable degree
(I'm just saying)
 
6:14 PM
@acl Yes, but that isn't the best of our virtues
 
acl
@belisarius you're not a pedant, just a jerk
(although an eloquent one so I guess pointing it out was a mistake :) )
 
@acl I'm such a jerk that you can't tell the difference with a real pedantic one
 
acl
@belisarius indeed; jerk-nature, implemented well, probably looks like that
but seriously, I get so annoyed by pedants it's funny when I later think about it
oh well.
 
@acl Let them alone
and move on
 
acl
yes of course, I've worked out the optimal strategy by now. but I still get annoyed.
guess I'm easy to manipulate: behave pedantically->I get irritated, offer me beer-> I get happy etc
 
6:21 PM
@acl So, the strategy isn't still optimal. Keep working
Oh, beer cures it all
 
 
2 hours later…
8:43 PM
@fpghost, regarding your question here
0
Q: How to build a grid of integrand points and numerically integrate?

fpghostIf I have some function I know numerically only, say f(x) and each point $x$ takes significant time to compute so I have them all stored in some file as f(1)=0.232423, f(1.1)=0.3243432,....Then is it possible to tell NIntegrate only sample on the grid x=1,1.1,1.2,1.3...... and try to integrate th...

Did you already calculated the points or does it just take long to calculate the points?
 
acl
8:56 PM
@all, I have a question. I have something like
tiltedhamiltonian[nwells_ /; EvenQ@nwells, theta_] :=
 Module[ {size = nwells, centre = nwells/2, bdiag, boffdiag},
    boffdiag = Table[-.5,{size-2}];
    bdiag = v[Range[size-1], centre, theta];
    SparseArray[
        {
          Band[{1, 1}] -> bdiag,
          Band[{1,2}] -> boffdiag,
          Band[{2,1}] -> boffdiag
      },
      {size - 1, size - 1}
     ]
]
(this constructs a tridiagonal matrix from the 3 bands)
any obvious way to speed the construction up? it's sparse but that doesn't matter; I am not going over 1000*1000 or 2000*2000 max here.
@rm-rf short fuse!
 
Chap gets downvoted for unnecessarily ranting and saying the IDE sucks, so he goes and edits it to add:
> The default Mathematica IDE does not deserve that name. (It sucks soo badly!!!)
@acl ha! We were both writing about the same thing
 
acl
@rm-rf well, if he's been on the internet as long as he says and with such thin skin, he must have suffered a lot...
@rm-rf he must be doing this on purpose
 
@rm-rf Should this forum have decent moderators I would ask them to delete that pile of shitty comments
 
9:12 PM
@belisarius I wonder where we can find a decent one...
 
@rm-rf No way. Most of them are not even human
 
@belisarius Let's see... a Celtic goddess, a toad, a wizard and a knot. Nope, not a single human.
6
should have removed the downvotes, too :o) — NoEscape 55 secs ago
 
@rm-rf They aren't a set. Just an InternalBag
 
@belisarius Eternal`DBag :)
 
@rm-rf The comments are rocketing again there
 
9:26 PM
@belisarius I'm monitoring it, don't worry.
 
acl
hm, I wish all the downvoters also upvoted my answer!
 
@acl Post the palette code then ...
 
acl
@belisarius it's several pages long. it evolved into a "full" file manager. way too much to post here
how it evolved is interesting: I was producing lots of data on the cluster, in parallel, and so I had to name the files in such a way that I could tell the parameters used. so I then needed some way to display them in human-readable form
 
@acl Use my magical code sharing device meta.mathematica.stackexchange.com/questions/771/…
 
acl
so I wrote something like this, which read the coded filenames, then displayed them in human-readable (or at least acl-readable form)
and then I realized that I needed to do things like ssh them around, email them, move them etc. so I built all this into a palette
and then kept adding
@belisarius hm, well, I am also embarassed about the code... I already cleaned it up a little. i'll try to clean it up more over the weekend and maybe post it
 
9:30 PM
hehe
nice
 
acl
although I don't think many people here will learn much from it, it's straightforward. just took time to evolve the functionality, so I keep it
 
@acl soon, a gold badge :D
 
@acl looks like you'll get a gold badge soon.
 
acl
hm isn't there a badge for lots of - for the question and lots of + for the answer?
ah
 
blah! damn toad steals my thunder again...
2
 
9:31 PM
lol
 
Mind control not enough for you, now it's mind reading too?
 
:D :D
 
;-)
 
I controlled your mind to make you anti-golf your sentence :P
 
acl
can you guys control the minds of random passers-by so they upvote my answer? I'd like to have a gold badge that doesn't just say "I have no life and check this site every day"
thanks
 
9:33 PM
@acl At least, you don't have 9 that say "I shared this on reddit for the lulz" :)
 
(Seriously, is there a certain question of yours that is needing attention?)
 
acl
@Mr.Wizard no sorry I meant answer. it was a jocular reference to the question/answer you guys mentioned
 
u all suck - badly — NoEscape 33 secs ago
 
Ah. Yes, you'll have that soon I think.
@rm-rf Really? Really?
 
I want to edit that to say: "I love you guys like I love peanut butter"
or whatever
 
9:35 PM
@rm-rf Do you think that's actionable?
 
@acl ah, I should have known it was that user. Note, I raised an offensive flag on one of his comments ...
 
@Mr.Wizard Hey, at least he liked your joke, so we're making some progress :P
 
acl
@Mr.Wizard I almost fell off my chair when I saw the Al Gore thing...
 
@acl :D
 
@Mr.Wizard All's fair when the situation becomes comical :P
At least, we have his quote captured here in chat
 
acl
9:39 PM
OK, so, does anybody have any comments on this?
I'd appreciate any help
 
Let me take a look.
What is v?
 
@rm-rf He does sound like the type of guy I'd be kicking in the teeth in real life...
 
@acl Ha, sorry that got neglected in all the other fun
 
@J.M. Cool down. Mind your blood pressure.
 
acl
in my case,
v=Compile[
	{{i,_Integer},{centre,_Integer},{Theta,_Real}},
	-(i-centre)*Sin[Theta],
	CompilationTarget->"C",
	RuntimeAttributes -> {Listable}
	]
 
9:42 PM
@belisarius It hasn't gone up... yet. :)
 
acl
basically, some function such that v[lst,c,t] with lst a list and the other two reals gives a list of the same length as lst
 
@acl Why didn't you do Band[{1, 2}] -> -.5?
 
acl
@J.M. hm, good question. let me check how much it helps
 
(and similarly for the subdiagonal)
 
Should help quite a lot IME.
 
9:44 PM
@J.M. We overreact sometimes (me too :) ) If someone wants to say "MMa sucks", it's his opinion. Let it be.
 
@belisarius I don't mind the "Mathematica sucks" or "you all suck". It's the general attitude that is of the kind I'd pull teeth for...
 
acl
@J.M. OK thanks. Changed that. It doesn't make much difference... (to answer your question as to why: because I copied it from other code where the subdiag depended on position and, like an idiot, forgot to change it...)
 
@belisarius No one said anything for the "mma sucks" initially... I was just going to edit it out and leave it at that. I got an offensive flag on his comment to JM, and it had been edited quickly too... I'm guessing the xxxx was originally shit. I then remembered he had a loose temper in the past and snapped at rcollyer
 
acl
OK thanks for the try anyway, both
 
@acl "It doesn't make much difference" - I know. :) I was just asking why. I'm still looking at your snippet.
 
9:48 PM
@J.M. He started saying "Mma sucks", and he found resistance. Then the attitude developed. Should we just stayed calm and quiet (perhaps downvoting without comments) he could let it go
 
acl
@J.M. short version of the answer as to why: stupidity combined with optimizing code full-time for the last few days
@belisarius ah well, there goes my gold badge :(
 
@belisarius *shrug* I'm still wondering what sort of culture is this that asking about awareness is offensive...
 
@belisarius It's ok... it brought some levity to my boring day :)
 
@acl You still need seven more people...
 
I guess my "new to the internet" remark pushed him over, but then, by reacting that way, he just proved my point :)
 
acl
9:50 PM
@rm-rf and it gave the opportunity to @Mr.W to insert his joke!
 
@acl The reversal badge is wonderful
I got two on SO
or one, depending on the pOV
damn deletions
 
acl
well with -6 the question won't be very visible so I'm not getting it. but my answer isn't really worth much anyway, so I can't complain
@belisarius which two?
 
@acl two reversal badges
 
@rm-rf Why do I have the feeling he's not as old as he says he is... :)
 
acl
@belisarius no I mean, for which two answers?
 
9:52 PM
@acl with -4 and below, it falls off the front page
 
@acl They questions got deleted, and I didn't keep a link. Let me see if I can recover at least one via Google
 
acl
@rm-rf yep, that's what I mean
 
You can't have it all — it needs to be -5 and below for the badge, but -3 and above to be visible to get the votes :)
 
acl
@belisarius that's a danger when you get that badge I guess!
@rm-rf I could shamelessly promote it
 
@acl Apart from making the pattern test nwells_?EvenQ, I can't think of anything else...
 
9:53 PM
It'll get there eventually... many people sort by new questions and work down the list
 
acl
@J.M. that does not help much either... I was afraid of this. well, OK, I'll just waste some more CPU cycles on the cluster.
thanks
"I find the default Mathematica IDE lacking"
ha
 
@acl Is this repeated like a million times? It takes about 0.19s on my machine
 
acl
@rm-rf several million yes
 
one of my reversals
 
acl
@rm-rf it's the main bottleneck for the matrix sizes I use
 
9:55 PM
@acl Now see, if he opened with such refinement, we have no troubles... :)
 
acl
@belisarius I don't have high enough rep to see that...
 
@acl I think I see a way to make this quite a bit faster, but I need more time.
 
acl
@Mr.Wizard how? (I'd very much appreciate it if it worked!)
 
@belisarius You can always find a link to it by clicking on "Reversal" on your badge list
 
@rm-rf No, I'm knot...
 
9:58 PM
@rm-rf One of them get lost because I got it before some modification that allowed it
 
@J.M. I did think of writing "Knot a single human" :D
@acl You can generate the indices easily. So perhaps using Dispatch, ArrayRules and SparseArray might be faster
 
This one was epic
sep 19 '11 at 1:50
How to send 100,000 emails weekly? — Levon Mirzoyan 376116
 
acl
@rm-rf maybe... Let me try that tomorrow, I need to work out how to generate them very fast for this to work. and there's the extra steps to Dispatch
@belisarius can't see it, but I remember seeing it when it was active
 
Still benchmarking. Sorry I'm so slow.
 
10:05 PM
@rm-rf Yep, you need 10K to see it
 
@acl Thread[{{Most@#, Rest@#}\[Transpose], {Rest@#, Most@#}\[Transpose]} &@Range[6]~Flatten~1 -> 0.5]
replace 6 with n
 
acl
@rm-rf thanks. that by itself takes 60% of the time my code does to construct the matrix. let me give it a shot though
 
Pasting before my PC crashes and I lose this:
With[{c = SparseArray@ConstantArray[-0.5, n]},
 SparseArray[{{i_, i_} :> x[[i]]}, {n, n}] +
  Sum[DiagonalMatrix[c, i, n], {i, {-1, 1}}]
 ]
Wait ...
 
acl
@Mr.Wizard you have got to be joking
how did you do that?
 
Clear@indices
indices[n_, theta_] := {Sequence @@
        Thread[# -> -0.5] & /@ {{Most@#, Rest@#}\[Transpose], {Rest@#,
          Most@#}\[Transpose]},
     Thread[{#, #}\[Transpose] -> v[#, n/2, theta]], {{_, _} -> 0}} &@
   Range[n - 1] ~Flatten~ 1
Use as SparseArray@indices[n, theta]. I see a 50 fold speedup on my machine
 
10:18 PM
Okay, try this:
tiltedhamiltonianMrW[nwells_ /; EvenQ@nwells, theta_] :=
 Module[{size = nwells, centre = nwells/2, bdiag, boffdiag},
  boffdiag = SparseArray@ConstantArray[-0.5, size - 2];
  bdiag = RandomReal[99, size - 1] (* substitute for v *);
  SparseArray[{{i_, i_} :> bdiag[[i]]}, size - {1, 1}] +
   Sum[DiagonalMatrix[boffdiag, i], {i, {-1, 1}}]
  ]
@acl If it works, Magic -- if not... lack of coffee. ;-)
 
acl
@rm-rf thanks! but, this by itself is slower than my code to contruct the matrix
@Mr.Wizard what you posted before works
 
Huh? I'm confused.
 
acl
@Mr.Wizard sorry, the "slower" comment was meant to be directed to @rm-rf. your code (the one you posted earlier) did the job, and is 4 or 5 times faster than mine
 
@acl Oh, sorry.. I don't see a 50 fold speedup. It is in fact about the same. I missed that I had a Normal after yours in my timings :)
 
acl
@rm-rf ah right, I was wondering
 
10:21 PM
@acl Oh, you managed to translate that yourself? Good work. :-)
Anyway, here's the code I'm using to compare:
tiltedhamiltonianX[nwells_ /; EvenQ@nwells, theta_] :=
 Module[{size = nwells, centre = nwells/2, bdiag, boffdiag},
  boffdiag = Table[-.5, {size - 2}];
  bdiag = RandomReal[99, size - 1] (* substitute for v *);
  SparseArray[{Band[{1, 1}] -> bdiag, Band[{1, 2}] -> boffdiag,
    Band[{2, 1}] -> boffdiag}, {size - 1, size - 1}]]

tiltedhamiltonianMrW[nwells_ /; EvenQ@nwells, theta_] :=
 Module[{size = nwells, centre = nwells/2, bdiag, boffdiag},
  boffdiag = SparseArray@ConstantArray[-0.5, size - 2];
 
acl
@Mr.Wizard yes I've already packaged the code you posted earlier and tested
as I said, it's 5 times faster. I think you've earned your name!
thanks!
 
I wish I could work that fast. :-) Glad I could help, and thanks, I try!
 
acl
but, how on earth did you know that would speed it up?
 
Experience, and a tip from Norbert Pozar a couple years ago.
He showed me that {i_, i_} :> x[[i]] is a faster way to get a band into the middle. I figured out DiagonalMatrix@SparseArray@(stuff) myself.
I actually need to test those two against each other now for this application. brb...
{i_, i_} :> x[[i]] is faster by a little; there is some kind of optimization that kicks in for that specific case. Don't expect a similar improvement with other patterns.
I knew from past experience that adding sparse arrays was fast, so it was only natural to try to build three arrays that I knew would be quick, and add them, rather than having it all in one SparseArray expression.
 
In his case, since the sub- and superdiagonals are constant...
 
acl
10:29 PM
@Mr.Wizard yes I can see the logic now.
another thing to note for later.
 
@Mr.Wizard How would the rule {i_, j_} /; Abs[i - j] == 1 :> -.5 do if used here?
 
@J.M. Really horribly I imagine. Try it and see.
 
(I can't test at the moment; I have something running...)
 
Ah.
 
acl
probably terribly, it tests too much
 
10:32 PM
Hmm... why do we have to choose between efficiency and code clarity? :D
 
Ask Leonid. <grin>
 
(Yes, it was rhetorical. Trade-offs are a staple of programming... :) )
 
In the case of Mathematica Leonid has complained about the lack of a good compiler. I too dream of a system with a super-intelligent JIT compiler, and as I see it the amount of code we write is fairly constant, yet computing power continues to increase, so the amount of intelligent optimization that the computer does on each block of code should also be able to increase...
 
acl
@Mr.Wizard I'd settle for a stupid, but existent, JIT compiler
 
If a system like Wolfram|Alpha was built not to interpret free-form language, but instead intelligently interpret the meaning behind out code I think this, just maybe, could become a reality, but I'm not a CS major.
 
acl
10:37 PM
I hate it when mma forces me to write C. it's like having to walk with your hands
 
@acl Better a dumb real product than a smart imaginary one. :D
 
@acl Agreed. I pretty much refuse to do it, which fortunately I have been able to do thus far.
 
acl
for me, compilation to C was the main feature that made me upgrade to 8
if not the only one
 
@Mr.Wizard C doesn't give much opportunities for infix... >:)
 
Do either of you know, or are interested in learning Haskell? That's been kicking around in my mind for a while now.
 
10:41 PM
@Mr.Wizard It's on my bucket list, but somewhat below some other things...
 
I think it would be interesting to learn it along with a few others, specifically those with a Mathematica background.
 
...still, there's no reason for you not to learn Haskell. If you can spare the time, have at it!
 
IIRC Leonid said something about learning Haskell too.
 
acl
Either Haskell or ocaml have been the next language to learn for some time (each for different reasons), but I doubt i'll get around to either of them any time soon...
 
Define "soon" please.
E.g. is next summer a possibility?
 
acl
10:46 PM
@Mr.Wizard yes, that is the timescale I am ideally aiming for.
 
Let's see if we can get a small group together around that time, assuming of course that group learning interests you.
 
acl
@Mr.Wizard it's a good way to keep motivation up and frustration down
 
@J.M. how about you?
 
@Mr.Wizard As I said, still somewhere downwards on my bucket list. I'll join you guys when I can. :)
 
Okay.
 
10:56 PM
@Mr.Wizard I am, and I did start learning a few weeks ago... I'm not that far out yet, so I'll join
 
Good, you can be the instructor; I'll just listen. :^)
@acl are you still here?
 
@Mr.Wizard :O
 
acl
@Mr.Wizard yep
 
I thought of another improvement. Try replacing SparseArray@ConstantArray[-0.5, size - 2] with SparseArray[{}, size - 2, -0.5]
 
Ah, changing the background
 
acl
11:00 PM
@Mr.Wizard a bit faster indeed
 
Yes; basically zero time is spent on this step, so it's all up to DiagonalMatrix to expand it.
 
acl
@Mr.Wizard yep
cleverly obscure or obscurely clever?
anyway thanks to all three for the help, it was useful
and to be honest I doubted it could be sped up, but, as usual...
 
I'll take arcane. ;-)
 
acl
@Mr.Wizard that is an accurate description (I was only joking :) )
 
Oh my, look at the time. I'll see you all later.
 
acl
11:06 PM
@Mr.Wizard see you
 
acl
11:46 PM
@Mr.Wizard I am thinking of posting a question on the problem you just solved (speeding up my code); your trick deserves to be seen by more people
if nobody objects, I'll do it tomorrow
I'm off for now
 

« first day (268 days earlier)      last day (4206 days later) »