vv

1734 Reputation

9 Badges

1 years, 121 days

MaplePrimes Activity


These are replies submitted by vv

@tomleslie 

p := x^4-17001090662707204*x^2+4:
s1:=select(u -> is(u>0), [solve(p,explicit)]);

    s1 := [46099201*sqrt(2)-37639840*sqrt(3), 46099201*sqrt(2)+37639840*sqrt(3)]
evalf(s1); evalf[30](s1);
    [-0.3e-1, 1.303882305*10^8]
    [1.53388077417338*10^(-8), 1.30388230537526675954819973540*10^8]

# So, s1 is correct; the first solution is >0 but evalf needs >10 digits to see this

s2:=select(type, allvalues~([solve(p)]), positive &under evalf);
    s2 := [-46099201*sqrt(2)+37639840*sqrt(3), 46099201*sqrt(2)+37639840*sqrt(3)]
evalf(s2); evalf[30](s2);
[0.3e-1, 1.303882305*10^8]
[-1.53388077417338*10^(-8), 1.30388230537526675954819973540*10^8]
#s2 is not correct

s3:=solve({p, x>0});
    s3 := {x = RootOf(_Z^4-17001090662707204*_Z^2+4, 0. .. 0.625e-1)}, {x = 1.303882305*10^8}
evalf(s3); evalf[30](s3);
    {x = 1.533880774*10^(-8)}, {x = 1.303882305*10^8}
    {x = 1.53388077417339100429211486174*10^(-8)}, {x = 1.303882305*10^8}

# So, s3 is correct
# It seems that I was wrong and only Carl's solutions contains negative numbers.
# This is not a bug though because s2 selects the positive solutions using the current Digits (=10)
# while s1 and s3 are obtained internally and Digits is most probably increased.
# [actually I was surprised in the first post when it seemed that s3 <> s1]
#
#  I hope that your head is OK now  :-)

 

 

 

 

Actually both slick/non slick methods fail for the polynomial
p := x^4-17001090662707204*x^2+4;
I'd suggest:

select(u -> is(u>0), [solve(p,explicit)]);

which seems to work without modifying Digits.

 

 

@Zeineb 

I said that |f(z)| < 1 at the corners i.e. for x,y in {- (n+1/2)*Pi , (n+1/2)*Pi },  n in Z. And this is true.

The general situation is:

|f(z)| < 1  if and only if  

x in R  and  n*Pi + Pi/4 < y < n*Pi + 3*Pi/4  for some integer n.

@Kitonum 
The OP wanted this way. Otherwise is even simpler:
GetCoeff:=proc(f,u, x)  # x = the set of vars
  if u=0 or u=1 then return eval(f,x=~0) fi;
  eval(foldl(coeff,f,op(u)), x=~0);
end proc:

@Rouben Rostamian  

eval( m, [x=Pi*(n+1/2),y=Pi*(n+1/2)]):  # it's enough, cos,cosh being even
simplify(%) assuming n::integer:
convert(%,tanh);

              tanh((1/2)*Pi*(2*n+1))^2
So, <1.

 

@Kitonum 

There is another problem. If C is the cuboid [a1,a2] x [b1,b2] x [c1,c2], this approach plots f( boundary(C) ) , and this is not necessarily the boundary of f(C),  which is supposed to be plotted.

@Markiyan Hirnyk 

int( sin(x^2 - y^2), dxdy )  = 0

(by symmetry, the integrand is odd)

@toandhsp 

You may produce a warning (or an error if you prefer). E.g.

eq:=proc(L::listlist)
  local e:=primpart(LinearAlgebra:-Determinant(<Matrix([[x,y,z],L[]])|<1,1,1,1>>));
  if e=0 then WARNING("Collinear points: %1",L) end if;
  e*signum(lcoeff(e))=0
end proc:

 

@toandhsp 

eq:=proc(L::listlist,x::name,y::name,z::name)
  primpart(LinearAlgebra:-Determinant(<Matrix([[x,y,z],L[]])|<1,1,1,1>>));
  %*signum(lcoeff(%))=0
end:

Note that this also works if the list contains floats.

@Kitonum 

If the polygon is not "convex", the order of the points is essential.
The triangles are colored in the order A1A2A3, A1A3A4, A1A4A5,...
so,  see:
PolyOnUnitSphere([ <1,2,1>, <1,0,0>, <0,1,0>, <0,0,1>]);

Probably inserting numbers near vertices as textplot could be useful.

Best regards,
V.A.

 

Indeed, e.g.

restart;
PolyOnUnitSphere:=proc(A::list(Vector[column](3)),pt:=true,sph:=true) #A[i] = directions (or points on sphere)
uses LinearAlgebra,plots,plottools;
local a:=map(Normalize,A,2), n:=nops(A), u,v,i, L,P:=NULL;
L:= seq( plot3d(1.01*Normalize(a[1]+v*(a[i]+u*(a[i+1]-a[i])-a[1]),2), u=0..1,v=0..1,color=red,style=surface,_rest), i=2..n-1);
if pt=true then P:= pointplot3d(eval(1.01*~a),symbolsize=20,color=blue,symbol=solidsphere)  fi;
display(`if`(sph=true,sphere(style=surface),NULL), L, P);
end:

PolyOnUnitSphere([ <0,0,1> , <1,0,0>, <1,1,-1.5>, <1,2,1>, <0,1,0>]);

 

@Markiyan Hirnyk 

I know the definitions (it's a part of my job to know them). I tried to explain the Maple point of view (that the argument of f is supposed to be an integer); it is mathematically OK. It would be easy in Maple to define f(x)=0 for x in R \ N but probably the actual implementation has some advantages (e.g. speed).

@sand15athome 

So, we have different opinions.

Let P be a discrete probability in N = {0,1,....}.
This means that P is defined on 2^N --> [0,1], (it is a measure).
Its probability function is
f : N --> R,  f(n) = P({n}).
Here f(5.1) does not make sense.
Maple has an extension F of f and returns F(5.1) instead. That's all.

In the case of a continuous distribution we have the ProbabilityDensityFunction.
For the Normal(0,1) distribution it is
f(t) = (1/2)*sqrt(2)*exp(-(1/2)*t^2)/sqrt(Pi),  t in R.
But here also, t=I (=sqrt(-1)) does not produce an error, f(I) is actually a real number, and I think that nobody sees this as a bug.

As a rule, Maple tries to use the largest possible domain of definition for a function.

 

We all know that Maple has bugs. But any CAS has.
It would be nice if Maple solves the bugs faster and maintains a list of known bugs and their status.
In your other thread (about Probability) the bugs are clear.
Here, ProbabilityFunction(X, 1.1) = 0 is OK: 1.1 is not in the sample (within current precision). Note that X is not supposed to take only integer values (unlike Geometric). The situation is not perfect but acceptable in my opinion (as long as it is documented).

I don't see any bug.

ProbabilityFunction(Geometric(p), t);
is defined clearly as piecewise(t < 0, 0, p*(1-p)^t)  for 0 < p <=1,  t::integer.
The fact that it returns values instead of an error when t is not integer should not be a problem, and it is easier then to work with floats (no need for round). [Think of n! for noninteger n].

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