%% syntaxe : (coeff) decomp_coeff -> (num) (den)
/decomp_coeff {
2 dict begin
/chaine_coeff exch def
47 chaine_coeff in {
%% coeff non entier
/pivot exch def
chaine_coeff 0 pivot getinterval
chaine_coeff pivot 1 add chaine_coeff length pivot 1 add sub getinterval
} {
%% coeff entier
chaine_coeff (1)
} ifelse
end
} def
%% syntaxe : (coeff) (p) p coeff_premark -> ((num * p)/den) coeff*p
/coeff_premark {
5 dict begin
/valeur exch def
/symbol exch def
decomp_coeff
/chaine_den exch def
/chaine_num exch def
chaine_den cvi /den exch def
chaine_num cvi /num exch def
den 1 eq {
%% coeff entier
chaine_num (1) eqstring {
symbol
} {
chaine_num (-1) eqstring {
(-) symbol append
} {
chaine_num symbol append
} ifelse
} ifelse
num valeur mul
} {
%% coeff non entier
chaine_num (1) eqstring {
symbol (/) append chaine_den append
} {
chaine_num (-1) eqstring {
(-) symbol append (/) append chaine_den append
} {
chaine_num symbol append (/) append chaine_den append
} ifelse
} ifelse
num den div valeur mul
} ifelse
end
} def
%% syntaxe : (coeff) p coeff_xtick
/coeff_xtick {
(p) exch
coeff_premark xtick pop
} def
%% syntaxe : [(coeff1) (coeff2) ... (coeffn)] p coeff_xticks
/coeff_xticks {
2 dict begin
/valeur exch def
{(p) valeur coeff_premark xtick pop} apply
end
} def
%% syntaxe : (coeff) (p) p coeff_xmark
/coeff_xmark {
coeff_premark dup xtick Oy xmarkstyle
} def
%% syntaxe : [(coeff1) (coeff2) ... (coeffn)] (p) p coeff_xmarks
/coeff_xmarks {
2 dict begin
/valeur exch def
/symbol exch def
{symbol valeur coeff_premark dup xtick Oy xmarkstyle} apply
end
} def
%% syntaxe : (coeff) p coeff_ytick
/coeff_ytick {
(p) exch
coeff_premark ytick pop
} def
%% syntaxe : [(coeff1) (coeff2) ... (coeffn)] p coeff_yticks
/coeff_yticks {
2 dict begin
/valeur exch def
{(p) valeur coeff_premark ytick pop} apply
end
} def
%% syntaxe : (coeff) (p) p coeff_ymark
/coeff_ymark {
coeff_premark dup ytick Ox exch ymarkstyle
} def
%% syntaxe : [(coeff1) (coeff2) ... (coeffn)] (p) p coeff_ymarks
/coeff_ymarks {
2 dict begin
/valeur exch def
/symbol exch def
{symbol valeur coeff_premark dup ytick Ox exch ymarkstyle} apply
end
} def
|