« first day (2883 days earlier)      last day (1602 days later) » 

1:05 AM
@CarlLange Well, to be fair, student life is very much like ”if you don’t succeed you’ll run out of money and be kicked out on the street”. At least here in Europe, it’s the complete opposite in the workplace. Suddenly, as soon as you leave school, ”job security” is a human right, because who could live without a sense of security in their lives? So I can empathize...
 
 
10 hours later…
11:01 AM
@C.E. Do you think? I never had that feeling here in Ireland. But I went to a technical college, and I also dropped out, so I suppose my experience is different to many.
 
 
4 hours later…
2:55 PM
ClearAll["Global`*"]
par = {1, 5, 10, 25};
ron = 50 10^-3;
iLoad = 1;
(*Proposed Vestigial Conduction Loss 2*)
pLossProposedGen2[iLoad_, dcr_, ron_, m_, n_] :=
iLoad^2 (dcr + ((m^2 + 2 n - m (1 + n)) ron)/(-1 + m + n));
(*Conventional Buck-Boost Conduction Loss*)
pLossConBB[iLoad_, dcr_, ron_] := iLoad^2 (2 ron + dcr);
Block[{t =
Table[{pLossProposedGen2[iLoad, dcr, ron, m, n]/
pLossConBB[iLoad, dcr, ron]}, {dcr, par*ron}]},
Manipulate[
Plot[Table[{pLossProposedGen2[iLoad, dcr, ron, m, n]/
pLossConBB[iLoad, dcr, ron]}, {dcr, par*ron}], {m, 0, 1},
Can anyone tell me why only one legend is plotted?
 
3:54 PM
posted on December 10, 2019 by Jon McLoone

Much effort and money are spent trying to analyze whether political messages resonate with the electorate. With the UK in its final days before a general election, I thought I would see if I could gain such insight with minimal effort. My approach is simple: track the sentiment of tweets that mention each party. Since [...]

 
4:44 PM
@anhnha See this question:
90
Q: Plot draws list of curves in same color when not using Evaluate

trayresThis example comes from the Mathematica documentation for Plot under Basic Examples. Can someone please explain why these are each plotted as a different color in this case: Plot[Evaluate[Table[BesselJ[n, x], {n, 4}]], {x, 0, 10}, Filling -> Axis] But when Evaluate[] is removed, all of them...

 
@LukasLang I read that before.
In my case, the legend works well without Manipulate
The problem only happens when Manipulate is added.
hm
but you're right
it works with Evaluate
I need to see the code again
it's too complex so I lost track
@LukasLang I think I know why it works without Manipulate. It's because I set the expression to t and use the variable t.
I tried to use t in the plot but it didn't work. Do you know why?
 
@anhnha Can you show the exact code you're using without Manipulate?
 
@LukasLang I posted all above
ah
I misread
one minute
ClearAll["Global`*"]
par = {1, 5, 10, 25};
ron = 50 10^-3;
iLoad = 1;
(*Proposed Vestigial Conduction Loss 2*)
pLossProposedGen2[iLoad_, dcr_, ron_, m_, n_] :=
iLoad^2 (dcr + ((m^2 + 2 n - m (1 + n)) ron)/(-1 + m + n));
(*Conventional Buck-Boost Conduction Loss*)
pLossConBB[iLoad_, dcr_, ron_] := iLoad^2 (2 ron + dcr);
Block[{t =
Table[{pLossProposedGen2[iLoad, dcr, ron, m, 1]/
pLossConBB[iLoad, dcr, ron]}, {dcr, par*ron}]},
Plot[t, {m, 0, 1},
PlotStyle -> {Directive[Blue, Thick], Red, Darker@Green,
@LukasLang
I use n = 1 for that case
 
5:13 PM
@anhnha if you wrap the Block in Manipulate I see no issues. I varied your n parameter like:
Manipulate[
 Block[....],
 {n, 1, 10}
  ]
And it seemed fine
 
@b3m2a1 yes, it works. I didn't know you can put Block inside Manipulate like that
 
@anhnha You can put whatever you want inside Manipulate
It doesn't care
 
5:31 PM
@anhnha It works with Block because Plot has special handling for a single symbol in the first argument implemented. So since Plot sees t as the first argument, it decides to evaluate it to see how many functions it need to plot. If it sees Table[…] on the other hand, it sees only a single thing, and thus decides it only needs one color.
 
@anhnha @LukasLang ahh I thought the issue was with the legend on the right
Apparently it's the classic "needs an Evaluate" issue
 
yes, indeed - I just got a bit confused by the Block[{t = …}, Plot[t, …]] example... As far as I knew, that shouldn't have worked. It seems you can never be certain with stuff like this until you try it ;)
 
Initially I use t inside the Plot function. I also put Manipulate inside Block.
However, the variable t inside Plot turned red
so I copy and paste the whole expression instead of t
that's where the problem happened
 
@LukasLang Plot isn't going to relocalize the t unless you use it as the plotting variable
@anhnha fundamentally the problem was that you needed to use Evalute@Table[...], though
Otherwise Plot doesn't know how many functions you're trying to plot and so miscolors them and mislabels them in the legend
 
ClearAll["Global`*"]
par = {1, 5, 10, 25};
ron = 50 10^-3;
iLoad = 1;
(*Proposed Vestigial Conduction Loss 2*)
pLossProposedGen2[iLoad_, dcr_, ron_, m_, n_] :=
iLoad^2 (dcr + ((m^2 + 2 n - m (1 + n)) ron)/(-1 + m + n));
(*Conventional Buck-Boost Conduction Loss*)
pLossConBB[iLoad_, dcr_, ron_] := iLoad^2 (2 ron + dcr);
Block[{t =
Table[{pLossProposedGen2[iLoad, dcr, ron, m, n]/
pLossConBB[iLoad, dcr, ron]}, {dcr, par*ron}]},
Manipulate[
Plot[t, {m, 0, 1},
PlotStyle -> {Directive[Blue, Thick], Red, Darker@Green,
Can you explain why this doesn't work?
The variable t turns red
 
5:47 PM
You have the order wrong
Block localizes t
Manipulate only has an effect outside of the scope of the localization
Mathematica is telling you that you messed up the ordering
If you need to localize a variable, you want to do it inside Manipulate
Another way you could have written that to take effect of the localization that Manipulate does:
Manipulate[
 t = Table[{pLossProposedGen2[iLoad, dcr, ron, m, n]/
     pLossConBB[iLoad, dcr, ron]}, {dcr, par*ron}];
 Plot[t, {m, 0, 1},
  PlotStyle -> {Directive[Blue, Thick], Red, Darker@Green,
    Directive[Orange, Thick]}, PlotLegends -> (Row[{"DCR", #}] & /@ par),
  AxesLabel -> {Style["M", 16, Bold], Style["P", 16, Bold]},
  GridLinesStyle -> LightGray, PlotRange -> {0, 1.8}, AxesOrigin -> {0, 0},
  Ticks -> {Automatic, Range[0.6, 1.8, 0.2]},
  GridLines -> {Automatic, Range[0.6, 1.8, 0.2]},
Notice the {t, None} at the end. That means: "treat t as local, but don't give it a valuate"`
 
@b3m2a1 Yes, Plot will not relocalize t. But I expected Plot to use the same color for all curves in that case nevertheless, similar to how it does in the Table case. Compare:
t = Table[x^i, {i, 3}];
Plot[t, {x, 0, 1}]
Plot[Table[x^i, {i, 3}], {x, 0, 1}]
Plot[{x, x^2, x^3}, {x, 0, 1}]
 
Ah I see what you mean
 
(The first one is news to me, the others are expected)
 
Yeah that's clearly a special case since people probably use it so often
 
Using {t, None} looks neat
"Block localizes t
Manipulate only has an effect outside of the scope of the localization"
I put Manipulate outside of the scope.
Block[{t=..},
Manipulate[Plot[t,..], {n,1,5,1}]]
 
6:06 PM
That is directly inside the scope of the localization
Manipulate only operates once displayed on screen
So that is outside of the scope of the localization
 
@CarlLange Unfortunately, I have seen people suffer from stress related issues in school, at all levels.
 
 
3 hours later…
9:02 PM
@1010011010 here's a ZIP of my speedup hack for you: dsc.cloud/valuedcustomer/BetheSolverSpeedup.zip
 
 
1 hour later…
10:18 PM
@kirkus Hi Kirkus, thank you very much;
So the way I would use this is to load the base code from SolverFixed.nb as normally, then load the helper?
I can also reproduce a 48% speed up
On 4 cores
Impressive
How may I cite your work?
 
 
1 hour later…
11:48 PM
@1010011010 You put it big into the Acknowledgements of your paper.
 
@1010011010 glad to hear you're able to reproduce the speedup! Yes, I had just separated the helper since the main file did the ClearAll["Global`*"], but looks like you got it running fine. No direct citation necessary, but if you feel compelled, perhaps "contributions from the Wolfram StackExchange community".
 
@kirkus Btw, I wonder how much speed-up one can get by using vector intrinsics in the C code
 
@halirutan Indeed, but I have no name
@kirkus Yes thanks again. I guess I will do that. Cheers:-)
 

« first day (2883 days earlier)      last day (1602 days later) »