vv

13065 Reputation

20 Badges

9 years, 22 days

MaplePrimes Activity


These are answers submitted by vv

intat(f(x), x=a)  computes an antiderivative F(x) of f(x) and returns F(a).

Two antiderivatives may differ by an additive constant, depending e,g. on the method used to compute it.

 intat is useful when it is desired to subsequently perform a change of variable, or in the case of symbolic manipulation of the solutions of differential equations.

 

So, for example,

intat(x^2, x=1);

1/3

(1)

has not much sense, unless you know which antiderivative was computed.

 

restart;

f := sin(x)*cos(x) + 1/x;

sin(x)*cos(x)+1/x

(2)

F1 := intat(f, x=a);

ln(a)+(1/2)*sin(a)^2

(3)

F2 := intat(simplify(f), x=a);

ln(a)-(1/4)*cos(2*a)

(4)

simplify(F1-F2);

1/4

(5)

F3 := Int(f, x=0..a); value(%);

Int(sin(x)*cos(x)+1/x, x = 0 .. a)

 

infinity

(6)

Note. When Intat(f(x), x=a)  is replaced by Int(f(x). x=0..a), odesolve will verify it, but 0 could be out of dom(f), so, nonsense!

 

1/2*evalf(Int(min(-6*cos(t), 2-2*cos(t))^2, t=Pi/2..3*Pi/2));
identify(%);
#                          15.70796327
#                              5 Pi

Using Edge is ok, Firefox too; maybe try some font settings:

 

The answer for your previous problem works here too.

restart;
eq:=x^2+y^2-N*(1+x*y):  # [x=0, y=sqrt(N)] and [x=sqrt(N),y=0] are solutions!
XY:=[X=x, Y=2*y-x*N]: xy:=solve(XY,[x,y])[]:
EQ:=simplify(eval(eq,xy)):
for N in [9, 49 , 729] do
  SOL:=isolve(EQ):
  sol[N]:=map(u -> simplify(eval(xy, u)), [SOL]);
  num:={seq}(simplify(sol[N])[],_Z1=0..2);
  print('N'=N, select(type,num, [anything=integer,anything=integer]));
od:

N = 9, {[x = -1497363, y = -13307787], 
  [x = -1497363, y = -168480], [x = -168480, y = -1497363], 
  [x = -168480, y = -18957], [x = -18957, y = -168480], 
  [x = -18957, y = -2133], [x = -2133, y = -18957], 
  [x = -2133, y = -240], [x = -240, y = -2133], 
  [x = -240, y = -27], [x = -27, y = -240], [x = -27, y = -3], 
  [x = -3, y = -27], [x = -3, y = 0], [x = 0, y = -3], 
  [x = 0, y = 3], [x = 3, y = 0], [x = 3, y = 27], 
  [x = 27, y = 3], [x = 27, y = 240], [x = 240, y = 27], 
  [x = 240, y = 2133], [x = 2133, y = 240], 
  [x = 2133, y = 18957], [x = 18957, y = 2133], 
  [x = 18957, y = 168480], [x = 168480, y = 18957], 
  [x = 168480, y = 1497363], [x = 1497363, y = 168480], 
  [x = 1497363, y = 13307787]}

N = 49, {[x = -96687343207, y = -4735705783543], 
  [x = -96687343207, y = -1974033600], 
  [x = -1974033600, y = -96687343207], 
  [x = -1974033600, y = -40303193], 
  [x = -40303193, y = -1974033600], [x = -40303193, y = -822857], 
  [x = -822857, y = -40303193], [x = -822857, y = -16800], 
  [x = -16800, y = -822857], [x = -16800, y = -343], 
  [x = -343, y = -16800], [x = -343, y = -7], [x = -7, y = -343], 
  [x = -7, y = 0], [x = 0, y = -7], [x = 0, y = 7], 
  [x = 7, y = 0], [x = 7, y = 343], [x = 343, y = 7], 
  [x = 343, y = 16800], [x = 16800, y = 343], 
  [x = 16800, y = 822857], [x = 822857, y = 16800], 
  [x = 822857, y = 40303193], [x = 40303193, y = 822857], 
  [x = 40303193, y = 1974033600], [x = 1974033600, y = 40303193], 
  [x = 1974033600, y = 96687343207], 
  [x = 96687343207, y = 1974033600], 
  [x = 96687343207, y = 4735705783543]}

N = 729, {[x = -4052517025117644747, y = -2954279352292037818803], 
  [x = -4052517025117644747, y = -5559018725201760], 
  [x = -5559018725201760, y = -4052517025117644747], 
  [x = -5559018725201760, y = -7625554438293], 
  [x = -7625554438293, y = -5559018725201760], 
  [x = -7625554438293, y = -10460313837], 
  [x = -10460313837, y = -7625554438293], 
  [x = -10460313837, y = -14348880], 
  [x = -14348880, y = -10460313837], [x = -14348880, y = -19683], 
  [x = -19683, y = -14348880], [x = -19683, y = -27], 
  [x = -27, y = -19683], [x = -27, y = 0], [x = 0, y = -27], 
  [x = 0, y = 27], [x = 27, y = 0], [x = 27, y = 19683], 
  [x = 19683, y = 27], [x = 19683, y = 14348880], 
  [x = 14348880, y = 19683], [x = 14348880, y = 10460313837], 
  [x = 10460313837, y = 14348880], 
  [x = 10460313837, y = 7625554438293], 
  [x = 7625554438293, y = 10460313837], 
  [x = 7625554438293, y = 5559018725201760], 
  [x = 5559018725201760, y = 7625554438293], 
  [x = 5559018725201760, y = 4052517025117644747], 
  [x = 4052517025117644747, y = 5559018725201760], 
  [x = 4052517025117644747, y = 2954279352292037818803]}

With sol[N] you may inspect the general solution depending on _Z1.


 

 

isolve is old and should be updated.

Actually isolve knows to solve generalized Pell equations. It only needs a little help to convert the diophantine quadratic to generalized Pell form.

At the end we must filter the obtained numeric solutions in order to eliminate the non-integer ones due to the form of xy, see below.

 

restart;

eq:=x^2 - 12*x*y + 6*y^2 + 4*x + 12*y - 3:

XY:=[X = 2*x-12*y+4, Y = -5*y+3]; # via complete squares

[X = 2*x-12*y+4, Y = -5*y+3]

(1)

xy:=solve(XY,[x,y])[];

[x = (1/2)*X+8/5-(6/5)*Y, y = -(1/5)*Y+3/5]

(2)

EQ:=simplify(eval(eq,xy));

(1/4)*X^2+19/5-(6/5)*Y^2

(3)

SOL:=isolve( EQ ):

sol:=map(u -> simplify(eval(xy, u)), [SOL]);

[[x = (1/10)*(30^(1/2)+7)*(11-2*30^(1/2))^_Z1+8/5+(1/10)*(-30^(1/2)+7)*(11+2*30^(1/2))^_Z1, y = (1/60)*(-30^(1/2)+12)*(11-2*30^(1/2))^_Z1+3/5+(1/60)*(30^(1/2)+12)*(11+2*30^(1/2))^_Z1], [x = (1/10)*(3*30^(1/2)-17)*(11-2*30^(1/2))^_Z1+8/5+(1/10)*(-3*30^(1/2)-17)*(11+2*30^(1/2))^_Z1, y = (1/60)*(30^(1/2)-12)*(11-2*30^(1/2))^_Z1+3/5+(1/60)*(-30^(1/2)-12)*(11+2*30^(1/2))^_Z1], [x = (1/10)*(-3*30^(1/2)-17)*(11-2*30^(1/2))^_Z1+8/5+(1/10)*(3*30^(1/2)-17)*(11+2*30^(1/2))^_Z1, y = (1/60)*(-30^(1/2)-12)*(11-2*30^(1/2))^_Z1+3/5+(1/60)*(30^(1/2)-12)*(11+2*30^(1/2))^_Z1], [x = (1/10)*(-30^(1/2)+7)*(11-2*30^(1/2))^_Z1+8/5+(1/10)*(30^(1/2)+7)*(11+2*30^(1/2))^_Z1, y = (1/60)*(30^(1/2)+12)*(11-2*30^(1/2))^_Z1+3/5+(1/60)*(-30^(1/2)+12)*(11+2*30^(1/2))^_Z1], [x = (1/10)*(30^(1/2)-7)*(11-2*30^(1/2))^_Z1+8/5+(1/10)*(-30^(1/2)-7)*(11+2*30^(1/2))^_Z1, y = (1/60)*(-30^(1/2)-12)*(11-2*30^(1/2))^_Z1+3/5+(1/60)*(30^(1/2)-12)*(11+2*30^(1/2))^_Z1], [x = (1/10)*(3*30^(1/2)+17)*(11-2*30^(1/2))^_Z1+8/5+(1/10)*(-3*30^(1/2)+17)*(11+2*30^(1/2))^_Z1, y = (1/60)*(30^(1/2)+12)*(11-2*30^(1/2))^_Z1+3/5+(1/60)*(-30^(1/2)+12)*(11+2*30^(1/2))^_Z1], [x = (1/10)*(-3*30^(1/2)+17)*(11-2*30^(1/2))^_Z1+8/5+(1/10)*(3*30^(1/2)+17)*(11+2*30^(1/2))^_Z1, y = (1/60)*(-30^(1/2)+12)*(11-2*30^(1/2))^_Z1+3/5+(1/60)*(30^(1/2)+12)*(11+2*30^(1/2))^_Z1], [x = (1/10)*(-30^(1/2)-7)*(11-2*30^(1/2))^_Z1+8/5+(1/10)*(30^(1/2)-7)*(11+2*30^(1/2))^_Z1, y = (1/60)*(30^(1/2)-12)*(11-2*30^(1/2))^_Z1+3/5+(1/60)*(-30^(1/2)-12)*(11+2*30^(1/2))^_Z1]]

(4)

nops(sol)

8

(5)

num:={seq}(simplify(sol)[],_Z1=0..20): # some numeric solutions

numsols:=select(type,num,  [anything=integer,anything=integer]);

{[x = 3, y = 1], [x = 3, y = 3], [x = 5, y = 1], [x = 5, y = 7], [x = 29, y = 3], [x = 29, y = 53], [x = 75, y = 7], [x = 75, y = 141], [x = 603, y = 53], [x = 603, y = 1151], [x = 1613, y = 141], [x = 1613, y = 3083], [x = 13205, y = 1151], [x = 13205, y = 25257], [x = 35379, y = 3083], [x = 35379, y = 67673], [x = 289875, y = 25257], [x = 289875, y = 554491], [x = 776693, y = 67673], [x = 776693, y = 1485711], [x = 6364013, y = 554491], [x = 6364013, y = 12173533], [x = 17051835, y = 1485711], [x = 17051835, y = 32617957], [x = 139718379, y = 12173533], [x = 139718379, y = 267263223], [x = 374363645, y = 32617957], [x = 374363645, y = 716109331], [x = 3067440293, y = 267263223], [x = 3067440293, y = 5867617361], [x = 8218948323, y = 716109331], [x = 8218948323, y = 15721787313], [x = 67343968035, y = 5867617361], [x = 67343968035, y = 128820318707], [x = 180442499429, y = 15721787313], [x = 180442499429, y = 345163211543], [x = 1478499856445, y = 128820318707], [x = 1478499856445, y = 2828179394181], [x = 3961516039083, y = 345163211543], [x = 3961516039083, y = 7577868866621], [x = 32459652873723, y = 2828179394181], [x = 32459652873723, y = 62091126353263], [x = 86972910360365, y = 7577868866621], [x = 86972910360365, y = 166367951854107], [x = 712633863365429, y = 62091126353263], [x = 712633863365429, y = 1363176600377593], [x = 1909442511888915, y = 166367951854107], [x = 1909442511888915, y = 3652517071923721], [x = 15645485341165683, y = 1363176600377593], [x = 15645485341165683, y = 29927794081953771], [x = 41920762351195733, y = 3652517071923721], [x = 41920762351195733, y = 80189007630467743], [x = 343488043642279565, y = 29927794081953771], [x = 343488043642279565, y = 657048293202605357], [x = 920347329214417179, y = 80189007630467743], [x = 920347329214417179, y = 1760505650798366613], [x = 7541091474788984715, y = 657048293202605357], [x = 7541091474788984715, y = 14425134656375364071], [x = 20205720480365982173, y = 1760505650798366613], [x = 20205720480365982173, y = 38650935309933597731], [x = 165560524401715384133, y = 14425134656375364071], [x = 165560524401715384133, y = 316695914147055404193], [x = 443605503238837190595, y = 38650935309933597731], [x = 443605503238837190595, y = 848560071167740783457], [x = 3634790445362949466179, y = 316695914147055404193], [x = 3634790445362949466179, y = 6952884976578843528163], [x = 9739115350774052210885, y = 848560071167740783457], [x = 9739115350774052210885, y = 18629670630380363638311], [x = 79799829273583172871773, y = 6952884976578843528163], [x = 79799829273583172871773, y = 152646773570587502215381], [x = 213816932213790311448843, y = 18629670630380363638311], [x = 213816932213790311448843, y = 409004193797200259259373], [x = 1751961453573466853712795, y = 152646773570587502215381], [x = 1751961453573466853712795, y = 3351276133576346205210207], [x = 4694233393352612799663629, y = 409004193797200259259373], [x = 4694233393352612799663629, y = 8979462592908025340067883], [x = 38463352149342687608809685, y = 3351276133576346205210207], [x = 38463352149342687608809685, y = 73575428165109029012409161], [x = 103059317721543691281150963, y = 8979462592908025340067883], [x = 103059317721543691281150963, y = 197139172850179357222234041], [x = 844441785831965660540100243, y = 73575428165109029012409161], [x = 2262610756480608595385657525, y = 197139172850179357222234041]}

(6)

nops(numsols);

82

(7)

{seq}( eval(eq, s), s=numsols); #check

{0}

(8)

 

 

Download dioph-sols-vv.mw

 

select(u -> nops(u)=m and andmap(isprime,u), L);

 

 

restart;

dis:= (A,B) -> sqrt( (A[1]-B[1])^2 + (A[2]-B[2])^2 ):
P:= unapply(dis(A,B)+dis(B,C)+dis(C,A), [A,B,C]):

A0:=[0,0]:
A1:=[u1,0]:
A2:=[u2,u3]:
A3:=v1*~A1:
A4:=A1+v2*~(A2-A1):
A5:=A1+v3*~(A2-A1):
A6:=A0+v4*~(A2-A0):
A7:=A0+v5*~(A2-A0):
A8:=A6+v6*~(A4-A6):

eps:=0.05:

perim:=
P(A0,A3,A6)=10, P(A6,A3,A4)=15, P(A3,A1,A4)=11,
P(A6,A8,A7)=9,  P(A8,A5,A7)=13, P(A8,A4,A5)=12,
P(A7,A5,A2)=20:

vars := u1=1..50, u2=1..50, u3=1..50,
v1=eps ..1-eps, v2=eps ..1-eps, v3=eps ..1-eps, v4=eps ..1-eps, v5=eps ..1-eps, v6=eps ..1-eps:

inisol:=[u1 = 8, u2 = 3, u3 = 12, v1 = 0.5, v2 = 0.3, v3 = 0.5, v4 = 0.09, v5 = 0.3, v6 = 0.5]:

sol:=DirectSearch:-SolveEquations([perim], [vars], initialpoint=inisol );

[7.928429359693041*10^(-17), Vector(7, {(1) = 0.1798504456e-8, (2) = -0.1393335225e-8, (3) = -0.7304805649e-9, (4) = 0.7992083439e-8, (5) = -0.1359651947e-8, (6) = 0.1542570516e-8, (7) = 0.2339469063e-8}), [u1 = 8.211758237046912, u2 = 1.8442345202064532, u3 = 12.033442054587029, v1 = .5526589984562774, v2 = .26313930832995064, v3 = .5414796127553622, v4 = 0.7943775626427665e-1, v5 = .2941739734925204, v6 = .485843681048224], 5405]

(1)

plots:-display(plot(eval([A0,A1,A2,A0],sol[3])), plot(eval([A3,A4,A6,A3],sol[3])), plot(eval([A5,A7,A8,A5],sol[3])), scaling=constrained);

 

eval([perim], sol[3]);

[HFloat(10.000000001798504) = 10, HFloat(14.999999998606665) = 15, HFloat(10.99999999926952) = 11, HFloat(9.000000007992083) = 9, HFloat(12.999999998640348) = 13, HFloat(12.00000000154257) = 12, HFloat(20.00000000233947) = 20]

(2)

eval(seq("A"||i=A||i,i=0..8), sol[3])

"A0" = [0, 0], "A1" = [HFloat(8.211758237046912), 0], "A2" = [HFloat(1.8442345202064532), HFloat(12.033442054587029)], "A3" = [HFloat(4.538302082851432), 0], "A4" = [HFloat(6.536212450422957), HFloat(3.166471619072571)], "A5" = [HFloat(4.763873960641556), HFloat(6.515863543831874)], "A6" = [HFloat(0.14650185231032542), HFloat(0.9559096369525809)], "A7" = [HFloat(0.5425257968612042), HFloat(3.539925463989865)], "A8" = [HFloat(3.2509023701302153), HFloat(2.029897207531015)]

(3)

 


(Edited - a typo).

Download perims-vv.mw

The curve length is infinite. The integrand has a singularity at t=ln(Pi/2):

restart;
f:= t -> sqrt((sin(t/cos(exp(t))) + t*(1/cos(exp(t)) + t*exp(t)*sin(exp(t))/cos(exp(t))^2)*cos(t/cos(exp(t))))^2 + (cos(t) - t*sin(t))^2 + 2*t):
a:=ln(Pi/2): evalf(a);
#                          0.4515827054

Digits:=15:
:-int(f, a..a+1/10, numeric, epsilon=1e-5);
#                     3.33001574946940* 10^13  
Optimization:-Minimize(AD, {CD=AB-2, BC=AB+2, AD=AB+BC+CD, AB>=1, BC>=1, CD>=1}, assume=integer);
#        [9, [AB = 3, AD = 9, BC = 5, CD = 1]]

 

eval(E-A, solve({C-A + D-B + E-C = a, D-B = b}, {A,B,C,D,E}));
#                             -b + a

 

 

A more precise version and a simple proof

 

The cited result is true only when the curbe is not "too flat" and in those cases the result of the limit is different.

 

To simplify things we shall consider the Ox axes as one of the tangents to the curve.

So, we shall take  f(0) = 0, f'(0) = 0.

 

 

The tangent at the point P(a, f(a)) intersects the Ox axis for the abscissa  c = a - f(a)/f'(a);

 

So, the ratio r of the two areas is

 

restart;

r := (a*f(a)/2 - int(f(t),t=0..a))/ (1/2 * (a-f(a)/D(f)(a))* f(a));

2*((1/2)*a*f(a)-(int(f(t), t = 0 .. a)))/((a-f(a)/(D(f))(a))*f(a))

(1)

# f(0) = 0, f'(0)=0

0

(2)

eval( r,  f = (u -> u^2*g(u)) ):
series(%, a);

series(2/3+(2*(-(1/30)*((D@@2)(g))(0)+(1/12)*(D(g))(0)^2/g(0))/g(0))*a^2+O(a^3),a,3)

(3)

Hence  limit(r, a=0)  = 2/3   indeed.

 

What happens if f is more "flat".  E.g. f(0) = 0, f'(0)=0, f''(0)=0

 

eval( r,  f = (u -> u^3*g(u)) ):
series(%, a);

series(3/4+((1/40)*(D(g))(0)/g(0))*a+O(a^2),a,2)

(4)

And so on; if the first nonzero derivative (at 0) is the 10th we obtain:

 

eval( r,  f = (u -> u^10*g(u)) ):
series(%, a, 14);

series(10/11+((2/297)*(D(g))(0)/g(0))*a+(2*((7/2574)*((D@@2)(g))(0)-(31/10692)*(D(g))(0)^2/g(0))/g(0))*a^2+O(a^3),a,3)

(5)

So, the limit will be  k/(k+1)  it  the first nonzero derivative of f at 0 is the k-th.


 

Download voller-vv.mw

Optimization:-NLPSolve works very well and fast without the need of any simplification.

restart;
Digits:=15:
e:=(x,y) -> x^2 + 2*y^2 - 1:
h:=(x,y) -> (x-sin(x))^2 + (y-sin(y))^2 - 1:
constr:=
e(x1,y1)=0, h(x2,y2)=0, h(x3,y3)=0, r>=0,
D[1](e)(x1,y1)*(y1-y0) - D[2](e)(x1,y1)*(x1-x0) = 0,
D[1](h)(x2,y2)*(y2-y0) - D[2](h)(x2,y2)*(x2-x0) = 0,
D[1](h)(x3,y3)*(y3-y0) - D[2](h)(x3,y3)*(x3-x0) = 0,
(x1-x0)^2 + (y1-y0)^2 = r^2,
(x2-x0)^2 + (y2-y0)^2 = r^2,
(x3-x0)^2 + (y3-y0)^2 = r^2,
x3 >= x2 + 1/10:

sol:=Optimization:-Maximize(r, {constr},   x0=1..1.4, y0=1..1.4, x1=0..1, y1=0..1, x2=1..2, y2=1..2, x3=1..2, y3=1..2);

sol := [0.769863723979874459, [r = 0.769863723979874, x0 = 1.13805882552303, x1 = 0.699729170630851, x2 = 1.27446720511737, x3 = 1.89574141571275, y0 = 1.13805882552303, y1 = 0.505162888466810, y2 = 1.89574141571275, y3 = 1.27446720511737]]

p1:=plots:-implicitplot(e, -2..2, -2..2): p2:=plots:-implicitplot(h, -2..2, -2..2):
p3:=plottools:-circle(eval([x0,y0],sol[2]), eval(r,sol[2]), color=red):
p4:=plots:-pointplot(eval([[x0,y0],[x1,y1],[x2,y2],[x3,y3]],sol[2]), symbolsize=8, color=blue):
p5:=plots:-textplot(eval({seq}([x||i,y||i,P__||i], i=0..3), sol[2]), align={below, left}, color=blue):
plots:-display(p1,p2,p3,p4,p5);

 

data_new := DataFrame(data_2, rows=[1,2]);

 

For a system of m polynomial equations of (total) degrees d_1, ..., d_m in n unknowns over C (or other algebraically closed field), the standard result is given by Bezout' theorem:

For m=n, the number of solutions is either infinite or <= d_1* d_2 * ...* d_m.

For details see: Bézout's theorem - Wikipedia

 

restart;
# f := floor;
f := x -> x^2:
X := [seq(x, x=-3..3,0.02)]: n:=nops(X):
Y := map(f, X):
C := Array(1..n, i -> X[i], datatype=float[8]):
plot(X,Y, color=COLOR(HUE, C), thickness=6);

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