Kitonum

21530 Reputation

26 Badges

17 years, 86 days

MaplePrimes Activity


These are answers submitted by Kitonum

In the line  phiB1 = ...   should be   phiB1 := ...

In fact, your function  omega  depends only on  x  and  the function  y  so

omega:=(x, y)-> (y(x)*(diff(y(x), x))/x);

 

Example:

omega(x, cos);

                              -cos(x)*sin(x)/x

 

You can just assign any valid names to specific  styles. Also multiple plots should be given a list and not a set (in order to options conform to plots).

Example:

`1` := dash: `2` := dashdot:

plot([x^2, x+1], x = -2 .. 2, linestyle = [`1`, `2`]);

                                     

 

 

You must specify the rule that you are going to compare the real and imaginary numbers.

Example:

sort([1+3*I, 2-I, 3], (a,b)->is(abs(a)<=abs(b)));

                        [2-I, 3, 1+3*I]

 

Read help on  sort  command.

restart;

Lines:=[y, x, x+y-3, x-y+7]:

Points:={[1,1],[4,3],[1,11],[-2,9],[-1,5],[-2,2],[-8,4],[-9,-1],[-3,-3],[3,-3],[6,-1]}:

Points1:=map(t->op([[t[1]-0.5,t[2]],[t[1]+0.5,t[2]]]), Points):

Packs:=combinat[choose](Points1,4):

k:=0:

for p  in Packs do

if convert([seq(add(sign(eval(Lines[i],[x=p[j,1],y=p[j,2]])),j=1..4)=0,i=1..4)],`and`) then

k:=k+1; Teams[k]:=p fi;

od:

Teams:=convert(Teams,list):

L:=ListTools[Categorize]((t1,t2)->convert([seq([seq(sign(eval(Lines[i],[x=t1[j,1],y=t1[j,2]])),j=1..4)]=[seq(sign(eval(Lines[i],[x=t2[j,1],y=t2[j,2]])),j=1..4)],i=1..4)],`and`),Teams):

n:=nops([L]);

Confs:=[seq(L[i,1], i=1..n)]; 


                                                                             n := 13

Confs := [{[-9.5, -1], [-8.5, -1], [3.5, 3], [4.5, 3]}, {[-9.5, -1], [-8.5, 4], [3.5, 3], [5.5, -1]}, {[-9.5, -1], [-3.5, -3], [.5, 11], [3.5, 3]}, {[-9.5, -1], [-2.5, 2], [.5, 11], [5.5, -1]}, {[-9.5, -1], [-2.5, 9], [.5, 1], [5.5, -1]}, {[-9.5, -1], [-2.5, 9], [2.5, -3], [3.5, 3]}, {[-9.5, -1], [-1.5, 5], [.5, 11], [2.5, -3]}, {[-8.5, 4], [-7.5, 4], [5.5, -1], [6.5, -1]}, {[-8.5, 4], [-3.5, -3], [.5, 11], [5.5, -1]}, {[-8.5, 4], [-2.5, 9], [2.5, -3], [5.5, -1]}, {[-3.5, -3], [-2.5, -3], [.5, 11], [1.5, 11]}, {[-3.5, -3], [-2.5, 9], [.5, 11], [2.5, -3]}, {[-2.5, 9], [-1.5, 9], [2.5, -3], [3.5, -3]}]

 

Visualization:

A:=plots[implicitplot](Lines,x=-10..7,y=-5..12, thickness=3, color=blue):

B:=[seq([seq(plottools[disk](Confs[i,j],0.2,color=red), j=1..4)],i=1..13)]:

plots[display](Matrix(3,4,[seq(plots[display](A,op(B[i]), axes=none), i=1..12)]));

plots[display](A,B[13], axes=none);



Lines:=[y, x, x+y-3, x-y+7]:

Points:=[[1,1],[4,3],[1,11],[-2,9],[-1,5],[-2,2],[-8,4],[-9,-1],[-3,-3],[3,-3],[5,-1]]:

Packs:=combinat[choose](Points,4):

k:=0:

for p  in Packs do

if convert([seq(add(sign(eval(Lines[i],[x=p[j,1],y=p[j,2]])),j=1..4)=0,i=1..4)],`and`) then

k:=k+1; Teams[k]:=p fi;

od:

Teams:=convert(Teams,list);  nops(%);

Teams := [[[1, 11], [4, 3], [-3, -3], [-9, -1]], [[1, 11], [-2, 9], [-3, -3], [3, -3]], [[1, 11], [-8, 4], [-3, -3], [5, -1]], [[1, 11], [3, -3], [-1, 5], [-9, -1]], [[1, 11], [-9, -1], [5, -1], [-2, 2]], [[4, 3], [-2, 9], [3, -3], [-9, -1]], [[4, 3], [-8, 4], [-9, -1], [5, -1]], [[-2, 9], [-8, 4], [3, -3], [5, -1]], [[-2, 9], [1, 1], [-9, -1], [5, -1]]]

                                                                                      9

 

Visualization of all the 9 solutions:

A:=plots[implicitplot](Lines,x=-10..6,y=-4..12, thickness=3, color=blue):

B:=[seq([seq(plottools[disk](Teams[i,j],0.2,color=red), j=1..4)],i=1..9)]:

plots[display](Matrix(3,[seq(plots[display](A,op(B[i]), axes=none), i=1..9)]));

 

One equation  a = sin(w*t1 + phi)  is equivalent to an infinite number of linear equations  w*t1 + ph=(-1)^n*arcsin(a)+Pi*n , n is an integer. I take only n=0

The exact solution of the first two equations:

restart;

solve({w*t1 + phi=arcsin(a), w*t2 + phi=arcsin(b)}, {w,phi});

                   {phi = -(arcsin(a)*t2-t1*arcsin(b))/(t1-t2), w = 1/(t1-t2)*(arcsin(a)-arcsin(b))}

 

If the data obtained as a result of the experiment, the overdetermined system can be solved by the method of least squares.  Maple finds a solution for which the sum of the squares of the differences of the left and right parts is minimal.

LinearAlgebra[LeastSquares]({w*t1 + phi=arcsin(a), w*t2 + phi=arcsin(b), w*t3 + phi=arcsin(c)}, {w,phi}) assuming t1::real,t2::real,t3::real;

{phi = -1/2*(arcsin(a)*t1*t2+arcsin(a)*t1*t3-arcsin(a)*t2^2-arcsin(a)*t3^2-arcsin(b)*t1^2+arcsin(b)*t1*t2+arcsin(b)*t2*t3-arcsin(b)*t3^2-arcsin(c)*t1^2+arcsin(c)*t1*t3-arcsin(c)*t2^2+arcsin(c)*t2*t3)/(t1^2-t1*t2-t1*t3+t2^2-t2*t3+t3^2), w = 1/2*(2*t1*arcsin(a)-arcsin(a)*t2-t3*arcsin(a)-t1*arcsin(b)+2*t2*arcsin(b)-t3*arcsin(b)-t1*arcsin(c)-t2*arcsin(c)+2*t3*arcsin(c))/(t1^2-t1*t2-t1*t3+t2^2-t2*t3+t3^2)}

 

otat := proc(a::`=`, b::list)

     local q;

     q := isolate(a, y);

seq(eval(q, b[i]), i=1..nops(b));   # returns values of  y  for all values of  x  in the list  b    

end proc:

 

Example:

otat(x-y = 1, [x = 10, x = 11, x=14]);

                  y = 9, y = 10, y = 13

 

Addition:  The line  seq(eval(q, b[i]), i=1..nops(b));   can be written shorter  eval~(q, b)[];   with the same output

Boundary problems can rarely be solved symbolically. And your task even has  a parameter K. Such problems are solved numerically for a particular value of the parameter:

K:=1:

Eq := diff(y(x), x, x) = -(x^2+1)*y(x)+K;

sol:=dsolve({Eq, y(-1) = 0, y(1) = 0}, y(x),numeric);

plots[odeplot](sol,[x,y(x)], x=-1..1, color=red, thickness=2);

                         

Here are another 6 ways (from the shortest to the longest) for the same list  L:=[7, 9, 13, evalf(Pi), a, b]:

L^~2;

`^`~(L,2);

map(`^`,L,2);

[seq(t^2, t=L)];

[L[i]^2 $ i=1..nops(L)];

[seq(L[i]^2, i=1..nops(L))];

restart:

with(plots):

f:=2*x:

g:=x^2: 

h:=unapply(piecewise( 0<=x and x<= 5, f, 5<x and x <= 10, g ), x):

A:=[1,2,8]:

h_table_A:=map(h,A);

                                         h_table_A := [2, 4, 64]

 

Addition: another way (without  unapply)

restart:

with(plots):

f:=x->2*x:

g:=x->x^2:

h:=x->piecewise( 0<=x and x<= 5, f(x), 5<x and x <= 10, g(x) ) :

A:=[1,2,8]:

h_table_A:=map(h,A);

Or:

ans:=solve({alpha = (1/2)*lambda*alpha*Pi, beta = (1/2)*lambda*beta*Pi}, lambda);

assign(ans);

lambda^6,  lambda^8;

                    

 

 

local Prime:

Prime:= proc (a, b)

local i, p, r;

p := {};

r :={} ;

for i from a to b do

   if isprime(i) then p := p union {i} ;

     if type(sqrt(p[-1]-1), integer) then r := r union {p[-1]} end if; end if;

end do;

p, r;

end proc:

 

Your example:

Prime(1, 10);

                       {2, 3, 5, 7}, {2, 5}

 

Another example:

Prime(1, 100);

   {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97}, {2, 5, 17, 37}

I guess that you are interested only real solution:

RealDomain[solve](convert({0.001=x*exp(0.6/(n*0.026)), 0.01=x*exp(0.68/(n*0.026))}, fraction),{x,n});

evalf(%);

 

 

n[1] := 1.5:  n[2] := 1:

sin(theta[g]):='n[2]'/'n[1]' = cat(convert(n[2], symbol)/convert(n[1], symbol), `=`, `0`, n[2]/n[1]);

                                

 

 

First 201 202 203 204 205 206 207 Last Page 203 of 290