私はラケットと博士ラケットを使用しています。 plotと呼ばれる素晴らしいライブラリがあり、グラフを2Dまたは3Dでプロットすることができます。私はこの方程式をプロットしようとすると、しかしラケット付き3次元グラフをプロットする方法
(plot3d (surface3d (lambda (x y) (* x 3)) (- 10) 10 (- 10) 10))
:
パッケージインポートした後:
(require plot)
を私はf(x,y) = 3 * x
のようなグラフをプロットすることができ
f (x,y,z) = 2(x-2)^2 + (y-1)^2+(z-3)^2 - 10
(plot3d (surface3d (lambda (x y z) (+ (* 2 (expt (- x 2) 2))
(expt (- y 1) 2)
(expt (- z 3) 2)
-10))
(- 10) 10 (- 10) 10))
を
私は理解できないエラーの大きなメッセージが表示されます:
surface3d: contract violation
expected: a procedure that accepts 2 non-keyword argument
given: #<procedure:...top/graficos.rkt:14:19>
in: the 1st argument of
(->*
((-> any/c any/c Real))
((or/c Real #f)
(or/c Real #f)
(or/c Real #f)
(or/c Real #f)
#:alpha
Nonnegative-Real
#:color
(or/c
Integer
Symbol
String
(recursive-contract g147 #:impersonator)
(cons/c
Real
(cons/c Real (cons/c Real '()))))
#:label
(or/C#f String)
#:line-color
(or/c
Integer
Symbol
String
(recursive-contract g147 #:impersonator)
(cons/c
Real
(cons/c Real (cons/c Real '()))))
#:line-style
(or/c
Integer
'transparent
'solid
'dot
'long-dash
'short-dash
'dot-dash)
#:line-width
Nonnegative-Real
#:samples
Positive-Integer
#:style
(or/c
Integer
'transparent
'solid
'bdiagonal-hatch
'crossdiag-hatch
'fdiagonal-hatch
'cross-hatch
'horizontal-hatch
'vertical-hatch)
#:z-max
(or/c Real #f)
#:z-min
(or/c Real #f))
any)
contract from:
<pkgs>/plot-lib/plot/private/plot3d/surface.rkt
blaming: /home/pedro/Desktop/graficos.rkt
(assuming the contract is correct)
at: <pkgs>/plot-lib/plot/private/plot3d/surface.rkt:49.9
これをグラフ化するabsolutelly可能です。私はウルフラムアルファでそれをやった:
[documentation of surface3d](https://docs.racket-lang.org/plot/renderer3d.html?q=plot#%28part._3.D_.Surface_.Renderers%29)を読むと、機能パラメータには3つではなく2つのパラメータがあることを確認してください。 – Renzo
'f(x、y、z)= 2(x-2)^ 2 +(y-1)^ 2 +(z-3)^ 2 - 10'は方程式ではなく、a 3つのパラメータの関数。あなたが探している方程式は '2(x-2)^ 2 +(y-1)^ 2 +(z-3)^ 2 = 10'(つまり' f(x、y、z)= 0')、これはあなたがWolframに入力したものです。変数の1つを求めて解いてください。 – molbdnilo