Kitonum

19635 Reputation

26 Badges

15 years, 79 days

MaplePrimes Activity


These are answers submitted by Kitonum


 

restart;

eqs := [u     + v     + w     = 1,
        u*x   + v*y   + w*z   = 1/2,
        u*x^2 + v*y^2 + w*z^2 = 1/3,
        u*x^3 + v*y^3 + w*z^3 = 1/4,
        u*x^4 + v*y^4 + w*z^4 = 1/5,
        u*x^5 + v*y^5 + w*z^5 = 1/6]:

[u+v+w = 1, u*x+v*y+w*z = 1/2, u*x^2+v*y^2+w*z^2 = 1/3, u*x^3+v*y^3+w*z^3 = 1/4, u*x^4+v*y^4+w*z^4 = 1/5, u*x^5+v*y^5+w*z^5 = 1/6]

(1)

soln := [solve(eqs, explicit)];

[{u = 4/9, v = 5/18, w = 5/18, x = 1/2, y = 1/2+(1/10)*15^(1/2), z = 1/2-(1/10)*15^(1/2)}, {u = 4/9, v = 5/18, w = 5/18, x = 1/2, y = 1/2-(1/10)*15^(1/2), z = 1/2+(1/10)*15^(1/2)}, {u = 5/18, v = 4/9, w = 5/18, x = 1/2+(1/10)*15^(1/2), y = 1/2, z = 1/2-(1/10)*15^(1/2)}, {u = 5/18, v = 4/9, w = 5/18, x = 1/2-(1/10)*15^(1/2), y = 1/2, z = 1/2+(1/10)*15^(1/2)}, {u = 5/18, v = 5/18, w = 4/9, x = 1/2+(1/10)*15^(1/2), y = 1/2-(1/10)*15^(1/2), z = 1/2}, {u = 5/18, v = 5/18, w = 4/9, x = 1/2-(1/10)*15^(1/2), y = 1/2+(1/10)*15^(1/2), z = 1/2}]

(2)

# Show that each member of soln is a solution of eqs

andmap(t->is(`and`(seq(eval(eq,t),eq=eqs))), soln);

true

(3)

# Show that the solutions are unique

is(nops(soln)=nops(convert(soln,set)));

true

(4)

 


 

Download eq-soln-verify_new.mw

To solve such systems, which are usually inconsistent, the least squares method is used. See help on the LinearAlgebra:-LeastSquares  command.

The  DirectSearch  package often solves problems of discrete optimization incorrectly. For this, see the discussion in the post  https://www.mapleprimes.com/posts/201020-About-DirectSearch 
Therefore, the result obtained above, although true, cannot be considered justified. An justified solution can be easily obtained by brute-force method, if you notice that no variable  x1 ... x9 can be greater than 10, since 8*(-5)^3+11^3>0

restart;
R:=[0,[0$9]]:
for x1 from -5 to 10 do
for x2 from x1 to 10 do
for x3 from x2 to 10 do
for x4 from x3 to 10 do
for x5 from x4 to 10 do
for x6 from x5 to 10 do
for x7 from x6 to 10 do
for x8 from x7 to 10 do
for x9 from x8 to 10 do
if add(x||i^3, i=1..9)=0 then d:=add(x||i, i=1..9);
if d>R[1] then R:=[d, [seq(x||i, i=1..9)]] fi; fi;
od: od: od: od: od: od: od: od: od:
R; 

                                  [12, [-5, -4, 3, 3, 3, 3, 3, 3, 3]]

 

restart;
diffr1:=x^2+y^2-1:
diffr2:=(x-2)^2+y^2-(3/2)^2:
with(plots):
P1:=implicitplot(diffr1, x=-1..1, y=-1..1, color=black, thickness=2):
P2:=implicitplot(diffr2, x=0..4, y=-2..2, color=black, thickness=2):
P3:=inequal({diffr1<0,diffr2<0}, x=-2..4, y=-2..2, color=red):
P4:=inequal({diffr1<0,diffr2>0}, x=-2..4, y=-2..2, color=yellow):
P5:=inequal({diffr1>0,diffr2<0}, x=-2..4, y=-2..2, color=green):
P6:=inequal({diffr1>0,diffr2>0}, x=-2..4, y=-2..2, color="LightBlue"):
display(P1,P2,P3,P4,P5,P6, scaling=constrained);

                               

restart;
NM1 := proc(f, xold)
    local x1, x0, precision;
    x0 := xold;
    x1 := evalf(x0 - f(x0)/D(f)(x0));
    precision := 10^(-3);
        if limit(f(x),x=x0) = 0 then
            error("Newton's Method cannot do the calculation");
        end if;
        if D(f)(x0) = 0 then
            error("Newton's Method cannot do the calculation");
        else
        while abs(x1-x0) > precision do
            x0 := x1;
            print(x0);        
            x1 := evalf(x0 - f(x0)/D(f)(x0));            
        end do;
        end if;

   return x1;
end proc:

# Examples
NM1(x->1-x-sin(x), 0);
fsolve(1-x-sin(x)); # Check
NM1(x->1-x-sin(x), %); # Check

 

You are wrong in assuming that  Phi = -b . Maple returns the principal value of the argument and simplification can only be obtained by using assumptions on the parameters  a  and , for example

restart;
z:=-a*exp(-I*b):
simplify(evalc(argument(z))) ;
simplify(argument(z)) assuming a>0, b<Pi/2, b>0;
 

arctan(a*sin(b), -a*cos(b))

 

-b+Pi

(1)

 

Download argument.mw

restart;
with(geometry):
point(F1,[5,0]): point(F2,[0,-5]): 
ellipse(p, ['foci'=[F1,F2], 'distance'=12], [x,y]);
Eq:=Equation(p);
d:=igcd(coeffs(lhs(Eq)));
Eq1:=Eq/d; # Simplified ellipse equation
plots:-implicitplot(Eq1, x=-12..12, y=-12..12, color=red, thickness=2);

 

Consider 2 points   A(0,0)  and  B(1,0) . The line  BC  has the equation  y=tan(100*Pi/180)*(x-1) . We assume that the points  С  and  D   lie above the axis  Ox , and the length of the  BC  is equal to 1. Then we get  C(1+cos(100*Pi/180), sin(100*Pi/180)) . The slope of the straight line  CD  will be equal to  tan(100*Pi/180+70*Pi/180) .


 

restart;
local D:
A:=[0,0]: B:=[1,0]: C:=[1+cos(100*Pi/180),sin(100*Pi/180)]:
D:=eval([x,y],solve({y=tan(120*Pi/180)*x, y=C[2]+tan(100*Pi/180+70*Pi/180)*(x-C[1])}));
P:=plottools:-curve([A,B,C,D,A], color=red, thickness=2):
T:=plots:-textplot([[A[],"A"],[B[],"B"],[C[],"C"],[D[],"D"]], font=[times,20], align=[left,below]):
plots:-display(P,T, scaling=constrained, axes=none);

[(tan((1/18)*Pi)*cos((4/9)*Pi)-sin((4/9)*Pi)-tan((1/18)*Pi))/(3^(1/2)-tan((1/18)*Pi)), -3^(1/2)*(tan((1/18)*Pi)*cos((4/9)*Pi)-sin((4/9)*Pi)-tan((1/18)*Pi))/(3^(1/2)-tan((1/18)*Pi))]

 

 

 


 

Download quadrilateral.mw

restart

randomize()

j := proc (x) options operator, arrow; RandomTools[Generate](posint(range = 40)*identical(x)+posint(range = 10)*('ln')(posint(range = 20)*identical(x)^posint(range = 13))-posint(range = 10)*('exp')(posint(range = 10)*identical(x))) end proc

proc (x) options operator, arrow; RandomTools[Generate](posint(range = 40)*identical(x)+posint(range = 10)*('ln')(posint(range = 20)*identical(x)^posint(range = 13))-posint(range = 10)*('exp')(posint(range = 10)*identical(x))) end proc

(1)

i := j(x)

39*x+10*ln(9*x^13)-2*exp(9*x)

(2)

diff(i(x), x)

39+130/x-18*exp(9*x)

(3)

NULL

 
 

Download RandomfunctionQ_new.mw

There are other ways to solve the problem. For example, you can use the  seq  command, or just loop through the set  , applying the appropriate condition:

restart;
A := {3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101};

{seq(`if`(modp(a,3)=1,a,NULL), a=A)}; # The second way

k:=1:  # The third way
for a in A do
if modp(a,3)=1 then k:=k+1; B[k]:=a fi;
od:
convert(B, set); 

 

restart;

f := x->a*x/(4*x^2+b);
g:=D(f);

proc (x) options operator, arrow; a*x/(4*x^2+b) end proc

 

proc (x) options operator, arrow; a/(4*x^2+b)-8*a*x^2/(4*x^2+b)^2 end proc

(1)

h:=unapply(int(f(t),  t=0..x, continuous), x);
h(x);

proc (x) options operator, arrow; -(1/8)*ln(b)*a+(1/8)*ln(4*x^2+b)*a end proc

 

-(1/8)*ln(b)*a+(1/8)*ln(4*x^2+b)*a

(2)

 

Download Answers.mw

restart

n := [80, 79, 83, 84, 83, 83, 81, 85, 86, 86, 83, 82, 83, 84, 81, 80, 83, 79, 82, 81, 85]

[80, 79, 83, 84, 83, 83, 81, 85, 86, 86, 83, 82, 83, 84, 81, 80, 83, 79, 82, 81, 85]

(1)

nops(n)

21

(2)

for i from 3 by 2 to 17 do f[i] := n[i-2]-3*n[i-1]+3*n[i]; f[i+1] := n[i-2]+4*n[i-1]-6*n[i]+n[i+1] end do

92

 

-18

 

80

 

4

 

77

 

14

 

84

 

-9

 

77

 

14

 

86

 

-3

 

74

 

13

 

90

 

-18

(3)

NULL

NULL

Download fyp_2_new.mw

The  simplify  command is redundant here and can be dispensed with using the  eval command:

restart;
diff(f(x,y),x)+diff(f(x,y),y);
eval(%, f(x,y)=f(x,y0));

                                     

 

In older versions of Maple, the  simplify  command does not help (I'm using Maple 2018). The  convert  command does the job:

Expr:=sin(theta)^(A - 2)*cos(theta)^2 - sin(theta)^(A - 2) + sin(theta)^A:
convert(Expr, exp);

                                                                 0

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