Kitonum

21550 Reputation

26 Badges

17 years, 124 days

MaplePrimes Activity


These are answers submitted by Kitonum

Probably the questioner meant getting real solutions depending on a real parameter m. But Maple does not solve the problem:

restart;

assume(m::realcons);

RealDomain[solve](x^2-(2*(m+1))*x+m^2-2*m+m^2 = 0, x, parametric = full);

                     [{x = m+1+sqrt(-m^2+4*m+1)}, {x = m+1-sqrt(-m^2+4*m+1)}]

 

Mathematica solves the problem correctly:

Reduce[x^2 - 2*(m + 1)*x + m^2 - 2*m + m^2 == 0, x,
Reals] 

(m == 2 - Sqrt[5] &&
x == 3 - Sqrt[5] - Sqrt[
1 + 4 (2 - Sqrt[5]) - (2 - Sqrt[5])^2]) || (2 - Sqrt[5] < m <
2 + Sqrt[5] && (x == 1 + m - Sqrt[1 + 4 m - m^2] ||
x == 1 + m + Sqrt[1 + 4 m - m^2])) || (m == 2 + Sqrt[5] &&
x == 3 + Sqrt[5] - Sqrt[1 + 4 (2 + Sqrt[5]) - (2 + Sqrt[5])^2])

 

Explanation:  &&  is logical  and,  ||  is logical  or

 

 

 

 

S:="110100100011001001010110001000":

L:=[1]:

for i from 2 to length(S) do

if S[i]=S[i-1] then L:=subsop(nops(L)=L[nops(L)]+1, L) else L:=[op(L), 1] fi:

od:

L; 

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

 

 

Addition  -  another variant for long strings:

restart;

S:=StringTools[Random](10^5, 'binary');

L[1]:=1: k:=1:

for i from 2 to length(S) do

if S[i]=S[i-1] then L[k]:=L[k]+1 else k:=k+1: L[k]:=1 fi:

od:

convert(L,list);

fsolve command does not solve the equation with unknown parameters. Use solve command:

eq3 := k*y^2+x^2 = 4:

eq4 := -h*x^2+a*y = 0:

solve({eq3, eq4}, {x, y});

allvalues(%);

 

StringTools[Random](30, 'binary');

StringTools[CharacterFrequencies](%);

                     "110100100011001001010110001000"

                                  "0" = 18, "1" = 12

for n while ithprime(n)<29 do

end do:

n;

                       10

You can immediately get a decimal answer, if you use the  fsolve command, or solve command but at least one of the coefficients of your equation has float type:

solve(3*x^2-8*x+3 = 0);
fsolve(3*x^2-8*x+3 = 0);
solve(3.*x^2-8*x+3 = 0);

A:=plot(sqrt(x), x=-1..5, thickness=3, color=blue):

B:=plot(sqrt(x), x=1..4, filled=true, color=yellow, view=[-1..5, -1..3]):

plots[display](A,B, scaling=constrained);

 

 

solve(z^3=lambda^3, z);

is(-1/2+1/2*I*3^(1/2)=exp(2*I*Pi/3));

 

 Addition: You can also write it in exponential form or by  j :

Sol:=solve(z^3=lambda^3, z);

z1, z2:=op(1,Sol[2]), op(1,Sol[3]);

op(subs({z1=abs(z1)*exp(``(Pi*argument(z1))),z2=abs(z2)*exp(``(Pi*argument(z2)))}, [Sol]));

op(subs({z1=j,z2=j^2}, [Sol]));

 

 

Enough to check that any vector of the subspace  V  can be uniquely decomposed into the specified basis:

V, e1, e2, e3:=<2*a+b+c, 3*a+b+2*c, 2*a+c, b+7*c>, <2,3,2,0>, <1,1,0,1>, <0,1,1,6>;

Equate(V, x*e1+y*e2+z*e3);  #  The system of linear equation

solve(%, {x,y,z});

 

 

Not permissible to consider the integral of the sequence.

Should be

V1 := [1/9, -5/9, 7/9, 1/9, -5/9, 7/9, 1/9, -5/9, 7/9];

V2:=expand(t*V1);

seq(Int(V2[i], t=0..1), i=1..9);

 

V1 is not a vector, it is a list.

 

Variant for a vector:

V1 := <1/9, -5/9, 7/9, 1/9, -5/9, 7/9, 1/9, -5/9, 7/9>;

V2:=t*V1;

map(Int,V2,t=0..1);

restart;

CartProd1:=proc(L::list, N::posint)

local It;

It:=proc(M::list)

[seq(seq([L[i],op(M[j])], i=1..nops(L)), j=1..nops(M))];

end:

(It@@(N-1))(L);

end:

 

Example: 

n:=3: L:=[0,1]: N:=n*(n+1)/2:

M:=CartProd1([0,1],N):

Ind:=[seq(seq([i,j], j=i..n), i=1..n)]:

K:=[seq(Matrix(n,{seq(op(Ind[k])=M[s][k],k=1..N)},shape=symmetric), s=1..nops(M))]:

nops(K);

K[1..30];  # The first 30 such matrices from total 64 ones

 

In Maple 12 classic:

restart;

CartProd1:=proc(L::list, N::posint)

local It;

It:=proc(M::list)

[seq(seq([L[i],op(M[j])], i=1..nops(L)), j=1..nops(M))];

end:

(It@@(N-1))(L);

end:

 

map(Matrix,CartProd1([0,1,2],6),2,3);

To save time, at first it is convenient to create these matrices as lists, and then necessary  lists to  convert  in matrices. In the example displayed  the first  10 and the last 10 of 729 matrices:

restart;

m,n:=2,3:

T:=combinat[cartprod]([[0,1,2] $ m*n]): i:=0:

while not T[finished] do

i:=i+1:  L[i]:=T[nextvalue]() end do:

convert(L, list):

 

N:=nops(%);

seq(Matrix(m,n,L[k]), k=1..10);

seq(Matrix(m,n,L[k]), k=N-9..N);

 

The fsolve command did not take into account the constraints that assume command imposes. To solve your problem, it is necessary to choose the starting point for the iterations. After several attempts, I have found such a point:

restart;

Digits:=20:
assume(w>0): assume(T>0): assume(k>0): assume(ki>0): assume(Mn>0): assume(Ms>0): assume(Tf>0): assume(alfa>0):
Gp:=1/exp(sqrt(w*I)):
Cf:=((T*w*I+1)/(Tf*w*I+1)):
Cpi:=(k*w*I+ki)/(w*I):
L:=Cf*Cpi*Gp:
L:=evalc(L):
F:=subs({Ms=2,Tf=(k*T^(alfa)/Mn)^(1/alfa)},evalc(abs(1+L)^2-1/Ms^2)):
F:=subs({Mn=10,alfa=0.2},evalc(F)):
Fw:=diff(F,w):
Fk:=diff(F,k):
Ft:=diff(F,T):
Sol:=fsolve({F,Fw,Fk,Ft},{w=10,k=5,ki=10,T=10});
evalf(eval({F,Fw,Fk,Ft}, Sol));

 

 

 

 

I tried to solve your system with Mathematica and it showed that the system is inconsistent:

 

First 234 235 236 237 238 239 240 Last Page 236 of 290