Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • 1
    $\begingroup$ To integrate a function $f(x,y,z,w)$ over the unit 4-sphere's surface you can integrate it in explicit hyperspherical coordinates: NIntegrate[f[Cos[θ], Cos[χ]*Sin[θ], Cos[φ]*Sin[θ]*Sin[χ], Sin[θ]*Sin[φ]*Sin[χ]] * Sin[θ]^2*Sin[χ], {θ, 0, π}, {χ, 0, π}, {φ, 0, 2 π}]. $\endgroup$ Commented Aug 21, 2021 at 16:11
  • $\begingroup$ Thanks! That might help... $\endgroup$ Commented Aug 21, 2021 at 16:53
  • $\begingroup$ Thank you, that indeed works and I can accept that as an aswer. Do you perhaps know how to run NMaximize now with this? It seems that NMaximize[improvement[a[[1 ;; d]], a[[d + 1 ;; 2*d]], a[[2*d + 1 ;; 3*d]], a[[3*d + 1 ;; 4*d]]], a [Element] Sphere[4*d]] goes through only one iteration and returns NMaximize::ivar: True is not a valid variable., and then NMaximize[4.90928724127370, True]. Improvement is the sum of term functions as above for $k = 1, 2, 3, 4$. Thank you again! $\endgroup$ Commented Aug 22, 2021 at 10:42
  • $\begingroup$ Please ask a separate question for this follow-up! $\endgroup$ Commented Aug 22, 2021 at 15:18