vv

12453 Reputation

19 Badges

9 years, 287 days

MaplePrimes Activity


These are replies submitted by vv

NonnegIntComb:=proc(M::Matrix,v::Vector)
local n:=upperbound(M,2), L, t, S;
if upperbound(M,1) <> upperbound(v) then error "Incompatible vector" fi;
L:=convert(add(M[..,i]*t[i],i=1..n)-v,list);
try
  S:=Optimization:-Minimize(0, [(L=~0)[]],assume=[integer,nonnegative] );
  catch:  
  return FAIL;
end try;
eval([seq(t[i],i=1..n)],  S[2]);
end:

M:=Matrix([[3, 0, 2, 2, 1, 1], [-1, -1, 0, -1, 0, -1], [0, 3, 0, 1, 1, 2], [3, 0, 1, 2, 0, 1], [-1, -1, -1, -1, -1, -1]]):
v1:= Vector[column](5, [3, 1, 0, 0, -2]):
v2 := M[..,1]+7*M[..,2]+9*M[..,4]:

NonnegIntComb(M,v1);
                            

FAIL

(1)

NonnegIntComb(M,v2);
                  

[7, 10, 0, 0, 0, 0]

(2)

 


 

Download NonnegIntComb.mw

@Carl Love 

Nice. Still, the following cases are not covered:

ex1 := RealRange(-infinity, 1) union RealRange(Open(-1), infinity);
ex2 := RealRange(-infinity, 1) intersect RealRange(-infinity, infinity);

In Maple D is symmetric. Actually it is a mathematical fact that for a C^2 function u,  D[1,2](u) = D[2,1](u).
Of course there are "pathological" u such that D[1,2](u), D[2,1](u) exist and are not equal. Do you have such functions? Give an example.

@student_md 

It is not a good idea to use such non-standard constructions.

 

restart;

f:=unapply(Vector(2), t);

f := proc (t) options operator, arrow; Vector(2, {(1) = 0, (2) = 0}) end proc

(1)

showstat(f);


f := proc(t)
   1   Vector(2, [0,0])
end proc

 

f(t)[1]:=11;

11

(2)

f(t)[2]:=22;

22

(3)

f(x);

Vector(2, {(1) = 11, (2) = 22})

(4)

showstat(f);


f := proc(t)
   1   Vector(2, [11,22])
end proc

 

print(eval(f));

proc (t) options operator, arrow; Vector(2, {(1) = 11, (2) = 22}) end proc

(5)

Apparently the body of the procedure has changed.
But actually this is not true. So, what happened?
f was defined as a Vector-valued constant function. Denote this vector by V; initially V=<0,0>
  f(t)[1]:=11;  ==>  the entry V[1] is changed to 11 inplace  (V being mutable). Same for V[2].
So, f(x) returns the (constant) vector V, but this is now changed to <11,22>

 

 

Compare with the similar situation when the function is a constant list (=immutable).

 

g:=unapply([0,0], t);

proc (t) options operator, arrow; [0, 0] end proc

(6)

showstat(g);


g := proc(t)
   1   [0, 0]
end proc

 

g(t)[1]:=11;

11

(7)

g(t)[2]:=22;

22

(8)

g(x);

[0, 0]

(9)

showstat(g);


g := proc(t)
   1   [0, 0]
end proc

 

print(eval(g));

proc (t) options operator, arrow; table( [( t ) = [11, 22] ] ) [0, 0] end proc

(10)

 

@FormatB 

SolveTools[SemiAlgebraic] command was introduced in Maple 16.
You could try   solve([sys, l>0], [alpha], parameters=[l]);  but it probably will not work in Maple 15 (because it is calling SemiAlgebraic).

 


 

foil:= proc(m::posint, n::posint, r::realcons:=2)   plots:-tubeplot(
 [cos(m*s)*(5+r*cos(n*s)), sin(m*s)*(5+r*cos(n*s)),r*sin(n*s)],  s=0..2*Pi,
 scaling=constrained, radius=1, numpoints=160,tubepoints=20, axes=none, style=surfacecontour, _rest) end:

foil(2,3, color=gold, orientation=[90,0]);

 

foil(3,2, orientation=[90,0]);

 

foil(5,2,color=green, orientation=[90,0]);

 

foil(4,7, color=gold, orientation=[0,0]);

 

foil(7,4,4, color="CornflowerBlue", orientation=[0,0]);

 

@litun 

I do not have your (very old) version to check. You could:
- check the entries of the matrix AB. Are they correct?
- LinearSolve has several options. Maybe one of them works for you.

Also, your system seems to be consistent but has n+1 equations (n=the number of unknowns).
You should try to eliminate one of them. Or, try LinearAlgebra[LeastSquares].

@litun 

Here is the executed worksheet. I have changed the line  V = ~Vsol seeing that you use Maple 12.

solntosystem-1.mw

1 / %;            

@tomleslie 

Carl has changed the code and now it does not work because q is no longer necessarily a prime.

@Carl Love 

Of course for <128 bit Maple cracks easily the RSA:

p1,q1:=expand([op(ifactor(n))])[];
d1:=1/e mod ilcm(p1-1, q1-1);

 

The prefered form of the answer is "culture-dependent". E.g. in my country (Romania) a teacher definitely expects sqrt(2)/2; in universities it does not matter.

Anyway, an option for this (if any) should be part of Typesetting. However, I would prefer Maplesoft effort  directed towards maths rather than typesetting.

@tomleslie 

Why didn't you respect OP's special request?   :-)

@Jsevillamol 

Why don't you post an executable worksheet . Use the green arrow to upload it.

with(Domains):

---------------------- Domains version 1.0 ---------------------

Initially defined domains are Z and Q the integers and rationals
Abbreviations, e.g. DUP for DenseUnivariatePolynomial, also made

 

GI:=Gaussian(Z):
za:=2+3*I: zb:=1-I:
a := GI[Input](za);
b := GI[Input](zb);

`domains/Gaussian/badge0`(2, 3)

 

`domains/Gaussian/badge0`(1, -1)

(1)

EEA:=proc(ED,a,b)
local u;
u:=ED[`*`](a,b);
u:=ED[`-`](u,a);  # +,- work directly
u;
end:

EEA(GI,a,b) = za*zb-za;

`domains/Gaussian/badge0`(3, -2) = 3-2*I

(2)

 


Download gi.mw

@Axel Vogt 

For the last limit it's a "semi-bug" because with assuming a>1 it works. And also with assuming a>0,a<=1.

P.S. Many limits are computed by series, not by f/g, L'Hospital or such.

First 63 64 65 66 67 68 69 Last Page 65 of 166