2:48 AM
Is it me, or there is a lot of nonsense upvoting in questions lately?
0

i write the code of the recursion equation,but it can not work correctly. who can help me. RSolve[{ a[0]==(1-p)a[n], For[i=1,i<=n-1,i++,a[i]==p a[n-i+1]+(1-p)a[n-i]], a[n]==a[0]+p a[1], Sum[a[k],{k,0,n}]==1}, a[n],n]

3:03 AM
@belisarius it's the hats...
@Artes I don't think there's anything interesting either. On most other sites, you'll also find silly and undesirable behaviour from users just trying to game the hats. I would much rather this not be a feature of our site in the future as well, which is why I downvoted this question. — rm -rf 10 hours ago

@rm-rf Damn! I should've guessed.

see the links in my comment for a sample... there are plenty more such examples on the network.

They are like the badges, but short term
so everybody sprints to make things worse

yes, and for very specific things, like only upvoting or reviewing 5 items, etc.

I accepted to enter because I wanted to see what it was
not worth it

3:48 AM
@rm-rf Thanks for the info. Now I'm plainly against it :(

3 hours later…
7:08 AM
Block[{\$RecursionLimit=20},x=x+1]
in my version 9, the result is not the same as that in the help page, who know why?
(((((((((((((((((Hold[x+1]+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1
This is the default result in the help page of Block.19 + Hold[1 + x]

2 hours later…
9:28 AM
@HyperGroups Interestingly, I get 1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + Hold[1 + x]))))))))))))))))), which is sorted in the reverse order of your answer
Simplify gives the result on the help page

9:44 AM
hi, I have a short question, could someone have a look？
How to effectively compile this function so that there is no main evaluator?
a = 1.;
f = Function[{t}, If[t < a, a*t, -a*t]];
CompilePrint@
Compile[{{t, _Real}}, f[t + 1.],
CompilationOptions -> {"InlineCompiledFunctions" -> True,
"InlineExternalDefinitions" -> True}]

10:00 AM
@SjoerdC.deVries ha, I didn't notice that!

10:16 AM
@xslittlegrass replace `f[t + 1.] ` with `f[t + 1.] // Evaluate`

2 hours later…
11:53 AM
@SjoerdC.deVries thanks, but if instead of f[t+1.0], I have {{1., 0.}, {0., 1.}} + f[t + 1.], how can I evaluate f[t+1.0] and hold the matrix addition?

@xslittlegrass what do you mean by holding the matrix addition?

For example, If I use {{1., 0.}, {0., 1.}} + f[t + 1.] // Evaluate, then I get the code repeat for times:
{{1. + If[1. + t < 1., a (1. + t), -a (1. + t)],
0. + If[1. + t < 1., a (1. + t), -a (1. + t)]}, {0. +
If[1. + t < 1., a (1. + t), -a (1. + t)],
1. + If[1. + t < 1., a (1. + t), -a (1. + t)]}}
@SjoerdC.deVries and when compile like this, the corresponding compiled code for f[t] would repeat for multiple times.
@SjoerdC.deVries a = 1.;
f = Function[{t}, If[t < a, a*t, -a*t]];
CompilePrint@
Compile[{{t, _Real}}, {{1., 0.}, {0., 1.}} + f[t + 1.] // Evaluate,
CompilationOptions -> {"InlineCompiledFunctions" -> True,
"InlineExternalDefinitions" -> True}]

@xslittlegrass that's not what I see in the compiled code

What did you see in the compiled code?
@SjoerdC.deVries I see something like this:
1 R3 = R2 + R0
2 B0 = R3 < R2 (tol R4)
3 if[ !B0] goto 8
4 R3 = R2 + R0
5 R5 = R2 * R3
6 R6 = R5
7 goto 12
8 R3 = - R2
9 R6 = R2 + R0
10 R3 = R3 * R6
11 R6 = R3
12 R5 = R1 + R6
13 R6 = R2 + R0
14 B0 = R6 < R2 (tol R4)
15 if[ !B0] goto 20
16 R6 = R2 + R0
17 R3 = R2 * R6
18 R7 = R3
19 goto 24
20 R6 = - R2
21 R7 = R2 + R0
22 R6 = R6 * R7
23 R7 = R6
24 R3 = R2 + R7
25 T(R1)0 ={ R3, R5 }
26 T(R1)1 ={ R5, R3 }
27 T(R2)2 ={ T(R1)0, T(R1)1 }
28 Return
from the compiled code, the line 13-24 is a repetition of line 1-12.

12:09 PM
Well, you said it repeated 4 times in the matrix addition itself. It doesn't. The two repeats you see are simply the two branches of your If statement.

@SjoerdC.deVries But line 1-12 is a complete if statement. The branch happens at line 3, right?

12:37 PM
@szabolcs Regarding "WolframLink"; have you heard anything about the timing of this change? ML* works on the RPi and I wonder if Wolfram is going to eliminate or deprecate the ML* functions, or perhaps make ML* == WL* for the meanwhile...

3 hours later…
3:29 PM
@xslittlegrass are you still here?

3:57 PM
@bobthechemist All I know is the documentation page I linked to. I assume they will keep around the ML versions of aliases, anything else would be ridiculously counterproductive.

4 hours later…
8:04 PM
@bobthechemist I mean I don't have any more information than you (or anyone else) do. The only way I found out about this is that I looked at the online docs.