Kitonum

21715 Reputation

26 Badges

17 years, 188 days

MaplePrimes Activity


These are replies submitted by Kitonum

This example:

result := ODETools[convertsys]({(D(x))(t) = x(t), ((D@@2)(y))(t) = y(t)-x(t)}, {}, {x(t), y(t)}, t);

[[YP[1] = Y[1], YP[2] = Y[3], YP[3] = Y[2]-Y[1]], [Y[1] = x(t), Y[2] = y(t), Y[3] = diff(y(t), t)], undefined, []]

(1)

NULL

subs(YP[1] = toto, result[1, 1]);

YP[1] = Y[1]

(2)

subs(lhs(result[1, 1]) = toto, result[1, 1]);

toto = Y[1]

(3)

``

 

Download convertsys.mw

 


 

 

@Joe Riel  I agree that your option is best if whole list is considered. But if the same thing should be done only for elements for example with odd numbers:

[seq(A[i,1]/A[i,2], i=1..nops(A), 2)];

@Carl Love 

eq:= a*x+b*y=c*x+d*y:

eq1:=(lhs-rhs)(eq);

factor(select(has, eq1, x)=-select(has, eq1, y));

                                      

 

or

coeff(eq1,x)*x=``(-coeff(eq1,y))*y;

                                             

 

 Edited.

@mskalsi 

restart;

Expr:=V[2]+a[5]*V[5]+a[6]*V[6]+a[7]*V[7]+V[9]:

v:=[a[5], a[6], a[7]]:

map(t->[t,0], v):

L:=[seq(seq(seq([i,j,k], k=%[3]), j=%[2]), i=%[1])];

F:=n->eval(Expr,v=~L[n]);

 

Function  F  substitutes  a[5], a[6], a[7]  in  Expr  by  nth triplet from  L .

For example:

F(3);

@Markiyan Hirnyk  I do not see any difference in quality:

A := plot(10*sqrt(3)/sqrt(120*Pi^2+19*x), x = 0 .. 10, y = 0 .. 1, thickness = 0):

B := plots:-implicitplot(y-10*sqrt(3)/sqrt(120*Pi^2+19*x), x = 0 .. 10, y = 0 .. 1, view = [0 .. 10, 0 .. 1], thickness = 0, gridrefine = 5):

plots[display](<A | B>);

 

 

 

@felixp  I used the codes from Carl Love's  comment  I missed that

My outputs are

educed(<0,0,0,1; 1,3,0,4>);

reduced(<1,3,0,4; 0,0,0,0>);

reduced(<0,0,0,0; 1,3,0,4>);

reduced(<1,3,0,4; 0,0,0,1>);

reduced(<0,0,0,0; 0,0,0,1>);

reduced(<0,1,1,1; 1,1,1,1>);

reduced(<1,0,1,1; 1,1,1,1>);

  

We get the same error in all cases.

@Carl Love  in each of which your  reduced  proc is not working properly;

reduced(<0,0,0,1; 1,3,0,4>);

reduced(<1,3,0,4; 0,0,0,0>);

reduced(<0,0,0,0; 1,3,0,4>);

reduced(<1,3,0,4; 0,0,0,1>);

reduced(<0,0,0,0; 0,0,0,1>);

reduced(<0,1,1,1; 1,1,1,1>);

reduced(<1,0,1,1; 1,1,1,1>);

@Carl Love 

1) Permutations of a set and the corresponding list give the same result:

restart;

combinat:-permute([1,2,3]);

combinat:-permute({1,2,3});

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

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

 

2) Enumeration in a multiple cycle more efficient. Compare:

 

t:=time():

for i to 100 do

for j to 100 do

for k to 100 do

i+j+k;

od: od: od:

time()-t;

                                                                  0.203

and

t:=time():

P:=combinat:-permute(`$`~([$1..100], 3),3):

for k in P do

`+`(k[]);

od:

time()-t;

                                                                  21.563

 

Of course, this is not essential for OP's problems.

@lg674 

Curve := proc(Range, a, b, c)  # Range is the range for t

local R, Phi, Theta;

R:=r(t,a,b,c); Phi:=phi(t,a,b,c); Theta := theta(t,a,b,c); plots:-spacecurve([R*cos(Phi)*sin(Theta), R*sin(Phi)*sin(Theta), R*cos(Theta)], t = Range, color = red, thickness = 2, linestyle = solid, axes = normal, orientation = [10, 50]);

end proc:

 

r := (t, a, b, c)->a*cos(t)+b*sin(t)+c:

phi := (t, a, b, c)->a^2*cos(t)+(b-1)*sin(t)+c+1:

theta := (t, a, b, c)->a^3*cos(t)+(b^2-1)*sin(t)+c^2+1:

 

Cone := (R, Theta) -> plot3d(eval([r*cos(phi)*sin(theta), r*sin(phi)*sin(theta), r*cos(theta)], theta = Theta), r = 0 .. R, phi = 0 .. 2*Pi, scaling = constrained) :

 

plots[display](Cone(8, (1/6)*Pi), Curve(0..2*Pi,1,2,3));

@san  I replaced  matrix  command by  Matrix  command, because matrix command is deprecated, and removed the  space between the  matrix  command and the subsequent opening parenthesis:

 

Download ch512_new.mw

 

@Ronan  If you want to add  0 to C2  in 4th position you can do it as follows:

C2:=[a,2,1-3*a,a^2-5,7*a,a^2]:

[C2[1..3][], 0, C2[4..-1][]];

                            [a, 2, 1-3*a, 0, a^2-5, 7*a, a^2]

@Markiyan Hirnyk  3. We have

expand(eval({x=9*z^2+3*z+367, y=6*z^2+z+244}, z=n+1/3));  # My nontrivial answer

expand(subs(n=n-1, %));   # We got Mathematica nontrivial answer

 

 

 

@Markiyan Hirnyk  

I know. For full automation, we can write

restart;

minimize(sin(x+y), x=-1..1, y=-1..1);

solve({sin(x+y)=%, abs(x)<=1, abs(y)<=1});

                  

 

 

 

@Carl Love  I usually insert a code text and images separately. The first by copying and pasting, and the second by making a screenshot and it's processing in Paint. Of course, it takes more time, but gives better quality pictures. I use Google Chrome, and Standard Interface for pictures.

 

@Carl Love   you are right. The simple example shows it very well:

plot(abs(x), x=-1..1, style=point, numpoints=20):

plot(abs(x), x=-1..1, style=point, adaptive=false, numpoints=20):

plots[display](<%% | %>, scaling=constrained);

    

 

 

 

First 80 81 82 83 84 85 86 Last Page 82 of 133