Kitonum

21435 Reputation

26 Badges

17 years, 24 days

MaplePrimes Activity


These are answers submitted by Kitonum

RootOf  is a way of representing the roots of an equation when explicit formulas are too cumbersome or do not exist at all. The  index=...  indicates the ordinal number of the root if there are several of these roots. To get the roots explicitly, you can use  allvalues  command. But since your equation also contains the parameter  l , in order to get all the roots in explicit form, you need to specify the parameter value:

A:=RootOf(6*_Z^3+(27+3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*sqrt(9-3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2))*_Z^2+(3*sqrt(9-3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2)*l^4*RootOf(_Z^2*l^2+3*_Z^4-3)^2-9*sqrt(9-3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2)*l^2+90*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2-18*l^4+6*l^6*RootOf(_Z^2*l^2+3*_Z^4-3)^2-81+45*RootOf(_Z^2*l^2+3*_Z^4-3)^2*sqrt(9-3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2))*_Z-324-3*l^8+l^10*RootOf(_Z^2*l^2+3*_Z^4-3)^2+108*RootOf(_Z^2*l^2+3*_Z^4-3)^2*sqrt(9-3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2)-3*sqrt(9-3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2)*l^6+sqrt(9-3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2)*l^8*RootOf(_Z^2*l^2+3*_Z^4-3)^2-63*sqrt(9-3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2)*l^2+30*sqrt(9-3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2)*l^4*RootOf(_Z^2*l^2+3*_Z^4-3)^2+45*l^6*RootOf(_Z^2*l^2+3*_Z^4-3)^2+351*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2-108*l^4, index = 1):

allvalues(RootOf(_Z^2*l^2+3*_Z^4-3));

eval(A, l=1);
allvalues(%);

             

restart;
f[a,alpha,beta,k];
f[ax,k];
f[c,0,d];

                                            

 

 

The numerical solution is better and more accurate than graphical one.
The wage  y  is a function of the sales  x .

# Solution a
# Setting of this function
y:=x->2000+0.1*x;
y(1480);
                 
 Output:                   2148.0

# Solution b
solve(y(x)=2225, x);
                   
Output:                    2250.

 

This integral  (=1/24)  is equal to the volume of the following body:

plot3d(x*y, x=0..1, y=0..1-x, style=surface, filled);

                          

 

Should be  sin(2*x)  instead of  sin2x . This is just a symbol . The general rule is that the argument of any function must be surrounded by parentheses.

You can immediately get the result in vector form using  LinearAlgebra:-LinearSolve  command as in the following example:

Sys:={3*x+5*y=21, -2*x+y=-1}:
LinearAlgebra:-LinearSolve(<3,5; -2,1>, <21,-1>);

 

We get the symbolic result containing the imaginary unit  I , but in fact the result is a real number:

Digits:=20:
int(x^5/(exp(x)-1)/(1-exp(-x)), x=0..1);
evalf(%);
fnormal(%,19);
simplify(%, zero);

    

 

We get the symbolic result containing the imaginary unit  I , but in fact this is a real number:

Digits:=20:
int(x^5/(exp(x)-1)/(1-exp(-x)), x=0..1);
evalf(%);
fnormal(%,19);
simplify(%,zero);

                      

 

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^2+(-b-c)*a-b*c))^(1/2)+(c^2+(-a+b)*c+a*b)*(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^2+(-b-c)*a-b*c))^(1/2)+(c^2+(-a+b)*c+a*b)*(a-b))/(c^2+(-a+b)*c+a*b)^4)^(1/2)/(((b-c)*a+c*(b+c))*((b-c)*a-b*(b+c))*(a^2+(-b-c)*a-b*c))^(1/2)]

 

[(((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]

 

[((a^2*b+a^2*c-a*b^2-4*a*b*c-a*c^2+b^2*c+b*c^2)^2*c^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)+(c^2+(-a+b)*c+a*b)*(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-2*c)*(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)+(c^2+(-a+b)*c+a*b)*(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-2*c)*(c^2+(-a+b)*c+a*b))/(c^2+(-a+b)*c+a*b)^4)^(1/2)/(((b-c)*a+c*(b+c))*((b-c)*a-b*(b+c))*(a^2+(-b-c)*a-b*c))^(1/2)]

(1)

a:=5: b:=11: c:=8:
e;
simplify([A,B,C,D]);

(1/167)*5118884^(1/2)

 

[[0, 0], [(3655/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'

                                  

First 65 66 67 68 69 70 71 Last Page 67 of 289