« first day (1191 days earlier)      last day (3294 days later) » 

6:42 AM
Can I set StyleDefinitions relative to the notebook directory?
 
6:58 AM
 
@blochwave Maybe a missclick :)
 
7:15 AM
I'd been doing so well... :-)
 
 
6 hours later…
1:00 PM
encryptedObj = Encrypt["pass", "TestCase"]

Decrypt["pass", encryptedObj]

With[{x = encryptedObj},
 Button["decrypt", Print[Decrypt["pass", x]]]]
any idea why this button is not working?
 
1:57 PM
@Kuba It works with Module. Some order of evaluation issue I'd guess.
 
2:11 PM
@Kuba Although this works, so I guess it's a special issue with EncryptedObject.
interpolatedObj = Interpolation[{1, 2, 3, 5, 8, 5}]
With[{x = interpolatedObj}, Button["a", Print@x[2.5]]]
 
2:21 PM
@Pickett I answered too quickly, and noticed where I messed up. Deleted my answer.
 
2:56 PM
@MichaelHale Special issue, nice wording :D
Module is not a solution unfortunately.
 
 
2 hours later…
5:14 PM
@rm-rf et al: do you know what is happening with rasher's account?
 
6:02 PM
@Mr.Wizard mmmm..., he's Ciao now and his profile says "Delete me".
Perhaps a rage quit because of some conflict or so? Not that I'm aware of any.
 
6:29 PM
Still rasher on Mathematics and on English.
 
6:51 PM
hey guys! I have a list of numbers and I want to round them to the nearest integer power of 10. Say, 850 would become 1000, 3.5 would become 1, 80 would become 100. But I cannot use functions in Round correct?
or, alternatively, anyone can suggest how I can rescale data to show up in a BoxWhiskerPlot where some of the data is very large and other is very small? My idea was to find a rescaling factor that would then also show up in the labeling of the plot
(the reason why I dont simply use Rescale is that I need to know what was the scaling factor used)
 
@Sosi logRound[n_] := 10^Round[Log10[n]]?
 
@chuy let me try!
but it makes sense :)
thanks!
 
@Sosi Or nf = Nearest[10^Range[0, 300]]; Then First[nf[n,1]]. There's a difference with chuy's: Try n = 4. and see which you prefer.
 
yes your case with 3.5 rounds to 10 for my function (which makes sense to me, but might not be what you want)
 
@chuy There can be reasons for each way. Depends on the application.
 
7:04 PM
@Sosi You can also modify @chuy version by subtracting about .24 after the logarithm. logRound[n_] := 10^Round[Log10[n] - .24]
 
@MichaelE2 - this may be my tiredness speaking, but I also have numbers much smaller than 1, though never negative. When I try to transform Nearest to consider negative exponents, I get weird results. For instance, with 0
hum...
tiredness speaking, nevermind
I got it
 
@Sosi Okay.:)
 
@MichaelHale sorry, but why?
(and thanks for the help guys! you are very kind)
 
@Sosi Log10 /@ {5.5, 55, 555, 5555} // N
Ooops
Log10 /@ {5.5, 55, 550, 5500} // N
 
well, in any case it would yield the same results no?
:D
 
7:14 PM
Hi all, this is a quickie: Say I have a replacement with an array, {x, 1} /. {x -> {2, 2}}, this will yield {{2,2}, 1}, if I wanted it to yield {{2,2},{1,1}}, how would I do the replacement?
 
{x_,y_}->{{2,2},{y,y}}?
 
Well I tried to make it as simple as possible
But this is for a more general case
I'm replacing x with an array
But it will only yield copies where 'x' exists in the expression
I'd like the array to not become ragged after the replacement
Basically I have an expression which may or may not depend on x, and I don't know apriori
So when I do the replacement I'm not guaranteed to have a non-ragged array
{x, y} /. {x -> {2, 2}}, the shape of the output depends on if y depends on x.
This gives me what I want but is horribly inefficient: rep = {2, 2}; {Table[x /. x -> r, {r, rep}], Table[1 /. x -> r, {r, rep}]}
 
@Guillochon PadRight[#, Automatic, #] &@{{a}, {b, b, b}, {c}, {d, d}}
 
@MichaelHale Where's the replacement array?
 
You would do that first and not worry about raggedness, then do PadRight to fix raggedness.
 
7:23 PM
Oh I see, will that work if the array is N dimensional?
 
No idea
 
I mean the only thing I can think of is to loop over the values, but I'd rather do it in a Mathematica way...
This also works but seems pretty stupid: ReleaseHold[{x, Hold[1 + 0 x]} /. x -> {2, 2}]
You basically have to "fool" it to make it think the expression has an x-dependence
 
I have {{a1,a2,b1,b2,2},{a3,a4,b3,b4,3},.....} and I want to generate 4 groups for each subset based on the last number in that subset that defines the location of the change. So the above array will become {{{a1,a2},{b1,b2},{b1,b2},{b1,b2}},{{a3,a4},{a3,a4},{b3,b4},{b3,b4}}} any ideas??
 
@Sosi logRound2[n_] := 10^(Boole[#[[1, 1]] >= 5] + #[[2]] - 1) &@RealDigits[n]
although there is probably a nicer way to right that
 
Wow, replacements work through Hold calls?
Anyhow, anyone have any ideas? Basically what I want is extremely close to a replacement operation
But not quite
This also works but doesn't seem the best: Map[Table[# /. x -> m, {m, {2, 2}}] &, {x, 1}, -1]
It's extremely slow to do it that way
Ah, Map[Table[# /. x -> m, {m, {2, 2}}] &, {x, 1}, {-1}] seems to work decently well.
...but it doesn't produce what I want in N-dimensions. Sigh.
 
8:07 PM
@chuy How about logRound3[n_] := 10^Floor[Log10[2 n]]?
@Guillochon I don't quite get what you want in N dimensions, but consider this:
m = RandomInteger[9, {2, 3}];
With[{n = {2, 3}},
 Transpose[ConstantArray[m, n],
  RotateRight[Range[ArrayDepth[m] + Length[n]], Length[n]]]
 ]
@Guillochon With n = {2}, it reproduces your example.
 
@MichaelE2 No that's not really what I'm going for here. Imagine a replacement where the replacement still takes place even if the replaced object does not appear in the element
Maybe a better example: {x, x^3+1,x-2,0} /. x->{2,2} yields {{2, 2}, {9, 9}, {0, 0}, 0}, I'd want that last zero to be {0,0}.
Since the replacement list was 2 elements long
 
@MichaelE2 lol I knew I was making life too complicated
 
8:22 PM
@Guillochon {x, x^3 + 1, x - 2, 0} /. {x -> {2, 2}, c_?NumericQ :> {c, c}}? I'm still not sure what higher dimensional example would look like.
 
@MichaelE2 {x, x^3 + 1, x - 2, 0} /. {x -> {{1, 1, 1}, {2, 2, 2}}, c_?NumericQ :> {c, c, c}}, x is higher dimension in this example
That throws an error, but I guess the second argument of c's could just be made to match the dimensions of the first?
That seems to work. Not as generic as I'd like though
 
@Guillochon Yes: {x, x^3 + 1, x - 2, 0} /. {x -> #, c_?NumericQ :> ConstantArray[c, Dimensions[#]]} &@{{1, 1, 1}, {2, 2, 2}}
 
@MichaelE2 OK, guess that'll have to do!
 
@Guillochon I think it's not quite safe. It's possible that a constant might be replaced in a place where it would not thread correctly. At least, until I can see that definitely cannot happen, I'd have to consider it a potential issue.
 
9:03 PM
@brama No, I don't get how the last number is connected to the subgroups you are building.
 
9:33 PM
@halirutan when the last number is 2, the second group and up are different from the rest. similarly, when the number is 3, the third group and up are different from the rest
 
@chuy thanks! :)
 
10:15 PM
@brama Hmm, OK, I might have understood this now.
 
@Mr.Wizard he's giving away bounties now...
 
@brama So is that what you want?
in = {{a1, a2, b1, b2, 2}, {a3, a4, b3, b4, 3}};
in /. {e1_, e2_, e3_, e4_, i_Integer} :> Join[ConstantArray[{e1, e2}, i - 1], ConstantArray[{e3, e4}, 5 - i]]
@SjoerdC.deVries I don't even find his username any more.
@SjoerdC.deVries Ah, he is not rasher
 
10:44 PM
@SjoerdC.deVries Apparently rasher has requested that his account be deleted. I do not know why, but if I did I would probably not be able to say anyway. What I can say is that I will personally miss his unique and powerful contributions and his spirit of collaboration.
2
 

« first day (1191 days earlier)      last day (3294 days later) »