vv

2152 Reputation

9 Badges

1 years, 213 days

MaplePrimes Activity


These are answers submitted by vv

f:=-4*a*sin(2*x)+4*b*cos(2*x)=-8*sin(2*x)+20*cos(2*x):
solve( identity(f,x), {a,b} );

                         {a = 2, b = 5}


Ad hoc methods are also possible:
solve({ eval(f,x=0), eval(diff(f,x),x=0)});
or
solve({ eval(f,x=0), eval(f,x=Pi/4)});

restart;
x:= rand(10^1000..10^1200)()/rand(10^1000..10^1200)():
n:=100:
v:=convert(evalf[n](x), rational, n);


evalf[10](evalf[5*n](x-v));
     -2.407569284*10^(-99)

 

For example:

evalindets(Tours, list(integer), u -> [1,u[]]);


 

restart;

with(plots):
with(plottools):

z := (m+I*n)/(p+I*q):
g := proc (z) options operator, arrow; (z-I)/(z+I) end proc:
bz := simplify(evalc(Im(z))):
a := simplify(evalc(Re(g(z)))):
b := simplify(evalc(Im(g(z)))):

r := 15;
Lista := Vector():
Listb := Vector():
C := Array(datatype = float[8]):
j := 1:
for m from -r to r do for n from -r to r do for p from -r to r do for q from -r to r do
if p <> 0 and q <> 0 and m^2-2*m*q+n^2+2*n*p+p^2+q^2 <> 0 and bz >= 0 then
   Lista(j) := a; Listb(j) := b;
   C(j) := a^2+b^2;  # color (HUE)
   j := j+1
end if
end do end do end do end do; j;

pointplot(Lista, Listb, symbol = point, symbolsize = 1, size = [1200, 1200], color = COLOR(HUE, C));

 


 

Download C.mw

It seems bo be a strange bug which crashes Maple and freezes Windows.
It seems to be caused by the fact that piecewise has floats and the rest of the expression does not.
A workaround:

fe11_1 := evalf(abs(-piecewise(1 <= p and p <= 9, 9.310043871-1.372270968*p+0.6222709675e-1*p^2, 0)+exp(-(1/40)*p*ln(3)-(1/4)*p*ln(2)+(1/40)*ln(3)+(1/10)*ln(p)+(13/4)*ln(2)))):
evalf(Int(fe11_1, p = 1 .. 11/3)+Int(fe11_1, p = 11/3 .. 19/3)+Int(fe11_1, p = 19/3 .. 9));

      1.342268852

If evalf in fe11_1 is removed ==> crash/freeze in Maple&Windows.

You final double integral is improper and it will be hard to compute it with desired accuracy.
A better idea is to use some approximations and symbolics.

ee:= t -> add(t^k/k!,k=0..12):
G1:=-0.9445379894:
f:= (x) -> 0.9/abs(x-0.4)^(1/3)+0.1/abs(x-0.6)^(1/2):
U1 := unapply(-ee(-x)*((int(f(t)*ee(t), t = 0 .. x))+G1)/2-ee(x)*((int(f(t)*ee(-t), t = 0 .. x))+G1)/2, x):
U:= unapply(-ee(x)/2*((int(f(t)*ee(-t),t=0..x))+G1)+ee(-x)/2*((int(f(t)*ee(t),t=0..x))+G1), x):
evalf(Int(U1(x)^2+U(x)^2-2*f(x)*U(x), x=0..1));

         -0.3753314046

Edit. For ee:= t -> add(t^k/k!,k=0..25):  and Digits:=25 ==>

-0.3753314045949344185803002

In my opinion Maple should be used for mathematics, not for typesetting. For this, use LaTeX.

Here is a simple IsI. Not optimized; it will be slow for large graphs but could be used to test IsIsomorphic.

IsI:=proc(G1::GRAPHLN,G2::GRAPHLN,phi::name)
local A,A1,B,B1,f,k,n:=nops(op(3,G1));
A:=convert(op(4,G1),list);
B:=convert(op(4,G2),list);
if sort(nops~(A)) <> sort(nops~(B)) then return false fi;
for f in combinat:-permute(n) do
  A1:=subsindets(A, posint, k->f[k]);
  B1:=[seq(B[f[k]],k=1..n)];
  if A1=B1 then if nargs=3 then phi:=[seq(k=f[k],k=1..n)] fi;
     return true fi
od;
false
end:

with(GraphTheory):
G1:=Graph(8,Trail(1,2,3,4,5,6,7,8)):
G2:=Graph(8,Trail(2,3,4,5,6,7,8,1)):
IsI(G1,G2,'ff');ff;

                              true
    [1 = 1, 2 = 8, 3 = 7, 4 = 6, 5 = 5, 6 = 4, 7 = 3, 8 = 2]
IsIsomorphic(G1,G2,'ff');ff;
                              true
    [1 = 1, 2 = 8, 3 = 7, 4 = 6, 5 = 5, 6 = 4, 7 = 3, 8 = 2]

 

A capped version.

ST:=proc(c::list(realcons), ur::range, r::realcons:=1, R::realcons:= 2)
local p1,p2,u,v,t,S:=[c[1]+(R+r*cos(u))*cos(v),c[2]+(R+r*cos(u))*sin(v),c[3]+r*sin(u)];
p1:=plot3d(S,u=ur,v=0..2*Pi);
p2:=plot3d(t*~eval(S,u=lhs(ur))+(1-t)*~eval(S,u=rhs(ur)), t=0..1,v=0..2*Pi);
plots:-display(p1,p2,_rest);
end proc:

plots:-display(ST([0, 0, 0], 0 .. Pi, 1, 2), lightmodel = light4, orientation = [-140, 60], scaling = constrained, style = patchnogrid);

 

Actually if u is undefined,
plot(u)  <==>  plot(u, u = -10 .. 10)

because -10 .. 10  is the default range.

(just because it seems that the problem is not nonsense).

1. You should clarify the relation between the eigenvalues of the original problem and the transformed one.
Use small matrices. (It seems that the method is known, i.e. reducing the generalized eigenvalue problem to a standard eigenvalue problem; this reduction seems to be useful because the Maple algorithm for standard eigenvalues is much better).
For example, for m=2, n=1, K11=M11=Identity, K12=<1,1> :
the original problem has a unique eigenvalue = 1, while the transformed one has 3:
1, 1/2+(1/2)*sqrt(8*LV^2+1), 1/2-(1/2)*sqrt(8*LV^2+1)
Do you know what is the general situation? This is important.

2. Construct some examples with known solutions and different m,n.
See what happens when m,n,LV are increased progressively. Compare the eigenvalues.

3. Only after all that you will be able to decide if Maple can solve your problem.

 

map(u -> op(0,u)[op(-1,u)], RR);

You forgot to initialize  s:=0; n:=0;
And a typo: list := ... instead of lista := ...

Let A be the matrix and a,b,... the eigenvalues.

1. Compute the characteristic polynomial P(x). If A is big, P(x) could be huge.
2. Compute gcd( P(a), P(b),...). This will be a polynomial Q in s.
3. solve(Q, s).
 

The assume facility is very limited. It works only for simple conditions: types, algebraic (mostly linear and hardly for several variables).
The last is(...) should return false (note that a::real, b::real are superfluous).

is(ln(a+b)-ln(a)=ln(1-b/a)) assuming a::real,b::real,a>0,b>0,b<a;  # should be false
                              FAIL
is(ln(a+b)-ln(a)=ln(1+b/a)) assuming a::real,b::real,a>0,b>0,b<a;
                              true
is(ln(a+b)=ln(a-b)) assuming a>0,b>0,b<a;
                              FAIL
is(a+b=a-b) assuming a>0,b>0,b<a;
                             false

 

 

 

1 2 3 4 5 6 7 Last Page 1 of 29