From 243fcb8274bd9c2570c4af8713456bca85dd6e99 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 24 Mar 2008 23:38:02 +0000 Subject: tablor 2.01 (24mar08) git-svn-id: svn://tug.org/texlive/trunk@7130 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/tablor/tablor.sty | 752 +++++++++++++++++++++++--- 1 file changed, 684 insertions(+), 68 deletions(-) (limited to 'Master/texmf-dist/tex/latex/tablor') diff --git a/Master/texmf-dist/tex/latex/tablor/tablor.sty b/Master/texmf-dist/tex/latex/tablor/tablor.sty index 726ed6f45a5..4b5a9e57334 100644 --- a/Master/texmf-dist/tex/latex/tablor/tablor.sty +++ b/Master/texmf-dist/tex/latex/tablor/tablor.sty @@ -1,12 +1,12 @@ \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{tablor}[19/03/2008 v1.9 la machine à créer des tableaux de signes et variations] +\ProvidesPackage{tablor}[24/03/2008 v2.01 la machine à créer des tableaux de signes et variations] % \copyleft Connan le Barbare \copyright % avec l'efficace participation de Jean-Michel Boucart -%% Crée 10 environnements : +%% Crée 14 environnements : %% tableau de signes de 2 facteurs affines % \begin{TSa} % TSa(-2,3,-1,5,\tv); @@ -32,7 +32,19 @@ %TVI([-1,+infinity],[-1],"f","x",x2/sqrt(x+1)-1,1,2,\tv) %\end{TVI} %%% +% tableau de variations avec f' sans zéro formel +%\begin{TVapp} +% TVapp([0,+infinity],[0],"g","x",ln(x)-x*exp(2-x),1,\tv) +% \end{TVapp} % +% +% tableau de variations avec f' sans zéro formel +%\begin{TVIapp} +% TVIapp([0,+infinity],[0],"g","x",ln(x)-x*exp(2-x),1,0,\tv) +% \end{TVIapp} +% +% +%%% % et leurs pendants étoilés qui permet l'affichage intermédiaire du % fichier metapost pour le modifier % @@ -170,11 +182,437 @@ -%%% -% -%%% LES SCRIPTS GIAC/XCAS -% -%%% +%%% +% +%%% LES SCRIPTS GIAC/XCAS +% +%%% + + + + + + + +%% +%% Code giac/Xcas pour les Tableaux de Variations +%% + + +\begin{VerbatimOut}{XcasTV.cxx} +TV(L,F,nom,nomv,f,ftt,nmr):={ +nl:=size(L); +f:=unapply(f,x); +fp:=fonction_derivee(f); +Z:=concat(L,F); +S:=resoudre(fp(x),x); + si size(S)>0 alors pour j de 0 jusque size(S)-1 faire + kk:=(evalf(S[j])>=evalf(L[0])) and (evalf(S[j])<=evalf(L[nl-1])); + if(kk==1){Z:=append(Z,simplifier(S[j]))}; + fpour + fsi; + +Z:=sort(Z); +nz:=size(Z); + si Z[0]==Z[1] alors Z:=augment(Z[0],Z[2..nz-1]);nz:=nz-1; + fsi; +pour u de 1 jusque nz-2 faire + si Z[u]==Z[u+1] alors Z:=augment(Z[0..u-1],Z[u+1..nz-1]);nz:=nz-1; + fsi; +fpour; +nz:=size(Z); +l0:=" newLigneVariables(btex $"+nomv+"$ etex);";lp:=" "; lf:=" ";lsp:=" "; +pour m de 0 jusque nz-1 faire l0:=l0+"val(btex $"+latex(Z[m])+"$ etex); +";fpour; + + k0:= evalf(limite(f(x),x=Z[0],1))> evalf(limite(f(x),x=Z[1],-1)); + kz:=evalf(limite(f(x),x=Z[nz-1],-1))> evalf(limite(f(x),x=Z[nz-2],1)); + +lsi:=" +newLigneSignes(btex $\\hbox{ Signe de }\\atop{\\displaystyle "+nom+"'("+nomv+")}$ etex);"+ + if(Z[0]==-infinity){if(sign(evalf(fp(if(Z[1]==+infinity){0}else{Z[1]-10^(-5)})))==1){"plus;"}else{"moins;"}}else{if(member(Z[0],F)==0){ + if(fp(Z[0])==0){"valBarre(btex 0 etex);"}else{" "}+ + if(sign(fp(Z[0]+10^(-5)))==1){"plus;"}else{"moins;"}}else{"nonDefBarre;"+ + if(sign(fp((Z[0]+10^(-5))))==1){"plus;"}else{"moins;"} }} + +if(nz>2){ for(r:=1; r<=nz-2;r++){ ksp:=evalf(fp(Z[r]+0.01))>0; + lsp:=lsp+if(member(Z[r],F)==0){"valBarre(btex 0 etex);"}else{"nonDefBarre;"}+ + if(ksp==1){"plus;"}else{"moins;"} + }; } + +lsf:=if(member(Z[nz-1],F)==0){""}else{"nomDefBarre; +"} +lm0:=limite(f(x),x=Z[0],1)==-infinity; + li:=" +newLigneVariations(btex $\\hbox{\\bf Variations de }\\atop{\\displaystyle \\Mathbold{"+nom+"}}$ etex);"+ + if(member(Z[0],F)==0){"valPos(btex $"+if(lm0==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[0],1)))}+"$ etex,"} + else{"nonDefBarre;limDroite(btex $"+if(lm0==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[0],1)))}+"$ etex,"}+ + if(k0==1){"1"}else{"0"}+ + ");"; + + if(nz>2){ for(r:=1; r<=nz-2;r++){ krm:=evalf(limite(f(x),x=Z[r-1],1))< evalf(limite(f(x),x=Z[r],-1)); + krp:=evalf(limite(f(x),x=Z[r],1))> evalf(limite(f(x),x=Z[r+1],-1)) ; + lmrm:=limite(f(x),x=Z[r],-1)==-infinity;lmrp:=limite(f(x),x=Z[r],1)==-infinity; + lp:=lp+if(member(Z[r],F)){ + "limGauche(btex $"+if(lmrm==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[r],-1)))}+"$ etex,"+if(krm==1){"1);"}else{"0);"}+"nonDefBarre;limDroite(btex $"+if(lmrp==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[r],1)))}+"$ etex,"+if(krp==1){"1);"}else{"0);"}} + else{"valPos(btex $"+latex(simplifier(f(Z[r])))+"$ + etex,"+if(sign(evalf(fp(Z[r]-0.01)))==sign(fp(Z[r]+0.01))){"0.5);"}else{if(krp==1){"1);"}else{"0); +"}}} + }; } + +lnz:=limite(f(x),x=Z[nz-1],-1)==-infinity; + lf:=if(member(Z[nz-1],F)==0){"valPos(btex $"+if(lnz==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[nz-1],-1)))}+"$ etex,"}else{"nonDefBarre;limGauche(btex $"+if(lnz==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[nz-1],-1)))}+"$ etex,"}+ + if(kz==1){"1);"}else{"0); +"}; + + +intro:="input tableauVariation; + verbatimtex +%&latex + \\documentclass{article} + \\usepackage[upright]{fourier} + \\usepackage{amsmath} + \\newcommand{\\Mathbold}[1]{\\mbox{\\boldmath$#1$\\unboldmath}} + \\begin{document} + etex; + +" + + +MetaL:=if(ftt==2){if(nz>2){intro+"beginTableau("+nmr+")"+ + l0+lsi+lsp+lsf+" +endTableau; +end +";}else{ +intro+"beginTableau("+nmr+")"+ + l0+ +lsi+lsf+" +endTableau; +end"; +} +}else{ if(ftt==0){if(nz>2){intro+"beginTableau("+nmr+")"+ + l0+ +li+ +lp+ +lf ++" +endTableau; +end";}else{intro+"beginTableau("+nmr+")"+ + l0+ +li+ +lf ++" +endTableau; +end";}}else{ +if(nz>2){intro+"beginTableau("+nmr+")"+ + l0+ +lsi+lsp+lsf+ +li+ +lp+ +lf ++" +endTableau; +end";}else{intro+"beginTableau("+nmr+")"+ + l0+ +lsi+lsf+ +li+ +lf ++" +endTableau; +end";} +}} + + + +MetaLfc:=if(ftt==2){if(nz>2){" + +beginTableau("+nmr+")"+ + l0+lsi+lsp+lsf+" +endTableau; + +";}else{ +intro+"beginTableau("+nmr+")"+ + l0+ +lsi+lsf+" +endTableau; + +"; +} +}else{ if(ftt==0){if(nz>2){"beginTableau("+nmr+")"+ + l0+ +li+ +lp+ +lf ++" +endTableau; + +";}else{"beginTableau("+nmr+")"+ + l0+ +li+ +lf ++" +endTableau; + +";}}else{ +if(nz>2){"beginTableau("+nmr+")"+ + l0+ +lsi+lsp+lsf+ +li+ +lp+ +lf ++" +endTableau; + +";}else{"beginTableau("+nmr+")"+ + l0+ +lsi+lsf+ +li+ +lf ++" +endTableau; + +";} +}} + + +sortie:=fopen("XCasmpfc.mp"); +fprint(sortie,Unquoted,MetaLfc); +fclose(sortie); + + +return(MetaL); + }:; + +\end{VerbatimOut} + + + + + +%% +%% +%% Quand les solutions formelles de f'(x)=0 ne sont pas calculables +%% + + + +\begin{VerbatimOut}{XcasTVapp.cxx} + + + + + + + +TVapp(L,F,nom,nomv,f,ftt,nmr):={ + + +nl:=size(L); +f:=unapply(f,x); +fp:=fonction_derivee(f); +z0:=concat(L,F);z:=sort(z0); +nz:=size(z); +if(L==[-infinity,+infinity]){S:=seq(fsolve(fp(x),x,k/10,newton_solver),k=-100..100);} +else{if(L[0]==-infinity){S:=seq(fsolve(fp(x),x,k/10,newton_solver),k=-100..L[1]);} +else{if(L[1]==+infinity){S:=seq(fsolve(fp(x),x,k/10,newton_solver),k=L[0]..100);} +else{S:=seq(fsolve(fp(x),x,k/10,newton_solver),k=z[0]..z[nz-1])}}}; +si size(S)>0 alors pour j de 0 jusque size(S)-1 faire + kk:=(re(S[j])==S[j]);kok:=(evalf(S[j])>=L[0]) and (evalf(S[j])<=L[1]); + if(kk==1){if(kok==1){z:=append(z,simplifier(S[j]))}}; + fpour; +fsi; + + +S:=NULL; +S:=S,z[0]; +for(j:=1;j1e-15 or z[j]==0)){ + S:=S,z[j]}; +} +z:=[S]; + +Z:=sort(z); +nz:=size(Z); + +S:=NULL; +S:=S,Z[0]; +for(j:=1;j evalf(limite(f(x),x=Z[1],-1)); + kz:=evalf(limite(f(x),x=Z[nz-1],-1))> evalf(limite(f(x),x=Z[nz-2],1)); + +lsi:=" +newLigneSignes(btex $\\hbox{ Signe de }\\atop{\\displaystyle "+nom+"'("+nomv+")}$ etex);"+ + if(Z[0]==-infinity){if(sign(evalf(fp(if(Z[1]==+infinity){0}else{Z[1]-10^(-5)})))==1){"plus;"}else{"moins;"}}else{if(member(Z[0],F)==0){ + if(fp(Z[0])==0){"valBarre(btex 0 etex);"}else{" "}+ + if(sign(fp(Z[0]+10^(-5)))==1){"plus;"}else{"moins;"}}else{"nonDefBarre;"+ + if(sign(fp((Z[0]+10^(-5))))==1){"plus;"}else{"moins;"} }} + +if(nz>2){ for(r:=1; r<=nz-2;r++){ ksp:=evalf(fp(Z[r]+0.01))>0; + lsp:=lsp+if(member(Z[r],F)==0){"valBarre(btex 0 etex);"}else{"nonDefBarre;"}+ + if(ksp==1){"plus;"}else{"moins;"} + }; } + +lsf:=if(member(Z[nz-1],F)==0){""}else{"nomDefBarre; +"} +lm0:=limite(f(x),x=Z[0],1)==-infinity; + li:=" +newLigneVariations(btex $\\hbox{\\bf Variations de }\\atop{\\displaystyle \\Mathbold{"+nom+"}}$ etex);"+ + if(member(Z[0],F)==0){"valPos(btex $"+if(lm0==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[0],1)))}+"$ etex,"} + else{"nonDefBarre;limDroite(btex $"+if(lm0==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[0],1)))}+"$ etex,"}+ + if(k0==1){"1"}else{"0"}+ + ");"; + + if(nz>2){ for(r:=1; r<=nz-2;r++){ krm:=evalf(limite(f(x),x=Z[r-1],1))< evalf(limite(f(x),x=Z[r],-1)); + krp:=evalf(limite(f(x),x=Z[r],1))> evalf(limite(f(x),x=Z[r+1],-1)) ; + lmrm:=limite(f(x),x=Z[r],-1)==-infinity;lmrp:=limite(f(x),x=Z[r],1)==-infinity; + lp:=lp+if(member(Z[r],F)){ + "limGauche(btex $"+if(lmrm==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[r],-1)))}+"$ etex,"+if(krm==1){"1);"}else{"0);"}+"nonDefBarre;limDroite(btex $"+if(lmrp==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[r],1)))}+"$ etex,"+if(krp==1){"1);"}else{"0);"}} + else{"valPos(btex $"+latex(simplifier(f(Z[r])))+"$ + etex,"+if(sign(evalf(fp(Z[r]-0.01)))==sign(fp(Z[r]+0.01))){"0.5);"}else{if(krp==1){"1);"}else{"0); +"}}} + }; } + +lnz:=limite(f(x),x=Z[nz-1],-1)==-infinity; + lf:=if(member(Z[nz-1],F)==0){"valPos(btex $"+if(lnz==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[nz-1],-1)))}+"$ etex,"}else{"nonDefBarre;limGauche(btex $"+if(lnz==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[nz-1],-1)))}+"$ etex,"}+ + if(kz==1){"1);"}else{"0); +"}; + + +intro:="input tableauVariation; + verbatimtex +%&latex + \\documentclass{article} + \\usepackage[upright]{fourier} + \\usepackage{amsmath} + \\newcommand{\\Mathbold}[1]{\\mbox{\\boldmath$#1$\\unboldmath}} + \\begin{document} + etex; + +" + + +MetaL:=if(ftt==2){if(nz>2){intro+"beginTableau("+nmr+")"+ + l0+lsi+lsp+lsf+" +endTableau; +end +";}else{ +intro+"beginTableau("+nmr+")"+ + l0+ +lsi+lsf+" +endTableau; +end"; +} +}else{ if(ftt==0){if(nz>2){intro+"beginTableau("+nmr+")"+ + l0+ +li+ +lp+ +lf ++" +endTableau; +end";}else{intro+"beginTableau("+nmr+")"+ + l0+ +li+ +lf ++" +endTableau; +end";}}else{ +if(nz>2){intro+"beginTableau("+nmr+")"+ + l0+ +lsi+lsp+lsf+ +li+ +lp+ +lf ++" +endTableau; +end";}else{intro+"beginTableau("+nmr+")"+ + l0+ +lsi+lsf+ +li+ +lf ++" +endTableau; +end";} +}} + + + +MetaLfc:=if(ftt==2){if(nz>2){" + +beginTableau("+nmr+")"+ + l0+lsi+lsp+lsf+" +endTableau; + +";}else{ +intro+"beginTableau("+nmr+")"+ + l0+ +lsi+lsf+" +endTableau; + +"; +} +}else{ if(ftt==0){if(nz>2){"beginTableau("+nmr+")"+ + l0+ +li+ +lp+ +lf ++" +endTableau; + +";}else{"beginTableau("+nmr+")"+ + l0+ +li+ +lf ++" +endTableau; + +";}}else{ +if(nz>2){"beginTableau("+nmr+")"+ + l0+ +lsi+lsp+lsf+ +li+ +lp+ +lf ++" +endTableau; + +";}else{"beginTableau("+nmr+")"+ + l0+ +lsi+lsf+ +li+ +lf ++" +endTableau; + +";} +}} + + +sortie:=fopen("XCasmpfc.mp"); +fprint(sortie,Unquoted,MetaLfc); +fclose(sortie); + + +return(MetaL); + }:; + + + + + + + +\end{VerbatimOut} @@ -183,19 +621,25 @@ %% -%% Code giac/Xcas pour les Tableaux de Variations +%% Code giac/Xcas pour les Tableaux de Variations avec +%% Valeurs intermédiaires %% -\begin{VerbatimOut}{XcasTV.cxx} -TV(L,F,nom,nomv,f,ftt,nmr):={ + + + +\begin{VerbatimOut}{XcasTVI.cxx} + + +TVI(L,F,nom,nomv,f,ftt,ao,nmr):={ nl:=size(L); f:=unapply(f,x); fp:=fonction_derivee(f); Z:=concat(L,F); S:=resoudre(fp(x),x); si size(S)>0 alors pour j de 0 jusque size(S)-1 faire - kk:=(evalf(S[j])>=evalf(L[0])) and (evalf(S[j])<=evalf(L[nl-1])); + kk:=(evalf(S[j])>=evalf(L[0])) and (evalf(S[j])<=evalf(L[nl-1])); if(kk==1){Z:=append(Z,simplifier(S[j]))}; fpour fsi; @@ -210,9 +654,32 @@ pour u de 1 jusque nz-2 faire fpour; nz:=size(Z); l0:=" newLigneVariables(btex $"+nomv+"$ etex);";lp:=" "; lf:=" ";lsp:=" "; -pour m de 0 jusque nz-1 faire l0:=l0+"val(btex $"+latex(Z[m])+"$ etex); -";fpour; + + +LI:=limite(f(x),x,Z[0],1); +LF:=limite(f(x),x,Z[nz-1],-1); +LP:=NULL; +if(nz>2){ for(r:=1; r<=nz-2;r++){LP:=LP,if(member(Z[r],F)){limite(f(x),x,Z[r],-1),limite(f(x),x,Z[r],1)}else{f(Z[r])}}}; +if(nz>2){ LL:=[LI,LP,LF]}else{LL:=[LI,LF]}; + +NL:=size(LL); +A:=NULL;aa:=1;kk:=0; + +if(NL==nz){for(k:=0;knz){for(k:=0;k evalf(limite(f(x),x=Z[1],-1)); kz:=evalf(limite(f(x),x=Z[nz-1],-1))> evalf(limite(f(x),x=Z[nz-2],1)); @@ -220,42 +687,86 @@ lsi:=" newLigneSignes(btex $\\hbox{ Signe de }\\atop{\\displaystyle "+nom+"'("+nomv+")}$ etex);"+ if(Z[0]==-infinity){if(sign(evalf(fp(if(Z[1]==+infinity){0}else{Z[1]-10^(-5)})))==1){"plus;"}else{"moins;"}}else{if(member(Z[0],F)==0){ if(fp(Z[0])==0){"valBarre(btex 0 etex);"}else{" "}+ - if(sign(fp(Z[0]+10^(-5)))==1){"plus;"}else{"moins;"}}else{"nonDefBarre;"+ - if(sign(fp((Z[0]+10^(-5))))==1){"plus;"}else{"moins;"} }} + if(sign(fp((Z[0]+10^(-10))))==1){"plus;"}else{"moins;"}}else{"nonDefBarre;"+ + if(sign(fp(10^(-10)+Z[0]))==1){"plus;"}else{"moins;"} }}+if(TestS==0){"valBarre(btex$ $ etex);"+ if(sign(fp(10^(-10)+Z[0]))==1){"plus;"}else{"moins;"}}else{" "}; + + + + -if(nz>2){ for(r:=1; r<=nz-2;r++){ ksp:=evalf(fp(Z[r]+0.01))>0; - lsp:=lsp+if(member(Z[r],F)==0){"valBarre(btex 0 etex);"}else{"nonDefBarre;"}+ - if(ksp==1){"plus;"}else{"moins;"} - }; } +if(nz>2){rr:=1; if(nz==NL){for(r:=1; r<=NL-2;r++){ TestS:=(sign(evalf(LL[r]-ao))==sign(evalf(LL[r+1]-ao))) or (sign(evalf(LL[r]-ao))==0.0)or (sign(evalf(LL[r+1]-ao))==0.0); + ksp:=evalf(fp(Z[r]+0.01))>0; + TestL:=(abs(LL[r])==abs(LL[r+1])); + lsp:=lsp+if(member(Z[r],F)==0){"valBarre(btex 0 etex);"}else{"nonDefBarre;"}+ + if(ksp==1){"plus;"}else{"moins;"}+if(TestS==0){"valBarre(btex $ $ etex);"}else{" "}+if(TestS==0){if(ksp==1){"plus;"}else{"moins;"}}else{" "}; + }} +else{for(r:=1; r<=NL-2;r++){kspp:=evalf(fp(Z[rr]+0.01))>0;TestS:=(sign(evalf(LL[r]-ao))==sign(evalf(LL[r+1]-ao))) or (sign(evalf(LL[r]-ao))==0.0)or (sign(evalf(LL[r+1]-ao))==0.0); + TestL:=(abs(LL[r])==abs(LL[r+1])); + if(TestS==0){if( TestL==1 ){lsp:=lsp}else{lsp:=lsp+if(member(Z[rr],F)==0){"valBarre(btex 0 etex);"}else{"nonDefBarre;"}+ + if(kspp==1){"plus;"}else{"moins;"}+"valBarre(btex $ $ etex);"+if(kspp==1){"plus;"}else{"moins;"};rr:=rr+1;} + } else{lsp:=lsp+if(member(Z[rr],F)==0){"valBarre(btex 0 etex);"}else{"nonDefBarre;"}+ + if(kspp==1){"plus;"}else{"moins;"};rr:=rr+1;} +}} + }; -lsf:=if(member(Z[nz-1],F)==0){""}else{"nomDefBarre; -"} + + +lsf:=if(member(Z[nz-1],F)==0){""}else{"nomDefBarre;"} lm0:=limite(f(x),x=Z[0],1)==-infinity; + +TestS:=(sign(evalf(LL[0]-ao))==sign(evalf(LL[1]-ao))) or (sign(evalf(LL[0]-ao))==0.0) or (sign(evalf(LL[1]-ao))==0.0); + li:=" -newLigneVariations(btex $\\hbox{\\bf Variations de }\\atop{\\displaystyle \\Mathbold{"+nom+"}}$ etex);"+ - if(member(Z[0],F)==0){"valPos(btex $"+if(lm0==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[0],1)))}+"$ etex,"} +newLigneVariations(btex $\\hbox{\\bf Variations de }\\atop{\\displaystyle \\Mathbold{"+nom+"}}$ etex); +"+ if(member(Z[0],F)==0){"valPos(btex $"+if(lm0==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[0],1)))}+"$ etex,"} else{"nonDefBarre;limDroite(btex $"+if(lm0==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[0],1)))}+"$ etex,"}+ - if(k0==1){"1"}else{"0"}+ - ");"; + if(k0==1){"1);"}else{"0);"}+if(TestS==0){"valPos(btex $ "+ao+" $ etex,0.5);"}else{" "}; + - if(nz>2){ for(r:=1; r<=nz-2;r++){ krm:=evalf(limite(f(x),x=Z[r-1],1))< evalf(limite(f(x),x=Z[r],-1)); + if(nz>2){if(nz==NL){for(r:=1; r<=nz-2;r++){TestS:=(sign(evalf(LL[r]-ao))==sign(evalf(LL[r+1]-ao))) or (sign(evalf(LL[r]-ao))==0.0)or (sign(evalf(LL[r+1]-ao))==0.0); + krm:=evalf(limite(f(x),x=Z[r-1],1))< evalf(limite(f(x),x=Z[r],-1)); krp:=evalf(limite(f(x),x=Z[r],1))> evalf(limite(f(x),x=Z[r+1],-1)) ; lmrm:=limite(f(x),x=Z[r],-1)==-infinity;lmrp:=limite(f(x),x=Z[r],1)==-infinity; - lp:=lp+if(member(Z[r],F)){ + lp:=lp+if(member(Z[r],F)) { "limGauche(btex $"+if(lmrm==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[r],-1)))}+"$ etex,"+if(krm==1){"1);"}else{"0);"}+"nonDefBarre;limDroite(btex $"+if(lmrp==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[r],1)))}+"$ etex,"+if(krp==1){"1);"}else{"0);"}} else{"valPos(btex $"+latex(simplifier(f(Z[r])))+"$ - etex,"+if(sign(evalf(fp(Z[r]-0.01)))==sign(fp(Z[r]+0.01))){"0.5);"}else{if(krp==1){"1);"}else{"0); -"}}} - }; } + etex,"+if(sign(evalf(fp(Z[r]-0.01)))==sign(fp(Z[r]+0.01))){"0.5);"}else{if(krp==1){"1);"}else{"0);"}}}+if(TestS==0){"valPos(btex + $ "+ao+" $ etex,0.5);" + }else{" "}; +};//for +}else{rr:=1;for(r:=1; r<=NL-2;r++){TestS:=(sign(evalf(LL[r]-ao))==sign(evalf(LL[r+1]-ao))) or (sign(evalf(LL[r]-ao))==0.0)or (sign(evalf(LL[r+1]-ao))==0.0); + krm:=evalf(limite(f(x),x=Z[rr-1],1))< evalf(limite(f(x),x=Z[rr],-1)); + krp:=evalf(limite(f(x),x=Z[rr],1))> evalf(limite(f(x),x=Z[rr+1],-1)) ; + lmrm:=limite(f(x),x=Z[rr],-1)==-infinity;lmrp:=limite(f(x),x=Z[rr],1)==-infinity; TestL:=(abs(LL[r])==abs(LL[r+1])); +if(TestS==0){if( TestL==1 ){lp:=lp}else{ lp:=lp+if(member(Z[rr],F)) { + "limGauche(btex $"+if(lmrm==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[rr],-1)))}+"$ etex,"+if(krm==1){"1);"}else{"0);"}+"nonDefBarre;limDroite(btex $"+if(lmrp==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[rr],1)))}+"$ etex,"+if(krp==1){"1);"}else{"0);"}} + else{"valPos(btex $"+latex(simplifier(f(Z[rr])))+"$ + etex,"+if(sign(evalf(fp(Z[rr]-0.01)))==sign(fp(Z[rr]+0.01))){"0.5);"}else{if(krp==1){"1);"}else{"0);"}}}+"valPos(btex + $ "+ao+" $ etex,0.5); + ";rr:=rr+1; +}// else testL==1 +}//testS==0 +else{lp:=lp+if(member(Z[rr],F)){ + "limGauche(btex $"+if(lmrm==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[rr],-1)))}+"$ etex,"+if(krm==1){"1);"}else{"0);"}+"nonDefBarre;limDroite(btex $"+if(lmrp==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[rr],1)))}+"$ etex,"+if(krp==1){"1);"}else{"0);"}} + else{"valPos(btex $"+latex(simplifier(f(Z[rr])))+"$ + etex,"+if(sign(evalf(fp(Z[rr]-0.01)))==sign(fp(Z[rr]+0.01))){"0.5);"}else{if(krp==1){"1);"}else{"0); + "}}};rr:=rr+1; +}//else testS==0 +}//for nz2 + lnz:=limite(f(x),x=Z[nz-1],-1)==-infinity; lf:=if(member(Z[nz-1],F)==0){"valPos(btex $"+if(lnz==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[nz-1],-1)))}+"$ etex,"}else{"nonDefBarre;limGauche(btex $"+if(lnz==1){"-\\infty"}else{latex(simplifier(limite(f(x),x=Z[nz-1],-1)))}+"$ etex,"}+ - if(kz==1){"1);"}else{"0); -"}; + if(kz==1){"1);"}else{"0);"}; -intro:="input tableauVariation; - verbatimtex + +intro:=" +input tableauVariation; +verbatimtex %&latex \\documentclass{article} \\usepackage[upright]{fourier} @@ -264,21 +775,21 @@ intro:="input tableauVariation; \\begin{document} etex; -" +"; -MetaL:=if(ftt==2){if(nz>2){intro+"beginTableau("+nmr+")"+ +MetaL:= if(ftt==2){if(nz>2){intro+"beginTableau("+nmr+")"+ l0+lsi+lsp+lsf+" endTableau; -end -";}else{ +end";}else{ intro+"beginTableau("+nmr+")"+ l0+ lsi+lsf+" endTableau; end"; } -}else{ if(ftt==0){if(nz>2){intro+"beginTableau("+nmr+")"+ +}else{ +if(ftt==0){if(nz>2){intro+"beginTableau("+nmr+")"+ l0+ li+ lp+ @@ -308,25 +819,23 @@ lf +" endTableau; end";} -}} - - +}}; -MetaLfc:=if(ftt==2){if(nz>2){" -beginTableau("+nmr+")"+ +MetaLfc:= if(ftt==2){if(nz>2){"beginTableau("+nmr+")"+ l0+lsi+lsp+lsf+" endTableau; ";}else{ -intro+"beginTableau("+nmr+")"+ +"beginTableau("+nmr+")"+ l0+ lsi+lsf+" endTableau; "; } -}else{ if(ftt==0){if(nz>2){"beginTableau("+nmr+")"+ +}else{ +if(ftt==0){if(nz>2){"beginTableau("+nmr+")"+ l0+ li+ lp+ @@ -340,7 +849,6 @@ li+ lf +" endTableau; - ";}}else{ if(nz>2){"beginTableau("+nmr+")"+ l0+ @@ -360,7 +868,8 @@ lf endTableau; ";} -}} +}}; + sortie:=fopen("XCasmpfc.mp"); @@ -371,42 +880,68 @@ fclose(sortie); return(MetaL); }:; + + \end{VerbatimOut} + + + + %% -%% Code giac/Xcas pour les Tableaux de Variations avec -%% Valeurs intermédiaires +%% +%% Quand les solutions de f'(x)=0 ne sont pas formellement calculables %% +\begin{VerbatimOut}{XcasTVIapp.cxx} -\begin{VerbatimOut}{XcasTVI.cxx} + +TVIapp(L,F,nom,nomv,f,ftt,ao,nmr):={ -TVI(L,F,nom,nomv,f,ftt,ao,nmr):={ nl:=size(L); f:=unapply(f,x); fp:=fonction_derivee(f); -Z:=concat(L,F); -S:=resoudre(fp(x),x); - si size(S)>0 alors pour j de 0 jusque size(S)-1 faire - kk:=(evalf(S[j])>=evalf(L[0])) and (evalf(S[j])<=evalf(L[nl-1])); - if(kk==1){Z:=append(Z,simplifier(S[j]))}; - fpour - fsi; +z0:=concat(L,F);z:=sort(z0); +nz:=size(z); +if(L==[-infinity,+infinity]){S:=seq(fsolve(fp(x),x,k/10,newton_solver),k=-100..100);} +else{if(L[0]==-infinity){S:=seq(fsolve(fp(x),x,k/10,newton_solver),k=-100..L[1]);} +else{if(L[1]==+infinity){S:=seq(fsolve(fp(x),x,k/10,newton_solver),k=L[0]..100);} +else{S:=seq(fsolve(fp(x),x,k/10,newton_solver),k=z[0]..z[nz-1])}}}; +si size(S)>0 alors pour j de 0 jusque size(S)-1 faire + kk:=(re(S[j])==S[j]);kok:=(evalf(S[j])>=L[0]) and (evalf(S[j])<=L[1]); + if(kk==1){if(kok==1){z:=append(z,simplifier(S[j]))}}; + fpour; +fsi; + + +S:=NULL; +S:=S,z[0]; +for(j:=1;j1e-15 or z[j]==0)){ + S:=S,z[j]}; +} +z:=[S]; -Z:=sort(Z); + + +Z:=sort(z); nz:=size(Z); - si Z[0]==Z[1] alors Z:=augment(Z[0],Z[2..nz-1]);nz:=nz-1; - fsi; -pour u de 1 jusque nz-2 faire - si Z[u]==Z[u+1] alors Z:=augment(Z[0..u-1],Z[u+1..nz-1]);nz:=nz-1; - fsi; -fpour; + +S:=NULL; +S:=S,Z[0]; +for(j:=1;j