INTERACTIVE DIGITAL DOCUMENT FOR INTERMEDIATE MICROECONOMICS COURSES

Loreto Llorente - Javier Puértolas
Universidad Pública de Navarra (Spain)

Join the Conversation #WolframTechConf

Abstract

This presentation shows an interactive digital document in CDF format built entirely with Mathematica. The document is an intermediate Microeconomic course where everything is integrated into the same document with full interactivity.
The whole document is interactive. Several controls enable the reader to interact with most graphics. Definitions are available on request and throughout the text you can decide whether to use calculus or not. There is a predefined order of Concepts and Activities to be followed by the reader, but you can also construct your own path using the contents, the index and the links within the text.

Introduction

Microeconomics and Mathematica: Calculus and graphics

Since 2006 interactive graphics: Teaching a concept before vs now

Interactive graphics in the classroom: our history

Wolfram Demonstration Project

Activities

Books with CDFs

Microeconomía Interactiva I
(J.Puértolas y L.Llorente).
Ediciones Pirámide, 2013	Second edition, 2018
       		     	
		
Microeconomía Interactiva II
(J.Puértolas y L.Llorente).
Ediciones Pirámide, 2013 

Activity: An example

Row[{Column[{
Style[Control[{{showtext,0,"Show Text"},{0->"No",1->"Yes"}, ControlType->RadioButton,ControlPlacement->Left}],FontFamily->"Arial",12,Plain],
Dynamic[If[showtext==1,,""]]
}],Manipulate[funcder=D[func,x];funcder2=D[func,x,x];Switch[func,Log[x],If[v==1,,ver0=0;ver1=0;ver2=0];v=1;desde=0; hasta=15; minimf=-1;maximf=3;esc={},5/x,If[v==2,,ver0=0;ver1=0;ver2=0];v=2;desde=-5; hasta=5; minimf=-45;maximf=45;esc={0},x^2/(2+x),If[v==3,,ver0=1;ver1=0;ver2=0];v=3;desde=-9; hasta=7; minimf=-20;maximf=20;esc={-2},x^3/3,If[v==4,,ver0=0;ver1=1;ver2=1];v=4;desde=-5; hasta=5; minimf=-45;maximf=45;esc={},3x^2-x^3+2,If[v==5,,ver0=0;ver1=1;ver2=0];v=5;desde=-2; hasta=3.5; minimf=-5;maximf=13;esc={},(x-1)(x-3)(x-6)(x-9),If[v==6,,ver0=0;ver1=0;ver2=0];v=6;desde=-1; hasta=10; minimf=-75;maximf=250];
Style[Column[{If[ver0==0,vacia["Function"],funcion],If[ver1==0,vacia["Derivative"],derivada],If[ver2==0,vacia["Second derivative"],segundaderiv]}],CacheGraphics->False],
Item[Row[{Control[{{func,Log[x] ,"Function nº "},
{Log[x]->1,5/x ->2, x^2/(2+x)->3,x^3/3 ->4,3x^2-x^3+2 ->5,(x-1)(x-3)(x-6)(x-9)->6}}],Row[{Style["    y(x) = ",16],Dynamic[Style[func,16]]}]}]],
Delimiter,
{{ver0,0,"Show the function"},{0->"No",1->"Yes"}, RadioButton,ControlPlacement->Top},{{ver1,0,"Show the derivative"},{0->"No",1->"Yes"}, RadioButton,ControlPlacement->Top},{{ver2,0,"Show (2^nd) derivative"},{0->"No",1->"Yes"}, RadioButton,ControlPlacement->Top},
ControlPlacement->Top ,TrackedSymbols:>Full,Initialization:>{
funcion:=Plot[{func},{x,desde,hasta}, PlotRange->{minimf,maximf},Exclusions->esc,PlotStyle->{{Thick, Orange}},AxesOrigin->{0,0},AxesLabel->{"x","y"}, PlotLabel->"Función",ImageSize->300];
derivada:=Plot[{funcder},{x,desde,hasta},Exclusions->esc,PlotStyle->{{Thick, Blue}},AxesOrigin->{0,0},AxesLabel->{"x","y"},PlotLabel->"Derivada",ImageSize->300];
segundaderiv:=Plot[{funcder2},{x,desde,hasta},Exclusions->esc,PlotStyle->{{Thick,Purple}},AxesOrigin->{0,0},AxesLabel->{"x","y"},PlotLabel->"Derivada segunda",ImageSize->300];
vacia[label_]:=Show[Plot[{0},{x,desde,hasta},AxesLabel->{"x","y"},PlotLabel->label],Graphics[Text[Style["?",100,Red], {(desde+hasta)/2,(minimf+maximf)/2}]], PlotRange->{minimf,maximf},ImageSize->300];Dynamic[Column[ToFileName/@CurrentValue[$FrontEnd,{"NotebookSecurityOptions","TrustedPath"}]]]}]}]

Interactive digital document

Most important features of our document

It is one unique Digital document with Concepts and Activities

NotebookOpen[FileNameJoin[{NotebookDirectory[],"base","MicroeconomicsConceptsActivities","MicroeconomicsConceptsActivities_Modular_10jun2018.cdf"}]]

Contents

General introduction

Sections

Introduction

Concepts

Activities

Index

The code

NotebookOpen[FileNameJoin[{NotebookDirectory[],"base","MicroeconomicsConceptsActivities","MicroeconomicsConceptsActivities_Modular_TheCode_EXPLANATIONS.nb"}]]

“Initializations”

Create list of sections (with their Concepts and Activities)

elementos={
{"Introduction",{"C. Introduction","A. Help on the use of interactive graphics"}},
{"Consumer theory",{"C. Introduction CT","C. The budget constraint","A. Changes in the budget set","C. Consumer preferences","C. The utility function","A. Preferences and utility function", 
"C. The marginal rate of substitution",
"C. The optimal choice", "A. Choice with different preferences","A. Demand functions with different preferences"}},
{"Producer theory",{"C. Introduction PT","C. Technology (I)","C. Technology (II)","A. Technologies: perfect substitutes and perfect complements","A. Technologies: Cobb-Douglas","C. Cost minimization","C. Conditional factor demands and cost functions","A. Cost minimization with different technologies","C. Cost curves","A. Cost functions","A. Producer supply"}},
{"Partial equilibrium",{"A. Competitive market"}},
{"General equilibrium",{}},
{"Imperfect competition",{}},
{"Index",{"C. Index"}}
};

If a new section, Concept or Activity is created we only have to enter its title in this list.

Define an ordered list of Concepts and Activities (“orden”) , and give the corresponding number for each of them  (“n0[name_]”)

orden:=Flatten[Table[elementos[[i]][[2]],{i,1,Count[elementos,___]}]](*list of Concepts and Activites in the predefined order*);
n0[nombre_]:=Position[orden,nombre][[1,1]]+1(*function that assigns to each element the order it has in the "orden" list*);

From this list the document automatically creates the list of Sections, Concepts and Activities using:

Count: to count the elements of the list…

StringCases: to select the Activities knowing their name begins by "A."  (similarly for Concepts),

Flatten: to create the list of Concepts or Activities of all the sections

secciones:=Table[elementos[[i,1]],{i,1,Count[elementos,___]}];(*.....*)

Generate the contents columns

listsections:=Table[Row[{i,"->Button[Style[Row[{",i,",\". \", secciones[[",i, "]]}],14,FontFamily->\"Arial\"],cap =",i,", Appearance->\"Frameless\"]"}],{i,1,Length[secciones]}]
(* Generates the elements for the column of the chapters (there are buttons that allow to select the correspondent Conceps and Activities*) (* Repeat for concepts and activities in each of the sections*)

Create the initial value for: section, definition, slide, associated figure

cap=1; (*for the initial section*)
defin=""; (*for the definitions*)
figura=""; (*for the figures associated to the definitions you can requested in the index*)
n=1;

Create empty lists that we will fill in as their elements are created

tipo=Table[1,{i,1,100}];
(*different types of slides:
 Type 1:Concept
Type 2:Activity
Type 3:The section's introduction
Type 4:Concept with a large figure
Type 6:Activity with a large figure
Type 7:Index*)
ptit=Table[1,{i,1,100}]; (*slide title list*)
psubtit=Table[1,{i,1,100}];(*slide subtitle list*)
pt1a=Table[1,{i,1,100}]; (*main text list*)
pt1c=Table[1,{i,1,100}];(*"a little more" text list*)
ptfig=Table[1,{i,1,100}];(*main text list*)
pt2=Table[1,{i,1,100}];(*list of text with questions on the figure *)
clues=Table[Table["vacia",{i,1,100}],{j,1,100}];cluess=Row[{""}](*list of clues*)
defD=Table["Vacía",{i,1,100}];
def=Table["Vacía",{i,1,100}];
fig=Table["Vacía",{i,1,100}];

(*INITIAL VALUES:*)
defD[[1]]=Row[{""}];
def[[1]]=Row[{""}];fig[[1]]=Row[{""}];

Create a list containing the visited slides “hist”  (“nhist” counts the slide we have returned to on our own path)

tipo[[1]]=0;
nhist=1;
adelante=0;
atras=1;
hist=Table[1,{i,1,200}];
histaux=Table[1,{i,1,200}];
hist[[1]]=1;

To indicate something in the figure.

colg3=Black;mag3=1;stylet3=Plain;(*Initial color, initial magnification, initial text style*)
resaltar3[concepto_,magextra_,colgi1_,colgf1_]:=Dynamic[Tooltip[Button[Mouseover[Style[MouseAppearance[concepto,"LinkHand"], Italic,Blue,14],Style[MouseAppearance[concepto,"LinkHand"],Italic,Red,14]],
mosgraaux=mosgraaux+1;mosgra=1;mosgra3=1;colg3=colgf1;mag3=1.3+magextra;stylet3=Bold;Pause[1.5];
mosgra=0;mosgra3=0;colg3=colgi1;mag3=1;stylet3=Plain;Pause[0.3](*Durante 0.3 segundos vuelve a valores iniciales*);
mosgra=1;mosgra3=1;colg3=colgf1;mag3=1.3+magextra;stylet3=Bold;Pause[1.5];mosgra=0;mosgra3=0;colg3=colgi1;mag3=1;stylet3=Plain,
Method->"Queued",Appearance->"Frameless"],"Press to see in figure",TooltipDelay->0.1]];

Example: budget line

In the text:

resaltar3["budget line",1,Blue,Red]

In the figure:

Graphics[Dynamic[If[mosgra3==0,{Point[{-20,-20}]},{Thick, colg3,Magnification->mag3,Tooltip[Line[{{0,m/p2},{m/p1,0}}],"Budget line: \n    (Subscript[p, 1]) (Subscript[x, 1])+ (Subscript[p, 2]) (Subscript[x, 2]) = m"]}]]]

Each Concept or Activity has a slide. For each one we have created a separate section:

Slide types

Type 1 - Concept				


Type 2 - Activity


Type 3	- Section’s introduction           	

Type 4 - Concept large figure


Type 6 - Activity large figure			

Type 7 - Index


Front cover

Front cover

NotebookEvaluate[FileNameJoin[{NotebookDirectory[],"GraficoPortada.nb"}]];

INTRODUCTION

tipo[[n0["C. Introduction"]]]=1;
ptit[[n0["C. Introduction"]]]=titconcepto["C. Introduction"];
psubtit[[n0["C. Introduction"]]]=subtitconcepto["C. Introduction"];NotebookEvaluate[FileNameJoin[{NotebookDirectory[],"INTRODUCTION","Introduction_fig.nb"}]];
NotebookEvaluate[FileNameJoin[{NotebookDirectory[],"INTRODUCTION","Introduction_1a.nb"}]];
NotebookEvaluate[FileNameJoin[{NotebookDirectory[],"INTRODUCTION","Introduction_1c.nb"}]];
NotebookEvaluate[FileNameJoin[{NotebookDirectory[],"INTRODUCTION","Introduction_2.nb"}]];

Activity: Help on the use of interactive graphics

tipo[[n0["A. Help on the use of interactive graphics"]]]=2;
ptit[[n0["A. Help on the use of interactive graphics"]]]=titactividad["A. Help on the use of interactive graphics"];
psubtit[[n0["A. Help on the use of interactive graphics"]]]=subtitactividad["A. Help on the use of interactive graphics"];
NotebookEvaluate[FileNameJoin[{NotebookDirectory[],"INTRODUCTION","ActHelp_fig.nb"}]];
NotebookEvaluate[FileNameJoin[{NotebookDirectory[],"INTRODUCTION","ActHelp_1a.nb"}]];
NotebookEvaluate[FileNameJoin[{NotebookDirectory[],"INTRODUCTION","CluesIntroduction","ActHelp_clues.nb"}]];

Introduction Consumer Theory
The budget constraint
Activity: Changes in the budget set
...

The technology (II)

tipo[[n0["C. Technology (II)"]]]=4;
ptit[[n0["C. Technology (II)"]]]=titconcepto["C. Technology (II)"];
psubtit[[n0["C. Technology (II)"]]]=subtitconcepto["C. Technology (II)"];
NotebookEvaluate[FileNameJoin[{NotebookDirectory[],"ProducerTheory","TechnologyII_1a_INGLES.nb"}]];
NotebookEvaluate[FileNameJoin[{NotebookDirectory[],"ProducerTheory","TechnologyII_1c_INGLES.nb"}]];
NotebookEvaluate[FileNameJoin[{NotebookDirectory[],"ProducerTheory","TechnologyII_fig.nb"}]];
NotebookEvaluate[FileNameJoin[{NotebookDirectory[],"ProducerTheory","TechnologyII_2_INGLES.nb"}]];

...
Index

tipo[[n0["C. Index"]]]=7;
ptit[[n0["C. Index"]]]=titconcepto["C. Index"];
psubtit[[n0["C. Index"]]]=subtitconcepto["C. Index"];

Definitions

NotebookEvaluate[FileNameJoin[{NotebookDirectory[],"Definitions","Definitions.nb"}]];

The MANIPULATE

NotebookOpen[FileNameJoin[{NotebookDirectory[],"base","MicroeconomicsConceptsActivities","ManipulateTipo1.nb"}]]

NotebookOpen[FileNameJoin[{ParentDirectory[ParentDirectory[ParentDirectory[NotebookDirectory[]]]],"NuevoProyectoLORE_trasJulio15","INSERTANDO_los_objetos","NuevoProyecto2","MicroeconomicsConceptsActivities_Modular.nb"}]]

NotebookOpen[FileNameJoin[{NotebookDirectory[],"base","MicroeconomicsConceptsActivities","Dynamic.nb"}]]

Where we are

Wolfram Demonstration Project?

See  CDFs through a Tablet?

Unsolved questions: tooltips, controls placement.

CDFs could be embedded in a pdf file?

Wolfram Cloud - Controls don’t work properly

Web browser - Html

Where do we go?

Change to Java Script?

Solutions?

Thank you very much for your attention!

Any comments
loreto.llorente@unavarra.es
jpuertolas@unavarra.es