Markiyan Hirnyk

Markiyan Hirnyk
8 years, 253 days


These are answers submitted by Markiyan Hirnyk

This works for me

July 28 2014 Markiyan Hirnyk 5973
0 0

sol := solve([u^2+v^2+x^2+y^2 = 1, 2*u*x+2*v*y, sqrt(y^2+x^2) = sqrt(v^2+u^2)], {u, v, x, y});

allvalues(sol[1]);

 

Explanation

July 25 2014 Markiyan Hirnyk 5973
0 5

Up to ?dsolve , Maple finds  closed form solutions for a single ODE.  The only closed form solution of the nonlinear ODE under consideration it can find is y(x)=0 (see the output of

restart; infolevel[dsolve] := 5;
ode := 2*a^2*y(x)-2*y(x)^3+3*a*(diff(y(x), x))+diff(y(x), `$`(x, 2)) = 0;
sol := dsolve(ode, y(x))  .

The command

sol1 := dsolve(ode, y(x), series);

outputs a general solution around x=0:

 

This ODE can be dsolved numerically, when assigning a and adding initial conditions. For example,

sol3 := dsolve({eval(ode, a = 2), y(0) = 0, (D(y))(0) = 1}, y(x), numeric);

plots:-odeplot(sol3, x = 0 .. 0.9e-1);

Example

July 25 2014 Markiyan Hirnyk 5973
1 0

Here is an example from S. Dempe, Foundations of Bilevel Programming, NY,...,Moscow, Kluwer Academic Publishers, 2002, done with Maple.

 

 

restart; with(simplex)

f := proc (y) options operator, arrow; minimize(-x, {8 <= 4*x+y, x+y <= 8, 2*x+y <= 13}, NONNEGATIVE) end proc:

f(2)

{x = 11/2}

(1)

 

 

plots:-inequal({4*x+y >= 8, x+y <= 8, 2*x+y <= 13}, y = 0 .. 8, x = 0 .. 8);

 

plot(proc (y) options operator, arrow; rhs(op(f(y))) end proc, 0 .. 8)

 

DirectSearch:-GlobalSearch(proc (y) options operator, arrow; 3*rhs(op(f(y)))+y end proc, {y >= 0, y <= 6})

Matrix(1, 3, {(1, 1) = 12.0000000000002, (1, 2) = Vector(1, {(1) = 5.999999999999885}, datatype = float[8]), (1, 3) = 15})

(2)

f(5.99999999999989)

{x = 2.000000000}

(3)

``

Because the upper level objective function is not differentiable, the DirectSearch package is used.

Download Bilevel_Programming.mw

The output of

ans2:=GlobalSearch(log(tarfun),constr,pointrange=constrp,maximize,evaluationlimit=30000,

tolerances=10^(-8),solutions=5);

 

suggests there are two different optimal solutions:

close to

[eta[p2] = -.820853583349005, mu[p] = 1., phi[1] = .759806839240713, phi[2] = .732170469304686,
phi[3] = .878063065537579, phi[4] = .815624200852221, phi[5] = .660085347688083,
 phi[6] = .722060536120714, phi[7] = .840690519184552, phi[8] = .829978889729624,
tau[p3] = -0.548513761568674e-1, tau[p4] = -.162913081930433, tau[p5] = -.115531722646346,
 tau[p6] = -.120266670080191, tau[p7] = -.128078874442439, tau[p8] = -0.965049847119155e-1,
 tau[p9] = -.179146416650995, w[1] = .638468266188749]


and close to

[eta[p2] = .825740931547679, mu[p] = .174259068452321, phi[1] = .780986442917954, phi[2] = .734520439265845,
 phi[3] = .847843754634582, phi[4] = .838306231949389, phi[5] = .637136562777000,
 phi[6] = .746598141197962, phi[7] = .841610094125539, phi[8] = .866597312970020,
 tau[p3] = -0.543251071903657e-1, tau[p4] = -.145991878661213, tau[p5] = -.118231611851851,
 tau[p6] = -.122477654914788, tau[p7] = -.129516460264233, tau[p8] = -0.722417009900789e-1,
tau[p9] = -.174259068452321, w[1] = .364946526201933]

The other outputs don't deny that proposition.

pr.mw

 

Explicit solution

July 23 2014 Markiyan Hirnyk 5973
2 9

After correcting the misprint in ao ( it should be a0) and replacing 0.5 by 1/2, explicit solution can be obtained in such a way.

 

restart; a0 := a01+I*a02; b1 := b11+I*b12; b0 := b01+I*b02; a1 := a11+I*a12; a2 := a21+I*a22; x := a+I*b; y := u+I*v; z := eta+I*xi; solve(evalc({Im(10*x+10*y*(1/4)+10*z = 10), Im(conjugate(a1)*x+b0*y+conjugate(a2)*conjugate(y)+a1*z = 0), Im(a0*x+a1*y+conjugate(a1)*conjugate(y)+a2*z+conjugate(a2)*conjugate(z) = 1/2), Re(10*x+10*y*(1/4)+10*z = 10), Re(conjugate(a1)*x+b0*y+conjugate(a2)*conjugate(y)+a1*z = 0), Re(a0*x+a1*y+conjugate(a1)*conjugate(y)+a2*z+conjugate(a2)*conjugate(z) = 1/2)}), {a, b, eta, u, v, xi}, domain = real)

{a = -(1/2)*a01*(16*a11^3+64*a11^2*a21-64*a11^2*b01+16*a11*a12^2-128*a11*a12*b02-16*a11*a21^2-16*a11*a21*b01-16*a11*a22^2+16*a11*a22*b02+64*a12^2*a21+64*a12^2*b01-16*a12*a21*b02-16*a12*a22*b01-64*a21^3-64*a21*a22^2+64*a21*b01^2+64*a21*b02^2-a11^2+8*a11*b01-a12^2+8*a12*b02+16*a21^2+16*a22^2-16*b01^2-16*b02^2)/(a01^2*a11^2-8*a01^2*a11*b01+a01^2*a12^2-8*a01^2*a12*b02-16*a01^2*a21^2-16*a01^2*a22^2+16*a01^2*b01^2+16*a01^2*b02^2-2*a01*a11^2*a21+60*a01*a11*a12*a22+64*a01*a11*a12*b02+16*a01*a11*a21*b01-62*a01*a12^2*a21-64*a01*a12^2*b01+16*a01*a12*a22*b01+32*a01*a21^3+32*a01*a21*a22^2-32*a01*a21*b01^2-32*a01*a21*b02^2+a02^2*a11^2-8*a02^2*a11*b01+a02^2*a12^2-8*a02^2*a12*b02-16*a02^2*a21^2-16*a02^2*a22^2+16*a02^2*b01^2+16*a02^2*b02^2-16*a02*a11^2*a12-2*a02*a11^2*a22-60*a02*a11*a12*a21+64*a02*a11*a12*b01+16*a02*a11*a22*b01-16*a02*a12^3-62*a02*a12^2*a22+64*a02*a12^2*b02+16*a02*a12*a21^2-16*a02*a12*a21*b01+16*a02*a12*a22^2+32*a02*a21^2*a22+32*a02*a22^3-32*a02*a22*b01^2-32*a02*a22*b02^2), b = (1/2)*a02*(16*a11^3+64*a11^2*a21-64*a11^2*b01+16*a11*a12^2-128*a11*a12*b02-16*a11*a21^2-16*a11*a21*b01-16*a11*a22^2+16*a11*a22*b02+64*a12^2*a21+64*a12^2*b01-16*a12*a21*b02-16*a12*a22*b01-64*a21^3-64*a21*a22^2+64*a21*b01^2+64*a21*b02^2-a11^2+8*a11*b01-a12^2+8*a12*b02+16*a21^2+16*a22^2-16*b01^2-16*b02^2)/(a01^2*a11^2-8*a01^2*a11*b01+a01^2*a12^2-8*a01^2*a12*b02-16*a01^2*a21^2-16*a01^2*a22^2+16*a01^2*b01^2+16*a01^2*b02^2-2*a01*a11^2*a21+60*a01*a11*a12*a22+64*a01*a11*a12*b02+16*a01*a11*a21*b01-62*a01*a12^2*a21-64*a01*a12^2*b01+16*a01*a12*a22*b01+32*a01*a21^3+32*a01*a21*a22^2-32*a01*a21*b01^2-32*a01*a21*b02^2+a02^2*a11^2-8*a02^2*a11*b01+a02^2*a12^2-8*a02^2*a12*b02-16*a02^2*a21^2-16*a02^2*a22^2+16*a02^2*b01^2+16*a02^2*b02^2-16*a02*a11^2*a12-2*a02*a11^2*a22-60*a02*a11*a12*a21+64*a02*a11*a12*b01+16*a02*a11*a22*b01-16*a02*a12^3-62*a02*a12^2*a22+64*a02*a12^2*b02+16*a02*a12*a21^2-16*a02*a12*a21*b01+16*a02*a12*a22^2+32*a02*a21^2*a22+32*a02*a22^3-32*a02*a22*b01^2-32*a02*a22*b02^2), eta = -(1/2)*(8*a01^2*a11*a21+8*a01^2*a11*b01-8*a01^2*a12*a22+8*a01^2*a12*b02+32*a01^2*a21^2+32*a01^2*a22^2-32*a01^2*b01^2-32*a01^2*b02^2-16*a01*a11^3-64*a01*a11^2*a21+64*a01*a11^2*b01+16*a01*a11*a12^2-128*a01*a11*a12*a22+16*a01*a11*a22^2-16*a01*a11*a22*b02+64*a01*a12^2*a21+64*a01*a12^2*b01-16*a01*a12*a21*a22-16*a01*a12*a22*b01+8*a02^2*a11*a21+8*a02^2*a11*b01-8*a02^2*a12*a22+8*a02^2*a12*b02+32*a02^2*a21^2+32*a02^2*a22^2-32*a02^2*b01^2-32*a02^2*b02^2+32*a02*a11^2*a12+128*a02*a11*a12*a21-128*a02*a11*a12*b01-16*a02*a11*a21*a22-16*a02*a11*a22*b01+128*a02*a12^2*a22-128*a02*a12^2*b02-16*a02*a12*a22^2+16*a02*a12*a22*b02-64*a02*a21^2*a22-64*a02*a22^3+64*a02*a22*b01^2+64*a02*a22*b02^2+a01*a11^2-8*a01*a11*b01-a01*a12^2+8*a01*a12*a22-16*a01*a21^2-16*a01*a22^2+16*a01*b01^2+16*a01*b02^2-2*a02*a11*a12-8*a02*a12*a21+8*a02*a12*b01)/(a01^2*a11^2-8*a01^2*a11*b01+a01^2*a12^2-8*a01^2*a12*b02-16*a01^2*a21^2-16*a01^2*a22^2+16*a01^2*b01^2+16*a01^2*b02^2-2*a01*a11^2*a21+60*a01*a11*a12*a22+64*a01*a11*a12*b02+16*a01*a11*a21*b01-62*a01*a12^2*a21-64*a01*a12^2*b01+16*a01*a12*a22*b01+32*a01*a21^3+32*a01*a21*a22^2-32*a01*a21*b01^2-32*a01*a21*b02^2+a02^2*a11^2-8*a02^2*a11*b01+a02^2*a12^2-8*a02^2*a12*b02-16*a02^2*a21^2-16*a02^2*a22^2+16*a02^2*b01^2+16*a02^2*b02^2-16*a02*a11^2*a12-2*a02*a11^2*a22-60*a02*a11*a12*a21+64*a02*a11*a12*b01+16*a02*a11*a22*b01-16*a02*a12^3-62*a02*a12^2*a22+64*a02*a12^2*b02+16*a02*a12*a21^2-16*a02*a12*a21*b01+16*a02*a12*a22^2+32*a02*a21^2*a22+32*a02*a22^3-32*a02*a22*b01^2-32*a02*a22*b02^2), u = 4*(a01^2*a11^2+4*a01^2*a11*a21-4*a01^2*a11*b01+a01^2*a12^2-4*a01^2*a12*a22-4*a01^2*a12*b02-2*a01*a11^2*a21+16*a01*a11*a12^2-4*a01*a11*a12*a22-8*a01*a11*a21^2+8*a01*a11*a21*b01+2*a01*a12^2*a21-8*a01*a12*a21*a22-8*a01*a12*a21*b02+a02^2*a11^2+4*a02^2*a11*a21-4*a02^2*a11*b01+a02^2*a12^2-4*a02^2*a12*a22-4*a02^2*a12*b02-2*a02*a11^2*a22+4*a02*a11*a12*a21-8*a02*a11*a21*a22+8*a02*a11*a22*b01-16*a02*a12^3+2*a02*a12^2*a22+16*a02*a12*a21^2-16*a02*a12*a21*b01+8*a02*a12*a22^2+8*a02*a12*a22*b02-a01*a12^2+4*a01*a12*a22+4*a01*a12*b02-a02*a11*a12-4*a02*a12*a21+4*a02*a12*b01)/(a01^2*a11^2-8*a01^2*a11*b01+a01^2*a12^2-8*a01^2*a12*b02-16*a01^2*a21^2-16*a01^2*a22^2+16*a01^2*b01^2+16*a01^2*b02^2-2*a01*a11^2*a21+60*a01*a11*a12*a22+64*a01*a11*a12*b02+16*a01*a11*a21*b01-62*a01*a12^2*a21-64*a01*a12^2*b01+16*a01*a12*a22*b01+32*a01*a21^3+32*a01*a21*a22^2-32*a01*a21*b01^2-32*a01*a21*b02^2+a02^2*a11^2-8*a02^2*a11*b01+a02^2*a12^2-8*a02^2*a12*b02-16*a02^2*a21^2-16*a02^2*a22^2+16*a02^2*b01^2+16*a02^2*b02^2-16*a02*a11^2*a12-2*a02*a11^2*a22-60*a02*a11*a12*a21+64*a02*a11*a12*b01+16*a02*a11*a22*b01-16*a02*a12^3-62*a02*a12^2*a22+64*a02*a12^2*b02+16*a02*a12*a21^2-16*a02*a12*a21*b01+16*a02*a12*a22^2+32*a02*a21^2*a22+32*a02*a22^3-32*a02*a22*b01^2-32*a02*a22*b02^2), v = -4*(4*a01^2*a11*a22-4*a01^2*a11*b02+4*a01^2*a12*a21+4*a01^2*a12*b01-16*a01*a11^2*a12-8*a01*a11*a21*a22+8*a01*a11*a21*b02+8*a01*a12*a21^2+8*a01*a12*a21*b01+4*a02^2*a11*a22-4*a02^2*a11*b02+4*a02^2*a12*a21+4*a02^2*a12*b01+16*a02*a11*a12^2-8*a02*a11*a22^2+8*a02*a11*a22*b02+8*a02*a12*a21*a22-16*a02*a12*a21*b02-8*a02*a12*a22*b01+a01*a11*a12-4*a01*a12*a21-4*a01*a12*b01-a02*a12^2-4*a02*a12*a22+4*a02*a12*b02)/(a01^2*a11^2-8*a01^2*a11*b01+a01^2*a12^2-8*a01^2*a12*b02-16*a01^2*a21^2-16*a01^2*a22^2+16*a01^2*b01^2+16*a01^2*b02^2-2*a01*a11^2*a21+60*a01*a11*a12*a22+64*a01*a11*a12*b02+16*a01*a11*a21*b01-62*a01*a12^2*a21-64*a01*a12^2*b01+16*a01*a12*a22*b01+32*a01*a21^3+32*a01*a21*a22^2-32*a01*a21*b01^2-32*a01*a21*b02^2+a02^2*a11^2-8*a02^2*a11*b01+a02^2*a12^2-8*a02^2*a12*b02-16*a02^2*a21^2-16*a02^2*a22^2+16*a02^2*b01^2+16*a02^2*b02^2-16*a02*a11^2*a12-2*a02*a11^2*a22-60*a02*a11*a12*a21+64*a02*a11*a12*b01+16*a02*a11*a22*b01-16*a02*a12^3-62*a02*a12^2*a22+64*a02*a12^2*b02+16*a02*a12*a21^2-16*a02*a12*a21*b01+16*a02*a12*a22^2+32*a02*a21^2*a22+32*a02*a22^3-32*a02*a22*b01^2-32*a02*a22*b02^2), xi = (1/2)*(8*a01^2*a11*a22-8*a01^2*a11*b02+8*a01^2*a12*a21+8*a01^2*a12*b01-32*a01*a11^2*a12-16*a01*a11*a21*a22+16*a01*a11*a21*b02+16*a01*a12*a21^2+16*a01*a12*a21*b01+8*a02^2*a11*a22-8*a02^2*a11*b02+8*a02^2*a12*a21+8*a02^2*a12*b01-16*a02*a11^3-64*a02*a11^2*a21+64*a02*a11^2*b01+16*a02*a11*a12^2+128*a02*a11*a12*b02+16*a02*a11*a21^2+16*a02*a11*a21*b01-64*a02*a12^2*a21-64*a02*a12^2*b01+16*a02*a12*a21*a22-16*a02*a12*a21*b02+64*a02*a21^3+64*a02*a21*a22^2-64*a02*a21*b01^2-64*a02*a21*b02^2+2*a01*a11*a12-8*a01*a12*a21-8*a01*a12*b01+a02*a11^2-8*a02*a11*b01-a02*a12^2-8*a02*a12*a22-16*a02*a21^2-16*a02*a22^2+16*a02*b01^2+16*a02*b02^2)/(a01^2*a11^2-8*a01^2*a11*b01+a01^2*a12^2-8*a01^2*a12*b02-16*a01^2*a21^2-16*a01^2*a22^2+16*a01^2*b01^2+16*a01^2*b02^2-2*a01*a11^2*a21+60*a01*a11*a12*a22+64*a01*a11*a12*b02+16*a01*a11*a21*b01-62*a01*a12^2*a21-64*a01*a12^2*b01+16*a01*a12*a22*b01+32*a01*a21^3+32*a01*a21*a22^2-32*a01*a21*b01^2-32*a01*a21*b02^2+a02^2*a11^2-8*a02^2*a11*b01+a02^2*a12^2-8*a02^2*a12*b02-16*a02^2*a21^2-16*a02^2*a22^2+16*a02^2*b01^2+16*a02^2*b02^2-16*a02*a11^2*a12-2*a02*a11^2*a22-60*a02*a11*a12*a21+64*a02*a11*a12*b01+16*a02*a11*a22*b01-16*a02*a12^3-62*a02*a12^2*a22+64*a02*a12^2*b02+16*a02*a12*a21^2-16*a02*a12*a21*b01+16*a02*a12*a22^2+32*a02*a21^2*a22+32*a02*a22^3-32*a02*a22*b01^2-32*a02*a22*b02^2)}

(1)

``

NULL

 

Download explicit.mw

 

The sum of f(seq(k[i],i=1..m)) over k[i]=rang[i], i=1..m, equals the integral

.

For example,

restart; m := 3;
f :=  (x,y,z)-> x ^2 + y *z:
rang[1] := 1 .. 6; rang[2] := 5 .. 9; rang[3] := 2 .. 4;
VectorCalculus:-int(f(seq(floor(k[i]), i = 1 .. m)), [seq(k[i], i = 1 .. m)] = Parallelepiped(seq(op(1, rang[j]) .. op(2, rang[j])+1, j = 1 .. m)));

                              3255

add(add(add(f(seq(k[i],i=1..m)),k[1]=rang[1]),k[2]=rang[2]),k[3]=rang[3])

                              3255

The formula is somewhat more complex in the case of noniteger ends of rangs (range is reserved here). I leave it on your own.

 

By plottools:-transform

July 17 2014 Markiyan Hirnyk 5973
0 0

Here is an example in your linear case.


M := LinearAlgebra:-RandomMatrix(10)

Matrix([[-79, -85, -29, 13, -25, -94, -19, -97, 10, 10], [75, -85, 9, 32, 78, 27, -55, -38, -44, -61], [-85, 19, 81, 48, 23, 18, 71, -36, 26, -26], [-19, 25, 35, -60, -67, 18, -50, -69, -3, -20], [57, 17, 80, 51, 28, 63, -17, 69, -62, -78], [83, 81, 20, 20, -81, 86, 35, -15, -83, -4], [-45, 89, 39, -46, -36, -51, -26, 2, 9, 5], [68, 92, -35, 35, -88, 51, -86, -88, 88, -91], [58, -2, 26, -54, 91, 38, 50, 99, 95, -44], [-43, -46, -74, -17, -62, -38, -94, -59, 63, -38]])

(1)

with(plots):

with(plottools):

f := transform(proc (x, y) options operator, arrow; [2*x+1, y-3] end proc):

 

 

display(f(A), axes = frame, gridlines = false)

 

``


Download tickmarks.mw