I am a beginner with Mathematica and have only used it for about two months now so I may be missing something important. I am having problems with Manipulate[Plot3D[args]] where the args are intended to plot a function which is the product of functions.
The following Mathematica input is commented to explain the problem and demonstrate what is working and what does not. I'd greatly appreciate any help offered. Is there anyway to attach a notebook file here?
(* Example showing problem with Manipulate[Plot3D[arg]] in \
Mathematica 12.0 Student Edition, where arg is a function which is
the product of other functions although this problem is not exhibited \
for Plot3D[arg] by itself , where arg is a function
which is the product of other functions.
This is a simple example to demonstrate the problem encountered. The \
real goal is to be able to use Manipulate[Plot3D[arg]]
in Partial Differential Equation problems that are solved by methods \
of separation of variables and the final result is in
the form of the product of multiple functions.
Is there a way to get around this?
The only way I can think of is to do what I did here by copying the \
output expression & pasting it into the Plot3D[]
function but that is only masking the problem and only solves the \
immediate problem. If I were to modify the original problem
at some time later, I'd end up with incorrect results *)
ClearAll;
Clear[fn, fn1, fn2, fn3];
(* Function Definitions *)
fn[x_, y_, t_] := (2*x^
3 - x^2)*Sin[y]*E^(-5 t)
f1[x_] := 2*x^
3 - x^2
f2[y_] := Sin[y]
f3[t_] := E^(-5 t)
(* fn1 and fn2 treated as = for Plot3D[] *)
Print["fn1:"]
fn1[x, y, t] =
fn[x, y, t] /. {t ->
0} (* For Static Plot at t=0 *)
Print["fn2:"]
fn2[x, y, t] =
f1[x]*f2[y]*f3[t] /. {t -> 0} (* For Static Plot at t=0 *)
(* fn3 treated as NOT = fn for Manipulate[Plot3D[]] *)
Print["fn3:"]
fn3[x, y, t] = f1[x]*f2[y]*f3[t]
Print["fn:"]
fn[x, y, t]
(* If expressions are equivalent, why is there a problem? *)
(* Test Equivalency of functions / Both cases come back as True *)
fn1[x, y, t] === fn2[x, y, t]
fn[x, y, t] === fn3[x, y, t]
(* Test equivalency of function expression outputs / both cases come \
back as True *)
(* fn1 out test vs fn2 out *)
(-x^2 + 2 x^3) Sin[y] === (-x^2 + 2 x^3) Sin[y]
(* fn3 out test vs fn out *)
E^(-5 t) (-x^2 + 2 x^3) Sin[y] === E^(-5 t) (-x^2 + 2 x^3) Sin[y]
Print["Static Plot of fn1:"]
Plot3D[fn1[x, y, t], {x, 0, 10}, {y, 0, 4*\[Pi]},
PlotRange -> {{0, 10}, {0, 4*\[Pi]}, {-2000, 2000}}]
Print["Static Plot of fn2:"]
Plot3D[fn2[x, y, t], {x, 0, 10}, {y, 0, 4*\[Pi]},
PlotRange -> {{0, 10}, {0, 4*\[Pi]}, {-2000, 2000}}]
Print["Complete Plot of fn:"]
Manipulate[
Plot3D[fn[x, y, t], {x, 0, 10}, {y, 0, 4*\[Pi]},
PlotRange -> {{0, 10}, {0, 4*\[Pi]}, {-2000, 2000}}], {t,
0, .5, .05}]
Print["Empty Plot of fn3:"]
Manipulate[
Plot3D[fn3[x, y, t], {x, 0, 10}, {y, 0, 4*\[Pi]},
PlotRange -> {{0, 10}, {0, 4*\[Pi]}, {-2000, 2000}}], {t,
0, .5, .05}]
Print["Complete Plot using output expression of fn3:"]
Manipulate[
Plot3D[E^(-5 t) (-x^2 + 2 x^3) Sin[y], {x, 0, 10}, {y, 0, 4*\[Pi]},
PlotRange -> {{0, 10}, {0, 4*\[Pi]}, {-2000, 2000}}], {t,
0, .5, .05}]