vv

13827 Reputation

20 Badges

9 years, 317 days

MaplePrimes Activity


These are answers submitted by vv

You should use simply  sol(1);

If you really want such a manipulation, use:

eval('''sol'''(x), [x = X]);
eval(%, X=1);

 

This is not related to Special Relativity.

solve([2*x=6, y=2], x);
has no solutions because y is seen as a parameter. Only when y=2 a solution exists.
You may see this using

solve([2*x=6, y=2], x, parametric);

 

Of couse the system can be solved wrt all the variables:
solve([2*x=6, y=2], [x,y]);   # or    solve([2*x=6, y=2]);
      [[x = 3, y = 2]]

 

 

 

1. Strangely, for name instead of symbol it works.

3. Workaround:

e:=hypergeom([], [], a)+hypergeom([], [], b):
E:=subs(hypergeom=HG,e):
applyrule(HG(x1::anything, x2::anything, a) = 0, E):
subs(HG=hypergeom,%);

Or, use %hypergeom.

You have overlapping patterns, so both

    true, [x = 2]
    true, [y = 2]

are correct.

For uniqueness use e.g.

typematch({2}, set({x :: odd, y :: even}), 's'); s;

 

 

 

 

Yes, it seems to be a bug. It should give an error as in:
C:=Matrix(B);
A.C;

You mean divide a m-dimensional cube into n^m congruent cubes.

 

Cubes:=proc(m,n) # for the unit cube in R^m
local k,u,T,C;
T:=combinat:-cartprod([[seq(k/n, k=0..n-1)] $ m ]):
C:=('T[nextvalue]()')$(n^m):
seq( [u, 1/n +~ u], u=[C])
end:

Cubes(2,2);
 

[[0, 0], [1/2, 1/2]], [[0, 1/2], [1/2, 1]], [[1/2, 0], [1, 1/2]], [[1/2, 1/2], [1, 1]]

(1)

Cubes(2,4);

[[0, 0], [1/4, 1/4]], [[0, 1/4], [1/4, 1/2]], [[0, 1/2], [1/4, 3/4]], [[0, 3/4], [1/4, 1]], [[1/4, 0], [1/2, 1/4]], [[1/4, 1/4], [1/2, 1/2]], [[1/4, 1/2], [1/2, 3/4]], [[1/4, 3/4], [1/2, 1]], [[1/2, 0], [3/4, 1/4]], [[1/2, 1/4], [3/4, 1/2]], [[1/2, 1/2], [3/4, 3/4]], [[1/2, 3/4], [3/4, 1]], [[3/4, 0], [1, 1/4]], [[3/4, 1/4], [1, 1/2]], [[3/4, 1/2], [1, 3/4]], [[3/4, 3/4], [1, 1]]

(2)

Cubes(3,2);

[[0, 0, 0], [1/2, 1/2, 1/2]], [[0, 0, 1/2], [1/2, 1/2, 1]], [[0, 1/2, 0], [1/2, 1, 1/2]], [[0, 1/2, 1/2], [1/2, 1, 1]], [[1/2, 0, 0], [1, 1/2, 1/2]], [[1/2, 0, 1/2], [1, 1/2, 1]], [[1/2, 1/2, 0], [1, 1, 1/2]], [[1/2, 1/2, 1/2], [1, 1, 1]]

(3)

 

Edit: In Maple 15, probably
seq( [u, 1/n +~ u], u=[C])
must be replaced by
seq( [u, map(t->t+1/n, u)], u=[C])

 

 

The problem seems to be an escaped internal local variable.

restart;

diff(int(1/(1+exp(1/(x-u))), u = 0 .. x), x);

diff(int(1/(1+exp(1/(x-u))), u = 0 .. x), t)

(1)

indets(%,name) minus {x,u};

{t}

(2)

evalb(%[] = t);

false

(3)

 

You should check whether it is fixed in the development library; see:
https://www.mapleprimes.com/questions/222498-Issues-With-Pdsolve

I have also noticed this issue from a yesterday post.

 

restart;

# f:= (t,x)-> piecewise(t<>x, 1/(1+exp(1/(x-t))),0); # This works

f:=(t,x)-> piecewise(t<x, 1/(1+exp(1/(x-t))),t>x, 1/(1+exp(1/(x-t))), K(x));#or <>

f := proc (t, x) options operator, arrow; piecewise(t < x, 1/(1+exp(1/(x-t))), x < t, 1/(1+exp(1/(x-t))), K(x)) end proc

(1)

int(g(t,x), t = 0 .. x);

int(g(t, x), t = 0 .. x)

(2)

G__x:=diff(%,x);  # generic result, valid if g(x,x-)=g(x,x+)

int(diff(g(t, x), x), t = 0 .. x)+g(x, x)

(3)

#simplify(%);

F__x:=eval(G__x,g=f);  # Here is the problem; it should be the left limit

int(exp(1/(x-t))/((1+exp(1/(x-t)))^2*(x-t)^2), t = 0 .. x)+K(x)

(4)

SimpF__x:=simplify(F__x) assuming x>0;  # should be K=0

(K(x)*exp(1/x)+K(x)+1)/(1+exp(1/x))

(5)

F:=x -> int(1/(1+exp(1/(x-t))), t = 0 .. x);

proc (x) options operator, arrow; int(1/(1+exp(1/(x-t))), t = 0 .. x) end proc

(6)

limit((F(x+h)-F(x))/h, h=0) assuming x>0;

limit((int(1/(1+exp(1/(x+h-t))), t = 0 .. x+h)-(int(1/(1+exp(1/(x-t))), t = 0 .. x)))/h, h = 0)

(7)

limit((F(x+h)-F(x))/h, h=0, left) assuming x>0;

-signum(int(1/(1+exp(1/y)), y = 0 .. x)-(int(1/(1+exp(1/(x-t))), t = 0 .. x)))*infinity

(8)

limit((F(x+h)-F(x))/h, h=0, right) assuming x>0;

signum(int(1/(1+exp(1/y)), y = 0 .. x)-(int(1/(1+exp(1/(x-t))), t = 0 .. x)))*infinity

(9)

h:=10^(-10); a:=1/2;
evalf[20]((F(a+h)-F(a))/h) = evalf[20](f(0,a));

1/10000000000

 

1/2

 

.11920292204 = .11920292202211755594

(10)

 


 

Download bugdiffint.mw

 

F := unapply(simplify(int(f, [yip = -infinity .. infinity, xip = -infinity .. infinity, tp = 0 .. t])),  t):
Optimization:-Maximize(F, 0..1/2);

I'll take a polynomial of degree 3 (it is easier to write here):
p(x) = x^3 + a1*x^2 + a2*x + a3.

The polynomial has 3 complex roots x1, x2, x3 which depend continuously on (a1,a2,a3) in C^3.
But this dependence is "global" i.e. the multi-function (a1,a2,a3) |--> {x1,x2,x3} is continuous.
If we want to obtain a continuous selection (as it is called in maths) we must jump from one branch to another.

Now, RootOf(p(x), x) denotes the first root (for evalf)  (see ?RootOf for the order of the roots)
and generally this is not continuous as a function of (a1,a2,a3).

A graphical illustration:

consider the polynomial p(x) = (x-1)*(x-2)*(x-3) + c  for 0 <= c <= 1
and look at its largest real root r(c); so, e.g. r(0)=3. The next animation shows clearly that r() is discontinuous as a function of c.

On the other side, if you have another (continuous) function h(y), there is the possibility that r(h(y)) be continuous [for example this happens here if h(y)>1].

 

restart;
with(plots):
poly:=x>=0, y<=1, y>=-1, y<=4-4*x, y>=4*x-4:
plots:-inequal([poly],x=0..1,y=-1..1);
F:=piecewise(`and`(poly), x^2+y^2, undefined):
G:=piecewise(`and`(poly), 3*sin(x)-y^2, undefined):
fieldplot([F,G], x =0 .. 1, y = -1 .. 1, arrows = SLIM, color = x) ;

For such problems it is much better to use a little math.

In this case, (1-x)^(10^9)  1 - 10^9*x
with an excellent accuracy for a plot.

E1:=A+B+C+D:
E2:=A-B+C-D:
E3:=C:
sol:=solve(  [coeffs(expand(x*E1 + y*E2 + z*E3 - w*A), [A,B,C,D])], [x,y,z,w] )[]:
freevars:=indets(rhs~(sol),name):
[x,y,z,w]=~eval(rhs~(sol),freevars=~k);
# choose k for an integer solution (k=1 here); a simple procedure can be written for this if necessary

               [x = k, y = k, z = -2 k, w = 2 k]

Edit: Or, stealing Carl's isolve idea:

E1:=A+B+C+D:
E2:=A-B+C-D:
E3:=C:
sol:=isolve({coeffs(expand(x*E1 + y*E2 + z*E3 - w*A), [A,B,C,D])}):
freevars:=indets(rhs~(sol),name):
eval(sol, freevars =~1);
                 {w = 2, x = 1, y = 1, z = -2}

 

 

mondeg:=proc(X::list(name),d::posint)
if nops(X)=1 then X^~d else expand(add(X)^d); [op(%)]/~coeffs(%) fi
end:

 

First 81 82 83 84 85 86 87 Last Page 83 of 120