0
$\begingroup$

$B = \pm \sqrt {(1 + 3 x^2) (1 + 3 y^2)}$

I tried to use a data command to generated $B$ values at different Value of x and y, and then plot it as the graph in (3 D) dimension, however, I did not succeed. Could any one help me?

B = Sqrt[(1 + 3 i^2)*(1 + 3 j^2)];
data = Table[{B, -B}, {i, 0, 100}, {j, 0, 100}];
Length[data];
ListPlot3D[data]
$\endgroup$
1
  • 1
    $\begingroup$ If this question is about Mathematica software, would you show your attempts (as you said you did not succeed)? $\endgroup$
    – JimB
    Commented Feb 24, 2017 at 22:25

2 Answers 2

1
$\begingroup$

Why select discrete values of $x$ and $y$ when you can merely plot the function?

Plot3D[
 {Sqrt[(1 + 3 x^2) (1 + 3 y^2)], 
 -Sqrt[(1 + 3 x^2) (1 + 3 y^2)]}, 
   {x, -5, 5}, {y, -5, 5}]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks I got where my mistake.By the way, can I plot it a line plot (1d) instead of 3d ? $\endgroup$
    – dr.mo
    Commented Feb 25, 2017 at 5:48
1
$\begingroup$

To generate data from a two variables function, you can utilize Table as you did.

B[x_, y_] = Sqrt[(1 + 3 x^2)*(1 + 3  y^2)];
B1 = Table[{x, y, N[B[x, y]]}, {x, -2, 2}, {y, -2, 2}];
B2 = Table[{x, y, -N[B[x, y]]}, {x, -2, 2}, {y, -2, 2}];
ListPlot3D[{B1, B2}]

enter image description here

To get more smooth surfaces, then increment x and y much smaller, i.e., {x, -2, 2, 0.01} and {y, -2, 2, 0.01}, respectively.

$\endgroup$
1
  • $\begingroup$ I run the example using ListPlot3D and it doesn´t work. What is the solution ListPlot3D after run this is the output ListPlot3D::arrayerr: {{{{-2.,-2.,13.},{-2.,-1.,7.2111},{-2.,0.,3.60555},{-2.,1.,7.2111},{-2.,2.,13.}},{{-1.,-2.,7.2111},{-1.,-1.,4.},{-1.,0.,2.},{-1.,1.,4.},{-1.,2.,7.2111}},{{0.,-2.,3.60555},{0.,-1.,2.},{0.,0.,1.},{0.,1.,2.},{0.,2.,3.60555}},{{1.,-2.,7.2111},{1.,-1.,4.},{1.,0.,2.},{1.,1.,4.},{1.,2.,7.2111}},{{2.,-2.,13.},{2.,-1.,7.2111},{2.,0.,3.60555},{2.,1.,7.2111},{2.,2.,13.}}},{<<1>>}} must be a valid array or a list of valid arrays. $\endgroup$
    – irondonio
    Commented Aug 5, 2019 at 1:06

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