vv

13852 Reputation

20 Badges

9 years, 347 days

MaplePrimes Activity


These are answers submitted by vv

In Maple, a polynomial cannot have symbolic exponents (powers). For example, x^m - x^2 - 2 is not a polynomial, unless m is a (constant) nonnegative integer. This is normal; try for example to compute by hand the quotient and the remainder for the polynomials  x^m - x^2 - 2  and x^3 + 2*x + 3; such operations are essential in the Groebner package.

In conclusion your problem cannot be solved in a CAS (but you may solve it providing integer value(s) for m).

Maple needs a little help.

restart;
eq := x^2+floor(x)-10:
seq( solve({eval(eq, floor(x)=n), n <= x, x < n+1}), n=-5..5);

        {x = -sqrt(14)}, {x = 2*sqrt(2)}

restart;

LongestPath:=proc(a,b, G0::GRAPHLN, all::truefalse:=false)
uses GraphTheory;
local Pab:=Array(1..0), P, LEN, G, k,lengths;

LEN:=(u::list) -> add(GetEdgeWeight(G, u[i..i+1]),i=1..nops(u)-1);

P:=proc(u::list, a, G)
  local c, Ga := DeleteVertex(G,a);
  for c in Neighbors(G, a) do
    if c=b then Pab ,=  [u[],a,b]
    else thisproc([u[],a], c, Ga)
    fi;
  od;
  NULL
end proc:

G:=`if`(IsWeighted(G0), G0, MakeWeighted(G0));  
P([], a, G);  Pab:=seq(Pab);
lengths:=map(LEN,[Pab],G); k:=max[index](lengths);
if all then lprint('paths'=Pab); lprint('lengths'=lengths) fi;
Pab[k], lengths[k]

end proc:

##################

with(GraphTheory):

G:=CycleGraph(5):
G:=AddEdge(G, {1,4}):
a,b:=2,4;

2, 4

(1)

DrawGraph(G, layout=circle);

 

LongestPath(a, b, G);

[2, 1, 5, 4], 3

(2)

LongestPath(a, b, G, true);

paths = ([2, 1, 4], [2, 1, 5, 4], [2, 3, 4])
lengths = [2, 3, 2]

 

[2, 1, 5, 4], 3

(3)

 


 

Download LongestPath-sent2.mw

For such expressions involving principal branches, the solutions are difficult to find, and more important, they are much more difficult to check.

Consider the equation (equivalent to yours):
g:=2*ln(u) + ln(u^2+2);
solve( g - c = 0, u);       # 2 solutions     (1)

solve( g - ln(c) = 0, u);  # 4 solutions   (2)

If we are interested in real solutions (so, u>0, c real) then there is a unique solution.

But for complex u, c, do we have 2? 4? more? Of course (1) and (2) are contradictory (the 4 solutions given in (2) are distinct but not all are true -- for the principal branch of ln: just take a numeric c and check the solutions).
So, it's much more important to determine the true solutions rather than to eliminate the duplicates!

 

 

 

 

 

seq(expand(eval(test,_B1=v)), v=0..1); # 1/2, 1/2

 

Make the first multiplication inert.

restart;
expr:= A*B*C;
o1:= op(1,expr);
expr1:=o1%*(expr/o1);
nops(expr1);  # 2
value(expr1); # = expr

 

@Hnx 

diff  knows piecewise, so you can use it directly:

restart:
with(CurveFitting):
S := Spline([[0,0],[1,1],[2,4],[3,3]], v);
dS := diff(S,v);

 

floor(fsolve(1/(n+1)! = 0.0001, n)) + 1;

 

You can't use Dirac like that. Dirac is not a function; it is a distribution and must be handled with great care, and only if the user knows exactly its meaning. In Maple the use of the Dirac "function" is restricted to some contexts, e.g. as in the input and output of dsolve and in integral transforms (Fourier, Laplace).

The answer is no.
You will have to use the theory of Parametric LP.

The modp1 arithmetic is very fast in maple (but especially when the modulus is a hardware integer).
The usual mod operations use modp1, so they are fast too.
Using modp1 directly, the gain is modest:

restart;
m := 8009;
N := ceil(m/2) + 2;
read "nn.txt":
st := time[real]():
r := modpol(a*a, f_t, t, 2^N):
t1 := time[real]() - st;

N2:=2^N:
A:=modp1(ConvertIn(a,t),N2):
F:=modp1(ConvertIn(f_t,t),N2):

st := time[real]():
R:=modp1(Rem(Multiply(A,A),F), N2):
t2 := time[real]() - st;

rr:=modp1(ConvertOut(R,t),N2):
r-rr; # 0 
t2/t1;

st := time[real]():
modp1(Rem(Power(A,2),F), N2):
t3 := time[real]() - st;
t3/t1;

So, probably in your case that's all Maple can do.

For a general approach, you can use the package QuadraticInt (for working in the ring Z[sqrt(d)]); see the Application Center.

restart;

S:=Sum((-1)^(n+1)/(n*(n+1)),n = 1 .. infinity):
S=value(S);

Sum((-1)^(n+1)/(n*(n+1)), n = 1 .. infinity) = -1+2*ln(2)

(1)

# For a proof, let's change the variable in Sum

'S' = subs((n = 1.. infinity) = (k=0..infinity), n=k+1, S);

S = Sum((-1)^(k+2)/((k+1)*(k+2)), k = 0 .. infinity)

(2)

F:=int(ln(1+x),x);

ln(1+x)*(1+x)-1-x

(3)

Sx:=convert(F, FPS);

-1+Sum((-1)^(k+2)*x^(k+2)/((k+2)*(k+1)), k = 0 .. infinity)

(4)

# So,

S = eval(F + 1, x = 1);

Sum((-1)^(n+1)/(n*(n+1)), n = 1 .. infinity) = -1+2*ln(2)

(5)


 

 

Your Bst is the parametric representation of a surface.
But it is in the plane z = 0. So you obviously have a single "contour", but this "contour" is actually a 2-dimensional set in R^2 (it has interior points).

isolve is not able to manage inequalities in this case. Select the desired solutions later:

isolve(29 = x^2 + y^2):
select(u -> (eval(x,u)>=1 and eval(y,u)>=1), [%]);

 

First 39 40 41 42 43 44 45 Last Page 41 of 120