diff options
author | Karl Berry <karl@freefriends.org> | 2017-11-06 21:58:19 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-11-06 21:58:19 +0000 |
commit | 5949a9aee0bb29a10f1ec50a6cb8dd50a1c7de81 (patch) | |
tree | a2c10f60c3b3ee9b61acd1109ee21adc20d9cc72 /Master/texmf-dist/metapost | |
parent | 9b3715d6ade58a41883a912d6c01e1e502645323 (diff) |
repere (6nov17)
git-svn-id: svn://tug.org/texlive/trunk@45708 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r-- | Master/texmf-dist/metapost/repere/repere.mp | 100 |
1 files changed, 98 insertions, 2 deletions
diff --git a/Master/texmf-dist/metapost/repere/repere.mp b/Master/texmf-dist/metapost/repere/repere.mp index a9094e3e10c..f12b866c56e 100644 --- a/Master/texmf-dist/metapost/repere/repere.mp +++ b/Master/texmf-dist/metapost/repere/repere.mp @@ -2,7 +2,7 @@ %% repere.mp %% %% Macros pour la construction de figures dans un repère %% %% o.peault@posteo.net %% -%% Version 17.05 (Mai 2017) %% +%% Version 17.11 (Novembre 2017) %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This work may be distributed and/or modified under the conditions of @@ -1409,6 +1409,102 @@ vardef antecedents(suffix P)(expr y,p)= for i=1 upto 10: P[i]:=xpart (PP[i]); endfor enddef; +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%% INTERPOLATION %%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%Novembre 2017 +vardef polynomelagrangept(text t)(expr x)= + 0 + for i=t: + + ypart i + for j=t: + if i<>j: *((x-xpart j)/(xpart i - xpart j)) fi + endfor + endfor +enddef; + +%Novembre 2017 +vardef polynomelagrangeval(text t)(expr x)= +save tmp,k,j,ab,or; +pair tmp[];numeric k,j,ab,or; +k:=0;j:=0; +for i=t: + if j=0: ab:=i else: or:=i; k:=k+1; tmp[k]=(ab,or) fi; + j:=1-j; +endfor +polynomelagrangept(tmp[1] for ii=2 upto k: ,tmp[ii] endfor)(x) +enddef; + +%Novembre 2017 +vardef polynomelagrange(text t)(expr x)= + for i=t: + if pair i: polynomelagrangept(t)(x) + else: polynomelagrangeval(t)(x) + fi + exitif true + endfor +enddef; + + +%Novembre 2017 +vardef lagrange(text t)= + vardef _tmp_poly_lag(expr x)= polynomelagrange(t)(x) enddef; + courbefonc(_tmp_poly_lag)() +enddef; + + +%Novembre 2017 +vardef polynomehermitetriplet(text t)(expr x)= +%t=(x1,y1,z1),(x2,y2,z2)... +%H(X)=Σqi(X)Pi(X) avec qi(X)=Li(X)² et Pi(X)=yi+(X-xi)(zi-qi'(xi)yi) +%qi'(xi)=Σ2/(xi-xj) +0 +for i=t: + + + (greenpart i+(x-redpart i)*(bluepart i - + (0 + for j=t: %qi'(xi) + if i<>j: + 2/(redpart i - redpart j) fi + endfor + ) + *greenpart i)) + for j=t: % qi(X) + if i<>j: *(((x-redpart j)/(redpart i - redpart j))**2) fi + endfor +endfor +enddef; + +%Novembre 2017 +vardef polynomehermiteptder(text t)(expr x)= +save tmp,k,j,re,gr,bl; +color tmp[];numeric k,j,re,gr,bl; +k:=0;j:=0; +for i=t: + if pair i: re:= xpart i; gr:= ypart i else: bl:=i; k:=k+1; tmp[k]=(re,gr,bl) fi; +endfor +polynomehermite(tmp[1] for ii=2 upto k: ,tmp[ii] endfor)(x) +enddef; + +%Novembre 2017 +vardef polynomehermite(text t)(expr x)= + for i=t: + if color i: polynomehermitetriplet(t)(x) + else: polynomehermiteptder(t)(x) + fi + exitif true + endfor +enddef; + + +%Novembre 2017 +vardef hermite(text t)= + vardef _tmp_poly_her(expr x)= polynomehermite(t)(x) enddef; + courbefonc(_tmp_poly_her)() +enddef; + + + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% TANGENTES %%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1864,7 +1960,7 @@ vardef projboitemoustache@#(text t)= _lab_[4]:="$Q_3$"; _lab_[5]:="$X_{max}$"; elseif n=1: - if t=0: for i=1 upto 5: _lab_[i]:=nullpicture; endfor + if t=0: for i=1 upto 5: _lab_[i]:=""; endfor else: tmp:=floor(t); for i=1 upto 5: |