Γραφήματα 3D

Επειδή το WLJS δεν υποστηρίζει όλα τα PlotTheme του Mathematica, υπάρχει η λύση του MMAView για όσους δουλεύουν στο WLJS. Συγκεκριμένα, ενώ επί παραδείγματι το παρακάτω δεν εμφάνιζε κάτι:

Plot[f[x], {x, -8, 8}, PlotTheme -> "Marketing"]

γράφοντας τελικά:

Plot[f[x], {x, -8, 8}, PlotTheme -> "Marketing"]//MMAView

εμφανίζεται το γράφημα όπως ακριβώς το παράγει το Mathematica.

Για να μην προκύψουν παρανοήσεις σχετικά με τις εντολές της γλώσσας Wolfram, θα εφαρμόσουμε καθολικά το MMAView.

Unprotect[Graphics3D];
Graphics3D /: MMAView[Graphics3D[args__, opts: OptionsPattern[] ] ] = .;
Unprotect[ToString];
ToString[expr: _[__], StandardForm] := With[{view = MMAView[expr]}, ExportString[
    StringReplace[
        (view // ToBoxes) /. {RowBox->RowBoxFlatten} // ToString
    , {"\[NoBreak]"->""}]
, "String"]];
Protect[ToString];

Απλά

Clear["Global`*"]
f[x_, y_ ] := x*y + 1/x^2 + 8*Sin[y]
g[x_, y_] := (x - Sin[y]) (y - Cos[x])
Plot3D[f[x, y], {x, -2, 2}, {y, -1, 4}]
Plot

Ετικέτες αξόνων

Plot3D[f[x, y], {x, -2, 2}, {y, -1, 4}, AxesLabel -> Automatic]
Plot

Ετικέτες επιφανειών

Plot3D[f[x, y], {x, -2, 2}, {y, -1, 4}, PlotLegends -> f[x,y]]
Plot3D[{f[x, y], g[x, y]}, {x, -2, 2}, {y, -1, 4}, 
 PlotLegends -> {"f[x,y]","g[x,y]"}]
Plot
Plot

Γραμμές

Ισοϋψείς

Plot3D[f[x, y], {x, -2, 2}, {y, -1, 4}, MeshFunctions -> {#3 &}]
Plot

Απαλειφή

Plot3D[f[x, y], {x, -3, 3}, {y, -2, 4}, Mesh -> None]
Plot

Χρωματικά εφέ

Χρωματισμός συνάρτησης

Clear["Global`*"]
f[x_, y_ ] := x*y + x^2 + 8*Sin[3 y]
Plot3D[f[x, y], {x, -2, 2}, {y, -2, 4}, ColorFunction -> "Rainbow", PlotLegends -> Automatic]
Plot

Διαφάνεια

Plot3D[f[x, y], {x, -3, 3}, {y, -2, 4}, Mesh -> None, PlotStyle -> Opacity[0.7]]
Plot

Γυαλάδα

Plot3D[f[x, y], {x, -3, 3}, {y, -2, 2}, PlotStyle -> {Orange, Specularity[White, 20]}, Mesh -> None]
Plot

Απεικόνιση αυτών που υπερβαίνουν το πλαίσιο.

Clear["Global`*"]
f[x_, y_ ] := x*y + 1/x^2 + 8*Sin[y]
Plot3D[f[x, y], {x, -2, 2}, {y, -2, 4}, ClippingStyle -> None]
Plot

Για γέμισμα

Clear["Global`*"]
f[x_, y_ ] := x*y + 1/x^2 + 8*Sin[y]
g[x_, y_] := (x - Sin[y]) (y - Cos[x])
epipedo = 4;
Plot3D[f[x, y], {x, -2, 2}, {y, -2, 4}, Filling -> epipedo,  FillingStyle -> {Red, Blue}]
Plot3D[{g[x, y] - 2, f[x, y] + 2}, {x, 0, 2 Pi}, {y, 0, 2 Pi},  Filling -> {1 -> {Bottom, Blue}, 2 -> {Top, Red}}]
Plot
Plot

Οπτική γωνία

Plot3D[f[x, y], {x, -2, 2}, {y, -1, 4}, ViewPoint -> {1.3, -2.4, 2}]
Plot3D[f[x, y], {x, -2, 2}, {y, -1, 4}, ViewPoint -> {2, 0, 0}]
Plot3D[f[x, y], {x, -2, 2}, {y, -1, 4}, ViewPoint -> {0, 2, 0}]
Plot3D[f[x, y], {x, -2, 2}, {y, -1, 4}, ViewPoint -> {0, 0, 2}]
Plot
Plot
Plot
Plot

Παραμετρικές καμπύλες

Clear["Global`*"]
x[t_] := 20 Sin[t]
y[t_] := 30 Cos[t]
z[t_] := t^2
ParametricPlot3D[{x[t], y[t], z[t]}, {t, 0, 2 Pi}]
Plot
ParametricPlot3D[{{x[t], y[t], z[t]}, {x[t] - y[t], y[t] + x[t], 0.1 x[t]*z[t]}}, {t, 0, 2 Pi}]
Plot

Παραμετρικές επιφάνειες

Clear["Global`*"]
x[r_, t_] := r Cos[t]
y[r_, t_] := r Sin[t]
z[r_, t_] := t
ParametricPlot3D[{x[r, t], y[r, t], z[r, t]}, {r, 0, 1}, {t, 0, 2 Pi}]
Plot

Πεπλεγμένες συναρτήσεις

Clear["Global`*"]
f[x_, y_, z_] := x^3 + 2 y - z^2 - 1/5
ContourPlot3D[f[x, y, z] == 0, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]
Plot
ContourPlot3D[f[x, y, z], {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, 
 Contours -> 5]
Plot
ContourPlot3D[f[x, y, z], {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, 
 Contours -> {0, 1, -1}, PlotLegends -> Automatic]
Plot

Στερεά εκ περιστροφής

Περιστροφή της y=f(x) περί του y'y.

Clear["Global`*"]
f[x_] := x^2
(*Η ακτίνα κειμένεται από a έως b*)
a = 1;
b = 2;
RevolutionPlot3D[f[r], {r, a, b}]
(*Η γωνία κειμένεται από θ1 έως θ2*)
th1 = Pi/4;
th2 = 7 Pi/4;
RevolutionPlot3D[f[r], {r, a, b}, {th, th1, th2}]
Plot
Plot

Περιστροφή της παραμετρικής καμπύλης (x(t),y(t)) περί του y'y.

x[t_] := 2 + Cos[t]
y[t_] := Sin[t]
RevolutionPlot3D[{x[t], y[t]}, {t, 0, 2 Pi}]
RevolutionPlot3D[{x[t], y[t]}, {t, 0, 2 Pi}, {th, 0, Pi}]
Plot
Plot

Σφαιρικές συντεταγμένες

Clear["Global`*"]
SphericalPlot3D[2 th ph + th Sin[ph] - ph Cos[th], {th, 0, Pi}, {ph, 0, 2 Pi}]
Plot
SphericalPlot3D[{1, 2, 3}, {th, 0, Pi}, {ph, 0, 3 Pi/2}]
SphericalPlot3D[{1, 2, 3}, {th, Pi/2, Pi}, {ph, 0, 2 Pi}]
Plot
Plot