Commit 078c6fe9 authored by Ximin Luo's avatar Ximin Luo

New upstream version 1.4.9.69+dfsg1

parent a86d602e
J'ai partiellement reussi a integrer giac dans l'application de calculs
de Numworks, sur le simulateur uniquement bien sur.
Sur la calculatrice physique, il n'y a pas assez de memoire, mais il semble possible d'en ajouter:
Voir https://tiplanet.org/forum/viewtopic.php?f=97&t=20557
Voici comment:
1/ Installer Giac/Xcas sur Mac, ca doit aussi marcher sous Linux (je n'ai pas teste). Pour la calculatrice physique, installer un compilateur ARM,
compiler tommath https://github.com/zardam/libtommath-0.39 et copier
config.h.numworks dans config.h, puis compiler avec make -f Makefile.numworks.
2/ Dans le Makefile principal ajouter
LDFLAGS = -lgiac
Sur Mac, il est peut-etre necessaire de mettre
LDFLAGS = -L/Applications/usr/lib -lgiac
3/ Modifier apps/calculation/calculation.cpp, remplacer
=====
void Calculation::setContent(const char * c, Context * context) {
...
}
=====
par
=====
extern "C" const char * caseval(const char *);
void Calculation::setContent(const char * c, Context * context) {
reset();
#if 0
strlcpy(m_inputText, c, sizeof(m_inputText));
#else
static const char * bidon=caseval("init geogebra");
const char * ans=caseval(c);
strlcpy(m_inputText,ans,sizeof(m_inputText));
#endif
Evaluation<double> * evaluation = input()->evaluate<double>(*context);
evaluation->writeTextInBuffer(m_outputText, sizeof(m_outputText));
delete evaluation;
}
=====
Ensuite recompiler, par exemple avec gcc-7
make PLATFORM=simulator CC=gcc-7 CXX=g++-7 LD=g++-7
Lancer ./app.elf, essayez par exemple int(1/x,1,2), observez que l'input est remplace le resultat exact du calcul fait par giac (en mode geogebra). J'aurais bien voulu remplacer l'output par le resultat mais ca ne marche pas parce qu'il y a surement un post-traitement qui veut un resultat approche. Mais l'objectif est atteint de mon cote, ca marche et c'est tres facile a mettre en oeuvre.
\ No newline at end of file
SUBDIRS = src check intl po debianold debian doc examples
DIST_SUBDIRS = src check intl po debianold debian doc examples
EXTRA_DIST = path.h.in setup inst TROUBLES Init.scm compte INSTALACION LEAME.WIN LEAME.ipaq giac.specs giac.specs32 fltk.1.1.changes README.MACOSX pariinl.h changeversion mkosx mkosx10 mkosx3 mkdebian mkdebian2 win2unix.cc addu.cc xcas*.nsi xcas.desktop xcas.xpm xcas.applications README.visualcpp java.README config.h.win win64 mkiphone build_for_iphoneos path.iphone simupath.iphone config.h.iphone config.h.64 config.h.mingw path.mingw configure.mingw README.mingw archive.mingw compile.android mkrpm icons/*
EXTRA_DIST = path.h.in setup inst TROUBLES Init.scm compte INSTALACION LEAME.WIN LEAME.ipaq giac.specs giac.specs32 fltk.1.1.changes README.MACOSX pariinl.h changeversion mkosx mkosx10 mkosx3 mkdebian mkdebian2 win2unix.cc addu.cc xcas*.nsi xcas.desktop xcas.xpm xcas.applications README.visualcpp java.README config.h.win win64 mkiphone build_for_iphoneos path.iphone simupath.iphone config.h.iphone config.h.64 config.h.mingw path.mingw configure.mingw README.mingw archive.mingw compile.android mkrpm LISEZMOI.numworks icons/*
# Rule to build tar-bzipped distribution package
$(PACKAGE)-$(VERSION).tar.gz: dist
......
restart;maple_mode(1);cas_setup(0,0,0,1,0,1e-10,25,[1,50,0,25],0,0,0);#radians,pas de cmplx, pas de Sqrt
restart(1);maple_mode(1);cas_setup(0,0,0,1,0,1e-10,25,[1,50,0,25],0,0,0);#radians,pas de cmplx, pas de Sqrt
/* -------------------------------------EXERCICE---------------------------------------------*/
/* Attention pour les utilisateurs de maple, root[3](23) ne marche pas, il fait juste racine carree.*/
root(3,23);
......
......@@ -35,9 +35,9 @@ a/(a+u+a+u+v)+(a+u)/(a+a+u+v)+(a+u+v)/(a+a+u)-3/2,
4.0*(x+0.5)*(x+0.5)*(x^2-0.6180339887*x+1.0)*(x^2+1.618033989*x+1.0),
(2*x+1)^2*(x^4+x^3+x^2+x+1),
(X-1)*(X+1)*(X^2+1)*(X^2+(-sqrt(3))*X+1)*(X^2-X+1)*(X^2+X+1)*(X^2+sqrt(3)*X+1),
1/4194304*(X-1)*(X+1)*(2*X+sqrt(3)*(sqrt(3)*1/6*2*I+1))*(2*X-sqrt(3)*(sqrt(3)*1/6*2*I+1))*(4*X+sqrt(3)*2*I-2)*(4*X+sqrt(3)*2*I+2)*(4*X-sqrt(3)*2*I+2)*(4*X-sqrt(3)*2*I-2)*(8*X-sqrt(3)*4*(-sqrt(3)*1/96*32*I+1))*(8*X+8*I)*(8*X+sqrt(3)*4*(-sqrt(3)*1/96*32*I+1))*(8*X-8*I),
(X-1)*(X+1)*(X-I)*(X+((-I)*sqrt(3)-1)/2)*(X+((-I)*3+3*sqrt(3))/6)*(X+((-I)*sqrt(3)+1)/2)*(X+((-I)*3-3*sqrt(3))/6)*(X+(I*3-3*sqrt(3))/6)*(X+(I*sqrt(3)-1)/2)*(X+I)*(X+(I*sqrt(3)+1)/2)*(X+(I*3+3*sqrt(3))/6),
(X-1)*(X+1)*(X^2+1)*(X^2-X+1)*(X^2+X+1)*(X^4-X^2+1),
1/4194304*(X-1)*(X+1)*(2*X+sqrt(3)*(sqrt(3)*1/6*2*I+1))*(2*X-sqrt(3)*(sqrt(3)*1/6*2*I+1))*(4*X+sqrt(3)*2*I-2)*(4*X+sqrt(3)*2*I+2)*(4*X-sqrt(3)*2*I+2)*(4*X-sqrt(3)*2*I-2)*(8*X-1/2*sqrt(3)*8*(-sqrt(3)*1/96*32*I+1))*(8*X+8*I)*(8*X+1/2*sqrt(3)*8*(-sqrt(3)*1/96*32*I+1))*(8*X-8*I),
(X-1)*(X+1)*(X-I)*(X+((-I)*sqrt(3)-1)/2)*(X+((-I)*3+3*sqrt(3))/6)*(X+((-I)*sqrt(3)+1)/2)*(X+((-I)*3-3*sqrt(3))/6)*(X+(I*3-3*sqrt(3))/6)*(X+(I*sqrt(3)-1)/2)*(X+I)*(X+(I*sqrt(3)+1)/2)*(X+(I*3+3*sqrt(3))/6),
1+I*sqrt(3),
exp(2*I*Pi/9),
0,
......@@ -70,7 +70,7 @@ a^8+8*a^7*b+8*a^7*c+8*a^7*d+28*a^6*b^2+56*a^6*b*c+56*a^6*b*d+28*a^6*c^2+56*a^6*c
fi ,
"Done",
pnt(pnt[(sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4,1048580]),pnt(pnt[((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^2,1048580]),pnt(pnt[((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^3,1048580]),pnt(pnt[((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^4,1048580]),pnt(pnt[((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^5,1048580]),
pnt(pnt[group[(sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^3],56]),pnt(pnt[circle(pnt[group[-(sqrt(5)-1)/4-I*sqrt(2*sqrt(5)+10)/4+2*((16*I*sqrt(2*sqrt(5)+5)-16)*tan(1/6)+rootof([[-1-2*I,-1+2*I,37+50*I,45+30*I],[1,0,-30,-40,5]]))/(64*tan(1/6)),(sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4],0,1/3]),56]),pnt(pnt[circle(pnt[group[-(sqrt(5)-1)/4-I*sqrt(2*sqrt(5)+10)/4+2*((16*I*sqrt(2*sqrt(5)+5)-16)*tan(1/3)+rootof([[-1-2*I,-1+2*I,37+50*I,45+30*I],[1,0,-30,-40,5]]))/(64*tan(1/3)),(sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4],0,2/3]),56]),pnt(pnt[circle(pnt[group[-(sqrt(5)-1)/4-I*sqrt(2*sqrt(5)+10)/4+2*((16*I*sqrt(2*sqrt(5)+5)-16)*tan(1/2)+rootof([[-1-2*I,-1+2*I,37+50*I,45+30*I],[1,0,-30,-40,5]]))/(64*tan(1/2)),(sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4],0,1]),56]),pnt(pnt[circle(pnt[group[2*(((-16*I)*sqrt(-2*sqrt(5)+5)-16)*tan(1/4)+rootof([[-1+2*I,3-2*I,29-50*I,-15-30*I],[1,0,-30,-40,5]]))/(64*tan(1/4))-((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^2,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^2],0,1/2]),56]),pnt(pnt[circle(pnt[group[2*(((-16*I)*sqrt(-2*sqrt(5)+5)-16)*tan(1/2)+rootof([[-1+2*I,3-2*I,29-50*I,-15-30*I],[1,0,-30,-40,5]]))/(64*tan(1/2))-((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^2,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^2],0,1]),56]),pnt(pnt[group[((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^2,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^3],56]),pnt(pnt[circle(pnt[group[2*(rootof([[-1,1-2*I,25+4*I,39+30*I],[1,0,-30,-40,5]])*tan(1/6)+rootof([[I,-2-I,4-25*I,30+25*I],[1,0,-30,-40,5]]))/(64*tan(1/6))-((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^3,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^3],0,1/3]),56]),pnt(pnt[circle(pnt[group[2*(rootof([[-1,1-2*I,25+4*I,39+30*I],[1,0,-30,-40,5]])*tan(1/3)+rootof([[I,-2-I,4-25*I,30+25*I],[1,0,-30,-40,5]]))/(64*tan(1/3))-((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^3,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^3],0,2/3]),56]),pnt(pnt[circle(pnt[group[2*(rootof([[-1,1-2*I,25+4*I,39+30*I],[1,0,-30,-40,5]])*tan(1/2)+rootof([[I,-2-I,4-25*I,30+25*I],[1,0,-30,-40,5]]))/(64*tan(1/2))-((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^3,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^3],0,1]),56]),pnt(pnt[group[((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^3,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^4],56]),pnt(pnt[circle(pnt[group[2*((sqrt(5)*8-8)*tan(1/4)-sqrt(2)*8*sqrt(sqrt(5)+5))/(32*tan(1/4))-((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^4,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^4],0,1/2]),56]),pnt(pnt[circle(pnt[group[2*((sqrt(5)*8-8)*tan(1/2)-sqrt(2)*8*sqrt(sqrt(5)+5))/(32*tan(1/2))-((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^4,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^4],0,1]),56]),
pnt(pnt[group[(sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^3],56]),pnt(pnt[circle(pnt[group[-(sqrt(5)-1)/4-I*sqrt(2*sqrt(5)+10)/4+2*((16*I*sqrt(2*sqrt(5)+5)-16)*tan(1/6)+rootof([[-1-2*I,-1+2*I,37+50*I,45+30*I],[1,0,-30,-40,5]]))/(64*tan(1/6)),(sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4],0,1/3]),56]),pnt(pnt[circle(pnt[group[-(sqrt(5)-1)/4-I*sqrt(2*sqrt(5)+10)/4+2*((16*I*sqrt(2*sqrt(5)+5)-16)*tan(1/3)+rootof([[-1-2*I,-1+2*I,37+50*I,45+30*I],[1,0,-30,-40,5]]))/(64*tan(1/3)),(sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4],0,2/3]),56]),pnt(pnt[circle(pnt[group[-(sqrt(5)-1)/4-I*sqrt(2*sqrt(5)+10)/4+2*((16*I*sqrt(2*sqrt(5)+5)-16)*tan(1/2)+rootof([[-1-2*I,-1+2*I,37+50*I,45+30*I],[1,0,-30,-40,5]]))/(64*tan(1/2)),(sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4],0,1]),56]),pnt(pnt[circle(pnt[group[2*(((-16*I)*sqrt(-2*sqrt(5)+5)-16)*tan(1/4)+rootof([[-1+2*I,3-2*I,29-50*I,-15-30*I],[1,0,-30,-40,5]]))/(64*tan(1/4))-((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^2,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^2],0,1/2]),56]),pnt(pnt[circle(pnt[group[2*(((-16*I)*sqrt(-2*sqrt(5)+5)-16)*tan(1/2)+rootof([[-1+2*I,3-2*I,29-50*I,-15-30*I],[1,0,-30,-40,5]]))/(64*tan(1/2))-((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^2,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^2],0,1]),56]),pnt(pnt[group[((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^2,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^3],56]),pnt(pnt[circle(pnt[group[2*(rootof([[-1,1-2*I,25+4*I,39+30*I],[1,0,-30,-40,5]])*tan(1/6)+rootof([[I,-2-I,4-25*I,30+25*I],[1,0,-30,-40,5]]))/(64*tan(1/6))-((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^3,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^3],0,1/3]),56]),pnt(pnt[circle(pnt[group[2*(rootof([[-1,1-2*I,25+4*I,39+30*I],[1,0,-30,-40,5]])*tan(1/3)+rootof([[I,-2-I,4-25*I,30+25*I],[1,0,-30,-40,5]]))/(64*tan(1/3))-((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^3,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^3],0,2/3]),56]),pnt(pnt[circle(pnt[group[2*(rootof([[-1,1-2*I,25+4*I,39+30*I],[1,0,-30,-40,5]])*tan(1/2)+rootof([[I,-2-I,4-25*I,30+25*I],[1,0,-30,-40,5]]))/(64*tan(1/2))-((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^3,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^3],0,1]),56]),pnt(pnt[group[((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^3,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^4],56]),pnt(pnt[circle(pnt[group[2*((sqrt(5)*8-8)*tan(1/4)-8*sqrt(2*(sqrt(5)+5)))/(32*tan(1/4))-((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^4,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^4],0,1/2]),56]),pnt(pnt[circle(pnt[group[2*((sqrt(5)*8-8)*tan(1/2)-8*sqrt(2*(sqrt(5)+5)))/(32*tan(1/2))-((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^4,((sqrt(5)-1)/4+I*sqrt(2*sqrt(5)+10)/4)^4],0,1]),56]),
proc(a,n)
local A,B,C;
A:=1;
......
restart;maple_mode(1);cas_setup(0,0,0,1,0,1e-10,25,[1,50,0,25],0,0,0);#radians,pas de cmplx, pas de Sqrt
restart(1);maple_mode(1);cas_setup(0,0,0,1,0,1e-10,25,[1,50,0,25],0,0,0);#radians,pas de cmplx, pas de Sqrt
diag(seq(1,4)); diag(1$4);
diag(seq(i,i=1..4));
A:=matrix(4,4)+1;v:=[seq(1,j=1..4)];
......
restart;maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0);#radians,pas de cmplx, pas de Sqrt
restart(1);maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0);#radians,pas de cmplx, pas de Sqrt
n:=5;M:=matrix(n,n,(i,j)->rand(21)-10.0);#NB:rand(21) repond entre 0 et 20
maxnorm(M);colnorm(M);frobenius_norm(M);
Cond:=M->[frobenius_norm(evalf(M))*frobenius_norm(1/evalf(M)),M];
......
This source diff could not be displayed because it is too large. You can view the blob instead.
restart;maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0);#radians,pas de cmplx, pas de Sqrt
restart(1);maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0);#radians,pas de cmplx, pas de Sqrt
gcd(6,3);#Attention, a priori pour lui c'est des polynomes, on a dela chance il les normalise bien.
gcd(x*(x+3),2*x);
igcd(4,6,8);
......
......@@ -42,10 +42,10 @@ proc(A,i,j)
n:=(dim(A))[1];
U:=identity(n);
V:=identity(n);
for l from 1 to n do V[l,i]:=-iquo(A[l,j],A[i,j]);
for l from 1 to n do V[l,i]:=-(iquo(A[l,j],A[i,j]));
od;;
V[i,i]:=1;
for l from 1 to n do U[j,l]:=-iquo(A[i,l],A[i,j]);
for l from 1 to n do U[j,l]:=-(iquo(A[i,l],A[i,j]));
od;;
U[j,j]:=1;
V*A*U;
......@@ -90,7 +90,7 @@ proc(A,i,j)
local n,U,l;
n:=(dim(A))[1];
U:=identity(n);
for l from 1 to n do U[j,l]:=-iquo(A[i,l],A[i,j]);
for l from 1 to n do U[j,l]:=-(iquo(A[i,l],A[i,j]));
od;;
U[j,j]:=1;
A*U;
......
restart;maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0);#radians,pas de cmplx, pas de Sqrt
restart(1);maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0);#radians,pas de cmplx, pas de Sqrt
n:=5;A:=matrix(n,n,(i,j)->a[i,j]);M:=A;c:=1;k:=1;
/* Pour M, On peut ecraser car i,j>k*/
Lk:=[];
......
restart;maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
restart(1);maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
/* -------------------Polynome caracteristique et mineurs diagonaux------------------------------------------------------------------------------*/
n:=5; In:={seq(i,i=1..n)}; In minus {2,4};
extr:=proc(A,II,JJ)
......
restart;maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
restart(1);maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
/* ----------------------------calcul du determinant par interpolation----------------------------*/
monlagrange:=proc(A)
local n,i,j,P,L,M;
......
restart;maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
restart(1);maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
/* astuces, a retenir: sous xcas on utilise unapply qui est en general plus sur£que la methode suivante avec subs. */
f:=x^2+1; g:=unapply(f,x);expand(g(x+2));
g:=t->subs(x=t,f);g(x+2);
......
restart;maple_mode(1);
restart(1);maple_mode(1);
/* -------------------------------------EXERCICE-----------------------------------------*/
l:=[];
......
restart;maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
restart(1);maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
l:={1,4,5,6,7};a:=rand(10):
member(a,l);
a; #verification.
......
restart;maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
restart(1);maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
/* ------------------------------------------------Exercice---------------------------------------------*/
time(p:=nextprime(10^50)):
......
restart;maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
restart(1);maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
GF(3,6,'a');
(1+a)^17;
Factor(x^3-x+1) mod 3;
......
restart;maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
restart(1);maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
rem(x^2+2*x+2,x^2+1);
rem([1,2,2],[1,0,1]);
rem(X^2+2*X+2,X^2+1); #X ne marche pas, il le fait en x. On pourra utiliser: ,X
......
restart;maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
restart(1);maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
/* On prend une conique passant par (0,0,1), puis on change de variable.*/
C:=14*(x[1])^2+28*x[1]*x[2]+18*x[1]*x[3]+15*(x[2])^2+3*x[2]*x[3]; // add(add(rand(20)()*x[i]*x[j],i=1..3),j=1..2);
C:=normal(subs(x[1]=x[1]-x[3],x[2]=x[2]-x[3],C));
......
......@@ -35,10 +35,10 @@ matrix[[a[1,1]*s+a[1,2]*t],[a[2,1]*s+a[2,2]*t]],
t,
[(a[1,1]*s+a[1,2]*t)*t,-s^2*a[1,1]-s*a[1,2]*t-s*t*a[2,1]-t^2*a[2,2]+(a[2,1]*s+a[2,2]*t)*t,(a[2,1]*s+a[2,2]*t)*t],
(a[1,1]*s+a[1,2]*t)*l,1+(a[2,1]*s+a[2,2]*t)*l,(a[2,1]*s+a[2,2]*t)*l,
X*(a[2,1]*s+a[2,2])-a[1,1]*s-(a[1,2]),
Y*(a[2,1]*s+a[2,2])+s^2*a[1,1]+s*a[1,2]+s*a[2,1]+a[2,2]-a[2,1]*s-(a[2,2]),
-X^2*a[2,1]*a[2,2]*a[1,2]+X^2*(a[2,2])^2*a[1,1]+X*(a[2,1])^2*a[1,2]*Y-X*a[2,1]*a[2,2]*a[1,1]*Y+X*a[2,1]*(a[1,2])^2-X*a[2,2]*a[1,1]*a[1,2]-a[2,1]*a[1,1]*a[1,2]*Y+a[2,2]*(a[1,1])^2*Y,
(-a[2,2]*a[1,1]+a[1,2]*a[2,1])*(Z*X*a[1,2]-Z*a[1,1]*Y-X^2*a[2,2]+X*a[2,1]*Y),
-a[1,1]*s-(a[1,2])+X*(a[2,1]*s+a[2,2]),
s^2*a[1,1]+s*a[1,2]+s*a[2,1]+a[2,2]-a[2,1]*s-(a[2,2])+Y*(a[2,1]*s+a[2,2]),
(a[1,1])^2*a[2,2]*Y-a[1,1]*a[1,2]*X*a[2,2]-a[1,1]*a[1,2]*a[2,1]*Y+a[1,1]*X^2*(a[2,2])^2-a[1,1]*X*a[2,1]*a[2,2]*Y+(a[1,2])^2*X*a[2,1]-a[1,2]*X^2*a[2,1]*a[2,2]+a[1,2]*X*(a[2,1])^2*Y,
(-a[1,1]*a[2,2]+a[1,2]*a[2,1])*(-Z*a[1,1]*Y+Z*a[1,2]*X-a[2,2]*X^2+Y*X*a[2,1]),
X^2*a[2,2]-X*Y*a[2,1]-X*Z*a[1,2]+Y*Z*a[1,1],
(X,Y,Z)->X^2*a[2,2]-X*Y*a[2,1]-X*Z*a[1,2]+Y*Z*a[1,1],
0,
......
restart;maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
restart(1);maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
/* --------------------------------------------Exercice---courbes param\'etr\'ees---------------------------------*/
XT:=t*(t^2-1)^2;YT:=t^2+1;
eq:=resultant(XT-x,YT-y,t);
......@@ -58,7 +58,7 @@ purge(x,y);
solx:=[solve(eqred,x)];
soly:=seq(gcd(subs(x=solx[i],C1),subs(x=solx[i],C2)),i=1..3);
/* les ordonn\'ees des points d'abscisse solx[i] sont:*/
seq(cSolve(soly[i],y),i=1..3);
L2:=seq(cSolve(soly[i],y),i=1..3): sort([L2],(u,v)-> real(u+I*u*0.3)<real(v+I*v*0.3));
/* On constate que pour solx[3] les ordonn\'ees des points de C1 inter£ C2 ayant cette abscisse sont complexes conjuguees bien que solx[3]£ soit reel ce qui explique pourquoi le dessin ne nous donnait que 4 points.*/
/* ----------------------------------------Exercice---Intersections de quadriques--------------------------------------*/
purge(u);
......
......@@ -20,7 +20,7 @@ y^2-(x-3)*(x^2-16),
"Done",
"Done",
-x^5+3*x^4+16*x^3-48*x^2+16,
(-1.0)*(x-4.105876927)*(x-2.749235551)*(x-0.6633796231)*(x+0.5365997443)*(x+3.981892356),
-1.0*(x-4.105876927)*(x-2.749235551)*(x-0.6633796231)*(x+0.5365997443)*(x+3.981892356),
[1-t,1+(y-1)*t],
(1-t)*(1+(y-1)*t)-4,
(1+(y-1)*t)^2-(1-t-3)*((1-t)^2-16),
......@@ -48,7 +48,8 @@ x^3-2*x^2-20*x+48,
"Done",
[-sqrt(13)-1,sqrt(13)-1,4],
y^2+6*sqrt(13)+18,y^2-6*sqrt(13)+18,y^2,
-sqrt(6)*I*sqrt(sqrt(13)+3),sqrt(6)*I*sqrt(sqrt(13)+3),-sqrt(6)*sqrt(sqrt(13)-3),sqrt(6)*sqrt(sqrt(13)-3),0,
"Done",
[-sqrt(6*(sqrt(13)-3)),I*sqrt(6*(sqrt(13)+3)),0,(-I)*sqrt(6*(sqrt(13)+3)),sqrt(6*(sqrt(13)-3))],
"No such variable u",
x^2+1/4*y^2+1/9*z^2-1,
x^2+y^2+z^2-u,
......@@ -79,10 +80,10 @@ matrix[[-2,-2,-2,0],[-2,-8,-6,0],[-2,-6,-6,0],[0,0,0,-4]],
64*x^4+96*x^3*y+180*x^2*y^2+48*x^2+108*x*y^3+36*x*y+81*y^4+54*y^2+9,
(8*x^2+6*x*y+9*y^2+3)^2,
t^2*(x^2+y^2-1)+t*(x*y+y^2-x^2)+x^2+2*y^2-1,
2*t*(x^2+y^2-1)+x*y+y^2-x^2,
x*y+y^2-x^2+2*t*(x^2+y^2-1),
3*x^6+2*x^5*y+16*x^4*y^2-11*x^4-2*x^3*y+20*x^2*y^4-33*x^2*y^2+12*x^2-2*x*y^5+2*x*y^3+7*y^6-19*y^4+16*y^2-4,
(x^2+y^2-1)*(3*x^4+2*x^3*y+13*x^2*y^2-8*x^2-2*x*y^3+7*y^4-12*y^2+4),
3*x^4+2*x^3*y+13*x^2*y^2-8*x^2-2*x*y^3+7*y^4-12*y^2+4,
(t)->t^2*(x^2+y^2-1)+t*(x*y+y^2-x^2)+x^2+2*y^2-1,
(t)->2*t*(x^2+y^2-1)+x*y+y^2-x^2,
(t)->x*y+y^2-x^2+2*t*(x^2+y^2-1),
"Done"
restart;maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
restart(1);maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
P:=-2*x^3+5*x^2*y+x^2+4*x*y^2-26*x*y+22*x+2*y^3-4*y^2+18*y-24; // normal(add((rand(-5,5)*x+rand(-5,5)*y+rand(-5,5))*(x-2)^i*(y-1)^(2-i),i=0..2));
implicitplot(P,x,y,xstep=0.01):
fP:=unapply(P,x,y);
......
restart;maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
restart(1);maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
/* xcas peut reduire les matrice modulo n, avec les regles de priorite suivantes:*/
[[1,3],[-1,5]]*[[2,7],[-1,5]] mod 5;
([[1,3],[-1,5]]*[[2,7],[-1,5]]) mod 5;
......
[],
"Warning: some commands like subs might change arguments order",
0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0,
[[4,2],[3,3]],
[[14,2],[18,-2]],
[[4,2],[3,3]],
[[3,5],[3,5]],
[[3,0],[3,0]],
......
restart;maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
restart(1);maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
/* -----------------------------------------------Exercice-----------------------------------*/
/* Essayons (1,1) (1,0) (2,1). C'est l'ensemble des points annulant les elements de I.*/
q1:=(x+y-1)*(y-1);q2:=(x-y-1)*(x-1);q3:=(x-1)*(y-1); #Les coniques contenant les 3 points.
......
This diff is collapsed.
restart;maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
restart(1);maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
/* -----------------------------------------------Exercice-----------------------------------*/
L:=[];d:=2;purge(x);
for i from 0 to d do for j from 0 to d-i do L:=[op(L),x[1]^i*x[2]^j] od; od;
......
restart;maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
restart(1);maple_mode(1);cas_setup(0,0,0,1,0,1e-10,10,[1,50,0,25],0,0,0); #radians,pas de cmplx, pas de Sqrt
Factor(x^23-1) mod 2;
/* Astuce: pour recuperer directement le second facteur, on peut utiliser op, ou£bien on utilise factors, mais£il en faut la forme inerte pour travailler sur Z/2Z, d'ou les£guillemets. Attention, ca ne marche pas toujours, par exemple si P:=x^23-1,£'factors(P)' mod 2 ne marche pas. En revanche, on peut introduire les nombres£modulaires comme en mode xcas grace a makemod, ou bien basculer en mode xcas,£creer a:=1%2; et revenir en mode maple, puis utiliser a.*/
op(Factor(x^23-1) mod 2);
......
......@@ -74,7 +74,7 @@ x^6*u[6]+x^5*u[5]+x^4*u[4]+x^3*u[3]+x^2*u[2]+x*u[1]+u[0],
u[1],
u[4],
1/(x+1/(x^2+1/(x^3+x+1+1/(x+2+1/x)))),
[1,sqrt(3)*(x+3)/3,sqrt(3)*(x^2+3*x-3)/3,(-I)*sqrt(273)*(3*x^3+20*x^2+21*x-42)/273,(-I)*sqrt(32214)*(273*x^4+1194*x^3+498*x^2+77*x+483)/32214],
[1,sqrt(3)*(x+3)/3,sqrt(3)*(x^2+3*x-3)/3,(-I)*sqrt(273)*(3*x^3+20*x^2+21*x-42)/273,273*(-I)*sqrt(32214)*(x^4+398/91*x^3+166/91*x^2+11/39*x+23/13)/32214],
[1/(3*x+1),-1/(3*x^2-3*x-1),(3*x^2-11*x-3)/(42*x^3-21*x^2-20*x-3),(626*x^3+192*x^2+375*x+273)/(483*x^4+77*x^3+498*x^2+1194*x+273)],
proc(P)
normal(x^(degree(P))*subs(x=(1/x),P));
......
......@@ -251,9 +251,9 @@ x^2+1/2*x+1/3,
5,
matrix[[-8.1,-2.1,6.9,-9.1,2.9],[-5.1,-2.1,9.9,9.9,2.9],[-2.1,8.9,7.9,-7.1,6.9],[0.9,-3.1,7.9,-9.1,0.9],[0.9,-7.1,-1.1,2.9,8.9]],
matrix[[-8.1-X,-2.1,6.9,-9.1,2.9],[-5.1,-2.1-X,9.9,9.9,2.9],[-2.1,8.9,7.9-X,-7.1,6.9],[0.9,-3.1,7.9,-9.1-X,0.9],[0.9,-7.1,-1.1,2.9,8.9-X]],
-1.00000000005*X^5-2.49999999984*X^4+110.5*X^3+1240.4*X^2-11443.7*X-228845.7,
0,
0,
-1.00000000004*X^5-2.49999999953*X^4+110.499999998*X^3+1240.4*X^2-11443.7*X-228845.7,
(x+(1-i)/sqrt(2))*(x+(1+i)/sqrt(2))*(x+(-1-i)/sqrt(2))*(x+(-1+i)/sqrt(2)),
(x+(1-i)/sqrt(2))*(x+(1+i)/sqrt(2))*(x+(-1-i)/sqrt(2))*(x+(-1+i)/sqrt(2)),
[[1,2],[3,4]],
[[1.0,2.0],[3.0,4.0]],
[[-2.0,1.0],[1.5,-0.5]],
......
#! /bin/sh
unset LANG
../src/icas testfactor > factor.tst
diff factor.tst factor.out
......@@ -32,8 +32,8 @@ atan(exp(x)),
1/4*ln((4*x^2*tan(x/2)^4+8*x^2*tan(x/2)^2+4*x^2+16*x*tan(x/2)^3+16*x*tan(x/2)+16*tan(x/2)^2)/(tan(x/2)^4+2*tan(x/2)^2+1)),
2*(sqrt(x+1)*(x+1)/3-sqrt(x+1)),
atan(sqrt(exp(x)-1)/2),
2/3*asin(sqrt(x)*x/sqrt(a)/abs(a)),
-2*(-1/2*sqrt(a-x)*sqrt(a-a+x)+1/2*a*asin(sqrt(a-x)/sqrt(a))),
2/3*asin(sqrt(x)*x/sqrt(a)/a)*sign(a),
-2*(-1/2*sqrt(a-x)*sqrt(x)+1/2*a*asin(sqrt(a-x)/sqrt(a))),
2/4*x*sqrt(a^2+x^2)-2*a^2/4*ln(sqrt(a^2+x^2)-x),
-1/6*cos(3*x)-1/2*cos(x),
-x/2+1/2*atan(x)+x^2/2*atan(x),
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -24,8 +24,8 @@ idn(7);
normal((x+3)^4);
factor(x^4+12*x^3+54*x^2+108*x+81 );
factor(x^4-1);
int(1/x,x);
int(1/(1+x^2),x);
integrate(1/x,x);
integrate(1/(1+x^2),x);
int(1/(4+x^2),x);
integrate(1/(4+x^2),x);
30;
......@@ -252,8 +252,8 @@ k:=5;
A:=matrix(k,k,(l,j)->rand(21)-10.1);
B:=A-X*identity(k);
simplify(det(B));
regroup(factor(x^4+1,exp(i*pi/4))-'1/20736*(12*x+12*(-1/sqrt(2)+(i)/sqrt(2)))*(12*x+12*(-1/sqrt(2)-(i)/sqrt(2)))*(12*x+12*(1/sqrt(2)+(i)/sqrt(2)))*(12*x+12*(1/sqrt(2)-(i)/sqrt(2)))');
regroup((factor(x^4+1,exp(i*pi/4)+1))-'1/20736*(12*x+12*((i)/sqrt(2)-1/sqrt(2)))*(12*x+12*(-(i)/sqrt(2)-1/sqrt(2)))*(12*x+12*((i)/sqrt(2)+1/sqrt(2)))*(12*x+12*(-(i)/sqrt(2)+1/sqrt(2)))');
factor(x^4+1,exp(i*pi/4));
factor(x^4+1,exp(i*pi/4)+1);
A:=[[1,2],[3,4]];
B:=approx(A);
inv(B);
......
......@@ -2,8 +2,8 @@ dnl Run autoreconf -iv to produce the configure script and associated files.
dnl Giac version number
m4_define([giac_major_version], [1])
m4_define([giac_minor_version], [2])
m4_define([giac_micro_version], [3])
m4_define([giac_minor_version], [4])
m4_define([giac_micro_version], [9])
m4_define([giac_version], [giac_major_version.giac_minor_version.giac_micro_version])
dnl Attempt to change archive name made by make dist
......@@ -263,6 +263,38 @@ AC_SUBST(CONFIG_AO)
AC_SUBST(AO_LIBS)
AM_CONDITIONAL(CONFIG_AO, [test "$CONFIG_AO" = "yes"])
dnl AC_CHECK_LIB(glpk, main)
CONFIG_GLPK="yes"
AC_ARG_ENABLE([glpk],
[AS_HELP_STRING([--enable-glpk], [Use GLPK [[default=yes]]])],
[if test "$enableval" = "no"; then CONFIG_GLPK="no"; fi], [])
if test "$CONFIG_GLPK" = "yes"; then
AC_CHECK_HEADER(glpk.h, [], [CONFIG_GLPK="no"])
fi
if test "$CONFIG_GLPK" = "yes"; then
AC_CHECK_LIB(glpk, main, [], [CONFIG_GLPK="no"])
fi
AC_SUBST(CONFIG_GLPK)
AC_SUBST(GLPK_LIBS)
AM_CONDITIONAL(CONFIG_GLPK, [test "$CONFIG_GLPK" = "yes"])
dnl AC_CHECK_LIB(curl, main)
CONFIG_CURL="yes"
AC_ARG_ENABLE([curl],
[AS_HELP_STRING([--enable-curl], [Use CURL [[default=yes]]])],
[if test "$enableval" = "no"; then CONFIG_CURL="no"; fi], [])
if test "$CONFIG_CURL" = "yes"; then
AC_CHECK_HEADER(curl/curl.h, [], [CONFIG_CURL="no"])
fi
if test "$CONFIG_CURL" = "yes"; then
AC_CHECK_LIB(curl, main, [], [CONFIG_CURL="no"])
fi
AC_SUBST(CONFIG_CURL)
AC_SUBST(CURL_LIBS)
AM_CONDITIONAL(CONFIG_CURL, [test "$CONFIG_CURL" = "yes"])
AC_CANONICAL_HOST
dnl Check for stuff needed for building the Giac interactive shell (cas).
......
/* FileSaver.js
* A saveAs() FileSaver implementation.
* 2015-05-07.2
*
* By Eli Grey, http://eligrey.com
* License: X11/MIT
* See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md
*/
/*global self */
/*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
var saveAs = saveAs || (function(view) {
"use strict";
// IE <10 is explicitly unsupported
if (typeof navigator !== "undefined" && /MSIE [1-9]\./.test(navigator.userAgent)) {
return;
}
var
doc = view.document
// only get URL when necessary in case Blob.js hasn't overridden it yet
, get_URL = function() {
return view.URL || view.webkitURL || view;
}
, save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")
, can_use_save_link = "download" in save_link
, click = function(node) {
var event = doc.createEvent("MouseEvents");
event.initMouseEvent(
"click", true, false, view, 0, 0, 0, 0, 0
, false, false, false, false, 0, null
);
node.dispatchEvent(event);
}
, webkit_req_fs = view.webkitRequestFileSystem
, req_fs = view.requestFileSystem || webkit_req_fs || view.mozRequestFileSystem
, throw_outside = function(ex) {
(view.setImmediate || view.setTimeout)(function() {
throw ex;
}, 0);
}
, force_saveable_type = "application/octet-stream"
, fs_min_size = 0
// See https://code.google.com/p/chromium/issues/detail?id=375297#c7 and
// https://github.com/eligrey/FileSaver.js/commit/485930a#commitcomment-8768047
// for the reasoning behind the timeout and revocation flow
, arbitrary_revoke_timeout = 500 // in ms
, revoke = function(file) {
var revoker = function() {
if (typeof file === "string") { // file is an object URL
get_URL().revokeObjectURL(file);
} else { // file is a File
file.remove();
}
};
if (view.chrome) {
revoker();
} else {
setTimeout(revoker, arbitrary_revoke_timeout);
}
}
, dispatch = function(filesaver, event_types, event) {
event_types = [].concat(event_types);
var i = event_types.length;
while (i--) {
var listener = filesaver["on" + event_types[i]];
if (typeof listener === "function") {
try {
listener.call(filesaver, event || filesaver);
} catch (ex) {
throw_outside(ex);
}
}
}
}
, auto_bom = function(blob) {
// prepend BOM for UTF-8 XML and text/* types (including HTML)
if (/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
return new Blob(["\ufeff", blob], {type: blob.type});
}
return blob;
}
, FileSaver = function(blob, name) {
blob = auto_bom(blob);
// First try a.download, then web filesystem, then object URLs
var
filesaver = this
, type = blob.type
, blob_changed = false
, object_url
, target_view
, dispatch_all = function() {
dispatch(filesaver, "writestart progress write writeend".split(" "));
}
// on any filesys errors revert to saving with object URLs
, fs_error = function() {
// don't create more object URLs than needed
if (blob_changed || !object_url) {
object_url = get_URL().createObjectURL(blob);
}
if (target_view) {
target_view.location.href = object_url;
} else {
var new_tab = view.open(object_url, "_blank");
if (new_tab == undefined && typeof safari !== "undefined") {
//Apple do not allow window.open, see http://bit.ly/1kZffRI
view.location.href = object_url
}
}
filesaver.readyState = filesaver.DONE;
dispatch_all();
revoke(object_url);
}
, abortable = function(func) {
return function() {
if (filesaver.readyState !== filesaver.DONE) {
return func.apply(this, arguments);
}
};
}
, create_if_not_found = {create: true, exclusive: false}
, slice
;
filesaver.readyState = filesaver.INIT;
if (!name) {
name = "download";
}
if (can_use_save_link) {
object_url = get_URL().createObjectURL(blob);
save_link.href = object_url;
save_link.download = name;
click(save_link);
filesaver.readyState = filesaver.DONE;
dispatch_all();
revoke(object_url);
return;
}
// Object and web filesystem URLs have a problem saving in Google Chrome when
// viewed in a tab, so I force save with application/octet-stream
// http://code.google.com/p/chromium/issues/detail?id=91158
// Update: Google errantly closed 91158, I submitted it again:
// https://code.google.com/p/chromium/issues/detail?id=389642
if (view.chrome && type && type !== force_saveable_type) {
slice = blob.slice || blob.webkitSlice;
blob = slice.call(blob, 0, blob.size, force_saveable_type);
blob_changed = true;
}
// Since I can't be sure that the guessed media type will trigger a download
// in WebKit, I append .download to the filename.
// https://bugs.webkit.org/show_bug.cgi?id=65440
if (webkit_req_fs && name !== "download") {
name += ".download";
}
if (type === force_saveable_type || webkit_req_fs) {
target_view = view;
}
if (!req_fs) {
fs_error();
return;
}
fs_min_size += blob.size;
req_fs(view.TEMPORARY, fs_min_size, abortable(function(fs) {
fs.root.getDirectory("saved", create_if_not_found, abortable(function(dir) {
var save = function() {
dir.getFile(name, create_if_not_found, abortable(function(file) {
file.createWriter(abortable(function(writer) {
writer.onwriteend = function(event) {
target_view.location.href = file.toURL();
filesaver.readyState = filesaver.DONE;
dispatch(filesaver, "writeend", event);
revoke(file);
};
writer.onerror = function() {
var error = writer.error;
if (error.code !== error.ABORT_ERR) {
fs_error();
}
};
"writestart progress write abort".split(" ").forEach(function(event) {
writer["on" + event] = filesaver["on" + event];
});
writer.write(blob);
filesaver.abort = function() {
writer.abort();
filesaver.readyState = filesaver.DONE;
};
filesaver.readyState = filesaver.WRITING;
}), fs_error);
}), fs_error);
};
dir.getFile(name, {create: false}, abortable(function(file) {
// delete file if it already exists
file.remove();
save();
}), abortable(function(ex) {
if (ex.code === ex.NOT_FOUND_ERR) {
save();
} else {
fs_error();
}
}));
}), fs_error);
}), fs_error);
}
, FS_proto = FileSaver.prototype
, saveAs = function(blob, name) {
return new FileSaver(blob, name);
}
;
// IE 10+ (native saveAs)
if (typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob) {
return function(blob, name) {
return navigator.msSaveOrOpenBlob(auto_bom(blob), name);
};