acer

32373 Reputation

29 Badges

19 years, 333 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

Here are some ideas. (This site won't render it inline, as its backend Maplenet is old...)

student_md_question_2_ac.mw

Replace all instance in your code of lower with Lower, and all instances of upper with Upper.

There seems to be a problem with some procedure under Eigenvectors using the unquoted global name lower when invoking the Matrix constructior. (A bug, which I shall report.)

While you're making changes, you could also create your Matrix with the option shape=symmetric. Ie,
    M:=Matrix(2*n+1, shape=symmetric);
That way, if you ever decide to instead call Eigenvectors(evalf[15](M)) to get floating-point results there will be no zero imaginary components, ie. the results will be real floats.

The bug with the name lower only seems to affect the exact case, and Eigenvectors(evalf[15](M)) seems to not suffer from it. (We could probably find the offending line quickly in the debugger...)

[edited] I'll adjust my surmise about the precise cause. It goes wrong under LUDecomposition, but not because the option value contains the name lower unquoted, or in how it calls the Matrix constructor. Rather, it looks like a bug in the Matrix constructor itself. Eg,

restart;
lower := 1:

Matrix(2,'shape'='triangular'['lower']);
Error, (in Matrix) triangular[] storage expects name parameters
restart;

lower := 1:

interface(prettyprint=1):
trace(rtable):

Matrix(2, shape=triangular['lower']);
  execute rtable, args = triangular[lower], 1 .. 2, 1 .. 2, fill = 0,
  storage = triangular[1], subtype = Matrix
Error, (in Matrix) triangular[] storage expects name parameters

Matrix(2, shape=triangular['lower'], storage=triangular['lower']);
  execute rtable, args = triangular[lower], 1 .. 2, 1 .. 2, fill = 0,
  storage = triangular[lower], subtype = Matrix
                                   [0  0]
                                   [    ]
                                   [0  0]

There are internal routines of SolveTools:-Inequality , for linear systems, which are unprepared for arguments that contain relations which are a function of `<>`.

After such `<>` relations are generated internally, then as they get passed to such an internal procedure then that kind of error message attains.

I can reproduce the error message you've seen. (I edited the inequalities in your Question, and inserted a missing comma after what is now the first in your list.)

I did a cursory look through the related internal routines, and did not see any obvious reason why they shouldn't be able to handled `<>` present in their primary input. But I see one of two things which make me a little suspicious. If I simply change the parameter specification of those procedures to allow `<>` alongside the other kinds of relation in the input then I so obtain some result for your system.

It is not as quickly solved as the new system generated from the substitutions you suggested. I am unsure of the best way to try and verify whether the two answers (when re-expressed in the original variables, say) represent the same solution space.

restart;

kernelopts(version);

`Maple 2018.0, X86 64 LINUX, Mar 9 2018, Build ID 1298750`

plots:-setoptions(gridlines=false):

kernelopts(opaquemodules=false):
unprotect(SolveTools:-Inequality:-LinearMultivariateSystemInternal);
unprotect(SolveTools:-Inequality:-LinearUnivariateSystemInternal);
unprotect(SolveTools:-Inequality:-LinearUnivariateSystem);
unprotect(SolveTools:-Inequality:-LinearUnivariateInternal);

augstruct:=[_Inert_ASSIGNEDNAME("<", "PROC",
              _Inert_ATTRIBUTE(_Inert_NAME("protected",
                               _Inert_ATTRIBUTE(_Inert_NAME("protected"))))),
            _Inert_ASSIGNEDNAME("<>", "PROC",
              _Inert_ATTRIBUTE(_Inert_NAME("protected",
                               _Inert_ATTRIBUTE(_Inert_NAME("protected")))))]:

SolveTools:-Inequality:-LinearMultivariateSystemInternal:=
FromInert(subsop([1,1,2,2,1,1,1]=augstruct[],
                 ToInert(eval(SolveTools:-Inequality:-LinearMultivariateSystemInternal)))):

SolveTools:-Inequality:-LinearUnivariateSystemInternal:=
FromInert(subsop([1,1,2,2,1,1,1]=augstruct[],
                 ToInert(eval(SolveTools:-Inequality:-LinearUnivariateSystemInternal)))):

SolveTools:-Inequality:-LinearUnivariateSystem:=
FromInert(subsop([1,1,2,2,1,1,1]=augstruct[],
                 ToInert(eval(SolveTools:-Inequality:-LinearUnivariateSystem)))):

SolveTools:-Inequality:-LinearUnivariateInternal:=
FromInert(subsop([1,1,2,1,1]=augstruct[],
                 ToInert(eval(SolveTools:-Inequality:-LinearUnivariateInternal)))):

protect(SolveTools:-Inequality:-LinearMultivariateSystemInternal);
protect(SolveTools:-Inequality:-LinearUnivariateSystemInternal);
protect(SolveTools:-Inequality:-LinearUnivariateSystem);
protect(SolveTools:-Inequality:-LinearUnivariateInternal);
kernelopts(opaquemodules=true):

inequalities := [-a1-a2+a3+a4 <= 2, a1+a2 <= 3, -2*a1 <= -1, -2*a2 <= -1,
                 -2*a3 <= -1, -2*a4 <= -1, -a1+a2+a3-a4 <= 4,
                 -a1+a2-a3+a4 <= 4, a1-a2+a3-a4 <= 4, a1-a2-a3+a4 <= 4]:

vars := [a1,a2,a3,a4]:

ans1 := CodeTools:-Usage(
           SolveTools:-Inequality:-LinearMultivariateSystem(inequalities, vars)
                        );

memory used=8.92GiB, alloc change=324.01MiB, cpu time=75.78s, real time=72.01s, gc time=7.19s

{[{a1}, {a2 = a1}, {a3}, {1/2 <= a4, a4 <= 2+2*a1-a3}], [{a1 = 3/2}, {a2 = 3/2}, {a3 = 1/2}, {1/2 <= a4, a4 <= 9/2}], [{a1 = 3/2}, {a2 = 3/2}, {a3 = 9/2}, {a4 = 1/2}], [{a1 = 3/2}, {1/2 <= a2, a2 <= 3/2}, {1/2 <= a3}, {1/2 <= a4, a4 <= 5/2+a2+a3}], [{a1 = 3/2}, {1/2 <= a2, a2 < 3/2}, {a3 = 1/2}, {1/2 <= a4, a4 <= 3+a2}], [{a1 = 3/2}, {1/2 <= a2, a2 < 3/2}, {a3 = 3+a2}, {a4 = 1/2}], [{a1 = 3/2}, {1/2 <= a2, a2 < 3/2}, {1/2 < a3, a3 < 3+a2}, {1/2 <= a4, a4 <= 7/2+a2-a3}], [{a1 = 11/2}, {a2}, {a3}, {a4 <= -3/2+a2+a3, 3/2-a2+a3 <= a4}], [{a1 = 11/2}, {a2}, {a3}, {a4 <= 15/2+a2-a3, 3/2-a2+a3 <= a4}], [{a1 = 19/2}, {a2}, {a3}, {a4 <= -11/2+a2+a3, 11/2-a2+a3 <= a4}], [{a1 <> 11/2}, {a2 = a1}, {a3}, {1/2 <= a4, a4 <= 4+a3}], [{1/2 <= a1, a1 < 3/2}, {1/2 <= a2, a2 <= a1}, {1/2 <= a3, a3 <= 3/2+a1+a2}, {1/2 <= a4, a4 <= 2+a1+a2-a3}], [{1/2 <= a1, a1 < 3/2}, {3/2 <= a2, a2 <= 3-a1}, {1/2 <= a3, a3 <= -1+a2}, {1/2 <= a4, a4 <= 4+a1-a2+a3}], [{1/2 <= a1, a1 < 3/2}, {3/2 <= a2, a2 <= 3-a1}, {a3 <= 3+a1, 9/2+a1-a2 <= a3}, {a4 <= 2+a1+a2-a3, -4-a1+a2+a3 <= a4}], [{1/2 <= a1, a1 < 3/2}, {3/2 <= a2, a2 <= 3-a1}, {a3 < 9/2+a1-a2, -1+a2 < a3}, {1/2 <= a4, a4 <= 2+a1+a2-a3}], [{1/2 <= a1, a1 < 3/2}, {a1 < a2, a2 < 3/2}, {1/2 <= a3, a3 <= 3/2+a1+a2}, {1/2 <= a4, a4 <= 2+a1+a2-a3}], [{a1 <= 5/2, 3/2 < a1}, {1/2 <= a2, a2 <= 3-a1}, {1/2 <= a3, a3 <= -1+a1}, {1/2 <= a4, a4 <= 4-a1+a2+a3}], [{a1 <= 5/2, 3/2 < a1}, {1/2 <= a2, a2 <= 3-a1}, {a3 <= 3+a2, 9/2-a1+a2 <= a3}, {a4 <= 2+a1+a2-a3, -4+a1-a2+a3 <= a4}], [{a1 <= 5/2, 3/2 < a1}, {1/2 <= a2, a2 <= 3-a1}, {a3 < 9/2-a1+a2, -1+a1 < a3}, {1/2 <= a4, a4 <= 2+a1+a2-a3}]}

S := [t1 = a1-a2, t2 = a1+a2, r1 = a3-a4, r2 = a3+a4];

[t1 = a1-a2, t2 = a1+a2, r1 = a3-a4, r2 = a4+a3]

new := [-t2+r2 <= 2, t2 <= 3, -2*(t1+t2)/2 <= -1, -2*(t2-t1)/2 <= -1,
        -2*(r1+r2)/2 <= -1, -2*(r2-r1)/2 <= -1, -t1+r1 <= 4,
        -t1-r1 <= 4, t1+r1 <= 4, t1-r1 <= 4];

[-t2+r2 <= 2, t2 <= 3, -t1-t2 <= -1, -t2+t1 <= -1, -r1-r2 <= -1, -r2+r1 <= -1, -t1+r1 <= 4, -t1-r1 <= 4, t1+r1 <= 4, t1-r1 <= 4]

eval(new, S) - inequalities;

[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

ans2 := CodeTools:-Usage(
           SolveTools:-Inequality:-LinearMultivariateSystem(new, [t1,t2,r1,r2])
                        );

memory used=1.21GiB, alloc change=0 bytes, cpu time=9.74s, real time=9.22s, gc time=933.69ms

{[{t1 = -1}, {2 <= t2, t2 <= 3}, {-3 <= r1, r1 < -2}, {r2 <= 2+t2, 1-r1 <= r2}], [{t1 = -1}, {2 <= t2, t2 <= 3}, {r1 <= 3, 2 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{t1 = 0}, {t2 = 3}, {-4 <= r1, r1 < -3}, {r2 <= 5, 1-r1 <= r2}], [{t1 = 0}, {t2 = 3}, {r1 <= 4, 3 < r1}, {r2 <= 5, 1+r1 <= r2}], [{t1 = 0}, {1 <= t2, t2 <= 3}, {-2 <= r1, r1 < 0}, {r2 <= 2+t2, 1-r1 <= r2}], [{t1 = 0}, {1 <= t2, t2 <= 3}, {r1 <= 2, 0 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{t1 = 0}, {2 < t2, t2 < 3}, {r1 <= 1+t2, 3 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{t1 = 0}, {2 < t2, t2 < 3}, {-1-t2 <= r1, r1 < -3}, {r2 <= 2+t2, 1-r1 <= r2}], [{t1 = 1}, {2 <= t2, t2 <= 3}, {-3 <= r1, r1 < -2}, {r2 <= 2+t2, 1-r1 <= r2}], [{t1 = 1}, {2 <= t2, t2 <= 3}, {r1 <= 3, 2 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{-2 <= t1, t1 < 0}, {t2 <= 3, 1-t1 <= t2}, {r1 = 0}, {1 <= r2, r2 <= 2+t2}], [{-2 <= t1, t1 < 0}, {t2 <= 3, 1-t1 <= t2}, {-2 <= r1, r1 < 0}, {r2 <= 2+t2, 1-r1 <= r2}], [{-2 <= t1, t1 < 0}, {t2 <= 3, 1-t1 <= t2}, {r1 <= 2, 0 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{0 <= t1, t1 <= 2}, {t2 <= 3, 1+t1 <= t2}, {r1 = 0}, {1 <= r2, r2 <= 2+t2}], [{t1 <= 0, -1 < t1}, {2 <= t2, t2 <= 3}, {-3 <= r1, r1 < -2+t1}, {r2 <= 2+t2, 1-r1 <= r2}], [{t1 <= 0, -1 < t1}, {2 <= t2, t2 <= 3}, {r1 <= 3, 2-t1 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{t1 <= 0, -1 < t1}, {t2 < 2, 1-t1 < t2}, {r1 <= 1+t2, 2-t1 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{t1 <= 0, -1 < t1}, {t2 < 2, 1-t1 < t2}, {-1-t2 <= r1, r1 < -2+t1}, {r2 <= 2+t2, 1-r1 <= r2}], [{t1 <= 2, 0 < t1}, {t2 <= 3, 1+t1 <= t2}, {-2 <= r1, r1 < -2+t1}, {r2 <= 2+t2, 1-r1 <= r2}], [{t1 <= 2, 0 < t1}, {t2 <= 3, 1+t1 <= t2}, {r1 <= 2, 2-t1 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{-2 < t1, t1 < -1}, {t2 <= 3, 1-t1 <= t2}, {r1 <= t1+4, 2 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{-2 < t1, t1 < -1}, {t2 <= 3, 1-t1 <= t2}, {-t1-4 <= r1, r1 < -2}, {r2 <= 2+t2, 1-r1 <= r2}], [{-1 < t1, t1 < 0}, {t2 <= 3, 1-t1 <= t2}, {r1 <= 2-t1, 2 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{-1 < t1, t1 < 0}, {t2 <= 3, 1-t1 <= t2}, {-2+t1 <= r1, r1 < -2}, {r2 <= 2+t2, 1-r1 <= r2}], [{-1 < t1, t1 < 0}, {t2 <= 3, t1+3 < t2}, {r1 <= t1+4, 3 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{-1 < t1, t1 < 0}, {t2 <= 3, t1+3 < t2}, {-t1-4 <= r1, r1 < -3}, {r2 <= 2+t2, 1-r1 <= r2}], [{-1 < t1, t1 < 0}, {t2 <= t1+3, 2 < t2}, {r1 <= 1+t2, 3 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{-1 < t1, t1 < 0}, {t2 <= t1+3, 2 < t2}, {-1-t2 <= r1, r1 < -3}, {r2 <= 2+t2, 1-r1 <= r2}], [{0 < t1, t1 < 1}, {2 <= t2, t2 <= 3}, {-3 <= r1, r1 < -2-t1}, {r2 <= 2+t2, 1-r1 <= r2}], [{0 < t1, t1 < 1}, {2 <= t2, t2 <= 3}, {r1 <= 3, 2+t1 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{0 < t1, t1 < 1}, {t2 <= 3, 1+t1 <= t2}, {r1 <= 2+t1, 2 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{0 < t1, t1 < 1}, {t2 <= 3, 1+t1 <= t2}, {-2-t1 <= r1, r1 < -2}, {r2 <= 2+t2, 1-r1 <= r2}], [{0 < t1, t1 < 1}, {t2 <= 3, -t1+3 < t2}, {r1 <= -t1+4, 3 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{0 < t1, t1 < 1}, {t2 <= 3, -t1+3 < t2}, {t1-4 <= r1, r1 < -3}, {r2 <= 2+t2, 1-r1 <= r2}], [{0 < t1, t1 < 1}, {t2 <= -t1+3, 2 < t2}, {r1 <= 1+t2, 3 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{0 < t1, t1 < 1}, {t2 <= -t1+3, 2 < t2}, {-1-t2 <= r1, r1 < -3}, {r2 <= 2+t2, 1-r1 <= r2}], [{0 < t1, t1 < 1}, {t2 < 2, 1+t1 < t2}, {r1 <= 1+t2, 2+t1 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{0 < t1, t1 < 1}, {t2 < 2, 1+t1 < t2}, {-1-t2 <= r1, r1 < -2-t1}, {r2 <= 2+t2, 1-r1 <= r2}], [{0 < t1, t1 < 2}, {t2 <= 3, 1+t1 <= t2}, {r1 <= 2-t1, 0 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{0 < t1, t1 < 2}, {t2 <= 3, 1+t1 <= t2}, {-2+t1 <= r1, r1 < 0}, {r2 <= 2+t2, 1-r1 <= r2}], [{1 < t1, t1 < 2}, {t2 <= 3, 1+t1 <= t2}, {r1 <= -t1+4, 2 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{1 < t1, t1 < 2}, {t2 <= 3, 1+t1 <= t2}, {t1-4 <= r1, r1 < -2}, {r2 <= 2+t2, 1-r1 <= r2}]}

reverb := eval(ans2, S):

eval(reverb, [a3=2, a4=2]):
map(s->solve(map(op,s)), %);

{{a1 = 1, a2 <= 2, 1 < a2}, {a1 = 1/2, 3/2 <= a2, a2 <= 5/2}, {a1 = a2, a2 <= 3/2, 1 < a2}, {a1 = 2-a2, a2 <= 1, 1/2 < a2}, {a1 = -a2+3, 1 < a2, a2 < 3/2}, {a1 = -a2+3, 1/2 < a2, a2 < 1}, {a2 = 1, a1 <= 2, 1 < a1}, {a2 = 1/2, 3/2 <= a1, a1 <= 5/2}, {a2 = 2-a1, 1/2 < a1, a1 < 1}, {a2 = -a1+3, 1 < a1, a1 < 3/2}, {a2 = -a1+3, 1/2 < a1, a1 < 1}, {1 < a1, a1 < 3/2, a1 < a2, a2 < -a1+3}, {1 < a2, a1 < -a2+3, a2 < 3/2, a2 < a1}, {1/2 < a1, a1 < 1, a2 < -a1+3, 2-a1 < a2}, {1/2 < a2, a1 < -a2+3, a2 < 1, 2-a2 < a1}}

plots:-display(
  seq(plots:-inequal(s, a1=-3..3, a2=-3..3, view=[-3..3, -3..3]), s=%) );

eval(ans1, [a3=2, a4=2]):
map(s->solve(map(op,s)), %);

{{a1 = 1, 1 < a2, a2 < 3/2}, {a1 = 1/2, a2 <= 5/2, 3/2 < a2}, {a1 = 3/2, 1/2 <= a2, a2 <= 3/2}, {a1 = 3/2, 1/2 <= a2, a2 < 3/2}, {a1 = -a2+3, 3/2 < a2, a2 < 5/2}, {a2 = 1/2, a1 <= 5/2, 3/2 < a1}, {a2 = 3/2, 1/2 <= a1, a1 < 3/2}, {a2 = a1, 1 < a1, a1 < 3/2}, {a2 = 2-a1, 1 <= a1, a1 < 3/2}, {a2 = 2-a1, 1/2 < a1, a1 < 1}, {a2 = -a1+3, 3/2 < a1, a1 < 5/2}, {1 < a1, a1 < 3/2, a1 < a2, a2 < 3/2}, {1 < a1, a1 < 3/2, a2 < a1, 2-a1 < a2}, {1/2 < a1, 3/2 < a2, a1 < -a2+3, a2 < 5/2}, {1/2 < a1, a1 < 1, a2 < 3/2, 2-a1 < a2}, {1/2 < a2, 3/2 < a1, a1 < 5/2, a2 < -a1+3}}

plots:-display(
  seq(plots:-inequal(s, a1=-3..3, a2=-3..3, view=[-3..3, -3..3]), s=%) );

eval([inequalities], [a3=2, a4=2]);
plots:-display(
  seq(plots:-inequal(s, a1=-3..3, a2=-3..3, view=[-3..3, -3..3]), s=%) );

[[-a1-a2 <= -2, a1+a2 <= 3, -2*a1 <= -1, -2*a2 <= -1, -4 <= -1, -4 <= -1, -a1+a2 <= 4, -a1+a2 <= 4, -a2+a1 <= 4, -a2+a1 <= 4]]

showstat((SolveTools::Inequality)::LinearUnivariateInternal, 17..18);


LinearUnivariateInternal := proc(eq::{`<`, `<=`, `<>`, `=`}, var::name, ineqs := {}, listset := 'set')
local eqn, a, b, rel, cond, solution;
       ...
  17   if rel = `<=` and member(false,map(coulditbe,SolveTools:-Substitute(var = b/a,ineqs))) then
  18       rel := `<`
       end if;
       ...
end proc

 

Download ineqsystem.mw

If plots:-inequal is correct (especially in its lines) above then there may be some discrepencies in some part of the computed distinction between inequality and strict inequality. It might be better/necessary to have the altered routines convert all `<>` relations into alternate form, as their very first step.

 

A := unapply(eval(C(2,3),:-t=T),T):

A(0), A(0.5), A(0.3);

It would be less awkward if you did not have the unnecessary creation of Ld as an operator (using unapply) inside the procedure C., as well as not assign to Ld(t)[i]. I suspect that does not accomplish what you're expecting.

restart;
with(LinearAlgebra):
C:=proc(k,M) local N,P,m,L,T,j,Ld,n,i; 
N:=2^(k-1)*M:
P[0]:= t -> 1:
P[1]:= t -> t:
for m from 2 to M-1 do
   P[m]:= unapply(expand((2*m-1)*t*P[m-1](t)/m - (m-1)*P[m-2](t)/m), t)
end do: 
L:=proc(n,m) local a,b; 
  a := (2*n-2)/2^k; 
  b := 2*n/2^k; 
  return piecewise(a <= t and t <= b, P[m](2^k*t-2*n+1)*sqrt(((m+1)/2)*2^k))
end proc:
T := Vector(N):
for j from 1 to N do T[j] := (j-1/2)/N end do; 
Ld := Vector(N);
for n from 1 to 2^(k-1) do 
  for m from 0 to M-1 do
i := n+2^(k-1)*m:
Ld[i] := L(n,m)
     end do
end do:

return Ld:  
end proc:

A := unapply(C(2,3),t):
A(0), A(0.5), A(0.3);

What do you want to accomplish with PDEtools[PDEplot] ?

The plots below render more nicely in the actual Maple GUI.

restart;

PDE := diff(y(x,t), x,x,x,x)+(diff(y(x, t), t,t))=0;  
# Initial/boundary conditions
  BCs:=y(0,t) = 0, y(1,t) = 0,D[1](y)(0,t)=0,D[1](y)(1,t)=0;

  ICs:=y(x,0) =0, D[2](y)(x,0)=1 ;

diff(diff(diff(diff(y(x, t), x), x), x), x)+diff(diff(y(x, t), t), t) = 0

y(0, t) = 0, y(1, t) = 0, (D[1](y))(0, t) = 0, (D[1](y))(1, t) = 0

y(x, 0) = 0, (D[2](y))(x, 0) = 1

num_solution := pdsolve(PDE, {BCs,ICs}, numeric);

_m139650291560768

P3D := num_solution :-plot3d(x=0..1, t=0..1, grid=[49,149]):
P3D;

P2D := num_solution:-plot(x=0.5, t=0..1,
                          numpoints=200);

plots:-display( P3D,
                plottools:-transform((y,z)->[0.5,y,z])(P2D) );

 

Download pdeplot.mw

I have tried to un-muddle the code you supplied.

 restart:

 with(plots):
 with(LinearAlgebra):

 N:=48:
 a:=4:
 b:=5:
 Boundaries:=y(a)=0,y(b)=0;
 P(x):=1;
Q(x):=1;
R(x):=1;
F(x):=cos(Pi*x^2)*x;
NLPart:=-exp(-sin(y(x)))*y(x)^2/(1+y(x));
Equation:=P(x)*diff(y(x),x$2)+Q(x)*diff(y(x),x$1)+R(x)*NLPart=F(x);
NewtonSolution:=dsolve({Equation,Boundaries},y(x),type=numeric,method=bvp);
PlotNewtonSolution:=odeplot(NewtonSolution,a....b);

y(4) = 0, y(5) = 0

1

1

1

cos(Pi*x^2)*x

-exp(-sin(y(x)))*y(x)^2/(1+y(x))

diff(diff(y(x), x), x)+diff(y(x), x)-exp(-sin(y(x)))*y(x)^2/(1+y(x)) = cos(Pi*x^2)*x

proc (x_bvp) local res, data, solnproc, _ndsol, outpoint, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then outpoint := evalf[_EnvDSNumericSaveDigits](x_bvp) else outpoint := evalf(x_bvp) end if; data := Array(1..4, {(1) = proc (outpoint) local X, Y, YP, yout, errproc, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; X := Vector(34, {(1) = 4.0, (2) = 4.030138644973893, (3) = 4.06252075830933, (4) = 4.094888150822047, (5) = 4.1273438613473, (6) = 4.159816989954734, (7) = 4.192221888318701, (8) = 4.224543576874172, (9) = 4.256754500658247, (10) = 4.288740281823471, (11) = 4.320503853783057, (12) = 4.352072016657196, (13) = 4.383425561385851, (14) = 4.414529862821071, (15) = 4.445402267760153, (16) = 4.476096536048872, (17) = 4.506602115915622, (18) = 4.536942920110194, (19) = 4.567166859568994, (20) = 4.597271660548307, (21) = 4.6272042886208125, (22) = 4.656970737760961, (23) = 4.686560865933606, (24) = 4.715944142556049, (25) = 4.745122769711738, (26) = 4.774117826200048, (27) = 4.802932346972274, (28) = 4.831544048877039, (29) = 4.859951837709859, (30) = 4.88818587510624, (31) = 4.916287717622486, (32) = 4.944266740935822, (33) = 4.972160252377423, (34) = 5.0}, datatype = float[8], order = C_order); Y := Matrix(34, 2, {(1, 1) = .0, (1, 2) = -0.11708553875089373e-1, (2, 1) = 0.13700158767917764e-2, (2, 2) = 0.9660362799838607e-1, (3, 1) = 0.5498870360360167e-2, (3, 2) = .1419348442626504, (4, 1) = 0.9428954357184422e-2, (4, 2) = 0.8482319216100598e-1, (5, 1) = 0.10248208012770309e-1, (5, 2) = -0.3939969111538834e-1, (6, 1) = 0.7033593582560118e-2, (6, 2) = -.14868069760447897, (7, 1) = 0.1600320348522399e-2, (7, 2) = -.16808953622046421, (8, 1) = -0.268933454539153e-2, (8, 2) = -0.8270099569678202e-1, (9, 1) = -0.3221761013229303e-2, (9, 2) = 0.50092222673243834e-1, (10, 1) = 0.22956375918981573e-4, (10, 2) = .13857344513822856, (11, 1) = 0.4458505738284509e-2, (11, 2) = .12165303944158753, (12, 1) = 0.6723232053320422e-2, (12, 2) = 0.11140849003640395e-1, (13, 1) = 0.4998774025578387e-2, (13, 2) = -.11597918116164978, (14, 1) = 0.2649537110120204e-3, (14, 2) = -.17100444754563116, (15, 1) = -0.4430341756673352e-2, (15, 2) = -.11562972551238226, (16, 1) = -0.6104139891975028e-2, (16, 2) = 0.12092543179268235e-1, (17, 1) = -0.3874935987353878e-2, (17, 2) = .12366340298254656, (18, 1) = 0.43859249363331924e-3, (18, 2) = .14153191792478992, (19, 1) = 0.35974417547445185e-2, (19, 2) = 0.5291963406316792e-1, (20, 1) = 0.31797732360206703e-2, (20, 2) = -0.8032529122966872e-1, (21, 1) = -0.7029622818499879e-3, (21, 2) = -.16396730152505634, (22, 1) = -0.5492629827069677e-2, (22, 2) = -.13856716126876822, (23, 1) = -0.8008561926513108e-2, (23, 2) = -0.2171776099723813e-1, (24, 1) = -0.6701651609005721e-2, (24, 2) = .10400796028481248, (25, 1) = -0.27284860400601544e-2, (25, 2) = .1499884923488127, (26, 1) = 0.912205309588295e-3, (26, 2) = 0.8407403812966995e-1, (27, 1) = 0.15002731096950745e-2, (27, 2) = -0.4700893187998446e-1, (28, 1) = -0.15002344923093747e-2, (28, 2) = -.15056675043141238, (29, 1) = -0.6098673162178434e-2, (29, 2) = -.15372747280171484, (30, 1) = -0.922048274432461e-2, (30, 2) = -0.5432127608652006e-1, (31, 1) = -0.8851259497357482e-2, (31, 2) = 0.7813403552233018e-1, (32, 1) = -0.5422519739930223e-2, (32, 2) = .1505909374737268, (33, 1) = -0.15020236105948985e-2, (33, 2) = .111689562356771, (34, 1) = .0, (34, 2) = -0.11682217943418692e-1}, datatype = float[8], order = C_order); YP := Matrix(34, 2, {(1, 1) = -0.11708553875089373e-1, (1, 2) = 4.011708553875089, (2, 1) = 0.9660362799838607e-1, (2, 2) = 2.8236981576549516, (3, 1) = .1419348442626504, (3, 2) = -.1939107397989705, (4, 1) = 0.8482319216100598e-1, (4, 2) = -3.140214946215932, (5, 1) = -0.3939969111538834e-1, (5, 2) = -4.06296249155511, (6, 1) = -.14868069760447897, (6, 2) = -2.2530415764364617, (7, 1) = -.16808953622046421, (7, 2) = 1.1432165535554593, (8, 1) = -0.8270099569678202e-1, (8, 2) = 3.827139451569766, (9, 1) = 0.50092222673243834e-1, (9, 2) = 3.907950868344983, (10, 1) = .13857344513822856, (10, 2) = 1.2723607743919638, (11, 1) = .12165303944158753, (11, 2) = -2.2829064857596433, (12, 1) = 0.11140849003640395e-1, (12, 2) = -4.287435146582237, (13, 1) = -.11597918116164978, (13, 2) = -3.3099458846836973, (14, 1) = -.17100444754563116, (14, 2) = 0.5644385583296996e-2, (15, 1) = -.11562972551238226, (15, 2) = 3.3714761127314947, (16, 1) = 0.12092543179268235e-1, (16, 2) = 4.43632684217126, (17, 1) = .12366340298254656, (17, 2) = 2.4157267006515353, (18, 1) = .14153191792478992, (18, 2) = -1.3229052410514246, (19, 1) = 0.5291963406316792e-1, (19, 2) = -4.179354075542915, (20, 1) = -0.8032529122966872e-1, (20, 2) = -4.110187332162933, (21, 1) = -.16396730152505634, (21, 2) = -1.1127422482319964, (22, 1) = -.13856716126876822, (22, 2) = 2.7243688727683266, (23, 1) = -0.2171776099723813e-1, (23, 2) = 4.678157648740803, (24, 1) = .10400796028481248, (24, 2) = 3.332502712593583, (25, 1) = .1499884923488127, (25, 2) = -.39122670466449067, (26, 1) = 0.8407403812966995e-1, (26, 2) = -3.876509041901599, (27, 1) = -0.4700893187998446e-1, (27, 2) = -4.646231873073153, (28, 1) = -.15056675043141238, (28, 2) = -2.126096148715866, (29, 1) = -.15372747280171484, (29, 2) = 1.9305021938308524, (30, 1) = -0.5432127608652006e-1, (30, 2) = 4.675861822052817, (31, 1) = 0.7813403552233018e-1, (31, 2) = 4.154505645313669, (32, 1) = .1505909374737268, (32, 2) = .6876622361674014, (33, 1) = .111689562356771, (33, 2) = -3.3095888773870232, (34, 1) = -0.11682217943418692e-1, (34, 2) = -4.988317782056582}, datatype = float[8], order = C_order); errproc := proc (x_bvp) local outpoint, X, Y, yout, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; Digits := 15; outpoint := evalf(x_bvp); X := Vector(34, {(1) = 4.0, (2) = 4.030138644973893, (3) = 4.06252075830933, (4) = 4.094888150822047, (5) = 4.1273438613473, (6) = 4.159816989954734, (7) = 4.192221888318701, (8) = 4.224543576874172, (9) = 4.256754500658247, (10) = 4.288740281823471, (11) = 4.320503853783057, (12) = 4.352072016657196, (13) = 4.383425561385851, (14) = 4.414529862821071, (15) = 4.445402267760153, (16) = 4.476096536048872, (17) = 4.506602115915622, (18) = 4.536942920110194, (19) = 4.567166859568994, (20) = 4.597271660548307, (21) = 4.6272042886208125, (22) = 4.656970737760961, (23) = 4.686560865933606, (24) = 4.715944142556049, (25) = 4.745122769711738, (26) = 4.774117826200048, (27) = 4.802932346972274, (28) = 4.831544048877039, (29) = 4.859951837709859, (30) = 4.88818587510624, (31) = 4.916287717622486, (32) = 4.944266740935822, (33) = 4.972160252377423, (34) = 5.0}, datatype = float[8], order = C_order); Y := Matrix(34, 2, {(1, 1) = .0, (1, 2) = 0.27327112092203225e-7, (2, 1) = 0.978775060790798e-10, (2, 2) = 0.48529249007737746e-7, (3, 1) = -0.5409380029321304e-8, (3, 2) = 0.7538318387144695e-7, (4, 1) = -0.12045635038481313e-7, (4, 2) = 0.7308674897744689e-7, (5, 1) = -0.14823793655844814e-7, (5, 2) = 0.3852146210517772e-7, (6, 1) = -0.10568187054027944e-7, (6, 2) = -0.8489883548987247e-8, (7, 1) = -0.11128964228786468e-8, (7, 2) = -0.35558307183813596e-7, (8, 1) = 0.7732637048013274e-8, (8, 2) = -0.2210302159189014e-7, (9, 1) = 0.10164440310941924e-7, (9, 2) = 0.24447922129778563e-7, (10, 1) = 0.483962860909516e-8, (10, 2) = 0.7079862076004938e-7, (11, 1) = -0.3969150619899016e-8, (11, 2) = 0.8392038080023722e-7, (12, 1) = -0.9656967240921232e-8, (12, 2) = 0.53832229684224287e-7, (13, 1) = -0.7760495700261479e-8, (13, 2) = 0.8649668118906003e-9, (14, 1) = 0.7144312944825714e-9, (14, 2) = -0.3802894725149483e-7, (15, 1) = 0.10213436390765505e-7, (15, 2) = -0.3636870220284489e-7, (16, 1) = 0.14642824306539772e-7, (16, 2) = 0.4451544095413321e-8, (17, 1) = 0.11315681709129736e-7, (17, 2) = 0.5558209115158183e-7, (18, 1) = 0.29255095886161705e-8, (18, 2) = 0.8078375988497181e-7, (19, 1) = -0.4383642048557253e-8, (19, 2) = 0.6115682507735523e-7, (20, 1) = -0.4993426509629615e-8, (20, 2) = 0.8711261106962578e-8, (21, 1) = 0.1963407280965595e-8, (21, 2) = -0.396438348246792e-7, (22, 1) = 0.11869871997257991e-7, (22, 2) = -0.49592185982409896e-7, (23, 1) = 0.17985978666981787e-7, (23, 2) = -0.1390789173583301e-7, (24, 1) = 0.16324710055000545e-7, (24, 2) = 0.4137831006851972e-7, (25, 1) = 0.8522492508408787e-8, (25, 2) = 0.765805213315824e-7, (26, 1) = 0.421071518722858e-9, (26, 2) = 0.6681647497614776e-7, (27, 1) = -0.20131882330223897e-8, (27, 2) = 0.1892897982999753e-7, (28, 1) = 0.30707192791035046e-8, (28, 2) = -0.33002220069799734e-7, (29, 1) = 0.12148844202097171e-7, (29, 2) = -0.5265154226857148e-7, (30, 1) = 0.1908501428418955e-7, (30, 2) = -0.26871524839094744e-7, (31, 1) = 0.1930670085286513e-7, (31, 2) = 0.26219913369224307e-7, (32, 1) = 0.1283240224899888e-7, (32, 2) = 0.6900543603752283e-7, (33, 1) = 0.4319930491976274e-8, (33, 2) = 0.7049112852700384e-7, (34, 1) = .0, (34, 2) = 0.27547706106614173e-7}, datatype = float[8], order = C_order); if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "right" then return X[34] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(8.392038080023722e-8) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [2, 34, [y(x), diff(y(x), x)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[34] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[34] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(2, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(34, 2, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(2, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(34, 2, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[y(x), diff(y(x), x)]'[i] = yout[i], i = 1 .. 2)] end proc; if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "method" then return "bvp" elif outpoint = "right" then return X[34] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(8.392038080023722e-8) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [2, 34, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[34] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[34] end if; if Digits <= trunc(evalhf(Digits)) and (_EnvInFsolve <> true or _EnvDSNumericSaveDigits <= trunc(evalhf(Digits))) then V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0, (3, 1) = .0, (3, 2) = .0, (4, 1) = .0, (4, 2) = .0, (5, 1) = .0, (5, 2) = .0, (6, 1) = .0, (6, 2) = .0, (7, 1) = .0, (7, 2) = .0}, datatype = float[8], order = C_order); yout := Vector(2, {(1) = .0, (2) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(34, 2, X, Y, YP, outpoint, var(yout), var(L), var(V))) else if _EnvInFsolve = true then Digits := _EnvDSNumericSaveDigits end if; V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = 0., (1, 2) = 0., (2, 1) = 0., (2, 2) = 0., (3, 1) = 0., (3, 2) = 0., (4, 1) = 0., (4, 2) = 0., (5, 1) = 0., (5, 2) = 0., (6, 1) = 0., (6, 2) = 0., (7, 1) = 0., (7, 2) = 0.}, order = C_order); yout := Vector(2, {(1) = 0., (2) = 0.}); `dsolve/numeric/hermite`(34, 2, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 2)] end proc, (2) = Array(0..0, {}), (3) = [x, y(x), diff(y(x), x)], (4) = 0}); solnproc := data[1]; if not type(outpoint, 'numeric') then if outpoint = "solnprocedure" then return eval(solnproc) elif member(outpoint, ["start", "left", "right", "errorproc", "rawdata", "order", "error"]) then return solnproc(x_bvp) elif outpoint = "sysvars" then return data[3] elif procname <> unknown then return ('procname')(x_bvp) else _ndsol := pointto(data[2][0]); return ('_ndsol')(x_bvp) end if end if; try res := solnproc(outpoint); [x = res[1], seq('[y(x), diff(y(x), x)]'[i] = res[i+1], i = 1 .. 2)] catch: error  end try end proc


delta[0]:=unapply(piecewise(j=k,1,j<>k,0),j,k):
delta[1]:=unapply(piecewise(j=k,0,j<>k,((-1)^(k-j))/(k-j)),j,k):
delta[2]:=unapply(piecewise(j=k,(-Pi^2)/3,j<>k,-2*(-1)^(k-j)/(k-j)^2),j,k):
d:=Pi/2:
h:=2/sqrt(N):
xk:=unapply((a+b*exp(k*h))/(1+exp(k*h)),k):
phi:=unapply(log((x-a)/(b-x)),x);
Dphi:=unapply(simplify(diff(phi(x),x)),x):
D2phi:=unapply(simplify(diff(phi(x),x$2)),x):
w:=unapply(1/Dphi(x),x):
Dw:=unapply(simplify(diff(w(x),x$1)),x):
D2w:=unapply(simplify(diff(w(x),x$2)),x):
MatrixSystem:=[]:
for p from -N to N
do
MatrixSystem:=[op(MatrixSystem),
h*(sum(c[j]*( (1/h^2)*delta[2](p,j)*(Dphi(xk(j))*subs(x=xk(j),P(x)*w(x)))+ (1/h^1)*delta[1](p,j)*(
(D2phi(xk(j))/Dphi(xk(j)))*subs(x=xk(j),P(x)*w(x))+2*subs(x=xk(j),
diff(P(x)*w(x),x))) + (1/h^0)*delta[0](p,j)*((subs(x=xk(j),
diff(P(x)*w(x),x$2))/Dphi(xk(j))))),j=-N..N)
-sum(c[j]*( (1/h^1)*delta[1](p,j)*(subs(x=xk(j),Q(x)*w(x)))+
(1/h^0)*delta[0](p,j)*(subs(x=xk(j),diff(Q(x)*w(x),x))) /Dphi(xk(j))
),j=-N..N)
+subs(y(x)=c[p],NLPart)*subs(x=xk(p),w(x)*R(x))/Dphi(xk(p))
-subs(x=xk(p),w(x)*F(x))/Dphi(xk(p)))=0]:
od:

proc (x) options operator, arrow; ln((x-4)/(5-x)) end proc

CC:=fsolve(evalf(MatrixSystem)):

C:=Vector(2*N+1,(j)->eval(c[j-N-1],CC),datatype=float[8]);

C := Vector(4, {(1) = ` 1 .. 97 `*Vector[column], (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

ApproximateSol:=unapply('add(evalf(C[j+N+1]*sin(Pi*(phi(x)-j*h)/h)/(Pi*(phi(x)-
j*h)/h)),j=-N..N)',x,numeric):

ApproximateSol(4.1);

HFloat(0.009832017093837749)

a,b;
plot({ApproximateSol(x)},x=a..b,color=green,style=point,symbol=solidcircle);
`Sinc-GalerkinPlot`:=%:

4, 5

display({`Sinc-GalerkinPlot`, PlotNewtonSolution }, title =
"Sinc-GalerkinApproximation",
labels=["x","y"]);

 

Download sinc_method_example_ac.mw

restart;

C := [0,1/11],[1/11,1/9],[1/9, 1/7],[1/3,1/2],[1/2,1]:

op(map(`[]`@op,[solve(Or(op(map(r->__dum>=r[1] and __dum<=r[2],[C]))))]));

                         [   1]  [1   ]
                         [0, -], [-, 1]
                         [   7]  [3   ]

lprint(%);
  [0, 1/7], [1/3, 1]

restart;

isolve({(x-6)^2+(y+2)^2 = 225, (x+1)^2+(y+3)^2 = 125});

{x = -6, y = 7}, {x = -3, y = -14}

isolve({(x-19)^2+(y-11)^2 = 225, (x+1)^2+(y+3)^2 = 125});

{x = 10, y = -1}

temp := {solve({(x-19)^2+(y-11)^2 = 225, (x+1)^2+(y+3)^2 = 125})};

{{x = 10, y = -1}, {x = 692/149, y = 991/149}}

select(u->eval([x,y],u)::[integer,integer],temp);

{{x = 10, y = -1}}

 

Download solve_integer.mw

We can generate results for each a,b pair via a pair of nested seq calls. And we can accept or reject such candidates according to whether they each pass a conditonal test within the procedure which generates them.

Naturally, you could add whatever else you want to the conditional test (if...then) within procedure G. (note: the restrictions you were originally placing on a,b,x,y don't seem to follow from the problem description you gave. I mean, where you had nops({a, b, x, y}) = 4 and x*y*a*b <> 0)

restart;

G:=proc(a,b)
     local temp;
     temp := {isolve({(x-a)^2+(y-b)^2 = 225, (x+1)^2+(y+3)^2 = 125})};
     if nops(temp)=2 then
       return {[a,b],temp};
     else
       return NULL;
     end if;
end proc:

ans := seq(seq(G(a,b),b=-20..20),a=-20..20):

seq(print(u), u=ans):

{[-15, -5], {{x = -6, y = 7}, {x = -3, y = -14}}}

{[-15, -1], {{x = -6, y = -13}, {x = -3, y = 8}}}

{[-11, -13], {{x = -11, y = 2}, {x = 4, y = -13}}}

{[-11, 7], {{x = -11, y = -8}, {x = 4, y = 7}}}

{[-11, 17], {{x = -11, y = 2}, {x = 1, y = 8}}}

{[-8, -4], {{x = 1, y = 8}, {x = 4, y = -13}}}

{[-8, -2], {{x = 1, y = -14}, {x = 4, y = 7}}}

{[-6, -8], {{x = -6, y = 7}, {x = 9, y = -8}}}

{[-6, 2], {{x = -6, y = -13}, {x = 9, y = 2}}}

{[-5, -5], {{x = 4, y = 7}, {x = 10, y = -5}}}

{[-5, -1], {{x = 4, y = -13}, {x = 10, y = -1}}}

{[-3, -17], {{x = -12, y = -5}, {x = 9, y = -8}}}

{[-3, -7], {{x = -3, y = 8}, {x = 9, y = 2}}}

{[-3, 1], {{x = -3, y = -14}, {x = 9, y = -8}}}

{[-3, 11], {{x = -12, y = -1}, {x = 9, y = 2}}}

{[-2, -10], {{x = -11, y = 2}, {x = 10, y = -1}}}

{[-2, 4], {{x = -11, y = -8}, {x = 10, y = -5}}}

{[0, -10], {{x = -12, y = -1}, {x = 9, y = 2}}}

{[0, 4], {{x = -12, y = -5}, {x = 9, y = -8}}}

{[1, -17], {{x = -11, y = -8}, {x = 10, y = -5}}}

{[1, -7], {{x = -11, y = 2}, {x = 1, y = 8}}}

{[1, 1], {{x = -11, y = -8}, {x = 1, y = -14}}}

{[1, 11], {{x = -11, y = 2}, {x = 10, y = -1}}}

{[3, -5], {{x = -12, y = -5}, {x = -6, y = 7}}}

{[3, -1], {{x = -12, y = -1}, {x = -6, y = -13}}}

{[4, -8], {{x = -11, y = -8}, {x = 4, y = 7}}}

{[4, 2], {{x = -11, y = 2}, {x = 4, y = -13}}}

{[6, -4], {{x = -6, y = -13}, {x = -3, y = 8}}}

{[6, -2], {{x = -6, y = 7}, {x = -3, y = -14}}}

{[9, -13], {{x = -6, y = -13}, {x = 9, y = 2}}}

{[9, 7], {{x = -6, y = 7}, {x = 9, y = -8}}}

{[9, 17], {{x = -3, y = 8}, {x = 9, y = 2}}}

{[13, -5], {{x = 1, y = -14}, {x = 4, y = 7}}}

{[13, -1], {{x = 1, y = 8}, {x = 4, y = -13}}}

{[19, -13], {{x = 4, y = -13}, {x = 10, y = -1}}}

{[19, 7], {{x = 4, y = 7}, {x = 10, y = -5}}}

 

Download solve_integer_2.mw

Here is one way.

student_md_question_ac.mw

You can find several older posts on this topic by searching this site for the word colorbar. Eg, [1], [2], [3] .

The 2+3 becomes 5 due to automatic simplification. That's not something that's going to be able to help you with your second example.

One way to construct a procedure (operator) from a given expression is to use the unapply command.

example2 := unapply( int(1,y), x );

                       example2 := x -> y

example3 := unapply( int(sin(x*y),y), x );

                                     cos(x y)
                  example3 := x -> - --------
                                        x    
example3( 17 );

                           1           
                         - -- cos(17 y)
                           17          

One way is to pull the units out of the the two columns, separately.

You haven't told us what units you want have for the results. Is it foot and day?

restart;

kernelopts(version);

`Maple 2018.1, X86 64 LINUX, Jun 8 2018, Build ID 1321769`

M:=Matrix([[0.,              0.],
           [0.2697*Unit(ft), 0.3613*Unit(ft^2*d/inch^2)],
           [0.3821*Unit(ft), 0.7225*Unit(ft^2*d/inch^2)],
           [0.5352*Unit(ft), 1.4123*Unit(ft^2*d/inch^2)]]);

Matrix(4, 2, {(1, 1) = 0., (1, 2) = 0., (2, 1) = .2697*Units:-Unit(ft), (2, 2) = .3613*Units:-Unit(ft^2*d/`in`^2), (3, 1) = .3821*Units:-Unit(ft), (3, 2) = .7225*Units:-Unit(ft^2*d/`in`^2), (4, 1) = .5352*Units:-Unit(ft), (4, 2) = 1.4123*Units:-Unit(ft^2*d/`in`^2)})

Units:-UseUnit(d):
Units:-UseUnit(ft):

T1 := combine~(M[-1,1],units);
#T1 := M[-1,1];
convert~(T1,unit_free,'u1'):
u1;
M1 := simplify(M[..,1]/u1);

T1 := .5352*Unit('ft')

Unit('ft')

Vector[column](%id = 18446884055612239614)

T2 := combine~(M[-1,2],units);
#T2 := M[-1,2];
convert~(T2,unit_free,'u2'):
u2;
M2 := simplify(M[..,2]/u2);

T2 := 203.3712*Unit('d')

Unit('d')

Vector[column](%id = 18446884055612215654)

plot(M1, M2, labels=[u1,u2]);

 

Download plot_column_units.mw

Which level did you use for the interface setting prettyprint? Was it 0, or 1?

I have been seeing weird behavior with interface(prettyprint=0) for a while now, when using the Standard GUI.

So it you are trying to use writeto from within the Standard GUI (and presuming you are not just using printf calls) then you might want to see if you can get by with the setting interface(prettyprint=1) .

This looks kludgy at best, and perhaps suspect at worst, but for this example...

restart;

eqn := 5*(x*y)^2+x/sqrt(y) = x^2+2*(3*x^3+y^2)^3:

foo := implicitdiff(eqn, x, y);

-(1/2)*(24*y^(13/2)+144*x^3*y^(9/2)+216*x^6*y^(5/2)-20*x^2*y^(5/2)+x)/(54*x^2*y^(11/2)+324*x^5*y^(7/2)+486*x^8*y^(3/2)-10*x*y^(7/2)+2*x*y^(3/2)-y)

eqn2 := subsindets(eqn, `^`(`+`,anything), u->H(op(1,u))^op(2,u));

5*x^2*y^2+x/y^(1/2) = x^2+2*H(3*x^3+y^2)^3

implicitdiff(eqn2 , x, y);

-(1/2)*(24*H(3*x^3+y^2)^2*(D(H))(3*x^3+y^2)*y^(5/2)-20*x^2*y^(5/2)+x)/(54*H(3*x^3+y^2)^2*(D(H))(3*x^3+y^2)*x^2*y^(3/2)-10*x*y^(7/2)+2*x*y^(3/2)-y)

bar := eval(%, H=(u->u));

-(1/2)*(24*(3*x^3+y^2)^2*y^(5/2)-20*x^2*y^(5/2)+x)/(54*(3*x^3+y^2)^2*x^2*y^(3/2)-10*x*y^(7/2)+2*x*y^(3/2)-y)

simplify(foo-bar);

0

 

Download kludge.mw

[edit] I think that I prefer the following form, with radnormal as an intermediate step, since the following form behaves nicer under simplify.

eqn := 5*(x*y)^2+x/sqrt(y) = x^2+2*(3*x^3+y^2)^3:
 

eval(radnormal(implicitdiff(subsindets(eqn, `^`(`+`,anything),
                                       u->H(op(1,u))^op(2,u)),
                            x, y)), H=(u->u));
 

(1/2)*(-24*y^3*(3*x^3+y^2)^2+20*y^3*x^2-y^(1/2)*x)/(y*(54*y*(3*x^3+y^2)^2*x^2-10*y^3*x+2*x*y-y^(1/2)))

 

 

You can use the print command.

You could simply use rand here.

restart;

LetList := [C, E, F, H, K, P, T, W, X, Y]:

gen:=rand(1..nops(LetList)):

gen();
                               7

LetList[gen()];
                               Y

LetList[gen()];
                               P

LetList[['gen()'$5]];
                        [E, H, P, K, C]
First 167 168 169 170 171 172 173 Last Page 169 of 336