## 14453 Reputation

11 years, 269 days

## remove, RealDomain...

This can be done in many ways. Here are 2 ones:

 > restart; a1 := 5; b1 := 3; a2 := 3; b2 := 4; a3 := 3; b3 := 7; eq1 := expand((y-2)^2/b1^2+(x-5)^2/a1^2 = 1): eq2 := expand((y+2)^2/b2^2+(x+1)^2/a2^2 = 1): Sys := {eq1, eq2}; Sol := [solve(Sys, explicit)]: Sol1:=evalf(Sol); L := remove(has, Sol1, I);
 (1)
 > RealDomain:-solve(Sys); evalf(%);
 (2)
 >

## rsolve...

We can easily get the answer in a closed form if we use  rsolve  command. To remove the sign of the sum, it is necessary to split this sum into 3 terms:

 > restart; u := unapply(simplify(value(rsolve({u(1) = 1, u(n+1) = a*u(n)+b[irem(n, 3)]}, u(n)))), n); U := n->a^(n-1)+sum(a^(n-2-3*k), k = 0 .. floor((n-2)*(1/3)))*b[1]+sum(a^(n-3-3*k), k = 0 .. floor((n-3)*(1/3)))*b[2]+sum(a^(n-4-3*k), k = 0 .. floor((n-4)*(1/3)))*b[0];
 (1)
 > V:=normal~(U(n)); # The result in a closed form (without sum)
 (2)
 > # Examples: seq(u(n), n = 1 .. 10); seq(U(n), n = 1 .. 10); eval(V,[a=5,n=100]);
 (3)
 >

Edit.

## Desired output...

The output how OP wants:

P:=combinat:-partition(5):
for p in P[1..-2] do
lprint(sort(p,>)[]);
od:


1, 1, 1, 1, 1
2, 1, 1, 1
2, 2, 1
3, 1, 1
3, 2
4, 1

Edit.

## No solutions...

Your system with the specified conditions has no solutions. Since the system does not contain derivatives with respect to  t , we can easily solve it with  dsolve  command, where arbitrary constants  _C1,...,_C4  are some functions of  t . But if we impose the condition you specified on the function  f4 , then as a result we get that the trigonometric function  cos(2*Pi*x)  is expressed as a linear combination exponential functions with real exponents, which is impossible.

 > restart; sys:={diff(f1(x,t),x)=2*f3(x,t)+3*f1(x,t)-f2(x,t), diff(f2(x,t),x)=-2*f4(x,t)-3.2*f1(x,t)+f2(x,t), diff(f3(x,t),x)=-3*f3(x,t)+3.2*f4(x,t)-0.045*f1(x,t), diff(f4(x,t),x)=f3(x,t)-f1(x,t)};
 (1)
 > sol:=dsolve(sys);
 (2)
 > Sol:=evalf(sol);
 (3)
 > f1, f2, f3, f4:=seq(unapply(rhs(Sol[i]),x,t), i=1..4); exp(-3*x)*cos(2*Pi*x)=f4(x,0); combine(%/exp(-3*x)); applyop(combine@expand,2,%); # This is impossible
 (4)
 >

## Plotting in Maple 2018.2...

I guess these two pictures (a) and (b)  are probably made in Matlab? Of course, you can do something similar in Maple. In the example below, the first plot from your file was made in Maple 2018.2:

g11:=plot3d(UU(x,t),x=0..xbas,t=0..tbas,color="LightBlue",title='NumericalSolution', titlefont=[times,18]):
xz:=plot3d([x,1,z],x=0..1,z=0..1,style=line,color=blue,thickness=0,grid=[3,6]):
tz:=plot3d([0,t,z],t=0..1,z=0..1,style=line,color=blue,thickness=0,grid=[3,6]):
xt:=plot3d([x,t,0],x=0..1,t=0..1,style=line,color=blue,thickness=0,grid=[3,3]):
display(g11,xz,tz,xt,lightmodel=none,tickmarks=[3,3,6],labels=[x,t,"UU(x,t)"],labeldirections=[horizontal,horizontal,vertical], labelfont=[times,14],axes=frame, view=[0..1,0..1,0..1]);


## allvalues...

Total there are 4 solutions:

solve({(13/4)*m-(7/4)*n-3 = 0,
-(17/2)*n*2^n +34*m= 0});
allvalues(%);
evalf(%);

{m = -0.1262032999, n = -1.948663272}, {m = 2., n = 2.}, {m = 1.551915566-4.737602358*I, n =     1.167843193-8.798404378*I}, {m = 1.551915566+4.737602358*I, n = 1.167843193+8.798404378*I}

On the plot we see the 2 real solutions .

## Parameterization by rotation matrix...

It is easy to verify that your curve is the circle in space obtained by rotating the vector  <5, 0, 0>  around the vector  <1, 1, 1> . So we get simpler parametric equations of this circle. The example shows its coloring in 3 colors:

restart;
with(Student[LinearAlgebra]):
A:=RotationMatrix(t, <1,1,1>);
Curve:=convert(A.<5,0,0>,list);  # Parametric equations of the circle
plots:-spacecurve(Curve, t=0..2*Pi, thickness=5, colorscheme=[red,blue,green,red], axes=normal);


## Solution...

Your tangents intersect on the red curve, sol  are its parametric equations (m is the parameter). Besides a static plot for  m=2 , I also made the animation of all this.

 > restart; with(plots): _EnvHorizontalName := 'x'; _EnvVerticalName := 'y'; para := -2*p*x+y^2 = 0; para1 := -2*p1*x+y^2 = 0; t := y-m*x-p/(2*m) = 0; t1 := y+x/m+(1/2)*p1*m = 0; sol := op(solve([t, t1], [x, y])); eliminate({rhs(sol[1]), rhs(sol[2])}, m);   p := 1; p1 := -2; PARA := implicitplot(para, x = -3 .. 3, y = -3 .. 3, color = blue); PARA1 := implicitplot(para1, x = -3 .. 3, y = -3 .. 3, color = green); Tang := implicitplot(eval(t,m=2), x = -3 .. 3, y = -3 .. 3, color = brown); Tang1 := implicitplot(eval(t1,m=2), x = -3 .. 3, y = -3 .. 3, color = aquamarine); A:=display(eval([PARA, PARA1, Tang, Tang1],m=2), view = [-3 .. 3, -3 .. 3], scaling = constrained): B:=plot([eval([x,y],sol)[], m=-3..4], color=red, discont): display(A,B, size=[500,500], view=[-2.5..2.5,-2.5..2.5]); A1:=display(PARA, PARA1, view = [-3 .. 3, -3 .. 3], scaling = constrained): animate(implicitplot,[[t,t1],x = -3 .. 3, y = -3 .. 3, color = [brown,aquamarine]], m=-2.5..3.5, frames=90, background=display(B,A1), size=[500,500], view=[-2.5..2.5,-2.5..2.5]);
 >

## Re, Im, abs...

For plotting, you can use Re, Im  and  abs  commands, which return respectively the real part, imaginary part and module of a complex number. Since you have a function of  2 variables, it is more natural to use  plot3d  command.

 >
 >
 >
 (1)
 >
 (2)
 > P:=subs(y(w)=Y,eval(lhs(Ans[1, 1]), [_C1 = 0, m = 1]))
 (3)
 > implicitplot(Re(P),w=-1..1,Y=-1..1, color=red, gridrefine=4); implicitplot(Im(P),w=-1..1,Y=-1..1, color=blue, gridrefine=4);
 > plot3d(Re(P),w=-1..1,Y=-1..1, grid=[100,100]); plot3d(Im(P),w=-1..1,Y=-1..1, grid=[100,100]); plot3d(abs(P),w=-1..1,Y=-1..1, grid=[100,100]);
 >

## According to the Newton - Leibniz...

F:=int(sqrt(1+((k*Pi)/l*cos((Pi*x)/l))^2), x) assuming k>0,l>0 ;
F1:=simplify(%);
FR:=combine(eval(F1,x=b)-eval(F1,x=a)); # The final result


## A radical solution to the problem...

I can not confirm this behavior, in Maple 2018.2 everything works as expected. But you can radically solve the problem and not use this option at all. Just first find all the discontinuity points using  discont  or  fdiscont  commands, and then plot your function by cutting these points by small neighborhoods as in the example below.

restart;
discont(frac(x^2/3), x);
allvalues(%);
seq(plot(frac(x^2/3)*3, x=sqrt(3)*sqrt(n)+0.001..sqrt(3)*sqrt(n+1)-0.001), n=0..9):
plots:-display(%, scaling=constrained, size=[900,400]);


## map...

Or use the  map  command, which causes Maple to sequentially calculate the integral of each summand:

map(int, g, theta = 0 .. Pi)  assuming r>0;

Axel's approach does not work in Maple 2018.

Edit. Of course, as acer showed in his comment, the  IntegrationTools:-Expand  command solves the problem.

## Solution with eval and diff commands...

I think this task is not too simple for a beginner, since there are many different objects in it. Here is a solution using  eval  and  diff  commands (the differentiation operator  D  does not seem to work for vector functions for Maple <=2018). A detailed commentary is provided for each line of code so that the beginner understands what it is doing. I gave different names for the parameters of the original curve  and the tangent line  s  (they are often confused but they are not related to each other). Ranges  t=0..1.4  and  s=-0.3..0.4  are chosen so that everything looks beautiful and informative.

restart;
f:=[t,t^2,t^3]; # The parametric equations of the original curve
t0:=1; # The value of the parameter at the tangency point
P:=eval(f,t=t0); # The coordinates of the tangency point
df:=eval(diff(f,t), t=t0); # The coordinates of the tangent vector at t=t0
with(plots):
A:=spacecurve(f, t=0..1.4, color=red, thickness=2,labels=[x,y,z]): # The plot of the original curve
T:=map(p->s*p,df)+P; # The parametric equations of the tangent line
B:=spacecurve(T, s=-0.3..0.4, color=blue, thickness=3): # The plot of the tangent line
C:=pointplot3d(P,color=red,symbol=solidsphere,symbolsize=10): # The plot of the tangency point
display(A,B,C, axes=normal, orientation=[-35,75], scaling=constrained); # All at once


I significantly reduced the  stepsize  option, slightly increased  the ranges for  x  and  y , and removed unused lines of code.

 >
 >
 >

 >

 >

 (1)

 (2)

 (3)

 (4)

 \left[ \begin {array}{cc} -2&0\\ \noalign{\medskip}0&0\end {array}  \right]

 (5)

 (6)

 (7)

 (8)

 (9)

## Procedure...

Here is the procedure that inserts a rational number with the lowest denominator (vv's assumption) between any 2 list items. If there are several such numbers, then the smallest number is inserted.

FindSamples:=proc(sourcesamples)
local N, P;
N:=nops(sourcesamples);
P:=proc(a,b)
local a1, b1, m1, n, m;
if a=b then error "Should be a<>b" fi;
a1,b1:=op(convert(sort([a,b],(x,y)->evalf(x)<evalf(y)),rational));
for n from 1 do
m1:=a1*n;
m:=if(type(m1,integer),m1+1,ceil(m1));
if is(m/n>a1) and is(m/n<b1) then return m/n fi;
od;
end proc:
[ceil(sourcesamples[1])-1, seq(op([sourcesamples[i],P(sourcesamples[i],sourcesamples[i+1])]), i=1..N-1),sourcesamples[N],floor(sourcesamples[N])+1];
end proc:



sourcesamples :=[evalf(-1-sqrt(7)), -2, 1, evalf(-1 + sqrt(7)), 2];
FindSamples(sourcesamples);

The main role in this procedure is played by the subprocedure  P , which returns a rational number between   and   with the lowest denominator. Here is a specific example of the application of this procedure: Take 2 numbers 3.14 and 3.15 (these are approximations of the number  Pi  with 3 digits with a deficiency and an excess) and find the intermediate number with the lowest denominator:

P:=proc(a,b)
local a1, b1, m1, n, m;
if a=b then error "Should be a<>b" fi;
a1,b1:=op(convert(sort([a,b],(x,y)->evalf(x)<evalf(y)),rational));
for n from 1 do
m1:=a1*n;
m:=if(type(m1,integer),m1+1,ceil(m1));
if is(m/n>a1) and is(m/n<b1) then return m/n fi;
od;
end proc:
P(3.14, 3.15);


Edit. The procedure  P  has been improved. Now it works much faster.

 4 5 6 7 8 9 10 Last Page 6 of 227
﻿