vv

12453 Reputation

19 Badges

9 years, 285 days

MaplePrimes Activity


These are answers submitted by vv

LSSolve minimizes the sum of the squares of the "residuals". In your example it actually calls

Minimize( 1/2 * ( (x-1)^2 + (y-1)^2+ (z-1)^2 ), {-10 <= x, x <= 0, 6*x+3*y <= 1}, initialpoint = {x = -1, y = 1});

Note that Minimize finds only a local minimum, usually the one which is closer to initialpoint (if given). For your example there is only one local minimum, so initialpoint is superfluous.

The integral does not exist. It is infinity if n is an even positive integer.

Note that if you use r:=5/2 than maple produces a symbolic answer but it will be incorrect because a continuous antiderivative is not found (too many symbolic parameters). For example in this case Q(6) returns 0 (obviously wrong).

A necessary and sufficient condition is given by

istetra:=proc(a,b,c,d,e,f)
is(`and`(       #((
a>0,b>0,c>0,d>0,e>0,f>0,
2*max(a,b,c)<a+b+c,
2*max(a,e,f)<a+e+f,
2*max(d,b,f)<d+b+f,
2*max(d,e,c)<d+e+c,
LinearAlgebra:-Determinant(
<0,a^2,b^2,c^2,1; a^2,0,f^2,e^2,1; b^2,f^2,0,d^2,1; c^2,e^2,d^2,0,1; 1,1,1,1,0>) >0
))
end;

In tomleslie's answer the triangle inequalities for faces are missing.

A more elegant version is:

IsTetra:=proc(d::Matrix(4, shape=symmetric))
Matrix(3, (i,j)-> d[4,i]^2+d[4,j]^2-d[i,j]^2);
LinearAlgebra:-IsDefinite(%, query = 'positive_definite')
end proc:

Example.

T:=Matrix(4, {(1,2)=3, (1,3)=4, (2,3)=5, (1,4)=4, (2,4)=4, (3,4)=4}, shape='symmetric'):
IsTetra(T);

        true

Try:

K:= f -> `if`(type(f,piecewise), select(type, [op(f)], And(algebraic,Not(undefined))), f);

 

f:=a*x^2 + b*x + c:
max(solve(f = 0, x)) assuming a>0, b^2-4*a*c >= 0;

         

max(solve(f = 0, x)) assuming a<0, b^2-4*a*c >= 0;
     

Note that the largest root is not necessarily positive. It will if a*c<0 or (a*c>0 and a*b<0).

Use assumptions or formal sums

sum(x^n,n=0..infinity) assuming abs(x)<1;
sum(x^n,n=0..infinity,  formal);

 

J := n -> int(sin(Pi*x*n/T)*cos(Pi*x*n/T)/(sin(Pi*x/T)*cos(Pi*x/T)), x);

proc (n) options operator, arrow; int(sin(Pi*x*n/T)*cos(Pi*x*n/T)/(sin(Pi*x/T)*cos(Pi*x/T)), x) end proc

(1)

 

 

K:= unapply(combine(J(k)-J(k-2)), k):

J__even:=Sum(K(2*k), k=1..n/2) assuming n::even;

Sum(sin((4*Pi*k*x-2*Pi*x)/T)*T/(2*Pi*k-Pi), k = 1 .. (1/2)*n)

(2)

J__odd:=x+Sum(K(2*k-1), k=2..(n+1)/2) assuming n::odd;

x+Sum(sin((2*Pi*(2*k-1)*x-2*Pi*x)/T)*T/(Pi*(2*k-1)-Pi), k = 2 .. (1/2)*n+1/2)

(3)

# Compact forms:
 

'J__even'=value(J__even); # n::even

J__even = -((1/4)*I)*T*(-(-exp(-(4*I)*Pi*x/T))^(1/2)*LerchPhi(exp((4*I)*Pi*x/T), 1, (1/2)*n+1/2)*(-exp((4*I)*Pi*x/T))^(1/2)*exp((2*I)*Pi*x*(n+1)/T)+(-exp(-(4*I)*Pi*x/T))^(1/2)*LerchPhi(exp(-(4*I)*Pi*x/T), 1, (1/2)*n+1/2)*(-exp((4*I)*Pi*x/T))^(1/2)*exp(-(2*I)*Pi*x*(n+1)/T)+2*exp((2*I)*Pi*x/T)*(-exp(-(4*I)*Pi*x/T))^(1/2)*arctan((-exp((4*I)*Pi*x/T))^(1/2))-2*exp(-(2*I)*Pi*x/T)*arctan((-exp(-(4*I)*Pi*x/T))^(1/2))*(-exp((4*I)*Pi*x/T))^(1/2))/(Pi*(-exp((4*I)*Pi*x/T))^(1/2)*(-exp(-(4*I)*Pi*x/T))^(1/2))

(4)

'J__odd'=value(J__odd); # n::odd

J__odd = x+((1/4)*I)*T*(exp((2*I)*Pi*x*(n+1)/T)*LerchPhi(exp((4*I)*Pi*x/T), 1, (1/2)*n+1/2)-ln(1-exp(-(4*I)*Pi*x/T))+ln(-exp((4*I)*Pi*x/T)+1)-LerchPhi(exp(-(4*I)*Pi*x/T), 1, (1/2)*n+1/2)*exp(-(2*I)*Pi*x*(n+1)/T))/Pi

(5)

 

 

Download int.mw

It is not possible to use plots:-animate because HeatMap is implemented to display a background picture.
Explore can be used, but I am not sure whether it works in Maple 2016. In Maple 2017+ it's ok.

restart;
p := k -> Matrix(3, 3, (i,j) -> (i+j+k) mod 3):
f:=proc(k) Threads:-Sleep(0.2): Statistics:-HeatMap(p(k)) end:
Explore(  f(k), k=0..8, animate,loop, autorun);

 

When a variable is implicitely declared local, a warning message appears.
The rules for this are simple, see ?local

In

foo:= proc() 
  local x;
  plot(sin(x),x=-Pi..Pi); 
end proc:

local is indeed needed, otherwise x:=10  at top level will produce an error.

Alternatively you may use
plot(sin('x'),'x'=-Pi..Pi);

 

All the floating point computations are done with 1 significant digit. So, sqrt(5) is approximated to 2.  and  (2. -1.)/2.  is 0.5.

See also:

restart;
Digits:=1;
                          Digits := 1
a:=[seq(i/10., i=1..9)];
       a := [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
b:=[seq(i/10., i=9..1,-1)];
       b := [0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1]
add(a) = add(b);
                            6. = 4.
evalf[2](add(a)) = evalf[2](add(b));
                           4.5 = 4.5

 

Maple (at least the recent versions) can compute directly the double integral (without passing to polar coordinates):

int(sqrt(x^2+y^2), x = 0 .. B/2, y = 0 .. b/2) assuming b>0, B>0;

S:=simplify(eval(SA/t, [x=y*t, Log[t]=1/L])):
collect(S,y, expand);

Now you have a polynomial in the variables (L,y) with rational coefficients and you want to guess its coefficients or a generating function. Why do you think that a simple generating function does exist? A more realistic approach would be to come back to the original problem (which produced the expression) and try there.

 

.

 

n >= ceil(fsolve(1/(n+1)! = 0.00001));
                             8 <= n
n >= ceil(fsolve(1/(n+1)! * exp(0.1) = 0.00001));
                             8 <= n

 

Seems to be a bug. Workaround:

ex:=D[2](eta)(t,x)+D[2](phi)(t,x,0)+D[1](phi)(t,x,0);

inds:=[indets(ex)[]]:  cinds:=map(convert, inds, Diff):
subs(inds=~cinds, ex);

with(Interpolation):

# I have chosen a more relevant f

points := [seq(x, x = 0 .. 9, 1.)];
data   := [seq(sin(x), x = 0 .. 9, 1.)];
f := Interpolate(points, data);

points := [0, 1., 2., 3., 4., 5., 6., 7., 8., 9.]

 

data := [0, .8414709848, .9092974268, .1411200081, -.7568024953, -.9589242747, -.2794154982, .6569865987, .9893582466, .4121184852]

 

_m685336448

(1)

f(Pi/2.); # OK works :).
 

HFloat(0.996827543241054)

(2)

plot(f, 0..9);

 

plot('fdiff(f(x), x=t)', t=0..9);

 

int(f, 0..3.14, numeric); # int(sin, 0..Pi) = 2

HFloat(1.9961813393496355)

(3)

 


 

Download Interpolate.mw

First 61 62 63 64 65 66 67 Last Page 63 of 111