Kitonum

21445 Reputation

26 Badges

17 years, 46 days

MaplePrimes Activity


These are answers submitted by Kitonum

If you replace  arg  by  args   the procedure will work but improperly. Error reason: in the body of the procedure you are referring to the argument of the procedure, which is unchanged. See

test([y, y*z-x, -15*x*y-x*z-x], [x,y,z]);

test([y, y*z-x, -15*x*y-x*z-x], [1,1,1]);

                                             [y, y*z-x, -15*x*y-x*z-x]

                                             [y, y*z-x, -15*x*y-x*z-x]

 

The following version works properly:

test1:=proc()

local f;

f:=args[1]; # a list

[f[2],f[2]*f[3]-f[1],-15*f[1]*f[2]-f[1]*f[3]-f[1]];

end:

 

or (closer to your version):

restart;

test2:=proc()

local f, vars;

f:=args[1]; # a list

vars:=args[2]: # a list

eval(f, [x,y,z]=~vars);

end:

 

Examples:

test1([x,y,z]);

test1([1,1,1]);

                               [y, y*z-x, -15*x*y-x*z-x]

                                          [1, 0, -17]

 

Edited.

May be you want to substitute  (-2+d1), (-1+d1)  terms by new symbols:

subs({d1-1=a, d1-2=b}, y);

 

 

nb:=(k-sigma+1)*lambda*L*(gamma*upsilon-delta__1122^k*tau)*upsilon*tau*v/(f__F*sigma*(-tau^2+upsilon^2)*k);

hh := (L*lambda*(k-sigma+1)*upsilon*tau*v)/(f__F*sigma*(-tau^2+upsilon^2)*k)=rho;

simplify(subs(L=solve(hh, L), nb));

 

S:=a^4*b*c*x^2+a^4*b*c*y+a^4*b*c;

subs(t=a^4*b*c, collect(algsubs(a^4*b*c=t, S), t));

                         

 

 

Use LinearAlgebra[DotProduct]  with the option  conjugate=false

 

Addition:  if you still use linalg[dotprod]  then use  'orthogonal'  option.

 

Example:

linalg[dotprod](vector([a,b,c]), vector([x,y,z]), 'orthogonal');

                                        a*x+b*y+c*z

 

Edited.

If a family of curves corresponds to the differential equation  F(x, y, y') = 0 , the orthogonal family will correspond to equation   F(x, y, -1/y') = 0 .

 

Example:

Equations  y'=2*x  and  -1/y'=2*x .  Their solutions  are  y=x^2+C  and  y=-1/2*ln(abs(x))+C .

Their plots:

A:=plot([seq(x^2+C, C=0..10)], x=-2..2, color=red):

B:=plot([seq(-1/2*ln(abs(x))+C, C=0..10)], x=-2..2, color=blue):

plots[display](A,B, scaling=constrained, view=[-2..2,-1..7]);

                                        

 

 

A more naive method:

e:= g^((2*(-sigma+k+1))/(-1+sigma))-tau^2:

ex:=(-sigma+k+1)/(-1+sigma):

subs(a=ex, factor(expand(eval(e, ex=a))));

 

Another way (without  ex):

e:= g^((2*(-sigma+k+1))/(-1+sigma))-tau^2:

factor(applyrule(g^(2*a::anything)=(g^a)^2, e));

 

Edited.

This is impossible, because in general, the roots of polynomials of degree higher than four can not be expressed explicitly in terms of their coefficients. Your problem can be solved numerically for any  w  by the procedure  Sol :

restart:

P:=w->w-10*z-1/5*z^2-1/200*z^3-1/500*z^4-z^5-1/1000*z^6:

Sol:=w->fsolve(P(w), z, complex):

 

Examples of use:

Sol(0);

Sol(1);

Sol(10);

 

If you only want the real roots, then remove  complex  option.

cat(2*x-5, ` > `, 3*x-6);

                                    

 

or even simplier:

 `2*x-5 > 3*x-6`;

                                    

For further changes, you can use  parse  command:

`2*x-5 > 3*x-6`;

parse(%);

solve(%);

                       

Edited.

m := -t*(-1+t)^3/(t^3+2):

map(t->`if`(type(t,`^`) and op(2,t)>1, `$`(op(t)), t), [op(m)]);

                                   [-1, t, -1+t, -1+t, -1+t, 1/(t^3+2)]

 

Edited.

 

 

If the problem should be solved not a single time then the solution is useful to write down as a procedure. The parameter  P  is a set or a list of any number of polynomials. The procedure returns the list whose first element is the number of common terms of these polynomials, and the second one is the set of common terms.

CommonTerms:=proc(P::{set(polynom),list(polynom)})

local S;

S:=`intersect`(op(map(t->{op(t)},P)));

[nops(S), S];

end proc:

 

Example of use:

CommonTerms({x^2*y+x+y, x^3+x^2*y+y, y^2+x^2*y+y});

                                                [2, {y, x^2*y}]

 

In the code replace  Iteration  by  iteration  (or  iteration  by   Iteration). Maple distinguishes between lower and upper case.

Very strange bug! Use  Optimization[Maximize]  command as a workaround:

Optimization[Maximize](x^2+4, x = -1 .. 2);

                                            [8., [x = 2.]]

Carl showed how to find the general solution of a linear system. But if you want to modify a solution to the desired form, a special procedure is necessary. Here is my attempt :

LSSF:=proc(A::Matrix)

local Sol, Ind, n, N, Sol0, i, V;

uses LinearAlgebra;

Sol:=LinearSolve(A);

Ind:=indets(Sol);

n:=nops(Ind);

N:=op(A)[2]-1;

if n=0 then return Sol else

Sol0:=eval(Sol,Ind=~0);

for i from 1 to n do

V[i]:=eval(Sol-Sol0,{Ind[i]=1,op(Ind minus {Ind[i]})=~0});

od; fi;

print(x=Vector([seq(x[i],i=1..N)]),v[0]=Sol0,seq(v[k]=V[k], k=1..n));

x=v[0]+``(`+`(seq(C[k]*v[k],k=1..n)));

end proc:

 

Solution of the initial example:

R := Matrix([[1, -2, 2, 6, -6], [2, -3, 4, 9, -8]]);

LSSF(R);  # C[1] and C[2] are arbitrary parameters

                           

 

 The procedure works for the arbitrary linear system which is given by an augmented matrix.

 

The absolutely exact (symbolic) value of  DthetaZero   can be gotten from the equation  Eq3  in my solution above:

DthetaZero:=eval((1/10)*sqrt(100*sin(theta(t))^2+1962*cos(theta(t))+1962), theta(t)=2*Pi/3);

evalf[20](%);

                                             

 

 

First 180 181 182 183 184 185 186 Last Page 182 of 289