Kitonum

21830 Reputation

26 Badges

17 years, 220 days

MaplePrimes Activity


These are answers submitted by Kitonum

The code below finds 2 chains:

chosen1 := [[1,2],[1,20],[3,4]]:
chosen2 := [[2,3],[20,3],[3,4]]:
chosen3 := [[3,4],[5,7]]:
chosen4 := [[4,5],[5,6]]:
chosen5 := [[5,6],[7,9]]:
seq(seq(seq(seq(seq(`if`(i[2]=j[1] and j[2]=k[1] and k[2]=l[1] and l[2]=m[1], [i,j,k,l,m], NULL), m=chosen5), l=chosen4), k=chosen3), j=chosen2), i= chosen1);
                     
 [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6]],  [[1, 20], [20, 3], [3, 4], [4, 5], [5, 6]]
 

Addition.  If there are many source lists, then the process of building nested sequences can be automated using the procedure  NestedSeq  that can be found in this thread.

because

evalc(cos(I*x));  # This assumes that x is real
convert(%, exp);
                                               
cosh(x)
                                     (1/2)*exp(x)+(1/2)*exp(-x)

Use  extrema  command for this (gives min and max). Optimization:-Minimize  command gives the same result.

An example:

restart;
with(LinearAlgebra):
A:=RandomMatrix(10,3);
b:=RandomVector(10);
x:=<x1,x2,x3>;
Obj:=VectorNorm(A.x-b, 2, conjugate = false);
extrema(Obj, x1^2+x2^2+x3^2=1, {x1,x2,x3});
evalf(%); # First way (gives min and max)
Optimization:-Minimize(Obj, {x1^2+x2^2+x3^2=1}); # Second way  

Matrix(10, 3, {(1, 1) = -6, (1, 2) = -68, (1, 3) = 6, (2, 1) = -25, (2, 2) = -10, (2, 3) = 60, (3, 1) = 32, (3, 2) = 40, (3, 3) = 41, (4, 1) = 26, (4, 2) = 93, (4, 3) = -87, (5, 1) = 75, (5, 2) = -22, (5, 3) = -22, (6, 1) = -45, (6, 2) = 94, (6, 3) = 51, (7, 1) = -77, (7, 2) = 25, (7, 3) = -86, (8, 1) = -90, (8, 2) = 50, (8, 3) = 12, (9, 1) = 39, (9, 2) = 31, (9, 3) = 60, (10, 1) = 73, (10, 2) = 87, (10, 3) = 44})

 

Vector(10, {(1) = 40, (2) = 12, (3) = -93, (4) = -29, (5) = 21, (6) = 84, (7) = 55, (8) = -40, (9) = -61, (10) = -89})

 

Vector[column](%id = 18446745429957422726)

 

((-6*x1-68*x2+6*x3-40)^2+(-25*x1-10*x2+60*x3-12)^2+(32*x1+40*x2+41*x3+93)^2+(26*x1+93*x2-87*x3+29)^2+(75*x1-22*x2-22*x3-21)^2+(-45*x1+94*x2+51*x3-84)^2+(-77*x1+25*x2-86*x3-55)^2+(-90*x1+50*x2+12*x3+40)^2+(39*x1+31*x2+60*x3+61)^2+(73*x1+87*x2+44*x3+89)^2)^(1/2)

 

{RootOf(5746334135035672084375*_Z^6-913958027295259362004439418*_Z^5+209303995485125455462754953871449*_Z^4-32271236300897810282685984855604245768*_Z^3+1625279483013868647347724976179028140933357*_Z^2-36929029028260658945070210577750774205716044622*_Z+341556341515302335505787717878837563118963515418383, index = 1)^(1/2), RootOf(5746334135035672084375*_Z^6-913958027295259362004439418*_Z^5+209303995485125455462754953871449*_Z^4-32271236300897810282685984855604245768*_Z^3+1625279483013868647347724976179028140933357*_Z^2-36929029028260658945070210577750774205716044622*_Z+341556341515302335505787717878837563118963515418383, index = 2)^(1/2)}

 

{160.8926194, 338.9540270}

 

[160.892619369734575, [x1 = HFloat(-0.8163050519700333), x2 = HFloat(-0.5087313946293615), x3 = HFloat(-0.27356613505088273)]]

(1)

 


 

Download min.mw

See help on  CurveFitting:-PolynomialInterpolation  command.

A:=[[1,2],[5,7]]:
B:=[[1,2]]:
(convert(A,set) intersect convert(B,set))[];

# or

A:=[[1,2],[5,7]]:
B:=[[1,2]]:
({A[]} intersect {B[]})[];

 

p := [[[0, 5], [3, 10], [1, 20], [0, 50]], [[2, 5], [0, 10], [2, 20], [0, 50]]];
evalindets(p, list(numeric), i->`if`(i[1]<>0,i,NULL)) ;

evalc  command tries to bring the result to the form  a+b*I  , in which  a  and  b  are  reals.

evalc(I^I);
evalc(2^(2*I+6));

Apparently it should be regarded as a bug in Maple. Use  is  command instead:

is(a * conjugate(a) = abs(a) ^ 2);
                                                         
  true


Of course, Maple knows this identity, making a corresponding simplification:

simplify(a*conjugate(a));
                                                         
abs(a)^2

Here is the corrected version:


 

restart

Typesetting:-mrow(Typesetting:-mi("et", italic = "true", mathvariant = "italic"), Typesetting:-mo(" ", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mo("&coloneq;", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.2777778em", rspace = "0.2777778em"), Typesetting:-mo("proc", bold = "true", mathvariant = "bold", fontweight = "bold", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi("x", italic = "true", mathvariant = "italic")), mathvariant = "normal"), Typesetting:-mi(""), Typesetting:-mspace(height = "0.0ex", width = "0.5em", depth = "0.0ex", linebreak = "firstprocnewline"), Typesetting:-mo("description", bold = "true", mathvariant = "bold", fontweight = "bold", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mspace(height = "0.0ex", width = "0.5em", depth = "0.0ex", linebreak = "auto"), Typesetting:-ms("this is a variant of evalf that gets rid of almost 0 nos.(rounding error) and shortens the display to 2 digits"), Typesetting:-mo(";", mathvariant = "normal", fence = "false", separator = "true", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.2777778em"), Typesetting:-mspace(height = "0.0ex", width = "0.5em", depth = "0.0ex", linebreak = "firstprocnewline"), Typesetting:-mo("if", bold = "true", mathvariant = "bold", fontweight = "bold", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mo(" ", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mi("abs", italic = "false", mathvariant = "normal"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi("evalf", italic = "true", mathvariant = "italic"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi("x", italic = "true", mathvariant = "italic"), Typesetting:-mo(",", mathvariant = "normal", fence = "false", separator = "true", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.3333333em"), Typesetting:-mn("20", mathvariant = "normal")), mathvariant = "normal")), mathvariant = "normal"), Typesetting:-mo("<", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.2777778em", rspace = "0.2777778em"), Typesetting:-mn("10", mathvariant = "normal"), Typesetting:-mo("^", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.1111111em", rspace = "0.1111111em"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mo("&uminus0;", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.2222222em", rspace = "0.2222222em"), Typesetting:-mn("14", mathvariant = "normal")), mathvariant = "normal"), Typesetting:-mo(" ", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mo("then", bold = "true", mathvariant = "bold", fontweight = "bold", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mspace(height = "0.0ex", width = "0.5em", depth = "0.0ex", linebreak = "increaseindentnewline"), Typesetting:-mn("0", mathvariant = "normal"), Typesetting:-mspace(height = "0.0ex", width = "0.5em", depth = "0.0ex", linebreak = "decreaseindentnewline"), Typesetting:-mo("else", bold = "true", mathvariant = "bold", fontweight = "bold", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mspace(height = "0.0ex", width = "0.5em", depth = "0.0ex", linebreak = "increaseindentnewline"), Typesetting:-mi("evalf", italic = "true", mathvariant = "italic"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi("x", italic = "true", mathvariant = "italic"), Typesetting:-mo(",", mathvariant = "normal", fence = "false", separator = "true", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.3333333em"), Typesetting:-mn("2", mathvariant = "normal")), mathvariant = "normal"), Typesetting:-mi(""), Typesetting:-mspace(height = "0.0ex", width = "0.5em", depth = "0.0ex", linebreak = "decreaseindentnewline"), Typesetting:-mo("end if", bold = "true", mathvariant = "bold", fontweight = "bold", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mspace(height = "0.0ex", width = "0.5em", depth = "0.0ex", linebreak = "decreaseindentnewline"), Typesetting:-mo("end", bold = "true", mathvariant = "bold", fontweight = "bold", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mo(" ", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mo("proc", bold = "true", mathvariant = "bold", fontweight = "bold", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mo(":", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.2777778em", rspace = "0.2777778em"))

et(Pi)

3.1

(1)

et(3.1637)

3.2

(2)

 


 

Download proc.description_new.mw

f:=(x^2+y^2+2*y)^2-4*(x^2+y^2):
plots:-implicitplot(f, x=-4..4,y=-4..4, gridrefine=3);

# Or
algcurves:-plot_real_curve(f, x, y);

# Or (in polar coordinates)
simplify(subs([x=r*cos(phi),y=r*sin(phi)], f));
solve(%, r);
plot(%[4], phi=0..2*Pi, coords=polar);

 

restart;
Set:={R = 7.339698158, S = 2.378491488, W = 2.512047349}:
X:=eval(R, Set);
Y:=eval(S, Set); 
#  and so on

You can do this in one line (multiple assignment):
restart;
Set:={R = 7.339698158, S = 2.378491488, W = 2.512047349}:
X, Y:=eval([R, S], Set)[];

 

Edit.

I think that in one answer it is easy to answer for everyone:

1. Student:-Calculus1:-LimitTutor command is very weak and just fails with this example.

2. For a student studying the theory of limits, it would be more useful to solve this example manually, first getting rid of the signs of the modules in the neighborhood of point  x=2  on the left and on the right.

3. The process of getting rid of modules is easy to automate with the help of Maple, after which the task becomes quite obvious:

Expr:=(2*abs(x-2)+abs(x+1)-3)/(abs(x^2-4)+x-2);  
A:=simplify(Expr) assuming x<2 and x>1.9;  
# On the left
B:=simplify(Expr) assuming x>2 and x<2.1;  # On the right
plot(Expr, x=1..3, view=0..1, discont, size=[600,300]);  # A visualization
                        

 

restart;
SplitChange := proc(str::string) 
local start, i, len, k, L;  
start := 1; len := length(str); k:=0;
for i from 2 to len do 
if str[i] <> str[start] then k:=k+1; L[k]:=str[start .. i-1]; start := i end if;
end do;
L[k+1]:=str[start..len]; 
convert(L, list);
end proc:

Example of use:
SplitChange("WPKCPYWYYYXHYY");
                
["W", "P", "K", "C", "P", "Y", "W", "YYY", "X", "H", "YY"]


Edit.

A  and  B  are 2 curves on the surface  C :

restart; 
f:=(x,y)->2*x^2+3^2-x*y-4:
A:=plots:-spacecurve([1,y,f(1,y)], y=-2..2, color=red, thickness=3):
B:=plots:-spacecurve([x,1,f(x,1)], x=-2..2, color=blue, thickness=3):
C:=plot3d(f, -2..2, -2..2, style=surface):
plots:-display(A,B,C, orientation=[115,75], labels=[x,y,z]);

For this particular plotting, 20 digits is enough. It is better not to specify the global Digits, but to specify the desired accuracy when specifying the function itself. In this case, you need a procedural form for plotting:

restart;
f:= x->evalf[20](exp(x)*HeunC(2*x, 1/2, -1/2, -x^2, 1/8, 99/100)):
plot(f, 0..40);
                          

 

First 109 110 111 112 113 114 115 Last Page 111 of 292