3
$\begingroup$

I have this potential function which I believe is representative of a grounded cube in a 3D plane. I'm not entirely sure if this is it, but here is the general solution of the function:

v(x,y,z) = G(mq)*sin(αx)*sin(βy)*sinh(γz)

I can rewrite this as an indefinite summation provided that α = (mπ/a), β = (qπ/b), and γ = sqrt(α^2+β^2)

The summation equation I have is this:

Potential Summation Function

This is an indefinite sum with 'mq' as the lower bound symbol.

I am trying to create a 3D plot of this function to see the shape for myself, and the code I have tried applying for this is:

V[x,y,z]=Sum[G(mq) Sin[mπx/a] Sin[qπy/b] Sinh[Sqrt[(mπ/a)^2 + (qπ/b)^2]*z], mq];

V[x_, y_, z_] = Sum[G(mq) Sin[mπx/a] Sin[qπy/b] Sinh[Sqrt[(mπ/a)^2 + (qππ/b)^2]*z],mq];

Plot3D[{V[x, y, z]}, {x, 1, 10}, {y, 1, 10}, {z, 1, 10}, ColorFunction -> Rust]

If I take this approach, I receive an error saying that 'Options are expected (instead of {z,1,10}) beyond position 3 in the Plot3D code. I also tried doing this with ContourPlot3D as well:

V[x, y, z] = Sum[G(mq) Sin[mπx/a] Sin[qπy/b] Sinh[Sqrt[(mπ/a)^2 + (qπ/b)^2]*z], mq];

V[x_, y_, z_] = Sum[G(mq) Sin[mπx/a] Sin[qπy/b] Sinh[Sqrt[(mπ/a)^2+(qπ/b)^2]*z], mq];

ContourPlot3D[{V[x, y, z]}, {x, 1, 10}, {y, 1, 10}, {z, 1, 10},ColorFunction -> "RustTones"]

Nothing is output with this code. I believe the former approach to be the best choice but I'm not entirely sure how I should input the variables.

Anyone have any alternatives or suggestions for the code?

$\endgroup$
4
  • 2
    $\begingroup$ You have syntax errors in your Sum(s). You need an iterator; i.e. {m,mMin,mMax}, {q,qMin,qMax}. Although an "indefinite sum" may have meaning to humans, Mathematica doesn't know what to do, and can only handle things with definite lower/upper bounds in the sum. Plotting functions require that things evaluate to numbers, so you'll also have to specify numerical values for a,b. Try using Table to evaluate your expression for a small number of values. If you don't see Real numbers (i.e. not symbolic or Complex values) you won't get a plot of any kind. $\endgroup$
    – user87932
    Oct 9, 2023 at 18:54
  • 1
    $\begingroup$ cube in a 3D plane What does that mean? $\endgroup$
    – Ghoster
    Oct 9, 2023 at 19:52
  • $\begingroup$ I believe this function just represents a cube in an xyz plane, that's what I'm referring to. $\endgroup$ Oct 9, 2023 at 19:59
  • $\begingroup$ a cube in an xyz plane That’s equally unclear. What is an xyz plane, and how can a cube be in a plane? $\endgroup$
    – Ghoster
    Oct 10, 2023 at 0:31

1 Answer 1

2
$\begingroup$
$Version

(* "13.3.1 for Mac OS X ARM (64-bit) (July 24, 2023)" *)

Clear["Global`*"]

To plot there cannot be any non-numeric parameters/variables

mqMax = 5; a = 1; b = 1; G = 1;

V[x_, y_, z_] = Sum[
   G mq Sin[m π x/a] Sin[q π y/b] Sinh[
     Sqrt[(m π/a)^2 + (q π/b)^2]*z],
   {mq, 1, mqMax}] // Simplify

(* 15 Sin[m π x] Sin[π q y] Sinh[π Sqrt[m^2 + q^2] z] *)

The plot is very slow

Manipulate[
 ContourPlot3D[V[x, y, z] /. {m -> mv, q -> qv},
  {x, 1, 10}, {y, 1, 10}, {z, 1, 10},
  MaxRecursion -> 2,
  ColorFunction -> "RustTones"],
 {{mv, 2, "m"}, Range[5]},
 {{qv, 3, "q"}, Range[5]},
 SynchronousUpdating -> False,
 TrackedSymbols :> {mv, qv}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.