Kitonum

15369 Reputation

24 Badges

12 years, 105 days

MaplePrimes Activity


These are answers submitted by Kitonum

R:=1.33*10^(-9)*C/m^2;
evalf[3](op(1,R)*``(`*`(op(2..3,R))));

                     

 

restart;
expr:=exp(x)^3*sin(x)+3/(exp(x)^n):
A:=exp(t::anything)^n::anything=exp(t*n):
applyrule([1/A,A], expr);

                                    

Edit.

restart;
a:= 456;
L:=convert(a,base,10);
Array([seq(L[i],i=-1..-nops(L),-1)]);
# Or shorter
Array(ListTools:-Reverse(L));

                          

Edit.

Use  LinearAlgebra:-Modular  subpackage to work with matrices on a specific finite field.

To generate all such matrices, read the thread  https://mapleprimes.com/questions/211872-Generate-Invertible-4x4-Matrices-Over-F2-

restart;
x, y := r*cos(t), r*sin(t):
plot3d([[x, y, r], [x, y, 0]], r= 0..1, t= 0..Pi, scaling= constrained);

 

Your equation contains several parameters in addition to variables  x  and  y . For Maple to accept this equation as an ellipse equation, conditions on the parameters are necessary. To get these conditions, we first select complete squares:

restart;
with(geometry):
eqell := expand((x+(1/2)*R1-(1/2)*R)^2/a^2+y^2/b^2-1);
A:=Student:-Precalculus:-CompleteSquare(eqell,x,y);
B, C := selectremove(t->has(t,x)or has(t,y), A);  
Eq:=subsindets(B,`^`,t->applyop(simplify,1,t))=simplify(-C); # Simplified ellipse equation
geometry:-ellipse(ell, Eq, [x, y]) assuming a>0, b>0, a>b; 
detail(ell);

 

Edit.

Download Ellipse1.mw

Use the appropriate options. An example:

restart;
plot([sin(x),cos(x)], x=0..2*Pi, color=[blue,red], style=point, symbol=[cross,diagonalcross], symbolsize=12, numpoints=50, adaptive=false, size=[800,400], scaling=constrained);

                 

See help on  ?plot,options
If you want to have a solid line as well, and not just some symbols, then use  style=pointline  option.

Remember that  e  is just a Maple symbol (not Euler's number e), and the exponential function  e^x  should be coded as  exp(x) .
First, we plot this function to ensure the existence and uniqueness of the root.
 

restart;

f:=x->(5-x)*exp(x)-5:
a := 4.:
b := 5.:
nStep := 5:
plot(f, 4..5);

for n from 1 to nStep do
c:=(a+b)/2;
if f(a)*f(c)<0 then b:=c else a:=c fi;
od;

fsolve(f, 4..5); # For comparison
 

 

4.500000000

 

4.750000000

 

4.875000000

 

4.937500000

 

4.968750000

 

4.965114232

(1)

 


 

Download bisect.mw

acer's way makes sense for a single application. But if this needs to be done several times, then a more significant gain (for arbitrary matrices) is given by applying the procedure:
 

Cs:=A->[seq(A[..,i],i=1..op([1,2],A))];

proc (A) options operator, arrow; [seq(A[() .. (), i], i = 1 .. op([1, 2], A))] end proc

(1)

A:=Matrix([[1,2,1,3,2],[3,4,9,0,7],[2,3,5,1,8],[2,2,8,-3,5]]);
Cs(A);

Matrix(4, 5, {(1, 1) = 1, (1, 2) = 2, (1, 3) = 1, (1, 4) = 3, (1, 5) = 2, (2, 1) = 3, (2, 2) = 4, (2, 3) = 9, (2, 4) = 0, (2, 5) = 7, (3, 1) = 2, (3, 2) = 3, (3, 3) = 5, (3, 4) = 1, (3, 5) = 8, (4, 1) = 2, (4, 2) = 2, (4, 3) = 8, (4, 4) = -3, (4, 5) = 5})

 

[Vector[column](%id = 18446747312617452598), Vector[column](%id = 18446747312617452718), Vector[column](%id = 18446747312617452838), Vector[column](%id = 18446747312617452958), Vector[column](%id = 18446747312617453078)]

(2)

 


 

Download Columns.mw

restart;
Eq:=x^2-3=0:
f:=unapply(lhs(Eq), x);
x0:=3.:
for n from 1 do
x||n:=x||(n-1)-f(x||(n-1))/D(f)(x||(n-1));
if abs(x||n-x||(n-1))<10^(-6) then break fi;
od;

sqrt(3.);  # for comparison

          

 

 

When working with expressions with a small denominator (you have  a=10^(-10) ), increased precision is required. You are working with  Digits=10  by default. If you take for example  Digits:=25 , then the difference in results disappears:


 

restart:

interface(version)

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

(1)

KL := (a, b) -> (1/4)*(2*ln(a+b)*a^2+4*ln(a+b)*b*a+2*ln(a+b)*b^2-2*ln(b)*b^2-a^2-2*a*b)/a

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

(2)


Digits:=25:
evalf(KL(1e-10, 1/2));

-.3465735902646299

(3)

evalf(KL(1e-10, 0.5))

-.3465735902646300000000000

(4)

 


 

Download I_am_lost_new.mw

This is not a continued fraction. You just need to rewrite the integrand as an infinite product  x^(1/2)*x^(1/4)*x^(1/8)* ...

So we get

int(product(x^(1/2^k), k=1..infinity), x);

                                     

Another way:
 

restart;
L:=[1/x, 3, 1, [0,t,t=0..4]]:
P:= plot(L,  x=-1..2, y=0..4, color=black, thickness=2):
Q:=plots:-implicitplot(y-1/x, x = 0 .. 1, y = 1 .. 3, coloring = ["SteelBlue", "White"], filledregions = true):
plots:-display(P,Q, scaling=constrained, size=[450,600]);

 

 

 


 

Download filledregions.mw

The procedure  P  saves from the list  L  only those pairs of entries  a  and  b  for which  abs(a - b)  equals the minimum distance  m  between the entries of the original list.


 

restart;
P:=proc(L::list(positive))
local n, L1, m, S, L2;
n:=nops(L);
L1:=sort(L);
m:=min(seq(L1[k]-L1[k-1],k=2..n));
S:={seq(`if`(L1[k]-L1[k-1]=m,op([L1[k-1],L1[k]]),NULL), k=2..n)};
select(x->evalb(x in S), L);
end proc:

# Examples
L:=[8.1 , 2.03 , 3.5 , 0.05 , 4.1]:
P(L);

L:=[8.1 , 7.5, 2.03 , 3.5 , 0.05 , 4.1]:
P(L);

[3.5, 4.1]

 

[8.1, 7.5, 3.5, 4.1]

(1)

 


 

Download P.mw

To calculate sums with specific numerical (not symbolic) limits, use the  add command instead of sum :

M:=<x[1]^2+x[2]^2,-x[1]^2-x[2]^2; -x[1]^2-x[2]^2,x[1]^2+x[2]^2>;

Matrix(2, 2, {(1, 1) = x[1]^2+x[2]^2, (1, 2) = -x[1]^2-x[2]^2, (2, 1) = -x[1]^2-x[2]^2, (2, 2) = x[1]^2+x[2]^2})

(1)

M[1,1];

x[1]^2+x[2]^2

(2)

diff(M[1,1],x[1]);

2*x[1]

(3)

diff(M[1,1],x[2]);

2*x[2]

(4)

add(diff(M[1,1],x[k])+diff(M[1,k],x[1])-diff(M[k,1],x[1]), k=1..2);

2*x[1]+2*x[2]

(5)

 


The above also shows how easy it is to enter a matrix using 1D input instead of 2D. No palettes needed.

Download add.mw

 

 

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