# Showing desired functions in Manipulate

I have a function like fun[a_, k_] := Exp[a x] + Cos[k t] I want to see how the function behaves when the parameters a and k change. So, I wrote a code as follows:

    Manipulate[
Plot3D[fun[a, k], {x, -5, 5}, {t, 0, 8}], {a, -2, 2, 0.5}, {k, -1, 3,
0.5}, Initialization :> {fun[a_, k_] := Exp[a x] + Cos[k t]}]


I want to see the value of the function (fun[a, k]) dynamically on the panel or on the graph when I move the a and k values.

Besides, suppose that I derive the plot which I want for a=1, k=0, I want to copy the value (Exp[ x] + 1) of the function from the panel in order to use in the next steps. (Second option; we can assign the values of the function to a new parameter. So, we can use this parameter in the next steps.)

(P.S. This is a simple example. In fact, I have more difficult functions including more parameters.)

I hope I understand correctly what you are looking for. To show the current parameter values in the graphics, you may use "PlotLabel". And to store the current parameters to make them accessible outside the manipulate, you can store the parameters in a global variable.

Manipulate[(param = {a, k};
Plot3D[fun[a, k], {x, -5, 5}, {t, 0, 8},
PlotLabel -> StringForm["a=, k=", a, k]]), {a, -2, 2,
0.5}, {k, -1, 3, 0.5},
Initialization :> {fun[a_, k_] := Exp[a x] + Cos[k t]}]


The parameters are available in the variable param:

param
(* {-2, -1} *)

• Thank you. It's almost what I want. Now, I can achieve the rest. Jan 4, 2022 at 21:09