vv

13922 Reputation

20 Badges

10 years, 9 days

MaplePrimes Activity


These are answers submitted by vv

MROUND := (x,m) -> round(x/m)*m;

(m can be noninteger)

Here is a more general and robust (I think) procedure. I borrowed from mmcdara the examples and the idea to consider only rational functions.

restart;

C3:=proc(f::ratpoly, x, {plot::truefalse:=false})
  local p,q,a,b,c,r2,r1, sol,solnum, circ := (x-p)^2+(y-q)^2-r2,
        fn:=(u -> fnormal(evalf(u),Digits,Float(1,-Digits+3)));
  numer(eval(circ, y=f));
  rem(%, (x-a)^2*(x-b)^2*(x-c)^2, x);
  solve([coeffs(%,x)], [a,b,c,p,q,r2], explicit);
  select(u -> ( fn(eval(a,u))<fn(eval(b,u)) and fn(eval(b,u))<fn(eval(c,u)) ), %);
  sol:=map(rhs~,%); #a, b, c, p, q, r2  
  if not type(sol,list) or sol=[] then return "No solution!" fi;
  solnum:=simplify(map(fn, sol[1]), zero);
  if plot then
    a, b, c, p, q, r2 := solnum[]; r1:=sqrt(r2);
    print(plots:-display(
     :-plot(f, x=a-1..c+1, view=q-r1-1..q+r1+1,color=red, discont),
     :-plot([p+r1*cos(t), q+r1*sin(t), t=0..2*Pi]), scaling=constrained));
  fi;
  sol, solnum  
end proc:

C3(1/(x^2-2*x), x, plot);

 

[[1-2^(1/2), 1, 1+2^(1/2), 1, 1/2, 9/4]], [-.414213562, 1., 2.414213562, 1., .5000000000, 2.250000000]

(1)

C3((1/2)*(2+x)/(x*(x+1)), x, plot);

 

[[-(1/6)*(-2*(46+(6*I)*237^(1/2))^(2/3)-(3*I)*237^(1/2)+(22*(46+(6*I)*237^(1/2))^(4/3)+(66*I)*(46+(6*I)*237^(1/2))^(1/3)*237^(1/2)-363*(46+(6*I)*237^(1/2))^(2/3)-(414*I)*237^(1/2)+506*(46+(6*I)*237^(1/2))^(1/3)+4812)^(1/2)-11*(46+(6*I)*237^(1/2))^(1/3)-23)/(46+(6*I)*237^(1/2))^(2/3)-(1/6)*(46+(6*I)*237^(1/2))^(1/3)-(11/3)/(46+(6*I)*237^(1/2))^(1/3)-2/3, (1/6)*(-2*(46+(6*I)*237^(1/2))^(2/3)-(3*I)*237^(1/2)+(22*(46+(6*I)*237^(1/2))^(4/3)+(66*I)*(46+(6*I)*237^(1/2))^(1/3)*237^(1/2)-363*(46+(6*I)*237^(1/2))^(2/3)-(414*I)*237^(1/2)+506*(46+(6*I)*237^(1/2))^(1/3)+4812)^(1/2)-11*(46+(6*I)*237^(1/2))^(1/3)-23)/(46+(6*I)*237^(1/2))^(2/3), (1/6)*(46+(6*I)*237^(1/2))^(1/3)+(11/3)/(46+(6*I)*237^(1/2))^(1/3)-1/3, 0, -1, 4]], [-1.551387524, -.5731827454, 1.124570270, 0., -1., 4.]

(2)

C3(-(1/2)*(3*x+1)/(x*(x+3)), x, plot);

 

[[-10/3-(1/6)*(-184+(2*I)*10058^(1/2))^(1/3)-7/(-184+(2*I)*10058^(1/2))^(1/3)+(1/6)*(I*10058^(1/2)+10*(-184+(2*I)*10058^(1/2))^(2/3)-(4782+42*(-184+(2*I)*10058^(1/2))^(4/3)+(42*I)*(-184+(2*I)*10058^(1/2))^(1/3)*10058^(1/2)+(552*I)*10058^(1/2)-1323*(-184+(2*I)*10058^(1/2))^(2/3)-3864*(-184+(2*I)*10058^(1/2))^(1/3))^(1/2)+21*(-184+(2*I)*10058^(1/2))^(1/3)-92)/(-184+(2*I)*10058^(1/2))^(2/3), -(1/6)*(I*10058^(1/2)+10*(-184+(2*I)*10058^(1/2))^(2/3)-(4782+42*(-184+(2*I)*10058^(1/2))^(4/3)+(42*I)*(-184+(2*I)*10058^(1/2))^(1/3)*10058^(1/2)+(552*I)*10058^(1/2)-1323*(-184+(2*I)*10058^(1/2))^(2/3)-3864*(-184+(2*I)*10058^(1/2))^(1/3))^(1/2)+21*(-184+(2*I)*10058^(1/2))^(1/3)-92)/(-184+(2*I)*10058^(1/2))^(2/3), (1/6)*(-184+(2*I)*10058^(1/2))^(1/3)+7/(-184+(2*I)*10058^(1/2))^(1/3)-5/3, -2, 10/9, 289/81]], [-3.745060582, -1.137576607, -.117362812, -2., 1.111111111, 3.567901235]

(3)

C3(x/(x^2+1), x);

"No solution!"

(4)

 


Download c3.mw

(mapleprimes does not render all the output)

restart;
f:=x->1/(x^2-2*x):
P:=plot(f, -4..4, color=red, discont, view=-4..4, scaling=constrained):
#normal at (a, f(a));
y - f(a) + 1/D(f)(a)*(x-a):
# center of the circle is (1,b)
b:=solve(eval(%, x=1), y):
(b-f(1))^2 = (1-a)^2 + (b-f(a))^2:
A:=select(u->is(u>2), {solve(%)}):
for a1 in A do
  b1:= simplify(eval(b, a=a1)); r1:=abs(b1-f(1));
  Q:=plot( [1+r1*cos(t), b1+r1*sin(t), t=0..2*Pi]):
  print( plots:-display(P,Q, title=typeset(Center=[1,b1],`, r`=r1)) );
od:

You can make a "custom lightmodel" using color

restart;
g:=exp(-x^2-y^2):
grad:=[diff(g,x),diff(g,y),-1]:
grad:=-grad/~sqrt(add(grad^~2)):
light:=[-1/sqrt(3),-1/sqrt(3),1/sqrt(3)]:
c:=add(grad*~light):
LED := plot3d(<3 + cos(t)*cos(s), cos(t)*sin(s), sin(t)>, s = 0..2*Pi, t =-Pi/2..Pi/2, 
              color = "Yellow", style=surface, lightmodel = none):
plots:-display(LED, plot3d(g, x=-2..2, y=-2..2, color=[1,1,c, colortype=HSV], style=surface),scaling=constrained);

subs does not evaluate. If you use

Cq:= proc(x,y)
  evalb(x=eval(y,{q2=q1,q1=q2}))
end proc;

everything works as expected. 

The integrals do not make much sense.
You integrate wrt RR = 0..R an indefinite integral. But the indefinite integral is determined up to an (additive) unknown constant.
So, the final result will be also up to a constant, hence it is useless.

You have the derivative of a function (defined by a piecewise expression) at the point t=0 (not an equation!).
The function is not derivable at this point because it is not correctly defined for t<0  (ln(0)).
You probably want the right-derivative, but Maple has only two-sided derivatives.
(It can be computed as a right-limit if you want, or simply remove the first branch in piecewise).
 

It actually works. I added the list type and set the base b to 10.

restart
`&*` := proc(A::list, B::list, b := 10, d := 4) 
    local i, k, c := 0; 
    [seq(irem(c + add(A[i]*B[k+1-i], i = 1 .. k), b, 'c'), k = 1 .. d)]
 end proc:
[4,3,2,1] &* [5,4,3,2]
#                          [0, 3, 7, 3]

1234*2345 mod 10^4;   # check
#                              3730

 

Motto: "In mathematics you don't understand things. You just get used to them" (John von Neumann).

A mathematician has an "abstract mind" so that in order to "see" R^13, he considers R^n and then takes n=13.
(This seems to be a joke, but basically it is not.)

Coming back more seriously to your example, observe first that in an abstract mathematical context such as Measure Theory,
Maple cannot help much. The visualization of a countable union of nested intervals should have been met in a Calculus course.

Anyway, in an abstract sigma-algebra, a visualization is out of the question; all we can do is to try special cases e.g. taking the space as finite, R, or R^2.

For the proof of the theorem 2.1 it is essentially enough to use the equivalence: 
sigma(A) = sigma(B)  iff  A subset sigma(B) and B subset sigma(A).

Visualizations are very seldom possible. Take for instance the proofs of the theorems:
1. Any Borel set is Lebesgue measurable.
2. There are subsets in R which are not Borel
(based on cardinality or on a Vitali-type construction).

restart;
JointNum := 3;                   
assign( seq(evaln(alpha[i]), i = 1 .. JointNum) = (0, 0, 0) );

If alpha is free (not assigned) then evaln can be omitted.

You cannot compute the indefinite integral numerically. Use:

seq(int(fN(x, 1.2), x=0..X), X=0..1,0.1);
0., 0.03008394009, 0.05955125696, 0.08778683199, 0.1141785882,   0.1381190848, 0.1590071982, 0.1762499145, 0.1892642546,  0.1974793487, 0.2003386758


 

The proof of the theorem: In a quadrilateral circumscribed to an ellipse, the line passing through the middle of the diagonals passes through the centre of the ellipse.
It is enough to have a circle instead of an ellipse (just take a projection). So, the proof:

restart;
x*cos(alpha[i])+y*sin(alpha[i])-1, x*cos(alpha[j])+y*sin(alpha[j])-1:
T:=unapply( eval([x,y], solve({%},[x,y])[]), [i,j]): # intersection for two tangents;
Slope:= P -> P[2]/P[1]:                              # the slope of the line OP
simplify( Slope((T(1,2)+T(3,4))/2) - Slope((T(1,3)+T(2,4))/2) );

        0

q.e.d.

msolve(5*x=7, 16);

                     {x = 11}

 

 w:=(x,y) -> (x^2 - y^2, 2*x*y)

proc (x, y) options operator, arrow; x^2-y^2, 2*x*y end proc

(1)

expform:=proc(w::procedure, t::name:=t_)
  local L:=w((Re,Im)(exp(2*Pi*I*t)));
  convert(L[1]+I*L[2],exp) assuming t::real
end:

expform(w, t);

exp((4*I)*Pi*t)

(2)

W:=unapply(%,t);

proc (t) options operator, arrow; exp((4*I)*Pi*t) end proc

(3)

expform((x,y)->(-y,x), t);

I*exp((2*I)*Pi*t)

(4)

exp(simplify(ln(%), symbolic)); #optional

exp(((1/2)*I)*Pi*(1+4*t))

(5)

 

There are several facts to consider.

Not all special functions are standardized. Different authors / software may use distinct conventions (notations).

 

In Maple, EllipticPi(nu, k)  i.e. the complete elliptic integral of the third kind  is defined by the integral

 

Ell := Int(1/((-nu*t^2 + 1)*sqrt(-t^2 + 1)*sqrt(-k^2*t^2 + 1)), t = 0 .. 1)

Int(1/((-nu*t^2+1)*(-t^2+1)^(1/2)*(-k^2*t^2+1)^(1/2)), t = 0 .. 1)

(1)

(Principal Cauchy value (CPV) for nu>1, not mentioned in the help file)

EllipticPi(4,1/3);evalf(%);

EllipticPi(4, 1/3)

 

-0.2328295621e-1-.9197641499*I

(2)

but Mathematica (or WolframAlfa)  uses  k^2  instead of k.

 

So, for EllipticPi(4, 1/3)

WolframAlfa gives   -0.0810909715...

 

but for EllipticPi(4, 1/9)   it gives gives   -0.0232829562...

 

As you see, now the result is the same as in Maple's real part.

 

Let's compute the CPV for Ell in this case. We must do some manipulations because in general the numerical integrators in a CAS do not like CPV.
(Maple knows CPV for symbolic computations only).

 

a:=eval(Ell,[nu=4,k=1/3]);

Int(1/((-4*t^2+1)*(-t^2+1)^(1/2)*(-(1/9)*t^2+1)^(1/2)), t = 0 .. 1)

(3)

evalf(a);     # no CPV  
evalf(Im(a)); # obviously, the integrand is real

Float(undefined)

 

0.

(4)

f:=unapply(op(1,a), t);

proc (t) options operator, arrow; 1/((-4*t^2+1)*(1-t^2)^(1/2)*(-(1/9)*t^2+1)^(1/2)) end proc

(5)

ff:=simplify(f(t)+f(1-t)) assuming t>0,t<1;

-3/((4*t^2-1)*(-t^2+1)^(1/2)*(-t^2+9)^(1/2))-3/(t^(1/2)*(-t+2)^(1/2)*(-t^2+2*t+8)^(1/2)*(4*t^2-8*t+3))

(6)

evalf[15](Int(ff, t=0..1/2));

-0.232829562094268e-1

(7)

So, the imaginary part is 0.

The presence of the imaginary part seems to be a bug; maybe the Maplesoft programmer simply considered that it is not important (?).

First 26 27 28 29 30 31 32 Last Page 28 of 120