##!!! Input "common.txt" first
#read "/texts/papers/sextics/equations/Maple/common.txt"; read "/texts/papers/sextics/equations/Maple/2A3.txt";
lp("\
#######################################################################","\n\
# Ramification locus A_3 + A_3 \n\
#######################################################################");
u1 := ((beta-alpha)*x[1]+(beta-alpha+beta*alpha)*x[2])*x[3]^2
     +((beta-2*alpha)*x[2]*x[1]-alpha*x[2]^2)*x[3]
     -alpha*x[1]*x[2]^2;
u2 := ((alpha-beta+beta*alpha)*x[1]+(alpha-beta)*x[2])*x[3]^2
     +(-beta*x[1]^2+(alpha-2*beta)*x[2]*x[1])*x[3]
     -beta*x[1]^2*x[2];
init_sextics(u1, u2);

lp("\
# Prohibited values of the parameters");
alpha=0, 'u1'=factor(subs(alpha=0, u1));
beta=0, 'u1'=factor(subs(beta=0, u1));
alpha=beta, 'u1'=factor(subs(alpha=beta, u1));

lp("\
#######################################################################","\n\
# A singular point adjacent to A_10 \n\
#######################################################################");
lp("\
## Express 'alpha', 'beta' in terms of 'mu', 'nu'");
section0 := the_factor(KS(t, 0), 2, t);
bad_factors := {alpha}:
solutions([subs(t=mu, section0), subs(t=nu, section0)], [alpha, beta]);
ab0 := op(1, %); ab := ab0:
alpha0 := factor(subs(ab, alpha));
beta0 := factor(subs(ab, beta));
bad_factors := {}:

lp("\
## Look for a section in the form 'y=a*(t-mu)^2' inflection tangent to 'K'");
a := get_a():

lp("\
## Invalid values:");
bad_factors := { all_factors(alpha0), all_factors(beta0),
                 all_factors(alpha0-beta0), all_factors(a_1) };
print2();

## Case 1
set_set("\
## The set of singularities", 12=A_12 + A_7);
lp("\
## Equations: ", 'Eq_Ak(2)');
select_solution(analyze([Eq_Ak(2)], [mu, nu])):
print_solution(complex):

## Case 2
set_set("\
## The set of singularities", 20=A_10 + A_7 + A_2);
lp("\
## Equations: ", 'Eq_A2(1, nu, gcd)');
alias(epsilon2=epsilon2):
select_solution(analyze([Eq_A2(1, nu, 'gcd')], [mu, nu])):
print_solution(epsilon2=op(2, op(1, found_mn))/2, radical):

lp("\
## Tangency with 'L_2'");
lp("\
## Equations: ", 'Eq_P2()', 'Eq_A1(1)');
alias(epsilon3=epsilon3):
alias(epsilon4=epsilon4):
mn := analyze([Eq_P2(), Eq_A1(1)], [mu, nu]):
print2();

## Case 3
set_set("\
## Multiple root in 'L_2':", 18=A_10 + A_9);
select_solution(mn):
print_solution(epsilon3=RootOf(_Z^2+11*_Z+19), radical):
lp("\
## The line 'y=0' is not a component; hence, the curve is irreducible");
print2():

## Case 4
set_set("\
## Multiple root not in 'L_2':", 19=A_10 + A_8 + A_1);
select_solution(mn):
print_solution(epsilon4=op(2, op(1, found_mn))*3):
j_check(found_d, epsilon4, 3):
print2();
## for a simplification:
#simplify(subs(_Z=2*_Z-5, _Z^3+17*_Z^2+51*_Z+43)/8); # -> _Z^3+_Z^2-11*_Z+11
## can replace epsilon4 with 5 + 2*RootOf(_Z^3+_Z^2-11*_Z+11);
## However, equations look much worse

## Case t1
set_set("\
## Triple point:", t1=D_9 + A_10);
select_solution(mn):
print_solution():
tcurve[idx] := trigonal();
print2();
