Message Boards Message Boards

[WWS21] Checking the preservation of the Schwarzschild metric

POSTED BY: Roberto Caiozzo
3 Replies

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: Moderation Team

I am yet to dive in WPP but I want to help you live a For-free life :) hope you don't mind. Those are nothing but side notes.

a) Since matr is a sparse binary array you can do:

hyperlist = matr["NonzeroPositions"]

And if it weren't sparse and binary you could use Position[matr, 1]. For sparse non binary: Position[ Normal @ matr, 1]

b)

shortestmaxradius = assoc // Map[Length] // Min

c) Dataplot, not exactly shorter but more idiomatic:

Dataplot = assoc[[All, 2 ;; shortestmaxradius]] // Values //
   MapIndexed[{#2[[2]], #} &, #, {2}] & // 
   Apply[Join] // 
   Prepend[{0, 0}]

Notice those lines lack of assoc length, 10, which was hardcoded.

d) Don't use sym := something unless you know you need :=, = is enough. If something is time intensive and sym is called multiple times this can make a difference.

Again, nothing but side notes. Good luck.

POSTED BY: Kuba Podkalicki
Posted 3 years ago

Thank you for the great Input!

POSTED BY: Updating Name
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract