Re: Manipulate a complex expression
- To: mathgroup at smc.vnet.net
- Subject: [mg77807] Re: Manipulate a complex expression
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sun, 17 Jun 2007 06:06:25 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <f505ip$qug$1@smc.vnet.net>
Daniele 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 Hi Daniele, Your function definitions are missing the name of one or more variables. I have made some modification in your code and and now it should work as expected. MeasuredCMF[vfrac_][f_] := vfrac*((EpsilonCell[f] - EpsilonMedium[f])/ (EpsilonCell[f] + 2*EpsilonMedium[f])) omega[f_] := 2*Pi*f EpsilonCyt[f_] := PermittivityCyt - (ConductivityCyt/omega[f])*I EpsilonMembrane[f_] := PermittivityMembrane - (ConductivityMembrane/omega[f])*I EpsilonMedium[f_] := PermittivityMedium - (ConductivityMedium/omega[f])*I CMFCell[f_] := (EpsilonCyt[f] - EpsilonMembrane[f])/ (EpsilonCyt[f] + 2*EpsilonMembrane[f]) v := CellRadius/(CellRadius - MembraneThickness) EpsilonCell[f_] := EpsilonMembrane[f]*((v^3 + 2*CMFCell[f])/ (v^3 - CMFCell[f])) 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; LogLinearPlot[Evaluate[Re[MeasuredCMF[0.1][f]]], {f, 1*10^5, 1*10^9}] Manipulate[ LogLinearPlot[Evaluate[Re[MeasuredCMF[VolumeFraction][f]]], {f, 1*10^5, 1*10^9}], {{VolumeFraction, 0.2}, 0.1, 0.5}] Regards, Jean-Marc