Kitonum

19675 Reputation

26 Badges

15 years, 143 days

MaplePrimes Activity


These are answers submitted by Kitonum

Maple does not understand arbitrary sums with an incomprehensible number of terms. The sum must be specific. For such sums the  add  command should be used:

An example:

restart;
fcn1:=add(N[i]*z[i]^2, i=1..10):
diff(fcn1, N[3]);

                                                   

 

Both solutions are correct, as confirmed by the  odetest  command. One solution is obtained from another simply by replacing arbitrary constants:

``

(1)

interface(version);

`Standard Worksheet Interface, Maple 2018.2, Windows 10, October 23 2018 Build ID 1356656`

(2)

Physics:-Version();

"C:\Program Files\Maple 2018\lib\update.mla", `2018, October 24, 4:22 hours, version in the MapleCloud: unable to determine, version installed in this computer: not installed`

(3)

restart;

ode :=[diff(x(t), t) = (3*x(t))/2 + 2*y(t), diff(y(t), t) = x(t)/2 + y(t)];
Sol:=dsolve(ode);
odetest(Sol, ode);

[diff(x(t), t) = (3/2)*x(t)+2*y(t), diff(y(t), t) = (1/2)*x(t)+y(t)]

 

{x(t) = _C1*exp((1/4)*(5+17^(1/2))*t)+_C2*exp(-(1/4)*(-5+17^(1/2))*t), y(t) = (1/8)*_C1*exp((1/4)*(5+17^(1/2))*t)*17^(1/2)-(1/8)*_C2*exp(-(1/4)*(-5+17^(1/2))*t)*17^(1/2)-(1/8)*_C1*exp((1/4)*(5+17^(1/2))*t)-(1/8)*_C2*exp(-(1/4)*(-5+17^(1/2))*t)}

 

[0, 0]

(4)

Sol1:=simplify(dsolve(ode,[x(t),y(t)]));

{x(t) = -(1/2)*_C2*(17^(1/2)-1)*exp(-(1/4)*(-5+17^(1/2))*t)+(1/2)*_C1*exp((1/4)*(5+17^(1/2))*t)*(17^(1/2)+1), y(t) = _C1*exp((1/4)*(5+17^(1/2))*t)+_C2*exp(-(1/4)*(-5+17^(1/2))*t)}

(5)

odetest(Sol1, ode);

[0, 0]

(6)

Sol2:=simplify(eval(Sol,[_C1=_C1*(sqrt(17)+1)/2, _C2=-_C2*(sqrt(17)-1)/2]));

{x(t) = -(1/2)*_C2*(17^(1/2)-1)*exp(-(1/4)*(-5+17^(1/2))*t)+(1/2)*_C1*exp((1/4)*(5+17^(1/2))*t)*(17^(1/2)+1), y(t) = _C1*exp((1/4)*(5+17^(1/2))*t)+_C2*exp(-(1/4)*(-5+17^(1/2))*t)}

(7)

is(Sol2=Sol1);

true

(8)

 

Download why_solution_changes_nov_27_2023_new.mw

Expr:=3/16-3/16*m2^2-m2/4*tanh(2*k-2*c)+m2/16*tanh(4*k+2*c)-m2/4*tanh(2*k+2*c)+3*m2/8*tanh(2*c);
select(t->has(t,tanh), Expr);

You use the same name to create different objects: a point in 3d and a procedure. Use a different name, for example:

restart;
with(geom3d):
Point:=(a,b,c)->point(P, a,b,c);
detail(Point(1,2,3));

Point := proc (a, b, c) options operator, arrow; geom3d:-point(P, a, b, c) end proc

 

Geom3dDetail(["name of the object", P], ["form of the object", point3d], ["coordinates of the point", [1, 2, 3]])

(1)

 


 

Download Point.mw


 

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

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