Message Boards Message Boards

0
|
1731 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Having trouble with displaying text style grid in a manipulate function

Posted 2 years ago

Manipulate[ F[Ct, Mt]:= (Tf(MpCp+MtCt)-MtCtTi)/(MpCp); y = (Tf(MpCp+MC)-MCTi)/(MpCp); (redefined Ti equation)

Plot[{Callout[{F[Ct, Mt]}, "Cobalt Chrome",0.39],
Callout[{F[Ct, Mt]}, "Stainless Steel",0.468],
Callout[{F[Ct, Mt]}, "Titanium",0.523]},
{Ct, 0.3, 0.6},
PlotLabel-> Style["Mass of Surgical Tool v. Temperature Required for Steralization", Fontsize->18],
AxesLabel-> {
    Style["Heat Capacity (J/g\[Degree]C)", Orange],
    Style["Temperature to Steralize Surgical Tool (\[Degree]C)", Red]
    }
    ,  
PlotRange->{{0.3, 0.6}, {Tmin, Tmax}},
ImageSize->500
],
    Text[Style[Grid[{
{"\[Degree]C to Steralize Cobalt Chrome Surgical Tool", (Tf*(Mp*Cp+M*0.39)-M*0.39*Ti)/(Mp*Cp)     },
{"\[Degree]C to Steralize Stainless Steel Surgical Tool",  (Tf*(Mp*Cp+M*0.468)-M*0.468*Ti)/(Mp*Cp)},
{"\[Degree]C to Steralize Titanium Surgical Tool", (Tf*(Mp*Cp+M*0.523)-M*0.523*Ti)/(Mp*Cp)}
}, Alignment->Left, Frame->All],  FontSize->12]],
Control[{{M, 5, "Mass of Surgical Tool (g)"}, 5, 2500, Appearance-> "Labeled"}],
ContentSize->{600, 300}
]

I am having trouble with successfully displaying the function output of F[Ct, Mt] in my text style grid. I have tried to redefine the function differently but the same problem still persists where the text style grid does not recognize the variable M. I have attached the constants and working text style grid below. Any help would be greatly appreciated.

(*Physical Constants*)
Mp=800; (*g for the mass of hotplate*)
Cp=0.89; (*J/gc heat capacity for hotplate*)
Tf=160; (*c desired final temp*)
Ti=25; (*c initial temp for surgical tool*)

 (*Ranges*)
 Tmin=100; (*minimal temperature of hotplate*)
 Tmax=450; (*maxmial temperature of hotplate*)
 Mmin=5; (*g minimal surgical tool weight*)
 Mmax=2500; (*g maxmimum surgical tool weight*)


(*Initial hotplate Temperature Equation*)
F[Ct_, Mt_]:= (Tf*(Mp*Cp+Mt*Ct)-Mt*Ct*Ti)/(Mp*Cp);

(*Manipulate-Friendly Equation*)
Ct=c; (*redefined Ct as c*)
Mt=M; (*redefined Mt as M*)
y = (Tf*(Mp*Cp+M*C)-M*C*Ti)/(Mp*Cp); (*redefined Ti equation*)


Manipulate[
y = (Tf*(Mp*Cp+M*C)-M*C*Ti)/(Mp*Cp); (*redefined Ti equation*)
Text[Style[Grid[{
{"\[Degree]C to Steralize Cobalt Chrome Surgical Tool", (Tf*(Mp*Cp+M*0.39)-M*0.39*Ti)/(Mp*Cp)},
{"\[Degree]C to Steralize Stainless Steel Surgical Tool",  (Tf*(Mp*Cp+M*0.468)-            M*0.468*Ti)/(Mp*Cp)},
{"\[Degree]C to Steralize Titanium Surgical Tool", (Tf*(Mp*Cp+M*0.523)-M*0.523*Ti)/(Mp*Cp)}
}, Alignment->Left, Frame->All],  FontSize->12]],
Control[{{M, 5, "Mass of Surgical Tool (g)"}, 5, 2500, Appearance-> "Labeled"}],
ContentSize->{600, 300}
]
Attachments:
POSTED BY: Peizhe Lu
2 Replies
Posted 2 years ago

Hi Peizhe

Not sure why the redefinitions are in the code. To use the F function in the Manipulate

Manipulate[
Plot[{Callout[{F[Ct, M]}, "Cobalt Chrome", 0.39, CalloutMarker->"CirclePoint",CalloutStyle->Blue],
    Callout[{F[Ct, M]}, "Stainless Steel",0.468, CalloutMarker->"CirclePoint",CalloutStyle->Blue],
    Callout[{F[Ct, M]}, "Titanium",0.523, CalloutMarker->"CirclePoint",CalloutStyle->Blue]},
    {Ct, 0.3, 0.6},
    PlotLabel-> Style["Mass of Surgical Tool v. Temperature Required for Steralization", FontSize->18],
    AxesLabel-> {
       Style["Heat Capacity (J/g\[Degree]C)", Orange],
       Style["Temperature to Steralize Surgical Tool (\[Degree]C)", Red]
       },    
    PlotRange->{{0.3, 0.6}, {Tmin, Tmax}},
    ImageSize->550
    ],
    Text[Style[Grid[{
{"\[Degree]C to Steralize Cobalt Chrome Surgical Tool",  Dynamic@F[0.39, M]},
{"\[Degree]C to Steralize Stainless Steel Surgical Tool", Dynamic@F[0.468, M]},
{"\[Degree]C to Steralize Titanium Surgical Tool", Dynamic@F[0.523, M]}
}, Alignment->Left, Frame->All],  FontSize->12]],
    Control[{{M, 5, "Mass of Surgical Tool (g)"}, 5, 2500, Appearance-> "Labeled"}],
    ContentSize->{600, 300}
    ]

enter image description here

POSTED BY: Rohit Namjoshi
Posted 2 years ago

Rohit thank you so much! I have been trying to fix this for the past few weeks now. You have no idea how much this had helped me!

POSTED BY: Peizhe Lu
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract