Re: Manipulate a complex expression
- To: mathgroup at smc.vnet.net
- Subject: [mg77886] Re: Manipulate a complex expression
- From: dh <dh at metrohm.ch>
- Date: Tue, 19 Jun 2007 06:35:06 -0400 (EDT)
- References: <f505ip$qug$1@smc.vnet.net> <f5332a$3lb$1@smc.vnet.net>
Hi Daniele, if you redefine epsilonCyt to: epsilonCyt:=(Print[{conductivityCyt}];complexEps[permittivityCyt,conductivityCyt,omega]); you will see that conductivityCyt is never replaced by a numerical value. Therefore, we must conclude that Manipulate localizes conductivityCyt before the Evaluate is done. To prevent this, you must give conductivityCyt as an argument: epsilonCyt[conductivityCyt_] := Im[complexEps[permittivityCyt, conductivityCyt, omega]]; the the following will work: Manipulate[Plot[epsilonCyt[conductivityCyt],{f,1 10^5,1 10^10}],{conductivityCyt,0.1,0.5}] hope this helps, Daniel Daniele wrote: > Hello, > as a follow up to my previous post, I think I can clarify my question > with a simpler example. > > Once I define the following: > > complexEps[permittivity_, conductivity_, omega_] := permittivity - (I > conductivity/omega); > epsilonCyt := complexEps[permittivityCyt, conductivityCyt, omega]; > omega := 2 Pi f > permittivityCyt := 50; > > Why does this work: > > Manipulate[Plot[Im[Evaluate[complexEps[permittivityCyt, > conductivityCyt, omega]]], {f, 1 10^5,1 10^10}], {conductivityCyt, > 0.1, 0.5}] > > While this doesn't: > > Manipulate[Plot[Im[Evaluate[epsilonCyt]], {f, 1 10^5, 1 10^10}], > {conductivityCyt, 0.1, 0.5}] > > I would think that the two 'Manipulate' expressions would be > equivalent, but obviously I'd be wrong.... > > thanks. > > On 16 Jun, 09:04, Daniele <d.mal... at gmail.com> wrote: >> Hello, >> I'm trying to use the new Manipulate function to evaluate a complex >> expression. I'm getting a headache, as I'm not familiar with the >> Mathematica notation (I do most of my work, numerically, with another system). >> Maybe somebody here can help debug these few lines? >> >> The expression I want to 'manipulate' is the following: >> >> MeasuredCMF := VolumeFraction ( EpsilonCell - EpsilonMedium)/ >> ( EpsilonCell + 2 EpsilonMedium) >> >> Where VolumeFraction is a parameter, and the other variables are >> complex and a function of 'f'. >> They are defined below. >> >> omega := 2 Pi f >> EpsilonCyt := PermittivityCyt - ( ConductivityCyt/omega) I >> EpsilonMembrane := PermittivityMembrane - (ConductivityMembrane/omega) >> I >> EpsilonMedium := PermittivityMedium - (ConductivityMedium/omega) I >> >> CMFCell := ( EpsilonCyt - EpsilonMembrane)/( EpsilonCyt + 2 >> EpsilonMembrane) >> v := CellRadius/(CellRadius - MembraneThickness) >> EpsilonCell := EpsilonMembrane *(v^3 + 2 CMFCell)/(v^3 - CMFCell) >> >> Epsilon0 = 8.85 10^-12; >> PermittivityCyt = 120 Epsilon0; >> PermittivityMembrane = 6 Epsilon0; >> PermittivityMedium = 80 Epsilon0; >> ConductivityCyt = 0.15; >> ConductivityMedium = 0.15; >> ConductivityMembrane = 1 10^-9; >> CellRadius = 10 10^-6; >> MembraneThickness = 9 10^-9; >> >> if I define VolumeFraction (eg. VolumeFraction=0.1) and plot >> Re[MeasuredCMF] vs. f, I have no problem. >> But I am unable to successfully do the following (I get a blank plot) >> >> Manipulate[ >> LogLinearPlot[ >> Evaluate[Re[MeasuredCMF]], {f, 1 10^5, 1 10^9}], {{VolumeFraction, >> 0.2}, 0.1, 0.5}] >> >> Can somebody help? I suspect I'm not using the assignment syntax >> correctly. >> Thanks >> >> Daniele Malleo > > >