Kitonum

21495 Reputation

26 Badges

17 years, 57 days

MaplePrimes Activity


These are answers submitted by Kitonum

First, we get general formulas for the coordinates of the vertices of such a quadrilateral. The vertex A lies at the origin, B lies in the upper half-plane, C to the right of A on the Ox-axis, D lies in the lower half-plane. We assume that  |AB|=a, |BC|=b, |AD|=c, |DC|=b+c-a . We can always inscribe a circle in the quadrilateral  ABCD . It remains for us to find the position of point C so that the sum of the angles  ABC  and  ADC  is 180 degrees.  For all plottings and checking the property of three points lying on one straight line (see the original post), we select specific parameter values  a=5, b=11, c=8 .

 

restart;
local D;
d:=b+c-a:
# e is the first coordinate of the point C, e=|AC|

Eq1:=e^2=a^2+b^2-2*a*b*t:
Eq2:=e^2=c^2+d^2-2*c*d*s:
e:=simplify(solve(solve(Eq1,t)=-solve(Eq2,s), e)[1]);
p1:=(a+b+e)/2: p2:=(c+d+e)/2:

S:=proc(a,b,c)
local p;
p:=(a+b+c)/2;
sqrt(p*(p-a)*(p-b)*(p-c));
end proc:
Dist:=(A,B)->sqrt((A[1]-B[1])^2+(A[2]-B[2])^2):

h1:=simplify(2*S(a,b,e)/e): h2:=simplify(2*S(c,d,e)/e):
# The coordinates of all the points A, B, C, D 

A:=[0,0]; B:=simplify([sqrt(a^2-h1^2),h1]); C:=[e,0]; D:=simplify([sqrt(c^2-h2^2),-h2]);

(((b-c)*a+c*(b+c))*((b-c)*a-b*(b+c))*(a^2+(-b-c)*a-b*c))^(1/2)/(c^2+(-a+b)*c+a*b)

 

[0, 0]

 

[((a^2*b-a^2*c-a*b^2+a*c^2+b^2*c+b*c^2)^2*a^2/((a*b-a*c+b*c+c^2)*(a*b-a*c-b^2-b*c)*(a^2-a*b-a*c-b*c)))^(1/2), (1/2)*(c^2+(-a+b)*c+a*b)*(-((((b-c)*a+c*(b+c))*((b-c)*a-b*(b+c))*(a^2+(-b-c)*a-b*c))^(1/2)+(a+b)*(c^2+(-a+b)*c+a*b))*(-(((b-c)*a+c*(b+c))*((b-c)*a-b*(b+c))*(a^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655/1279721)*1279721^(1/2), (220/1279721)*1279721^(1/2)*385^(1/2)], [(2/167)*1279721^(1/2), 0], [(2152/1279721)*1279721^(1/2), -(448/1279721)*1279721^(1/2)*385^(1/2)]]

(2)

E:=[e/(a+b)*a,0]; F:=[e/(c+d)*c,0];

[(5/2672)*5118884^(1/2), 0]

 

[(4/1837)*5118884^(1/2), 0]

(3)

O1:=simplify(eval([x,y],solve({(y-B[2])/(E[2]-B[2])=(x-B[1])/(E[1]-B[1]), (y-D[2])/(F[2]-D[2])=(x-D[1])/(F[1]-D[1])})));
r:=radnormal(2*S(a,Dist(A,O1),Dist(B,O1))/a);

[(1000/250667)*1279721^(1/2), -(12/250667)*1279721^(1/2)*385^(1/2)]

 

(4/19)*385^(1/2)

(4)

P:=simplify((A+B)/2); Q:=simplify((B+C)/2);
O2:=simplify(eval([x,y],solve({(B-A)[1]*(x-P[1])+(B-A)[2]*(y-P[2]),(B-C)[1]*(x-Q[1])+(B-C)[2]*(y-Q[2])})));
R:=Dist(A,O2);

[(3655/2559442)*1279721^(1/2), (110/1279721)*1279721^(1/2)*385^(1/2)]

 

[(18981/2559442)*1279721^(1/2), (110/1279721)*1279721^(1/2)*385^(1/2)]

 

[(1/167)*1279721^(1/2), -(57/514360)*1279721^(1/2)*385^(1/2)]

 

(1/3080)*492692585^(1/2)

(5)

S:=simplify(eval([x,y],solve({y=0,(y-B[2])/(D[2]-B[2])=(x-B[1])/(D[1]-B[1])})));

[(40/16199)*1279721^(1/2), 0]

(6)

# All the plottings
with(plots): with(plottools):
L1:=line(B,D,color=brown):
L2:=line(S,O2,color=green):
T:=textplot([[A[],"A"],[B[],"B"],[C[],"C"],[D[],"D"],[O1[],"O1"],[O2[],"O2"],[S[],"S"]],align=left,font=[times,18]):
PP:=pointplot([O1,O2,S],color=[red,blue,brown],symbol=solidcircle):
display(plot([A,B,C,D,A]),circle(O1,r,color=red),circle(O2,R,color=blue),PP,L1,L2,T, scaling=constrained, size=[500,500]);

 

 


 

Download problem.mw

  

# Without parenthesis
`%+`(seq(k,k=1..5))%/5;

# Or with parenthesis
`%+`(seq(k,k=1..5))/5;

# Or
1%/5*`%+`(seq(k,k=1..5));

                                

 

 

In fact, after calculating the derivatives, we get a linear system:

NULL

restart

Jestar := .222222222222222222222222222223*x[1]+3.98408963290776835548901841189+.222222222222222222222222222223*u[1]^2+1.20728063844142489971746563410*u[1]+.555555555555555555555555555557*x[2]+.555555555555555555555555555557*u[2]^2+2.19736562704190744843616437593*u[2]+.222222222222222222222222222218*x[3]+.222222222222222222222222222218*u[3]^2+.894156749261387141869195542552*u[3]+lambda[1]*(1.2*10^(-29)*x[1]-2.2*10^(-29)*x[2]+7.8*10^(-30)*x[3])+lambda[2]*(-1.61439242336161127378313801260*x[1]+.45420549105153639573117683365*x[2]+.16018693231007487805196117895*x[3]-1.*u[2])+lambda[3]*(-.95012749286786619995420043248*x[1]-.51534877135614818507764030330*x[2]+.46547626422401438503184073577*x[3]-1.*u[3])

.222222222222222222222222222223*x[1]+3.98408963290776835548901841189+.222222222222222222222222222223*u[1]^2+1.20728063844142489971746563410*u[1]+.555555555555555555555555555557*x[2]+.555555555555555555555555555557*u[2]^2+2.19736562704190744843616437593*u[2]+.222222222222222222222222222218*x[3]+.222222222222222222222222222218*u[3]^2+.894156749261387141869195542552*u[3]+lambda[1]*(0.1200000000e-28*x[1]-0.2200000000e-28*x[2]+0.7800000000e-29*x[3])+lambda[2]*(-1.61439242336161127378313801260*x[1]+.45420549105153639573117683365*x[2]+.16018693231007487805196117895*x[3]-1.*u[2])+lambda[3]*(-.95012749286786619995420043248*x[1]-.51534877135614818507764030330*x[2]+.46547626422401438503184073577*x[3]-1.*u[3])

(1)

Sys := {seq(diff(Jestar, lambda[i]) = 0, i = 1 .. 3), seq(diff(Jestar, u[i]) = 0, i = 1 .. 3), seq(diff(Jestar, x[i]) = 0, i = 1 .. 3)}

{.4444444444*u[1]+1.20728063844142489971746563410 = 0, 1.111111111*u[2]+2.19736562704190744843616437593-1.*lambda[2] = 0, .4444444444*u[3]+.894156749261387141869195542552-1.*lambda[3] = 0, 0.1200000000e-28*x[1]-0.2200000000e-28*x[2]+0.7800000000e-29*x[3] = 0, .222222222222222222222222222218+0.7800000000e-29*lambda[1]+.16018693231007487805196117895*lambda[2]+.46547626422401438503184073577*lambda[3] = 0, .222222222222222222222222222223+0.1200000000e-28*lambda[1]-1.61439242336161127378313801260*lambda[2]-.95012749286786619995420043248*lambda[3] = 0, .555555555555555555555555555557-0.2200000000e-28*lambda[1]+.45420549105153639573117683365*lambda[2]-.51534877135614818507764030330*lambda[3] = 0, -1.61439242336161127378313801260*x[1]+.45420549105153639573117683365*x[2]+.16018693231007487805196117895*x[3]-1.*u[2] = 0, -.95012749286786619995420043248*x[1]-.51534877135614818507764030330*x[2]+.46547626422401438503184073577*x[3]-1.*u[3] = 0}

(2)

solve(Sys)

{lambda[1] = -0.3405136588e31, lambda[2] = -73.32501333, lambda[3] = 81.81631382, u[1] = -2.716381437, u[2] = -67.97014107, u[3] = 182.0748534, x[1] = -8572.737031, x[2] = -17682.28255, x[3] = -36684.27842}

(3)

NULL

NULL


 

Download example-new.mw

y = x*(x^4 - 10*x^2 + 39)/30

For best results, I replaced the constant  2  with a third parameter  a3 . We specify the segment  [a,b]  and the step  h  to obtain data  X  and  Y  and then use the  Statistics:-NonlinearFit  command. When reducing the segment  [a,b] , we get better results:
 

restart;
a, b:=0, 5:
f1:=x->(2*x)/(3+5*x):  
f2:=x->a1*(a3-exp(-a2*x)):
h:=0.1: n:=(b-a)/h;
X:=[seq(i*h,i=0..n)];
Y:=[seq(f1(i*h),i=0..n)];
F:=Statistics:-NonlinearFit(f2(x), X, Y, x);
plot([f1(x),F], x=0..5, color=[blue,red],legend=["f1","f2"]);

50.00000000

 

[0., .1, .2, .3, .4, .5, .6, .7, .8, .9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0]

 

[0., 0.5714285714e-1, .1000000000, .1333333333, .1600000000, .1818181818, .2000000000, .2153846154, .2285714286, .2400000000, .2500000000, .2588235294, .2666666666, .2736842106, .2800000000, .2857142858, .2909090910, .2956521740, .3000000000, .3040000000, .3076923076, .3111111112, .3142857142, .3172413794, .3200000000, .3225806452, .3250000000, .3272727272, .3294117648, .3314285714, .3333333334, .3351351352, .3368421052, .3384615384, .3400000000, .3414634146, .3428571428, .3441860466, .3454545454, .3466666666, .3478260870, .3489361702, .3500000000, .3510204082, .3520000000, .3529411764, .3538461538, .3547169812, .3555555556, .3563636364, .3571428572]

 

HFloat(0.3473297773329595)-HFloat(0.31980563612041574)*exp(-HFloat(1.1646240098951652)*x)

 

 

a, b:=0, 2:
h:=0.1: n:=(b-a)/h;
X:=[seq(i*h,i=0..n)];
Y:=[seq(f1(i*h),i=0..n)];
F:=Statistics:-NonlinearFit(f2(x), X, Y, x);
plot([f1(x),F], x=0..2, color=[blue,red],legend=["f1","f2"]);

20.00000000

 

[0., .1, .2, .3, .4, .5, .6, .7, .8, .9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0]

 

[0., 0.5714285714e-1, .1000000000, .1333333333, .1600000000, .1818181818, .2000000000, .2153846154, .2285714286, .2400000000, .2500000000, .2588235294, .2666666666, .2736842106, .2800000000, .2857142858, .2909090910, .2956521740, .3000000000, .3040000000, .3076923076]

 

HFloat(0.31271326321044796)-HFloat(0.30377027346591473)*exp(-HFloat(1.6468916879789395)*x)

 

 

 


Edit.

Download nonlinfit2.mw

Here is another way. The first and second points almost coincide, so they block one another:

restart;
plot([[[28,.6481496576]],[[28, .648149657615473]],[[28, .6512873548]]],style='point',color=["Blue","Orange","Red"], symbol=solidcircle, symbolsize=12, labels = ["k", "y(k)"], legend = ["10-digit precision", "15-digit precision", "Floating-point iteration"] ,legendstyle = [font = ["HELVETICA", 9], location = right]);

                             

 

Use single quotes for single use (in 2d math only):

'a >= b'

                                  

Example:

-%int(x^2,x);

                                     

 

I think this is not a bug, but just such a design in Maple 2015. In subsequent versions of Maple, this command has been improved (the word  parameters  can be omitted). For example, in Maple 2018.2, the following code works correctly:

y := [1, 3, 8];
val := r->y[r]:
Explore(val(r), r=1..3);

 


 

diff(F(x(t),y(t)),t)=0;

(D[1](F))(x(t), y(t))*(diff(x(t), t))+(D[2](F))(x(t), y(t))*(diff(y(t), t)) = 0

(1)

 


 

Download diff.mw

In  display(L2,L22,L3,L1)  the previously recorded polygon  L2  closes the later recorded polygon  L22, but L1  and  L3  always lie higher (in Maple 2018.2). See the workaround below:

restart;
with(plots):
L1 := textplot([2, 2, "Polygon"], color = white, font=[times,bold,16]):
L2 := plottools:-polygon([[0, 0], [3, 4], [3, 1]], color = red):
L22 := plottools:-polygon([[0, 0], [0.5, 2], [1,0]], color = green):
L3 := contourplot(x^2 + y^2, x = 1 .. 1.5, y = 4/3*x..2):

display(L2,L22,L3,L1); 

                    

 

 

The  coords=polar  option doesn't seem to work (in Maple 2018.2), so I used Cartesian coordinates.
3 regions are plotted:

A:=plots:-inequal({sqrt(x^2+y^2)<2+2*x/sqrt(x^2+y^2),sqrt(x^2+y^2)>3},x=-3.3..4.3,y=-4.3..4.3, color=green):
B:=plots:-inequal({sqrt(x^2+y^2)>2+2*x/sqrt(x^2+y^2),sqrt(x^2+y^2)<3},x=-3.3..4.3,y=-4.3..4.3, color=blue):
C:=plots:-inequal({sqrt(x^2+y^2)<2+2*x/sqrt(x^2+y^2),sqrt(x^2+y^2)<3},x=-3.3..4.3,y=-4.3..4.3, color=red):
plots:-display(<A | B | C>, scaling=constrained);

             


 

We can get a general solution to your problem for an integer  n , if we first solve without initial conditions, and then impose these conditions and solve the corresponding system. We see that there is an infinite family of solutions  y(x)=C*sin(n*Pi*x)  (С is an any constant)  only if  A = 0. There are no any solutions if  A <> 0 .

restart;
ode := diff(y(x), x, x) + (n*Pi)^2*y(x) = A^3*sin(n*Pi*x)^3;
dsol1 := dsolve(ode);
Y:=eval(y(x),dsol1);
Sys:={eval(Y,x=0)=0, eval(Y,x=1)=0};
simplify(eval(op(2,Sys),_C1=0)) assuming n::integer;
solve(%, A,dropmultiplicity);

diff(diff(y(x), x), x)+n^2*Pi^2*y(x) = A^3*sin(n*Pi*x)^3

 

y(x) = sin(n*Pi*x)*_C2+cos(n*Pi*x)*_C1+(1/8)*(A^3*(cos(n*Pi*x)^2+2)*sin(n*Pi*x)-3*A^3*cos(n*Pi*x)*Pi*n*x)/(n^2*Pi^2)

 

sin(n*Pi*x)*_C2+cos(n*Pi*x)*_C1+(1/8)*(A^3*(cos(n*Pi*x)^2+2)*sin(n*Pi*x)-3*A^3*cos(n*Pi*x)*Pi*n*x)/(n^2*Pi^2)

 

{_C1 = 0, sin(n*Pi)*_C2+cos(n*Pi)*_C1+(1/8)*(A^3*(cos(n*Pi)^2+2)*sin(n*Pi)-3*A^3*cos(n*Pi)*Pi*n)/(n^2*Pi^2) = 0}

 

(3/8)*(-1)^(1+n)*A^3/(Pi*n) = 0

 

0

(1)

 


 

Download ode.mw

It is easy to achieve good visibility by simple means. I changed the style of the surfaces, removing the lines, each plane made in different colors and a few more minor changes. The solution itself is depicted as a bold red dot:

restart; with(plots):
sys := [p+x+.6*y-15, p+.3*x+.2*y-10, p+.5*x+y-14]:
sol:=solve(sys, [x, y, p])[];
A:=implicitplot3d(sys, x = 0 .. 10, y = 0 .. 10, p = 0 .. 10, style=surface, color=["LightBlue","LightGreen","Yellow"]):
B:=pointplot3d(eval([x,y,p],sol), color=red, symbol=solidsphere, symbolsize=15):
display(A,B, axes=normal, orientation=[-20,80], lightmodel=light4);

                   

 

 

 

Should be:

restart;

M:=Matrix(10, 10, [[1, 0, 0, 0, 1/2, 0, 0, 0, 0, 0], [0, 1/2, 0, 0, 0, 0, 0, 1/3, 0, 0], [0, 0, 1/2, 0, 0, 0, 0, 0, 1/3, 0], [0, 0, 0, 1/3, 0, 0, 0, 0, 0, 0], [1/2, 0, 0, 0, 1/3, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1/3, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1/4, 0, 0, 0], [0, 1/3, 0, 0, 0, 0, 0, 1/4, 0, 0], [0, 0, 1/3, 0, 0, 0, 0, 0, 1/4, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1/4]]);

B:=Matrix(10, 5, [[0, 0, 1/3, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 1/4, 0, 0, 0], [0, 0, 1/4, 0, 0], [0, 0, 0, 1/4, 0], [1/2, 1/2, 1, 0, 0], [1, 1/2, 1/2, 1, 0], [0, 1, 1/2, 1/2, 1], [0, 0, 1, 1/2, 1/2]]);

B^%T.M^(-1).B;

 

First 66 67 68 69 70 71 72 Last Page 68 of 290