Kitonum

21580 Reputation

26 Badges

17 years, 158 days

MaplePrimes Activity


These are answers submitted by Kitonum

I don't know what Maple Learn means. Use standard syntax to evaluate multiple integrals. Below is an example in which the double integral is reduced to an iterated integral and calculated in two ways:
 

restart;
plots:-inequal({y>=x^2,y<=1}, x=0..1, y=0..1); # The integration region

A:=Int(x*y^2, [y = x^2 .. 1, x = 0 .. 1]); # The first way
value(A);

B:=Int(x*y^2, [x = 0 .. sqrt(y), y = 0 .. 1]); # The second way
value(B);

 

Int(x*y^2, [y = x^2 .. 1, x = 0 .. 1])

 

1/8

 

Int(x*y^2, [x = 0 .. y^(1/2), y = 0 .. 1])

 

1/8

(1)

 


 

Download double_integral_(2).mw

If  n = 1  then you get  0  in the denominator of  c(n) , so I chose  n = 2 .. infinity . The method you use to find the convergence region is guaranteed to only give an open interval. Therefore, we must separately investigate the convergence at the ends of this interval:

 

restart;
c:=n-> 1/(n^2-1);
u:=n->c(n)*(x-2)^n; # The function of the general term of the series
S:=Sum(u(n), n=2..infinity);
limit(abs(u(n+1)/u(n)), n=infinity); # We use the ratio test (d'Alembert test) for a series of absolute values
solve(%<1); # We get the (open) convergence interval
x1,x2:=op(op(1,%)),op(op(2,%)); # The left and right ends of the convergence interval 

value(eval(S, x=x1)); # The series converges at the left end
value(eval(S, x=x2)); # The series converges at the right end

                                


Edit.

We will denote  U[n]=u(x[n])  for all  n=1..N


 

restart;
h:=0.01: r:=0.02: N:=10: f:=y->y^5: K:=(x,y)->sin(x)*y^5:
assign(seq(x[n]=sin(h*n), n=1..N));
assign(seq(y[m]=cos(r*m), m=1..N));
Sys:={seq(add(K(x[n],y[m])*U[n],n=1..N)=f(y[m]), m=1..N)};
solve(Sys);
assign(%);
plot([seq([x[n],U[n]], n=1..N)]);

{0.9041977446e-2*U[1]+0.1808214671e-1*U[2]+0.2711870069e-1*U[3]+0.3614983446e-1*U[4]+0.4517374631e-1*U[5]+0.5418863892e-1*U[6]+0.6319272033e-1*U[7]+0.7218420503e-1*U[8]+0.8116131509e-1*U[9]+0.9012228112e-1*U[10] = .9042278847, 0.9217561686e-2*U[1]+0.1843328007e-1*U[2]+0.2764531298e-1*U[3]+0.3685182042e-1*U[4]+0.4605096570e-1*U[5]+0.5524091660e-1*U[6]+0.6441984635e-1*U[7]+0.7358593478e-1*U[8]+0.8273736944e-1*U[9]+0.9187234656e-1*U[10] = .9217868940, 0.9377158775e-2*U[1]+0.1875244234e-1*U[2]+0.2812397660e-1*U[3]+0.3748988973e-1*U[4]+0.4684831323e-1*U[5]+0.5619738315e-1*U[6]+0.6553524110e-1*U[7]+0.7486003540e-1*U[8]+0.8416992218e-1*U[9]+0.9346306649e-1*U[10] = .9377471349, 0.9519961947e-2*U[1]+0.1903802012e-1*U[2]+0.2855227191e-1*U[3]+0.3806081695e-1*U[4]+0.4756175830e-1*U[5]+0.5705320364e-1*U[6]+0.6653326625e-1*U[7]+0.7600006627e-1*U[8]+0.8545173175e-1*U[9]+0.9488639979e-1*U[10] = .9520279281, 0.9645244800e-2*U[1]+0.1928856077e-1*U[2]+0.2892802026e-1*U[3]+0.3856169791e-1*U[4]+0.4818767181e-1*U[5]+0.5780402472e-1*U[6]+0.6740884511e-1*U[7]+0.7700022837e-1*U[8]+0.8657627792e-1*U[9]+0.9613510634e-1*U[10] = .9645566310, 0.9752366583e-2*U[1]+0.1950278292e-1*U[2]+0.2924929994e-1*U[3]+0.3898997090e-1*U[4]+0.4872285256e-1*U[5]+0.5844600637e-1*U[6]+0.6815749959e-1*U[7]+0.7785540643e-1*U[8]+0.8753780928e-1*U[9]+0.9720279972e-1*U[10] = .9752691664, 0.9840776929e-2*U[1]+0.1967958593e-1*U[2]+0.2951446027e-1*U[3]+0.3934343555e-1*U[4]+0.4916455091e-1*U[5]+0.5897585024e-1*U[6]+0.6877538326e-1*U[7]+0.7856120675e-1*U[8]+0.8833138568e-1*U[9]+0.9808399436e-1*U[10] = .9841104957, 0.9910019883e-2*U[1]+0.1981805799e-1*U[2]+0.2972213375e-1*U[3]+0.3962026895e-1*U[4]+0.4951048892e-1*U[5]+0.5939082379e-1*U[6]+0.6925930955e-1*U[7]+0.7911398932e-1*U[8]+0.8895291446e-1*U[9]+0.9877414571e-1*U[10] = .9910350219, 0.9959737274e-2*U[1]+0.1991748283e-1*U[2]+0.2987124616e-1*U[3]+0.3981903912e-1*U[4]+0.4975887715e-1*U[5]+0.5968878048e-1*U[6]+0.6960677527e-1*U[7]+0.7951089479e-1*U[8]+0.8939918065e-1*U[9]+0.9926968385e-1*U[10] = .9960069267, 0.9989671343e-2*U[1]+0.1997734498e-1*U[2]+0.2996102443e-1*U[3]+0.3993871556e-1*U[4]+0.4990842785e-1*U[5]+0.5986817559e-1*U[6]+0.6981597898e-1*U[7]+0.7974986542e-1*U[8]+0.8966787059e-1*U[9]+0.9956803967e-1*U[10] = .9990004334}

 

{U[1] = 43.01571534, U[2] = 2.129649377, U[3] = -.6317112735, U[4] = .3228390822, U[5] = -1.905151633, U[6] = 2.229722710, U[7] = 0.7779033052e-2, U[8] = 1.952960982, U[9] = 2.850101312, U[10] = .8287345356}

 

 

 


 

Download Sys.mw

Of course, the indefinite integral is calculated up to an additive constant. Here's a way to get the desired result.

NULL

restart

randomize

NULL

v := RandomTools:-Generate(choose({m, t, x, z}))

z

(1)

NULL

f := RandomTools:-Generate(polynom(integer(range = -10 .. 10, exclude = {0}), v, degree = 2))

z^2+3*z-1

(2)

fp := g(v)^4

g(z)^4

(3)

fd := diff(g(v), v)

diff(g(z), z)

(4)

NULL

fs := fd*g(v)^5

(diff(g(z), z))*g(z)^5

(5)

NULL

NULL

PE := Int(fs, v)

Int((diff(g(z), z))*g(z)^5, z)

(6)

PR := int(fs, v)

(1/6)*g(z)^6

(7)

subs(g(v)=f, PR);

(1/6)*(z^2+3*z-1)^6

(8)

``


 

Download QuestionInt_new.mw

You can use  combinat:-permute  for this:

restart;
S:=[1,2,3]:
combinat:-permute(map(`$`,S, 2), 2);

                   [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]]


or a little shorter

combinat:-permute(`$`~(S, 2), 2);


Edit. If you use  the  Iterator  package then the  CartesianProduct  command can be used.


 

restart;
V1 := Vector(8, [1, 2, 2, 1, 3, A, B, 1/(A + B)^2]);
V2 := Vector(8, [1, 2, 2, 1, 3, A, B, 1/(A^2 + 2*A*B + B^2)]);
V2:=simplify(V2);
LinearAlgebra:-Equal(V1[6 .. 8], V2[6 .. 8]);

Vector(8, {(1) = 1, (2) = 2, (3) = 2, (4) = 1, (5) = 3, (6) = A, (7) = B, (8) = 1/(A+B)^2})

 

Vector(8, {(1) = 1, (2) = 2, (3) = 2, (4) = 1, (5) = 3, (6) = A, (7) = B, (8) = 1/(A^2+2*A*B+B^2)})

 

Vector[column](%id = 18446746221073234750)

 

true

(1)

 


 

Download simplify.mw


 

restart

NULL

"f(x):=18*log10(x);"

proc (x) options operator, arrow, function_assign; 18*log10(x) end proc

(1)

"g(x):=1/(2) x^(3)-8*x^(2)+(69/(2))^()*x-27;"

proc (x) options operator, arrow, function_assign; (1/2)*x^3-8*x^2+(69/2)*x-27 end proc

(2)

plot([f(x), g(x)], x = -1 .. 11, -30 .. 25, size = [800, 500])

 

NULL

sort([RootFinding:-Analytic(f(x)-g(x), re = 0 .. 12, im = -1 .. 1)])

[0.372146548487319e-1, 1.00000000000000, 4.50616492819266, 10.0000000000000]

(3)

``


 

Download intersect_curve_new.mw

restart;
f:=unapply(int(diff(Y1(x), x), x)+C1, x);
solve({Y1(0) = f(0)}, {C1});

                                    f := x -> Y1(x) + C1
                                           {C1 = 0}

For drawing arrows see help on  plots:-arrow

restart;
with(plots): with(plottools):
S:=seq(seq(disk([x,y], 0.05, color=blue), x=-1..6), y=-1..3):
T:=textplot([[0,0,"(0,0)",align=[left,below]],[1,1,"(1,1)",align=[right,above]],[2,1,"(2,1)",align=[right,above]]], font=[times,18]):
display(S,T, scaling=constrained, size=[800,500],axes=none);

                           

Two-argument  arctan(y,x)  returns the polar angle  phi  of a point  A(x,y) in the range  -Pi < phi <= Pi

Examples:

restart;
arctan(1,sqrt(3)), arctan(-1,sqrt(3)), arctan(-1,-sqrt(3)), arctan(0,-1);  

                                 


See help on  ?arctan  for details  .

Example:

combs := combinat:-choose({a, b, c, d, e}, 3);

     combs := {{a, b, c}, {a, b, d}, {a, b, e}, {a, c, d}, {a, c, e}, {a, d, e}, {b, c, d}, {b, c, e}, {b, d, e}, {c, d, e}}

What functions are you talking about? Inside contourplot command, you simply calculate the sum of the values of one function  BesselJ  in a finite number of points, and skip one  sum command, since you have a double sum:

restart;
sum(sum(BesselJ(n,r),n=0..5),r=-10..10);

                 1+2*BesselJ(0, 10)+2*BesselJ(2, 10)+2*BesselJ(4, 10)+2*BesselJ(0, 9)+2*BesselJ(2, 9)+2*BesselJ(4, 9)+2*BesselJ(0, 8)+2*BesselJ(2, 8)+2*BesselJ(4, 8)+2*BesselJ(0, 7)+2*BesselJ(2, 7)+2*BesselJ(4, 7)+2*BesselJ(0, 6)+2*BesselJ(2, 6)+2*BesselJ(4, 6)+2*BesselJ(0, 5)+2*BesselJ(2, 5)+2*BesselJ(4, 5)+2*BesselJ(0, 4)+2*BesselJ(2, 4)+2*BesselJ(4, 4)+2*BesselJ(0, 3)+2*BesselJ(2, 3)+2*BesselJ(4, 3)+2*BesselJ(0, 2)+2*BesselJ(2, 2)+2*BesselJ(4, 2)+2*BesselJ(0, 1)+2*BesselJ(2, 1)+2*BesselJ(4, 1)


Of course, you can plot  a  contourplot for the function of two variables  BesselJ(n,r)  in appropriate ranges for n and r without any problem:

plots:-contourplot(BesselJ(n,r), n=0..5, r=-10..10, grid=[200,200]);

                  

 

Maple finds both real and complex solutions. The  select  command helps to select real roots:
 

restart;

F := -1 - y - exp(x);
G := x^2 + y*(exp(x) - 1);
sol1 := solve({F, G}, {x, y});
sol2:=allvalues(sol1);
``;
select(p->type(eval(x,p),realcons) and type(eval(y,p),realcons),[sol2])[];

-1-y-exp(x)

 

x^2+y*(exp(x)-1)

 

{x = RootOf(-(exp(_Z))^2+_Z^2+1), y = -1-exp(RootOf(-(exp(_Z))^2+_Z^2+1))}

 

{x = 0, y = -2}, {x = RootOf(-(exp(_Z))^2+_Z^2+1, 0.8091750422e-1+1.468988335*I), y = -1-exp(RootOf(-(exp(_Z))^2+_Z^2+1, 0.8091750422e-1+1.468988335*I))}, {x = RootOf(-(exp(_Z))^2+_Z^2+1, 0.8091750422e-1-1.468988335*I), y = -1-exp(RootOf(-(exp(_Z))^2+_Z^2+1, 0.8091750422e-1-1.468988335*I))}

 

``

 

{x = 0, y = -2}

(1)

 


Edit. Of course, you can immediately get the solution (as float number) you want using  fsolve  command:

sol := fsolve({F, G}, {x, y});

                                       sol := {x = 0., y = -2.000000000}

 

Download solve.mw

@Zeineb  What you want to calculate is called a (matrix) norm. Carl showed one way (the  infinity-norm). But there are other formulas for calculating a norm, and Maple has a suitable command. See help on  ?LinearAlgebra:-Norm .

 

Obviously, the function  g  depends not only on x, but also on p , so  g(x,p)=max{h(x,p),f(x,p) . It is useful to use graphic illustration to obtain this dependence. First, we plot a red line  x-p=x^2+p*x . It is easy to check that above this line (pink area) we have  g(x,p)=x^2+p*x, and below (blue area)  g(x,p)=x-p


 

restart;
eq:=x-p=x^2+p*x;
f:=unapply(solve(eq, p), x);
P1:=plot(f, 0..10, p=-1..1, color=red, thickness=3):
P2:=plots:-inequal(p>f(x),x=0..10,p=-1..1,color="LightPink",optionsexcluded = [color = "LightBlue"],nolines):
T:=plots:-textplot([[5,0.3,g(x,p)=x^2+p*x],[1,-0.7,g(x,p)=x-p]], font=[times,bold,16]):
plots:-display(P1,P2,T, size=[800,400]);

g:=unapply(piecewise(p>=f(x),x^2+p*x,x-p), x,p);
Sol:=unapply(int(g(x,p), x=0..10), p);

# Examples of use
Sol(2), Sol(1), Sol(0), Sol(-2);

eq := x-p = p*x+x^2

 

f := proc (x) options operator, arrow; -x*(x-1)/(x+1) end proc

 

 

g := proc (x, p) options operator, arrow; piecewise(-x*(x-1)/(x+1) <= p, p*x+x^2, x-p) end proc

 

proc (p) options operator, arrow; 50*p-60*p*piecewise(-p < 90/11, 0, 1)+1000/3-(850/3)*piecewise(-p < 90/11, 0, 1)+piecewise(And(p <= 3-2*2^(1/2), 0 < p), (1/8)*piecewise(-signum((p^2-6*p+1)^(1/2)/(p-3+(p^2-6*p+1)^(1/2))) = 1, 1, 0)*p^2*(p^2-6*p+1)^(1/2)-(3/4)*piecewise(-signum((p^2-6*p+1)^(1/2)/(p-3+(p^2-6*p+1)^(1/2))) = 1, 1, 0)*p*(p^2-6*p+1)^(1/2)-(1/12)*piecewise(-signum((p^2-6*p+1)^(1/2)/(p-3+(p^2-6*p+1)^(1/2))) = 1, 1, 0)+(1/12)*piecewise(-signum((p^2-6*p+1)^(1/2)/(p-3+(p^2-6*p+1)^(1/2))) = 1, 1, 0)*p^3-(3/4)*piecewise(-signum((p^2-6*p+1)^(1/2)/(p-3+(p^2-6*p+1)^(1/2))) = 1, 1, 0)*p^2+(1/8)*piecewise(-signum((p^2-6*p+1)^(1/2)/(p-3+(p^2-6*p+1)^(1/2))) = 1, 1, 0)*(p^2-6*p+1)^(1/2)-(1/24)*piecewise(-signum((p^2-6*p+1)^(1/2)/(p-3+(p^2-6*p+1)^(1/2))) = 1, 1, 0)*(p^2-6*p+1)^(3/2)+(3/4)*piecewise(-signum((p^2-6*p+1)^(1/2)/(p-3+(p^2-6*p+1)^(1/2))) = 1, 1, 0)*p+(1/12)*piecewise(signum((p^2-6*p+1)^(1/2)/(p-3+(p^2-6*p+1)^(1/2))) = 1, 1, 0)+(3/4)*piecewise(signum((p^2-6*p+1)^(1/2)/(p-3+(p^2-6*p+1)^(1/2))) = 1, 1, 0)*p*(p^2-6*p+1)^(1/2)-(1/8)*piecewise(signum((p^2-6*p+1)^(1/2)/(p-3+(p^2-6*p+1)^(1/2))) = 1, 1, 0)*p^2*(p^2-6*p+1)^(1/2)+(3/4)*piecewise(signum((p^2-6*p+1)^(1/2)/(p-3+(p^2-6*p+1)^(1/2))) = 1, 1, 0)*p^2-(3/4)*piecewise(signum((p^2-6*p+1)^(1/2)/(p-3+(p^2-6*p+1)^(1/2))) = 1, 1, 0)*p-(1/8)*piecewise(signum((p^2-6*p+1)^(1/2)/(p-3+(p^2-6*p+1)^(1/2))) = 1, 1, 0)*(p^2-6*p+1)^(1/2)-(1/12)*piecewise(signum((p^2-6*p+1)^(1/2)/(p-3+(p^2-6*p+1)^(1/2))) = 1, 1, 0)*p^3+(1/24)*piecewise(signum((p^2-6*p+1)^(1/2)/(p-3+(p^2-6*p+1)^(1/2))) = 1, 1, 0)*(p^2-6*p+1)^(3/2), 0)+piecewise(And(p <= 3-2*2^(1/2), -90/11 < p), (1/12)*piecewise(-signum((p^2-6*p+1)^(1/2)/(-p+(p^2-6*p+1)^(1/2)+3)) = 1, 1, 0)*p^3-(3/4)*piecewise(-signum((p^2-6*p+1)^(1/2)/(-p+(p^2-6*p+1)^(1/2)+3)) = 1, 1, 0)*p^2-(1/8)*piecewise(-signum((p^2-6*p+1)^(1/2)/(-p+(p^2-6*p+1)^(1/2)+3)) = 1, 1, 0)*(p^2-6*p+1)^(1/2)+(1/24)*piecewise(-signum((p^2-6*p+1)^(1/2)/(-p+(p^2-6*p+1)^(1/2)+3)) = 1, 1, 0)*(p^2-6*p+1)^(3/2)+(3/4)*piecewise(-signum((p^2-6*p+1)^(1/2)/(-p+(p^2-6*p+1)^(1/2)+3)) = 1, 1, 0)*p-(1/8)*piecewise(-signum((p^2-6*p+1)^(1/2)/(-p+(p^2-6*p+1)^(1/2)+3)) = 1, 1, 0)*p^2*(p^2-6*p+1)^(1/2)+(3/4)*piecewise(-signum((p^2-6*p+1)^(1/2)/(-p+(p^2-6*p+1)^(1/2)+3)) = 1, 1, 0)*p*(p^2-6*p+1)^(1/2)+(1/8)*piecewise(signum((p^2-6*p+1)^(1/2)/(-p+(p^2-6*p+1)^(1/2)+3)) = 1, 1, 0)*p^2*(p^2-6*p+1)^(1/2)-(3/4)*piecewise(signum((p^2-6*p+1)^(1/2)/(-p+(p^2-6*p+1)^(1/2)+3)) = 1, 1, 0)*p*(p^2-6*p+1)^(1/2)-(1/12)*piecewise(signum((p^2-6*p+1)^(1/2)/(-p+(p^2-6*p+1)^(1/2)+3)) = 1, 1, 0)*p^3+(3/4)*piecewise(signum((p^2-6*p+1)^(1/2)/(-p+(p^2-6*p+1)^(1/2)+3)) = 1, 1, 0)*p^2+(1/8)*piecewise(signum((p^2-6*p+1)^(1/2)/(-p+(p^2-6*p+1)^(1/2)+3)) = 1, 1, 0)*(p^2-6*p+1)^(1/2)-(1/24)*piecewise(signum((p^2-6*p+1)^(1/2)/(-p+(p^2-6*p+1)^(1/2)+3)) = 1, 1, 0)*(p^2-6*p+1)^(3/2)-(3/4)*piecewise(signum((p^2-6*p+1)^(1/2)/(-p+(p^2-6*p+1)^(1/2)+3)) = 1, 1, 0)*p-(1/12)*piecewise(-signum((p^2-6*p+1)^(1/2)/(-p+(p^2-6*p+1)^(1/2)+3)) = 1, 1, 0)+(1/12)*piecewise(signum((p^2-6*p+1)^(1/2)/(-p+(p^2-6*p+1)^(1/2)+3)) = 1, 1, 0), 0) end proc

 

1300/3, 1150/3, 667/2, 2863/12+(17/12)*17^(1/2)

(1)

 


 

Download int.mw


Here's another solution that is slightly more cumbersome but gives more compact results:


 

restart;
eq:=x-p=x^2+p*x;
f:=unapply(solve(eq, p), x);
plot(f, 0..10, p=-1..1);
maximize(f(x), x=0..10, location);
M:=expand~([%])[];
p1:=f(0); p2:=M[1];
x1,x2:=solve(eq, x);
g:=unapply(piecewise(p>=p2,x^2+p*x,p<p2 and p>p1,piecewise(x>x2 and x<x1,x-p,x^2+p*x),p<=p1,piecewise(x<=x1,x-p,x^2+p*x)), x,p);
Sol:=unapply(simplify(int(g(x,p), x=0..10)), p);

# Examples of use
Sol(2), Sol(1), Sol(0), Sol(-2);
 

eq := x-p = p*x+x^2

 

f := proc (x) options operator, arrow; -x*(x-1)/(x+1) end proc

 

 

-(1/2)*(sqrt(2)-1)*(sqrt(2)-2)*sqrt(2), {[{x = sqrt(2)-1}, -(1/2)*(sqrt(2)-1)*(sqrt(2)-2)*sqrt(2)]}

 

M := -2*sqrt(2)+3, {[{x = sqrt(2)-1}, -2*sqrt(2)+3]}

 

p1 := 0

 

p2 := -2*sqrt(2)+3

 

x1, x2 := -(1/2)*p+1/2+(1/2)*sqrt(p^2-6*p+1), -(1/2)*p+1/2-(1/2)*sqrt(p^2-6*p+1)

 

g := proc (x, p) options operator, arrow; piecewise(-2*sqrt(2)+3 <= p, p*x+x^2, 0 < p and p < -2*sqrt(2)+3, piecewise(-(1/2)*p+1/2-(1/2)*sqrt(p^2-6*p+1) < x and x < -(1/2)*p+1/2+(1/2)*sqrt(p^2-6*p+1), x-p, p*x+x^2), p <= 0, piecewise(x <= -(1/2)*p+1/2+(1/2)*sqrt(p^2-6*p+1), x-p, p*x+x^2)) end proc

 

proc (p) options operator, arrow; piecewise(p < -90/11, 50-10*p, p <= 0, (1/12)*(p^2-6*p+1)^(3/2)-(1/12)*p^3+(3/4)*p^2+(197/4)*p+4001/12, p < -2*2^(1/2)+3, (1/6)*(p^2-6*p+1)^(3/2)+50*p+1000/3, -2*2^(1/2)+3 <= p, 50*p+1000/3) end proc

 

1300/3, 1150/3, 667/2, (17/12)*17^(1/2)+2863/12

(1)

 


 

Download int1.mw

Edit.

First 47 48 49 50 51 52 53 Last Page 49 of 290