vv

14242 Reputation

20 Badges

10 years, 344 days

MaplePrimes Activity


These are answers submitted by vv

In packages such as VectorCalculus or DifferentialGeometry  the functions are usually supposed to be "sufficiently smooth".
For a "pathological" function it's better to use the definition.
The directional derivative of F in the direction of the unit vector V is:
Limit((F(X+t*V)-F(X))/t, t=0);
In our case:

F:=(x,y) -> min(abs(x),abs(y)):
(F(0-t/sqrt(2), 0+t/sqrt(2)) - F(0,0))/t;
limit(%, t=0);

        

        undefined

It is a bug. If mysol is given as   lhs-rhs=0  or lhs-rhs, it works.

odetest((lhs-rhs)(mysol) = 0, [ode,ic]);
      [0,0]
 

simpSum:=proc(S::specfunc(Sum))
local o1:=op(1,S), eq:=op(2,S), n,a,b,c;
if not type(eq, name=range) then return S fi;
n:=lhs(eq); a,b:=op(rhs(eq));
c:=max(select(type, [solve(o1,n)], integer));
if c>=a and c <= b then
  sum(o1, n=a..c-1) + Sum(o1, n=c+1..b)
else S fi;
end:

simpSum(Sum(n*x^n, n = 0 .. 20));

           

S:=Sum(n*(n-4)*x^(n^2), n = 0 .. infinity);
simpSum(S);

                     

             

S := Sum(epsilon^k*v(k,t)/k!, k = 0 .. infinity);

                  

S1 := diff(S, epsilon);

                       
 S1ok:=simpSum(S1);                   

                      

limit(%, epsilon=0);

                       

The result is correct. diff(x^n,x)  is 0 for n=0, not for n=1.
diff(Sum(x^n, n = 0 .. infinity), x) is correct too. Note that diff(Sum(f,...), x)  simply applies diff to f.
Of course, it is possible to simplify by eliminating the 0 term, but unfortunately it has to be done by hand (if you want).

S:=diff(Sum(x^n, n = 0 .. infinity),x);
eval(S, 'n = 0 .. infinity' = 'n = 1 .. infinity');

(In this case you may simply use eval(S, 0=1).)

I think that setting interface(typesetting=extended) solves the problem, but I cannot check this in Maple 2015.
But another problem is that the continued fraction appears as 1/( 1/... + 1). To change this, use inert operators g := x -> 1/(1 %+ x)

1 + something   is not  1.  It corresponds to Not(something).

with(GraphTheory):
G := RandomGraphs:-RandomGraph(8, .5):
u:=3;
DrawGraph(G);
add(map2(Degree, G, Neighbors(G,u)));

 

Here is the adaptation of the answer to your previous question. Note that now we must accept numerical solutions.

restart

f:=(exp(x^2)+exp(1))/(exp(x^2)-exp(1))+3;

(exp(x^2)+exp(1))/(exp(x^2)-exp(1))+3

(1)

 

 

b:=0: p:=0: a:=-c:

circ := (x-p)^2+(y-q)^2-r2: F:=unapply(eval(circ, y=f), x):
  

sys:=numer(simplify([F(b),F(c), D(F)(c)])):

fsolve(sys);

{c = -1.722111366, q = 3.005815153, r2 = 4.707895631}

(2)

assign(%);r1:=sqrt(r2);

2.169768566

(3)

plots:-display(
  plot(f, x=-5..5, view=-2..8,color=red, discont),
  plot([p+r1*cos(t), q+r1*sin(t), t=0..2*Pi]), scaling=constrained);

 

 

 

 

restart;

f := arcsin(x)/(1+(-x^2+1)^(1/2));

arcsin(x)/(1+(-x^2+1)^(1/2))

(1)

int(f,x);

Error, (in Utils:-TransformAndApply) numeric exception: division by zero

 

f1:=rationalize(f);

-(-1+(-x^2+1)^(1/2))*arcsin(x)/x^2

(2)

J:=Int(f1,x)

Int(-(-1+(-x^2+1)^(1/2))*arcsin(x)/x^2, x)

(3)

#map(rationalize,J);

F:=value(%);

(1/2)*arcsin(x)^2+(2*I)*arcsin(x)-(-(-x^2+1)^(1/2)+1+I*x)*arcsin(x)/x-2*ln(I*x+(-x^2+1)^(1/2)+1)

(4)

simplify(diff(F,x)-f);

0

(5)

plot(F,x=-1..1);

 

 

IntegrationTools:-Change(J, arcsin(x)=t);

Int(-(-1+(-sin(t)^2+1)^(1/2))*t*cos(t)/sin(t)^2, t)

(6)

simplify(%) assuming t<Pi/2,t>-Pi/2;

Int(t*cos(t)/(cos(t)+1), t)

(7)

value(%);

(1/2)*t^2-t*tan((1/2)*t)+ln(1+tan((1/2)*t)^2)

(8)

F1:=eval(%, t=arcsin(x));

(1/2)*arcsin(x)^2-arcsin(x)*tan((1/2)*arcsin(x))+ln(1+tan((1/2)*arcsin(x))^2)

(9)

simplify(diff(F1,x)-f);

0

(10)

F2:=eval(F1,tan = (u -> sin(2*u)/(1+cos(2*u))));

(1/2)*arcsin(x)^2-arcsin(x)*x/(1+(-x^2+1)^(1/2))+ln(1+x^2/(1+(-x^2+1)^(1/2))^2)

(11)

simplify(diff(F2,x)-f);

0

(12)

 

 

 

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.

First 27 28 29 30 31 32 33 Last Page 29 of 122