0
$\begingroup$

How to define a function that variable with subscript and then plot graphics? For example, $\lambda a_H^2 + (1-\lambda)a_L^2$. But it's has some error:

Manipulate[
  Plot[\[Lambda] Subscript[a, H] + (1 - \[Lambda]) Subscript[a, H], 
  {\[Lambda], 0, 1}], {Subscript[a, H], 0, 1}, {Subscript[a, L], 0, 1}]

enter image description here

New contributor
Chin Ching CHAN is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
4
  • 1
    $\begingroup$ That's a function of three variables. Or are some of the variables assigned a value? Is this related to your previous question in which you used the same variable names? $\endgroup$
    – MarcoB
    Jun 24 at 2:52
  • $\begingroup$ Do not use subscript. Manipulate[ Plot[λ *aH + (1 - λ)*aL, {λ, 0, 1}, PlotRange -> 4], {aH, 0, 1}, {aL, 0, 1}] $\endgroup$
    – cvgmt
    Jun 24 at 9:31
  • $\begingroup$ but it doesn't work $\endgroup$ Jun 24 at 10:07
  • 1
    $\begingroup$ Clear[F]; F[aH_, aL_, λ_] = λ*aH + (1 - λ)*aL; Manipulate[ Plot[F[aH, aL, λ], {λ, 0, 1}, PlotRange -> 4], {aH, 0, 1}, {aL, 0, 1}] $\endgroup$
    – cvgmt
    Jun 24 at 10:21

0

Browse other questions tagged or ask your own question.