« first day (330 days earlier)      last day (4155 days later) » 

12:18 AM
If you're making figures at the moment and you've just switched to 9, take a look at this:
4
Q: Graphics exported from Mathematica 9 are very large because even standard fonts are embedded

Peeter JootI've upgraded from Mathematica 8 to 9 (which apparently leaves the old version installed and usable which I didn't expect). I see a significant difference in the size of the PDFs produced by 'Save Graphic As', or Export[]. For example, with this very simple plot: Plot[ Abs[Sinc[x]], {x, 0, 4 ...

 
acl
strange, I sent some pdfs to a colleague today and they could not see the text (standard fonts for mma plots). I had assumed that there was some problem with the fonts not being embedded and his workstation not having it.
 
@MikeHoneychurch Yes, I think the BIGGEST problem was the slowness. Remember how we always used to CC each other just to get the messages faster? My second biggest complaint was the lack of threading. Newreaders and email clients can thread messages, but when there's a hybrid of a newsgroup and a mailing list it's impossible to do it properly. Sometimes I missed messages just because of that.
 
acl
perhaps they got messed up because most people here work interactively on a single (huge) machine and it has not been rebooted
 
@acl oh I hate those setups ...
 
acl
@Szabolcs it seems to work fine most of the time actually (although I don't use that machine myself, so maybe that's why I don't see the problems).
 
12:30 AM
@acl You have terminals that are not full computers on their own?
 
acl
@Szabolcs yes, that is what most people use for interactive work
 
@acl Isn't it more convenient to use your own laptop, if you brought one?
 
acl
it's basically a 24" HP monitor and a keyboard
@Szabolcs sure, that is what I do (I also have a workstation in my office but use it only via ssh)
but you couldn't tell they're just terminals if you didn't look, there's no lag
 
But you have no control over the software installed. That's the main reason I don't like them.
@acl Was this with 8 or 9? What was the value of those two options?
 
acl
@Szabolcs right, me neither. I have no control on my own workstation either (I'm not root)
@Szabolcs v9 on both sides (which options?)
 
12:34 AM
 
acl
@Szabolcs both true
 
Strange then ...
I'll go finally finish incorporating @halirutan's changes into the uploader palette. I should have finished that long ago, sorry about that @halirutan
 
1:19 AM
@acl When you use that shared machine next time, could you please check the default order of ChoiceButtons[] on Linux? Is it [OK] [Cancel] or [Cancel] [OK]? It might actually be desktop dependent (KDE vs Gnome)
 
acl
@Szabolcs let me try via X since I am just idly waiting for something to finish now
 
@acl If X is very slow through the networks, please don't bother
(it is very very slow here and I haven't been able to open a new notebook yet)
 
acl
@Szabolcs I am currently waiting for each keystroke to slowly appear; I need to sit here and wait for something else anyway, so...)
@Szabolcs cancel ok
 
1:34 AM
Thanks!
 
acl
(KDE I guess)
aside: how is the new job?
 
it's great so far
 
acl
:7252323 right. that's one problem we don't have here I guess (small group).
(if you want I can remove my answer too)
but in any case, you are still working on networks, right?
 
yes, actually I just started with that. I wasn't doing that (officially) before
 
acl
@Szabolcs oh I see! it seems an active area
 
1:44 AM
Some say it's past its peak ...
but what we do is almost closer to maths. It's about developing methods
 
acl
@Szabolcs I was going to write that it seems like an area ripe for formalization
from my superficial understanding at least.
I did some reading on it recently and this is what I thought anyway
 
1:59 AM
@all Can you please try to update the image uploader palette when you get the time? Please just use the Update... button, and tell me if something is broken.
 
@Szabolcs Where can I find the image uploader? It's about time I tried it!
 
acl
works fine here
 
@Szabolcs The "E" in "Upload to SE" jiggles around when I move my mouse on the palette
but otherwise, the upload works fine
 
2:19 AM
Shameless question plug!
0
Q: Using external variable as a variable inside WhenEvent & NDSolve

jtbandesI'm trying to use the new WhenEvent functionality of NDSolve in Mathematica 9, in order to perform an action when a variable in the system reaches a certain value. I would like this variable to come from an external variable, like so: var = y; (* this could come from somewhere else *) list = {};...

 
@jtbandes Answered!
 
@MarkMcClure Wow, awesome! Thanks! Relatedly, why doesn't putting Evaluate[var] work? Does the HoldAll take precedence somehow?
 
Note sure, I tried that first. Intuitively, I wasn't surprised it didn't work, but ...
 
2:35 AM
Hm.. well cool!
 
I'm still thinking about that - I'll ping you, if I figure that out.
Otherwise, rm is probably watching this and will enlighten at some future point. :)
 
@MarkMcClure fat chance of that happening of you didn't know it already...
 
Ha!
The issue appears to be related to the following:
 
I don't even know how to create a test for this... If you were to define a f[x_] with HoldAll, how would you even check whether stuff is being evaluated or not?
 
If I define a function called test to have the Attribute HoldAll, then test[Evaluate[var][x]] doesn't change but test[Evaluate[var[x]]] does, that is, when var=y.
@jtbandes Just try it!
I'm going to edit my answer to reflect this conversation in a bit and I'll be able to be more clear there.
@rm-rf So, you must be in your mid-twenties?
You should see some of my Mathematica code from when I was in my mid-twenties!
 
2:42 AM
@MarkMcClure Yup :)
 
Why should Evaluate[var][x] be any different from Evaluate[var[x]]? They both have var in them... And if anything, I would expect the former to be replaced but not the latter.
 
Also, With[{var2=var},... Round[var2[x],...] works
 
@rm-rf Right - probably a bit more robust, too.
 
@MarkMcClure But still adds to the confusion... in what way is var2 "different" from var?
 
I'm not sure what you mean.
When you set var2=var inside the first argument of With, var is evaluated to y, which is what var2 becomes.
Which is what you want, right?
 
2:45 AM
Yes, but inside Round[...], var2 needs to be evaluated to y again, no? Just like in the previous case...
 
That's practically the whole purpose of With. I usually use it to inject code into a Compile.
 
@rm-rf That's what I would think too.
 
@MarkMcClure facepalm. Especially, considering that I did know about it... I need to shut down for the day and go home...
 
"specifies that in expr occurrences of the symbols x, y, [Ellipsis] should be replaced by Subscript[x, 0], Subscript[y, 0], [Ellipsis]. "
 
Exactly!
 
2:47 AM
So... does this mean that using ReplaceAll would have the same effect? Probably so.
 
With did it for us!
I don't think ReplaceAll would work - it's a different mechanism.
But Maybe?
 
Ah yes, this works too: WhenEvent[...var2[x]...] /. var2 -> var
 
@rm-rf Ahh... the dreaded Trott-Strzebonski in-place evaluation trick.
@jtbandes I'm surprised!
OK, we've got all kinds of options, now!
 
(Note that var[x] ... /. var->var doesn't work... for plausibly obvious reasons!)
 
@MarkMcClure Why? The replacement rule gets evaluated to become var2 -> y, which is why it works
 
2:50 AM
Yeah, yeah.
Do you want me to argue why it shouldn't work, when we know it works?
 
@MarkMcClure Yikes. What purpose does /; True serve there?
 
That is a good question!
 
@jtbandes I mention it in brief in the answer:
> using Condition or /; forces the evaluation of eval when the condition is True (i.e., always) and then injected arbitrarily deep using With.
 
What about something like With[{eval = Evaluate[lhs]} ...]?
 
Evaluate only works 1 level deep
Compare: Hold[Evaluate[1 + 1]] vs Hold[{Evaluate[1 + 1]}]
 
2:55 AM
Also, it's used in quite a special context - namely replacing structures deep inside a held expression. I just know that, when I'm going to do that, I know where to look!
@rm-rf This question put my rep at exactly 10000 - what should I do?
 
@MarkMcClure Break open the champagne!
 
Will do!
 
(congrats, btw)
 
Thanks - or tanks, as my daughter would say.
Actually, I think I'll finish grading - final grades are due by 10:00 AM tomorrow.
 
Alright, see you later
 
3:06 AM
@MarkMcClure @rm-rf Thanks, you guys are awesome.
And you're welcome for 10k :P enjoy the moderator tools.
Vaguely related question: anyone know why this doesn't work with "f = x[#]+1 &":
NDSolve[x'[t] + y'[t] == 0 && x'[t] == 5 x[t] && x[0] == 5 &&
    y[0] == 5 && WhenEvent[#[t] == 8, Print["test"]], {x, y}, {t, 0,
    10}] &[f]
(Looking at you, @rm-rf :D )
 
3:58 AM
Hi
 
@user6818 Hi
 
yes
 
OK, it's better to discuss here than in the comments.
 
So any suggestion about how i can do the generalization?
 
You mentioned a theoretical function:
g[Table[z[i], {i, 1, Nf}]] = Sum[z[j]^2, {j, 1, Nf}]
 
4:01 AM
yes
 
which obviously does not work, but can you tell me how this here, behaves differently than your imaginary function?
f[zs__] := Sum[z^2, {z, {zs}}]
I mean f[z1, z2] is z1^2 + z2^2 and f[z1, z2, z3] is z1^2 + z2^2 + z3^2..
why does this not work for you?
 
And how will temp be replaced?
 
You mean because it has a y at the start?
What about the obvious solution temp[y_, zs__] := y + f[zs]
then
temp[a, b, c, d]

Out[6]= a + b^2 + c^2 + d^2
 
temp will be a far more complex function..its not going to split like this..I need to be able to generalize the updat on f_i and temp as in the last line of the loop, Subscript[f, i][y_, z1_, z2_, n_] = temp[y^n, z1^n, z2^n] .. how will this line generalize?
so you are saying that temp and f_i both need to be defined as temp[y_,zs__] and f_i [y_, zs__,n_] ?
 
f[y_, zs__, n_] := temp[y^n, Sequence @@ ({zs}^n)]
In[4]:= f[y, a, b, c, d, 4]

Out[4]= temp[y^4, a^4, b^4, c^4, d^4]
I guess you are struggling here with the Sequence and why you sometimes have to put zs in braces, right?
 
4:09 AM
yes and many other things too :) .and the definition of temp and f_i will be temp[y_,zs__] and f_i [y_, zs__,n_]
?
 
OK, so you have 5 min now?
 
may get interrupted suddenly..but go on..
 
First, you should drop the Subscript thing. It does not what you thing it does.
Let me explain:
A simple definition is func[x_] := 3
Now you can check whether func is set (it's called its DownValues)
??func

Global`func
func[x_]:=3
Looks ok. Now, if you do the same for your style:
 
the i subscript on f was needed to index the Nmax number of functions that I needed to define
 
Subscript[func2, 1][x_] := 3
??func2
you get nothing
Thats because the definition of your function func2 is not stored in func2!
It is stored in Subscript!
SubValues[Subscript]
and you get {HoldPattern[Subscript[func2, 1][x_]] :> 3}
The solution is simple! Just use f[x_,i] instead of Subscript[f,i][x_].
 
4:15 AM
how would you suggest the Nmax number of functions "f" could be defined if not through this running subscript?
 
Like my last suggestion
For instance you can create a table of many fi with
Table[f[x_, i] = x^i, {i, 0, 3}]
Now check, what ??f gives you.
And you just call like you would expect it, e.g. f[x, 2]
@user6818 OK so far?
 
The function f_i is a very complicated function of y and the zs.
 
@user6818 And? Mathematica can handle it. What do you mean?
 
May I intrude into this chat? I have thought of something that may help.
 
@halirutan But your definition makes f_i merely x^i
but f_i will be a complicated function of y and zs and the code solves to find that function.
 
4:22 AM
It was just an example!
You have to put whatever you want to have there. I just wanted to show you how it works.
 
so you are basically suggesting making the subscript "i" an argument of the function?
 
YES
But not a usual i_ argument. See that it has no _ in my Table expression.
 
hmm.. and when I am using this zs__ argument..how do I change the "print" line to make it print the value of f_i with all its arguments set to "1"?
 
Example:
Let's assume we have a not so complicated f[i,zs] which makes nothing more than the sum of all z and every z is raised to the power of i, ok.
ClearAll[f]
 
Hi @halirutan
I finally merged your changes
 
4:29 AM
@Szabolcs Hi. Yes, I have seen it. Thanks.
 
I'm sorry it took so long, I wanted to make the button layout prettier ...
It was a half-success, I'll fiddle some more
 
np
 
anyway, I learned I should do the merging (of fucntionally important things) first and fiddle with cosmetics later next time
 
with this arbitrary number of variables case do I write that Simplify command as, Simplify[temp[y, zs__]] ?
here zs shouldn't be a variable like y isn't
but what will the notation be
same in the Solve line there what will the notation be? there too in f_i y just comes as y..what will become of zs__?
 
Is it not possible to host downloads in github any more?
 
4:36 AM
Is halirutan there?
 
@user6818 temp[y_, zs__] = Solve[SeriesCoefficient[LnMT1 - LnMT2, {x, 0, i/2}] == 0, Subscript[f, i][y, zs, 1]]
works here
(although it still has the subscript in it)
 
and similarly remove the "__" in the simplify line?
 
Basically yes.
But..
When I see this right, then LnMT1 is fixed to contain only z1 and z2, or not?
How you want to generalize this?
 
in LnMT1 it will become \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(j = 1\), \(Nf\)]\(z[j]^n\)\)
So I now have this "zs__" thing only at 2 places, the first line of loop where temp is getting defined and in the last line of the loop where f_i is getting updated
 
@user6818 Give me a minute to transform you code into a simple example..
 
4:42 AM
and the code doesn't work..with nf =2 it doesn't give the same answer as what i had with z1 and z2 explicit
 
@user6818. To handle an arbitrary number of parameters {z1, ..., zn}, you should consider that in Mathematic Power is Listable and Plus accepts an arbitrary number of arguments. Consider:

z = {z1, z2, z3, z4};
Plus @@ (z^n)

This outputs

z1^n + z2^n + z3^n + z4^n

This behavior can be used to write your code for an arbitrary number of z-parameters.
 
the difficulty is in handling arbitrary number of z "variables"
 
@rm-rf Did you see that github removed the downloads feature?
 
@user6818 What is LnMT2 going to be for arbitrary z1, z2, ...?
 
the same as before..now f_i instead of being a function of z1 and z2 will be a function of Nf zs
 
5:04 AM
55
A: Can I easily post images to this site directly from Mathematica? (Yes!)

SzabolcsThis is my implementation (with contributions from @halirutan and help from a number of people) of an image uploader palette, which I would like to share with the community to make it more convenient to use this site. Download the latest version here! First time installation: Download the p...

 
5:15 AM
@user6818 This should give you at least a start:
nmax = 10;
nfmax = 3;
zs = Table[z[i], {i, nfmax}];
lnmt1[nmax_, nfmax_] := Sum[Sum[z[i]^n, {i, nfmax}], {n, nmax}];
lnmt2[nmax_, zs__] := Sum[(1/n) (Sum[x^(k*(n/2))*f[k, y, zs, n],
          {k, 1, nmax}]/(1 - x^(2*n))), {n, 1, nmax}];

temp[i_, y_, zs__] :=
  Simplify[Solve[
     SeriesCoefficient[
       lnmt1[nmax, nfmax] - lnmt2[nmax, zs], {x, 0, i/2}] == 0,
          f[i, y, zs, 1]][[1, 1, 2]]];

For[i = 1, i <= nmax, i++,
  Print["coefficient of ", x^{i/2}, " = ",
   Expand[Simplify[temp[i, y, Sequence @@ zs]]]];
@Szabolcs Hmm, haven't seen this. And now? Using another extra upload-service? The we have 3 with imgur.
 
you have removed the key step of updating f_i with the current temp..the last line of of my loop..
 
@Szabolcs Btw, I reported today the JLink not starting Java behavior. It was definitely working in V8 and the documentation hasn't change. Although, the doc says explicitly that you have to start it with InstallJava
 
wonder why this doesn't work
$Assumptions = {1 > y > 0 };
Nmax = 40;
Nf = 2;
LnMT1 = - \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n = 1\), \(Nmax\)]\(Log[1 -
FractionBox[\(1\), \(1 +
\*SuperscriptBox[\(x\), \(n\)]\)] \((
SuperscriptBox[\(x\), \(n/2\)] \((y^\((n/2)\) +
\*UnderoverscriptBox[\(\[Sum]\), \(j = 1\), \(Nf\)]z[j]^n)\) +
SuperscriptBox[\(x\), \(n/2\)] \((y^\((\(-n\)/2)\) +
\*UnderoverscriptBox[\(\[Sum]\), \(j = 1\), \(Nf\)]z[
j]^\((\(-n\))\)\ )\))\)]\)\) ;

LnMT2 = \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n = 1\), \(Nmax\)]\(
 
@user6818 FractionBox?? This cannot be copy&pasted.
 
I just selected my code and copy-pasted it
 
5:29 AM
Take the cell your code and copy it into a new notebook. Then select it in the new notebook and go to Cell->Convert To->InputForm
 
This is most likely a duplicate, even if it's about exporting notebooks and not exporting graphics.
@halirutan It was a problem because I didn't know where to host the initial download. I put it in my dropbox for now.
@halirutan In version 8 JLink is loaded and Java is started when the kernel "boots" up. In v9, JLink doesn't seem to be loaded (it's not in $Packages). The symbols do seem to exist (e.g. JLink`InstallJava is there), but they don't have definitions associated with them.
I'm not sure it's a bug, but I'm curious what they'll say
 
@Szabolcs But even when you start JLink with <<JLink` java is not started.
At least on my machine
 
same here
 
I mean, who loads JLink and has not planned to use Java?
 
I wonder if it's the same in v7
let me try
 
5:35 AM
@Szabolcs The thing is, that we have the Git-repo for SE attachments: github.com/stackmma/Attachments
This thing is now really useless for uploading attachments of Q&A.
 
that's what I was thinking too
not sure my test was correct, but loading JLink doesn't seem to do InstallJava in 7 either. At least when trying from the command line. (Had to ssh to a uni maching)
I really have to go sleep now
see you tomorrow!
 
Bye bye.
 
$Assumptions = {1 > y > 0};
Nmax = 40;
Nf = 2;
LnMT1 =
-Sum[Log[1 - (1/(1 + x^n))*(x^(n/2)*(y^(n/2) + Sum[z[j]^n,
{j, 1, Nf}]) +
x^(n/2)*(y^(-n/2) + Sum[z[j]^(-n),
{j, 1, Nf}]))], {n, 1, Nmax}];
LnMT2 = Sum[(1/
n)*(Sum[x^(k*(n/2))*Subscript[f, k][y, zs, n], {k, 1, Nmax}]/
(1 - x^(2*n))), {n, 1, Nmax}];
For[i = 1, i <= Nmax, i++,
temp[y_, zs__] = Simplify[
Solve[SeriesCoefficient[LnMT1 - LnMT2, {x, 0, i/2}] == 0,
Subscript[f, i][y, zs, 1]][[1, 1, 2]]];
Print["coefficient of ",
x^(i/2), " = ", Expand[Simplify[temp[y, zs]]]];
This doesn't give the same answers as the explicit z1, z2 case in my question
 
5:57 AM
@user6818 Because in this line
x^(i/2), " = ", Expand[Simplify[temp[y, zs]]]];
You need an explicit setting for zs. It has to be something like z1,z2,z3.. but you didn't worked that in.
 
and why so does this line in particular need an explicit listing? so what do you suggest to alter it to?
 
In the above code you never specified how many zn you need.
@user6818 What about
$Assumptions = {1 > y > 0};
Nmax = 40;
Nf = 2;
realzs = Sequence @@ Table[z[i], {i, 1, Nf}];
LnMT1 = -Sum[
    Log[1 - (1/(1 +
           x^n))*(x^(n/2)*(y^(n/2) + Sum[z[j]^n, {j, 1, Nf}]) +
         x^(n/2)*(y^(-n/2) + Sum[z[j]^(-n), {j, 1, Nf}]))], {n, 1,
     Nmax}];
LnMT2 = Sum[(1/
      n)*(Sum[x^(k*(n/2))*Subscript[f, k][y, zs, n], {k, 1,
        Nmax}]/(1 - x^(2*n))), {n, 1, Nmax}];

For[i = 1, i <= Nmax, i++,
 temp[y_, zs__] =
  Simplify[Solve[SeriesCoefficient[LnMT1 - LnMT2, {x, 0, i/2}] == 0,
 
so the "zs" and "realzs" are totally independent variables?
 
Yes, but we need this only, because your code is kind of a mess to be honest.
 
but this program that you have typed above gives a different result than the explicit z1, z2 case typed in my question
 
6:10 AM
One of the worst things is that you overwrite f which makes that you cannot call this snip of code 2 times without getting error messages.
Here it gives:
coefficient of Sqrt[x] = 1/Sqrt[y]+Sqrt[y]+1/z[1]+z[1]+1/z[2]+z[2]
your original one gives
coefficient of {Sqrt[x]} = 1/Sqrt[y]+Sqrt[y]+1/z1+z1+1/z2+z2
 
the coefficient of x comes out to be different
 
Did you restart your kernel?
 
the above code produces negative terms among other things..unlike the one in my question
 
@user6818 Not here. This is the result of your original code
and this here of the above method
Looks OK for me.
 
yes...same as what i have..and you can see that these two results are different
just look at the coefficient of x in both..they differ
 
 
2 hours later…
8:12 AM
So many little bugs
Quantity parsing leaks MakeBoxes@Quantity[Print@"hi"; 10, "Meters"]
 
 
8 hours later…
4:36 PM
@Rojo Did you report it?
It's a more striking demonstration to simply enter Quantity[Print@"hi"; 10, "Meters"] and press Control-Shift-N (in case you need to show that this is a significant problem)
 
 
2 hours later…
6:21 PM
Did anyone attend the experts live session yesterday? I totally forgot about it. Was there anything interesting?
 
6:44 PM
@Szabolcs Yes, I reported it and told them exactly that. In fact, that's how I came into it. You do x=10; Quantity[x, "Meters"], select the quantity, convert to STandardForm, and x disappears. In my real problem, it wasn't x but an AstronomicalData that turned into an ugly number
 
6:55 PM
why does Ctrl+K does not work in some places? This is very annoying. using version 9
It seems to stop finding a command to complete depending on where one is inside an expresssion
Wonder if this question was asked before and if it is worth putting on the main page?
 
7:14 PM
UnitConvert[Quantity[1, "GravitationalConstant"], "SI"] I'm guessing tat isn't expected to return unevaluated
 
7:39 PM
@NasserM.Abbasi You there?
 
yes
I am finding bugs in V9 :)
 
I would guess, without testing anything so far
 
ctrk+k does not work inside Dynamics! Please try Dynamic[x,(Rat and now hit Ctrl+k nothing happens
 
TRUE
 
very annoying
it works ok in V8
 
7:41 PM
Perhaps there-s a switch
To turn off context sensitivity
Btw, on your dynamic question, interesting...
It doesn't happen with, Slider[Dynamic[x, (x = #) &], {Range[0, 10, 1/100]}] for example
 
it took 2 hrs to find it. I thought I had a bug
 
I mean, it doesn't happen if you use a list of available values
instead of a range
 
interesting
 
@NasserM.Abbasi I don't think we users can do anything about it, so not really worth asking it as a question. But I'd definitely send some feedback about it to WRI
(yes, I can reproduce the problem too)
 
@Szabolcs, ok so you would like me to delete the question?
 
7:52 PM
@NasserM.Abbasi I didn't see the question. If you already posted it, just leave it. Maybe someone will come up with a workaround
 
and send bug report?
 
@NasserM.Abbasi I think that would be useful.
But I think you can leave the question
I must run now, sorry ...
 
I am taking about the Dynamics question, not the ctrl+K, which I thought that is what you meant
I did not post anything about the ctrl+k, not that important I know.
 
8:26 PM
why do I have the Talkative badge? Do I really talk too much?? I did not think I talk too much. or do I? being awarded a Talkative badge implies I talk too much, when in fact I do not think I talk that much at all. So I was surprised to see that I "earned" this badge.
 
8:43 PM
:D
 
9:26 PM
@Rojo @Nasser can you take a look at my comment-answer? I have to get some work done now, but I'm sure you can discover some more things if you dig a little deeper into how RemapValue and RemapVariable work
 
 
1 hour later…
10:52 PM
@Szabolcs, thanks, +1, that looks like a good analysis and good guess. I do not get into Mathematica internals myself that much, too complicated for me under the cover. But I think you might have hit on it there. May be someone like John Fultz from WRI can spot this question and make better comments on your analysis that I could.
 

« first day (330 days earlier)      last day (4155 days later) »