vv

12453 Reputation

19 Badges

9 years, 284 days

MaplePrimes Activity


These are answers submitted by vv

Am am sure it is based on the Euclidean algorithm for polynomials. (The modulus is in general a prime number).

Your system is numerically unstable.
Supposing that the constants are "exact", it is possible to make a mix of symbolic and numeric approaches.
The ideea is to convert the constants to rationals (for a precision of 15 digits) then solve the system symbolically wrt the variable ionic (because this is possible), then solve the univariate equation in ionic with very high precision.

Here are the results. The solution is unique [almost]. Some variables are negative.


 

restart;

Digits:=15;

15

(1)

eq1:=K_1=(((n_Cl-x)*u_Cl)*(n_H*u_H))/(n_HCl*m);
eq2:=K_2=(((n_Na-x)*u_Na)*(n_OH*u_OH))/(n_NaOH*m);
eq3:=K_w=(n_H*u_H/m)*(n_OH*u_OH/m);
eq4:=(n_NaCl-x)=(n_Na-x)+n_NaOH;
eq5:=(n_NaCl-x)=(n_Cl-x)+n_HCl;
eq6:=(n_Na-x)+n_H=(n_Cl-x)+n_OH;
eq7:=2*ionic=(n_H/m)+((n_Cl-x)/m)+((n_Na-x)/m)+(n_OH/m);
eq8:=u_H=0.4077*ionic^2-0.3152*ionic+0.9213;
eq9:=u_Na=0.0615*ionic^2-0.2196*ionic+0.8627;
eq10:=u_OH=0.1948*ionic^2-0.1803*ionic+0.8887;
eq11:=m=r*V;
eq12:=u_Cl=(1.417625986641341e-01)*exp(-ionic/2.199955601666953e-02)+2.369460669647978e-01*exp(-ionic/3.756472377688394e-01)+5.859738096037875e-01;
 

K_1 = (n_Cl-x)*u_Cl*n_H*u_H/(n_HCl*m)

 

K_2 = (n_Na-x)*u_Na*n_OH*u_OH/(n_NaOH*m)

 

K_w = n_H*u_H*n_OH*u_OH/m^2

 

n_NaCl-x = n_Na-x+n_NaOH

 

n_NaCl-x = n_Cl-x+n_HCl

 

n_Na-x+n_H = n_Cl-x+n_OH

 

2*ionic = n_H/m+(n_Cl-x)/m+(n_Na-x)/m+n_OH/m

 

u_H = .4077*ionic^2-.3152*ionic+.9213

 

u_Na = 0.615e-1*ionic^2-.2196*ionic+.8627

 

u_OH = .1948*ionic^2-.1803*ionic+.8887

 

m = r*V

 

u_Cl = .1417625986641341*exp(-45.4554627939891*ionic)+.2369460669647978*exp(-2.66207201719228*ionic)+.5859738096037875

(2)

#constants
K_1:=10^(8);K_2:=10^(-0.2);K_w:=10^(-13.995);n_NaCl:=1.2*10^(-4);V:=5*10^(-8);r:=997.0;x:=0;
 

100000000

 

.630957344480193

 

0.101157945425990e-13

 

0.120000000000000e-3

 

1/20000000

 

997.0

 

0

(3)

eq:={seq(eq||i,i=1..12)}:

Eq:=convert(eq,rational):

nops(Eq);

12

(4)

X:=indets(Eq,name);nops(%);

{ionic, m, n_Cl, n_H, n_HCl, n_Na, n_NaOH, n_OH, u_Cl, u_H, u_Na, u_OH}

 

12

(5)

S:=eliminate(Eq, X minus {ionic}):

f:=simplify(S[2])[]:

############

Digits:=200;

200

(6)

############

plot(f, ionic=0..3);

 

ionicS:=fsolve(f):

eval(S[1], ionic=ionicS):

evalf[15]([ionic=ionicS, %[]]);

[ionic = 2.40722164287621, m = 0.498500000000000e-4, n_Cl = 0.120000000000000e-3, n_H = -0.570189355755727e-11, n_HCl = -0.203222877739516e-18, n_Na = 0.120000004599272e-3, n_NaOH = -0.459927245018502e-11, n_OH = -0.110262131059512e-11, u_Cl = .586364294954344, u_H = 2.52504946683014, u_Na = .690449163557180, u_OH = 1.58348862197850]

(7)

 

 

 

###### Precision check

eval(f,ionic=ionicS);

0.23962833294454762502864124840136613066328936070999815539241196442017321814523037838085545177856951081566864562952416179056576403619594972564687659275843824010627201071429444585847063334975635851082636e-66

(8)

eval(f,ionic=ionicS-1e-190);

-0.21177153923974396361906170327470731797368197252746086982804407355632808153584734689408100550931080518334716557509197798241249396698817057004042718885026979469391788946875771652742342222284717170262391e-65

(9)

eval(f,ionic=ionicS+1e-190);

0.19949058717633589783634383929413730377718839279107346436418296037979420410590429000206216360565911775404414748657886469064599856013312814660102476347139983488847144891965012617717680226367217800405131e-65

(10)

 

 

solve( sum((1/(1+x+x^2))*y^n, n=1..infinity) = 1, parametric=true, real) assuming abs(y)<1;

    [{x = x, y = (x^2 + x + 1)/(x^2 + x + 2)}]

assuming is necessary, otherwise the series is divergent.

 

Maple cannot compute the integral directly.
We shall use residues.

restart;

Int( (cosh(a*x)-1)/sinh(b*x)/x, x=0..infinity) assuming a>0, b>0;
ans := -ln(cos(a*Pi/(2*b))); # abs(a)<b

Int((cosh(a*x)-1)/(sinh(b*x)*x), x = 0 .. infinity)

 

-ln(cos((1/2)*a*Pi/b))

(1)

f:=(cosh(a*x)-1)/sinh(b*x)/x;
# f is even, so we'll assume  0<a<b

(cosh(a*x)-1)/(sinh(b*x)*x)

(2)

singular(f,x);

{x = 0}, {x = I*Pi*_Z1/b}

(3)

r_n := residue(f, x=n*I*Pi/b) assuming n::integer;

-I*(cos(a*n*Pi/b)-1)/((-1)^n*n*Pi)

(4)

J:=Pi*I*sum(r_n, n=1..infinity) assuming a>0,b>a; # f is even

I*Pi*(((1/2)*I)*ln(1+exp(I*a*Pi/b))/Pi+((1/2)*I)*ln(1+exp(-I*a*Pi/b))/Pi-I*ln(2)/Pi)

(5)

evalc(J) assuming  a>0,b>a;

-Pi*((1/2)*ln((1+cos(a*Pi/b))^2+sin(a*Pi/b)^2)/Pi-ln(2)/Pi)

(6)

ANSWER:=expand(simplify(eval(%, a=2*b*c/Pi))) assuming 0<c,c<Pi/2;

-ln(cos(c))

(7)

ANSWER := eval(ANSWER, c = Pi*a/b/2);

-ln(cos((1/2)*a*Pi/b))

(8)


Download JInt-res.mw

 

 

 

Probably you mean:

 

Show that  A  implies  B, where  x >0  and

 

A := y = (sqrt(x) + 10)^(1/3) - (sqrt(x) - 10)^(1/3);

y = (x^(1/2)+10)^(1/3)-(x^(1/2)-10)^(1/3)

(1)

B := y^3 = 20 - 3*(x - 100)^(1/3)*y;

y^3 = 20-3*(x-100)^(1/3)*y

(2)

###############################################

factor( eval( (lhs-rhs)(B), A));;

-3*((x^(1/2)+10)^(1/3)-(x^(1/2)-10)^(1/3))*((x^(1/2)+10)^(1/3)*(x^(1/2)-10)^(1/3)-(x-100)^(1/3))

(3)

combine(%) assuming x>0;

-3*((x^(1/2)+10)^(1/3)-(x^(1/2)-10)^(1/3))*(((x^(1/2)+10)*(x^(1/2)-10))^(1/3)-(x-100)^(1/3))

(4)

expand(%);

0

(5)

# QED
# Note: The implication holds for x :: real

 

restart;
`diff/f` := (u,x) -> f[op(procname)-1](u)*diff(u,x):

Examples

diff(f[4](x), x, x);
    
f[2](x)

diff(x^2 + f[4](f[5](2*x)),  x,  x);
    
2 + 4*f[2](f[5](2*x))*f[4](2*x)^2 + 4*f[3](f[5](2*x))*f[3](2*x)

 

f:=proc(x,y)
   local lm := op(procname);
   if not type(procname, 'indexed') or nops([lm])<>2 then error "Two indices needed" fi;
   x^lm[1] + y^lm[2]
end proc:

 

It's possible in any dimension using quadratic forms. Here is an example when the quadric has a center.

[Your question is again more about maths than programming].

restart;

with(LinearAlgebra):

n:=3;
f := 7*x[1]^2 + 4*x[1]*x[2] - 4*x[1]*x[3] + 4*x[2]^2 - 2*x[2]*x[3] + 4*x[3]^2 - 4*x[1] + 5*x[2] + 4*x[3] - 18

3

 

7*x[1]^2+4*x[1]*x[2]-4*x[1]*x[3]+4*x[2]^2-2*x[2]*x[3]+4*x[3]^2-4*x[1]+5*x[2]+4*x[3]-18

(1)

plots:-implicitplot3d(f, x[1]=-5..5, x[2]=-5..5, x[3]=-5..5, style=surface, numpoints=64000, scaling=constrained);

 

A:=VectorCalculus:-Hessian(1/2*f,[seq(x[i],i=1..n)]);

Matrix(3, 3, {(1, 1) = 7, (1, 2) = 2, (1, 3) = -2, (2, 1) = 2, (2, 2) = 4, (2, 3) = -1, (3, 1) = -2, (3, 2) = -1, (3, 3) = 4})

(2)

b:=eval(Vector( [ seq(diff(f,x[i]),i=1..n)]), [seq(x[i]=0,i=1..n)]);

Vector(3, {(1) = -4, (2) = 5, (3) = 4})

(3)

c:=eval(f,[seq(x[i]=0,i=1..n)]);

-18

(4)

X:=Vector([seq(x[i],i=1..n)]);

Vector(3, {(1) = x[1], (2) = x[2], (3) = x[3]})

(5)

solve([ seq(diff(f,x[i]),i=1..n)],{seq(x[i],i=1..n)}); # the center

{x[1] = 11/27, x[2] = -26/27, x[3] = -29/54}

X0:= Vector[column]( eval([seq(x[i],i=1..n)],%) );

Vector(3, {(1) = 11/27, (2) = -26/27, (3) = -29/54})

(6)

J,Q := JordanForm(A,output=['J','Q']);

J, Q := Matrix(3, 3, {(1, 1) = 3, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = 9, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 3}), Matrix(3, 3, {(1, 1) = 5/6, (1, 2) = 2/3, (1, 3) = 1/2, (2, 1) = -1/3, (2, 2) = 1/3, (2, 3) = 0, (3, 1) = 4/3, (3, 2) = -1/3, (3, 3) = 1})

T:=Matrix(GramSchmidt([seq( Q[..,j],j=1..n)],normalized)); # T is orthogonal

Matrix(3, 3, {(1, 1) = (5/93)*sqrt(93), (1, 2) = (1/3)*sqrt(6), (1, 3) = -(1/31)*sqrt(62), (2, 1) = -(2/93)*sqrt(93), (2, 2) = (1/6)*sqrt(6), (2, 3) = (7/62)*sqrt(62), (3, 1) = (8/93)*sqrt(93), (3, 2) = -(1/6)*sqrt(6), (3, 3) = (3/62)*sqrt(62)})

(7)

fnew:=simplify( (T.X+X0)^+. A. (T.X+X0) + b.(T.X+X0) + c ); # ==> ellipsoid

-602/27+3*x[1]^2+9*x[2]^2+3*x[3]^2

(8)


 

Download quadric.mw

So, you must help Maple a bit.

restart;

f:=eval(1/(x+2)^4*(-(x+2)^5*RootOf(-2+(x^5*C[1]^5+10*x^4*C[1]^5+40*x^3*C[1]^5+80*x^2*C[1]^5+80*x*C[1]^5+32*C[1]^5)*_Z^25+(5*x^5*C[1]^5+50*x^4*C[1]^5+200*x^3*C[1]^5+400*x^2*C[1]^5+400*x*C[1]^5+160*C[1]^5)*_Z^20)^20*C[1]^5+1)/RootOf(-2+(x^5*C[1]^5+10*x^4*C[1]^5+40*x^3*C[1]^5+80*x^2*C[1]^5+80*x*C[1]^5+32*C[1]^5)*_Z^25+(5*x^5*C[1]^5+50*x^4*C[1]^5+200*x^3*C[1]^5+400*x^2*C[1]^5+400*x*C[1]^5+160*C[1]^5)*_Z^20)^20/C[1]^5, C[1]=t);

(-(x+2)^5*RootOf(-2+(t^5*x^5+10*t^5*x^4+40*t^5*x^3+80*t^5*x^2+80*t^5*x+32*t^5)*_Z^25+(5*t^5*x^5+50*t^5*x^4+200*t^5*x^3+400*t^5*x^2+400*t^5*x+160*t^5)*_Z^20)^20*t^5+1)/((x+2)^4*RootOf(-2+(t^5*x^5+10*t^5*x^4+40*t^5*x^3+80*t^5*x^2+80*t^5*x+32*t^5)*_Z^25+(5*t^5*x^5+50*t^5*x^4+200*t^5*x^3+400*t^5*x^2+400*t^5*x+160*t^5)*_Z^20)^20*t^5)

(1)

r:=indets(f,RootOf)[];

RootOf(-2+(t^5*x^5+10*t^5*x^4+40*t^5*x^3+80*t^5*x^2+80*t^5*x+32*t^5)*_Z^25+(5*t^5*x^5+50*t^5*x^4+200*t^5*x^3+400*t^5*x^2+400*t^5*x+160*t^5)*_Z^20)

(2)

ra:=asympt(r, t, 2);

RootOf(-2+(5*x^5+50*x^4+200*x^3+400*x^2+400*x+160)*_Z^20)*(1/t)^(1/4)-(1/250)*(1/t)^(3/2)/(RootOf(-2+(5*x^5+50*x^4+200*x^3+400*x^2+400*x+160)*_Z^20)^14*(x+2)^5)+O(1/t^2)

(3)

ra:=convert(ra,radical);

2^(1/20)*(1/(5*x^5+50*x^4+200*x^3+400*x^2+400*x+160))^(1/20)*(1/t)^(1/4)-(1/500)*2^(3/10)*(1/t)^(3/2)/((1/(5*x^5+50*x^4+200*x^3+400*x^2+400*x+160))^(7/10)*(x+2)^5)+O(1/t^2)

(4)

ff:=eval(f, r=ra);

(-(x+2)^5*(2^(1/20)*(1/(5*x^5+50*x^4+200*x^3+400*x^2+400*x+160))^(1/20)*(1/t)^(1/4)-(1/500)*2^(3/10)*(1/t)^(3/2)/((1/(5*x^5+50*x^4+200*x^3+400*x^2+400*x+160))^(7/10)*(x+2)^5)+O(1/t^2))^20*t^5+1)/((x+2)^4*(2^(1/20)*(1/(5*x^5+50*x^4+200*x^3+400*x^2+400*x+160))^(1/20)*(1/t)^(1/4)-(1/500)*2^(3/10)*(1/t)^(3/2)/((1/(5*x^5+50*x^4+200*x^3+400*x^2+400*x+160))^(7/10)*(x+2)^5)+O(1/t^2))^20*t^5)

(5)

limit(ff, t=infinity);

(3/2)*x+3

(6)

evalf(eval(f=%, [x=2,t=10000])); # check

6.000002820 = 6.

(7)

 

 


 

ineqz:=[abs(z - 1) > 1, abs(z + 1) > 1, Im(z) > 0];

[1 < abs(z-1), 1 < abs(z+1), 0 < Im(z)]

(1)

eval(ineqz, z=x+I*y):

ineqxy:=simplify(%) assuming real;

[1 < (x^2+y^2-2*x+1)^(1/2), 1 < (x^2+y^2+2*x+1)^(1/2), 0 < y]

(2)

plots:-inequal(ineqxy, x=-5..5, y=-5..5);

 


Download ineqz.mw


 

 

 

 

It is always a good idea to simplify the expressions.

restart;

f:=a^2*(2*a^2*p^3-a^2*((p^2+1)^2*(a^2-1))^(1/2)-((p^2+1)^2*(a^2-1))^(1/2)*p^2+2*p*a^2-2*p^3+((p^2+1)^2*(a^2-1))^(1/2)-2*p)/((p^2+1)^2*(a^2-1))^(1/2)/(p^3-((p^2+1)^2*(a^2-1))^(1/2)+p)/(a^2-p^2-1):
# int(f,p); # division by 0

F:=simplify(eval(f, a^2=1+b^2)) assuming b>0,p::real;

(b^2+1)/((b+p)*(p^2+1))

(1)

intf:=eval(int(F, p), b=sqrt(a^2-1));;

-(1/2)*ln(p^2+1)*(a^2-1)/a^2-(1/2)*ln(p^2+1)/a^2+(a^2-1)^(3/2)*arctan(p)/a^2+(a^2-1)^(1/2)*arctan(p)/a^2+ln((a^2-1)^(1/2)+p)*(a^2-1)/a^2+ln((a^2-1)^(1/2)+p)/a^2

(2)

simplify(diff(intf, p) - f) assuming a>0, p::real;  # check;

0

(3)


 

with(plots):

cylx := y^2 + z^2 - 1;
cylz := x^2 + y^2 - 1;

y^2+z^2-1

 

x^2+y^2-1

(1)

cyl:=implicitplot3d([cylx,cylz], x=-2..2, y=-2..2, z=-2..2,
scaling=constrained, style=surface, grid=[40, 40, 40], labels=[x, y, z]):

s:=solve([cylx,cylz],[x,y,z], explicit)

[[x = z, y = (-z^2+1)^(1/2), z = z], [x = z, y = -(-z^2+1)^(1/2), z = z], [x = -z, y = (-z^2+1)^(1/2), z = z], [x = -z, y = -(-z^2+1)^(1/2), z = z]]

(2)

a:=1.05:
ell:=spacecurve([seq(a*rhs~(s[i]),i=1..4)], z=-1..1, color=[red$2,yellow$2], thickness=4):

display(cyl,ell);

 

 

Download cyl.mw

Here is a procedure for Conic classification (general case). It was extracted (& adapted) from a MathApp.
It will not be useful to you, unless you read about this subject.

P:=proc(a,b,c,d,e,f)  #  See ?MathApps,ConicSections
    local equ,disc,Delta, Type, Point, deg, equ2;
    equ := sort(a*x^2+b*x*y+c*y^2+d*x+e*y+f);
    Delta := 4*a*c*f-a*e^2+b*e*d-b^2*f-c*d^2;
    disc := b^2-4*a*c;
    if Delta <> 0 then

        if disc < 0 then
            if c*Delta > 0 then
                Type := "This equation has no real solutions.";
            elif b = 0 and a = c then
                Type := "A circle.";
            else
                Type := "An ellipse.";
            end if;
        elif disc = 0 then
            Type := "A parabola.";
        else
            Type := "A hyperbola.";
        end if;

    # From here on, Delta = 0 : we have the degenerate cases

    elif disc > 0 then #OK
        Type := "Two intersecting lines.";
    elif disc < 0 then #OK
        Type := "A single point.";
        Point := [(2*c*d-b*e)/disc, (2*a*e-b*d)/disc];
    elif equ = 0 then
        Type := "Every point is a solution.";
    else
        deg := degree(equ, [x,y]);
        if deg = 0 then
            Type := "This equation has no solutions.";
        elif deg = 1 then
            Type := "A line.";
            equ2 := equ;
        else
            # a,b,c not all 0
            if c = 0 then
                # c=b=e=0
                disc := d^2-4*a*f;
            else
                # if a = 0 then                
                    # a=b=d=0
                    disc := e^2-4*c*f;
                # else
                    # both discs above have same sign,
                    # so either one is sufficient
                # end if;
            end if;
            if disc > 0 then
                Type := "Two parallel lines.";
            elif disc = 0 then
                Type := "A line.";
                equ2 := select(has, factor(equ)*t, [x,y]);
                if type(equ2, `^`) and op(2, equ2) = 2 then
                    equ2 := op(1, equ2);
                end if;
            else
                Type := "This equation has no solutions.";
            end if;
        end if;
    end if;
    equ=0,'Type'=Type;
end proc:
P(1,2,3,4,5,-6);
plots:-implicitplot(%[1], x=-10..10,y=-10..10, scaling=constrained);
        x^2 + 2*x*y + 3*y^2 + 4*x + 5*y - 6 = 0, Type = "An ellipse."

Why do you say that the first ODE y' = p1/p2 is exact? It became exact, after you have multiplied it with the integrating factor p2.
Most ODEs are in this situation. Should all be declared exact?

First 29 30 31 32 33 34 35 Last Page 31 of 111