Skip to main content
27 events
when toggle format what by license comment
Jun 16, 2020 at 9:23 history edited CommunityBot
Commonmark migration
Jan 17, 2017 at 14:36 comment added xzczd @faysou Actually this elegant yet abstruse function was one of the main barrier for my understanding 囧. It took me quite a while to figure out the meaning of P = (P = … today (after using Mathematica for more than 4 years! ).
Jan 17, 2017 at 13:50 comment added faysou The key innovation that allowed the CompileExpand function is the Step function from Mr Wizard.
Jan 17, 2017 at 13:32 comment added faysou It's quite powerful when you realize what it can do.
Jan 17, 2017 at 7:32 comment added xzczd @faysou Actually I know (and have already upvoted) this answer for years, but was not skilled enough to understand and use that function :)
Nov 11, 2016 at 9:06 history bounty ended xyz
Nov 10, 2016 at 8:57 comment added faysou @xzczd you can use the CompileExpand function from the following answer instead of replacing DownValues. mathematica.stackexchange.com/a/24596/66
Aug 17, 2015 at 6:27 comment added xyz Ok, maybe I need to consider refactor the searchSpan:)
Aug 17, 2015 at 6:20 comment added xzczd @ShutaoTang If the last element needs special treatment, you can use something like searchSpan2[knots_, u0_] := First@Ordering[Sign[u0 - knots], 1] + If[knots[[-1]] == u0, 1, -1]
Aug 17, 2015 at 5:35 comment added xyz OK, I see. The last element is a special case Thanks!
Aug 17, 2015 at 5:28 comment added xzczd @ShutaoTang knots1 doesn't fit the description, right? $u_0 \in [u_i,u_{i+1})$ so $u_i<u_{i+1}$.
Aug 17, 2015 at 5:16 comment added xyz Maybe a bug. knots1 = {0, 0, 0, 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10,10}; then searchSpan2[knots1, 10] searchSpan[{2, knots1}, 10]
Aug 17, 2015 at 5:02 comment added xyz For the auxiliary fuction searchSpan[], Please see my edit in here
Aug 17, 2015 at 4:28 comment added xyz Thanks a lot:). I am not familiar with Compile, so your code is very helpful for me.
Aug 17, 2015 at 4:22 vote accept xyz
Aug 17, 2015 at 4:18 history edited xzczd CC BY-SA 3.0
trivial edit
Aug 17, 2015 at 4:13 history edited xzczd CC BY-SA 3.0
correct a mistake
Aug 17, 2015 at 4:04 history edited xzczd CC BY-SA 3.0
simplify the code a little
Aug 17, 2015 at 3:50 history edited xzczd CC BY-SA 3.0
add a faster solution
Aug 17, 2015 at 3:37 history edited MarcoB CC BY-SA 3.0
Removed extra decimal point that had probably come from a copy/ paste too many
Aug 17, 2015 at 3:30 comment added xzczd @ShutaoTang Have a look at my edit.
Aug 17, 2015 at 3:29 history edited xzczd CC BY-SA 3.0
add the compiled version of OP's solution
Aug 17, 2015 at 1:00 comment added xyz In the function NonzeroBasis3, when I replace lst[[j, k + 1]] = (u0 - u[[j]])/(u[[j + k]] - u[[j]]) lst[[j, k]] + (1 - (u0 - u[[j + 1]])/(u[[j + k + 1]] - u[[j + 1]])) lst[[j + 1, k]] with lst[[j, k + 1]] = coeff[j, k] lst[[j, k]] + (1 - coeff[j + 1, k] ) lst[[j + 1, k]], here coeff = (u0 - u[[#1]])/(u[[#1 + #2]] - u[[#1]]) & in the Module enviroment, however, it failed. Could you tell me why?THX:)
Aug 17, 2015 at 0:55 history edited xyz CC BY-SA 3.0
added 82 characters in body
Aug 17, 2015 at 0:44 history edited xyz CC BY-SA 3.0
added 21 characters in body
Aug 16, 2015 at 14:59 history edited xzczd CC BY-SA 3.0
Improve the code a little
Aug 16, 2015 at 14:43 history answered xzczd CC BY-SA 3.0