Skip to main content
deleted 7 characters in body
Source Link
Bob Hanlon
  • 162.6k
  • 7
  • 81
  • 205
$Version

"13.2.1 for Mac OS X ARM (64-bit) (January 27, 2023)"

Clear["Global`*"]

b = 2.6666;
Pr = 10;

EDIT 2: Modified to return real part of roots rather than real roots.

(table = Prepend[
    Table[{r, Sequence @@
       Re[SolveValues[
        x^3 + x^2 (1 + b + Pr) + x (b + b (r - 1) + Pr*b) + 
          2*Pr*b (r - 1) == 0, x]]},
     {r, 0, 0.03, 0.01}],
    {"r", "x1", "x2", "x3"}]) // Grid

EDIT: Or, for earlier versions without SolveValues, use

(table = 
   Prepend[Table[{r, 
      Sequence @@ Re[(x /. 
         Solve[x^3 + x^2 (1 + b + Pr) + x (b + b (r - 1) + Pr*b) + 
            2*Pr*b (r - 1) == 0, x, Reals]x])]}, {r, 0, 0.03, 
      0.01}], {"r", "x1", "x2", "x3"}]) // Grid

enter image description here

Export["test.csv", table];

Import["test.csv"] // Grid

enter image description here

$Version

"13.2.1 for Mac OS X ARM (64-bit) (January 27, 2023)"

Clear["Global`*"]

b = 2.6666;
Pr = 10;

EDIT 2: Modified to return real part of roots rather than real roots.

(table = Prepend[
    Table[{r, Sequence @@
       Re[SolveValues[
        x^3 + x^2 (1 + b + Pr) + x (b + b (r - 1) + Pr*b) + 
          2*Pr*b (r - 1) == 0, x]]},
     {r, 0, 0.03, 0.01}],
    {"r", "x1", "x2", "x3"}]) // Grid

EDIT: Or, for earlier versions without SolveValues, use

(table = 
   Prepend[Table[{r, 
      Sequence @@ Re[(x /. 
         Solve[x^3 + x^2 (1 + b + Pr) + x (b + b (r - 1) + Pr*b) + 
            2*Pr*b (r - 1) == 0, x, Reals])]}, {r, 0, 0.03, 
      0.01}], {"r", "x1", "x2", "x3"}]) // Grid

enter image description here

Export["test.csv", table];

Import["test.csv"] // Grid

enter image description here

$Version

"13.2.1 for Mac OS X ARM (64-bit) (January 27, 2023)"

Clear["Global`*"]

b = 2.6666;
Pr = 10;

EDIT 2: Modified to return real part of roots rather than real roots.

(table = Prepend[
    Table[{r, Sequence @@
       Re[SolveValues[
        x^3 + x^2 (1 + b + Pr) + x (b + b (r - 1) + Pr*b) + 
          2*Pr*b (r - 1) == 0, x]]},
     {r, 0, 0.03, 0.01}],
    {"r", "x1", "x2", "x3"}]) // Grid

EDIT: Or, for earlier versions without SolveValues, use

(table = 
   Prepend[Table[{r, 
      Sequence @@ Re[(x /. 
         Solve[x^3 + x^2 (1 + b + Pr) + x (b + b (r - 1) + Pr*b) + 
            2*Pr*b (r - 1) == 0, x])]}, {r, 0, 0.03, 
      0.01}], {"r", "x1", "x2", "x3"}]) // Grid

enter image description here

Export["test.csv", table];

Import["test.csv"] // Grid

enter image description here

Modified to return real part of roots rather than real roots.
Source Link
Bob Hanlon
  • 162.6k
  • 7
  • 81
  • 205
$Version

"13.2.1 for Mac OS X ARM (64-bit) (January 27, 2023)"

Clear["Global`*"]

b = 2.6666;
Pr = 10;
 

EDIT 2: Modified to return real part of roots rather than real roots.

(table = Prepend[
    Table[{r, Sequence @@
       SolveValues[Re[SolveValues[
        x^3 + x^2 (1 + b + Pr) + x (b + b (r - 1) + Pr*b) + 
          2*Pr*b (r - 1) == 0, x, Reals]x]]},
     {r, 0, 0.03, 0.01}],
    {"r", "x1", "x2", "x3"}]) // Grid

EDIT: Or, for earlier versions without SolveValues, use

(table = 
   Prepend[Table[{r, 
      Sequence @@ Re[(x /. 
         Solve[x^3 + x^2 (1 + b + Pr) + x (b + b (r - 1) + Pr*b) + 
            2*Pr*b (r - 1) == 0, x, Reals])]}, {r, 0, 0.03, 
      0.01}], {"r", "x1", "x2", "x3"}]) // Grid

enter image description here

Export["test.csv", table];

Import["test.csv"] // Grid

enter image description here

$Version

"13.2.1 for Mac OS X ARM (64-bit) (January 27, 2023)"

Clear["Global`*"]

b = 2.6666;
Pr = 10;
 
(table = Prepend[
    Table[{r, Sequence @@
       SolveValues[
        x^3 + x^2 (1 + b + Pr) + x (b + b (r - 1) + Pr*b) + 
          2*Pr*b (r - 1) == 0, x, Reals]},
     {r, 0, 0.03, 0.01}],
    {"r", "x1", "x2", "x3"}]) // Grid

EDIT: Or, for earlier versions without SolveValues, use

(table = 
   Prepend[Table[{r, 
      Sequence @@ (x /. 
         Solve[x^3 + x^2 (1 + b + Pr) + x (b + b (r - 1) + Pr*b) + 
            2*Pr*b (r - 1) == 0, x, Reals])}, {r, 0, 0.03, 
      0.01}], {"r", "x1", "x2", "x3"}]) // Grid

enter image description here

Export["test.csv", table];

Import["test.csv"] // Grid

enter image description here

$Version

"13.2.1 for Mac OS X ARM (64-bit) (January 27, 2023)"

Clear["Global`*"]

b = 2.6666;
Pr = 10;

EDIT 2: Modified to return real part of roots rather than real roots.

(table = Prepend[
    Table[{r, Sequence @@
       Re[SolveValues[
        x^3 + x^2 (1 + b + Pr) + x (b + b (r - 1) + Pr*b) + 
          2*Pr*b (r - 1) == 0, x]]},
     {r, 0, 0.03, 0.01}],
    {"r", "x1", "x2", "x3"}]) // Grid

EDIT: Or, for earlier versions without SolveValues, use

(table = 
   Prepend[Table[{r, 
      Sequence @@ Re[(x /. 
         Solve[x^3 + x^2 (1 + b + Pr) + x (b + b (r - 1) + Pr*b) + 
            2*Pr*b (r - 1) == 0, x, Reals])]}, {r, 0, 0.03, 
      0.01}], {"r", "x1", "x2", "x3"}]) // Grid

enter image description here

Export["test.csv", table];

Import["test.csv"] // Grid

enter image description here

Added use of Solve vice SolveValues
Source Link
Bob Hanlon
  • 162.6k
  • 7
  • 81
  • 205
$Version

"13.2.1 for Mac OS X ARM (64-bit) (January 27, 2023)"

Clear["Global`*"]

b = 2.6666;
Pr = 10;

(table = Prepend[
    Table[{r, Sequence @@
       SolveValues[
        x^3 + x^2 (1 + b + Pr) + x (b + b (r - 1) + Pr*b) + 
          2*Pr*b (r - 1) == 0, x, Reals]},
     {r, 0, 0.03, 0.01}],
    {"r", "x1", "x2", "x3"}]) // Grid

EDIT: Or, for earlier versions without SolveValues, use

(table = 
   Prepend[Table[{r, 
      Sequence @@ (x /. 
         Solve[x^3 + x^2 (1 + b + Pr) + x (b + b (r - 1) + Pr*b) + 
            2*Pr*b (r - 1) == 0, x, Reals])}, {r, 0, 0.03, 
      0.01}], {"r", "x1", "x2", "x3"}]) // Grid

enter image description here

Export["test.csv", table];

Import["test.csv"] // Grid

enter image description here

$Version

"13.2.1 for Mac OS X ARM (64-bit) (January 27, 2023)"

Clear["Global`*"]

b = 2.6666;
Pr = 10;

(table = Prepend[
    Table[{r, Sequence @@
       SolveValues[
        x^3 + x^2 (1 + b + Pr) + x (b + b (r - 1) + Pr*b) + 
          2*Pr*b (r - 1) == 0, x, Reals]},
     {r, 0, 0.03, 0.01}],
    {"r", "x1", "x2", "x3"}]) // Grid

enter image description here

Export["test.csv", table];

Import["test.csv"] // Grid

enter image description here

$Version

"13.2.1 for Mac OS X ARM (64-bit) (January 27, 2023)"

Clear["Global`*"]

b = 2.6666;
Pr = 10;

(table = Prepend[
    Table[{r, Sequence @@
       SolveValues[
        x^3 + x^2 (1 + b + Pr) + x (b + b (r - 1) + Pr*b) + 
          2*Pr*b (r - 1) == 0, x, Reals]},
     {r, 0, 0.03, 0.01}],
    {"r", "x1", "x2", "x3"}]) // Grid

EDIT: Or, for earlier versions without SolveValues, use

(table = 
   Prepend[Table[{r, 
      Sequence @@ (x /. 
         Solve[x^3 + x^2 (1 + b + Pr) + x (b + b (r - 1) + Pr*b) + 
            2*Pr*b (r - 1) == 0, x, Reals])}, {r, 0, 0.03, 
      0.01}], {"r", "x1", "x2", "x3"}]) // Grid

enter image description here

Export["test.csv", table];

Import["test.csv"] // Grid

enter image description here

Source Link
Bob Hanlon
  • 162.6k
  • 7
  • 81
  • 205
Loading