5112 Reputation

15 years, 341 days

"A map that tried to pin down a sheep trail was just credible,

but it was an optimistic map that tried to fix a the path made by the wind,

or a path made across the grass by the shadow of flying birds."

- _A Walk through H_, Peter Greenaway

implicit...

See ?RootOf for an explanation of the implicit root representation.

```sols:=solve({z1=x1, z2=x3-x2^3, z3=-x1+x3, z4=-x1+x4},{x1,x2,x3,x4},Explicit):

seq(print(s), s in sols);

/                             (1/3)                            \
{ x1 = z1, x2 = (-z2 + z3 + z1)     , x3 = z3 + z1, x4 = z4 + z1 }
\                                                              /

/
{ x1 = z1,
\

1                (1/3)   1    (1/2)                (1/3)
x2 = - - (-z2 + z3 + z1)      + - I 3      (-z2 + z3 + z1)     ,
2                        2

\
x3 = z3 + z1, x4 = z4 + z1 }
/

/
{ x1 = z1,
\

1                (1/3)   1    (1/2)                (1/3)
x2 = - - (-z2 + z3 + z1)      - - I 3      (-z2 + z3 + z1)     ,
2                        2

\
x3 = z3 + z1, x4 = z4 + z1 }
/

```

initialization...

"Startup Code" refers to code that is saved with a specific worksheet, and executed upon opening it.

Automatic execution of code that is common across launched sessions can be provided using an initialization file.

spacecurve...

The "polygon graph" can be obtained by forcing the spacecurve to be done with a smaller number of points.

```restart:
with(plots):

y(t):=Vector[row]([cos(t),sin(t),t]):

B, inc := 2*Pi, 1/2;

1
2 Pi, -
2

graph := spacecurve(y(t), t=0..B, thickness=3, color=blue):

poly := spacecurve(y(t), t=0..B, thickness=3, color=red,
numpoints=trunc(B/inc)):

display(graph, poly, axes=box);
```

fixed by 14.01, it seems...

It was like that in the 64bit version of 13.02 for Windows 7 (that patch release officially supported Windows 7, even though 13.00 did not).

But in the 64bit version of 14.01, that problem had disappeared on Windows 7. I don't see it on 64bit 15.01 or 16.00 either, on Windows 7.

evalc...

Do you want to apply the evalc command to the expression T?

like this?...

```restart:
M:=200:

A:=Matrix(M,M,(i,j)->evalf(i*sin(j)),datatype=float[8]):
X:=Vector(M,i->i^2,datatype=float[8]):
Y:=Vector(M,i->evalf(1/i^(1/4)),datatype=float[8]):

plots:-pointplot3d(<X|Y|A[1..M,1]>,
style=line,thickness=2,axes=box,labels=["X","Y","A[..,1]"]);

plots:-pointplot3d(<X|Y|A[1,1..M]^%T>,
style=line,thickness=2,axes=box,labels=["X","Y","A[1,..]"]);

plots:-display(
seq(plots:-pointplot3d(<X|Y|A[1..M,k]>,
style=line,thickness=2,color=HSV((k/M),1,1)),
k=1..30),
axes=box
);

plots:-display(
seq(plots:-pointplot3d(<X|Y|A[k,1..M]^%T>,
style=line,thickness=2,color=HSV((k/M)^(1/3),1,1)),
k=1..30),
axes=box
);
```

ideas...

I'm not sure that I understand exactly what you want, but maybe this will give you some ideas.

```restart:
N:=40:
M:=20:

knob:=Vector(N,i->i/N,datatype=float[8]):

# v[j] are your dependent data Vectors
for j from 1 to M do
v[j]:=Vector(N,i->sin(i*knob[i])/(1.0*j)^(1/3),datatype=float[8]):
end do:

# Y[j] are used for 3d layout
for j from 1 to M do
Y[j]:=Vector(N,i->j,datatype=float[8]):
end do:

plots:-display(
seq(plots:-pointplot3d(<(knob)|Y[i]|v[i]>,
style=line,thickness=2,
color=HSV(i/M,1,1)),
i=1..M),
labels=[x,y,z],axes=box);

plots:-display(
seq(plottools:-rotate(
plots:-pointplot3d(<(knob)|Y[i]|v[i]>,
style=line,thickness=2,
color=HSV(i/M,1,1)),
0,0,i^2/10000),
i=1..M),
labels=[x,y,z],axes=box);

plots:-display(
seq(plots:-pointplot3d(<(knob+Y[1]*i^1.4*0.02)|Y[i]|v[i]>,
style=line,thickness=2,
color=HSV(i/M,1,1)),
i=1..M),
labels=[x,y,z],axes=box);
```

bug in 2D Math parser...

Ok, so this looks like it could be a new regression (bug) in the 2D Math parser. It seems to only happen when using the Matrix palette while entering a procedure in 2D Math input mode, in the case that the name of some formal parameter of the operator/procedure appears also in some entry of the typeset 2D Math Matrix.

Are you looking for workarounds that let you use your worksheets, with minimal edits? Ie. so that you don't have to type in all the entries for the 2D Matrices again?

One way it to edit around the Matrix, and make it like so (still all as 2D Math input)

`    proc(b) local a:=b; _and_now_the_2D_Matrix_containing_a_unchanged end proc:`

Another possibility is to change the formal parameter temporarily, eg, `aa` instead of `a` on the left hand side of the arrow. Then select the entire line and use the right-click context menu item "2-D Math" -> "Convert To" -> "1-D Math Input". And then reselect that entire 1D input line and use the context menu item "Convert To" -> "2-D Math input" to change it back without the Matrix typeset. And then finally change the formal parameter name back to `a`.

similar to earlier...

Have a look again at the first of the two approaches that I outlined in answering your earlier Question on this same topic. It's not as slick as placing assumptions, but it seems to work here too.

You can apply that here too. And with some modifications you can automate it. (Making it even more robust, for yet more examples, is something else you could try. Maybe you could even merge the two approaches I illustrated.)

```restart:

assume(n::posint):

deqs:={diff(y(x),x\$4)+(2/x)*diff(y(x),x\$3)
-((2*(n-1)^2+1)/(x^2))*diff(y(x),x\$2)
+((2*(n-1)^2+1)/(x^3))*diff(y(x),x)
+(((n-1)^4-4*(n-1)^2)/(x^4))*y(x)=
8*x^(n-1)*(n-n*x^2-x^2)+(n+1)*(n+3)*(n-3)*(n-5)/12
-(n+2)*(n+4)*(n-4)*(n-6)*x/12}:

ans:=dsolve(deqs union {y(1)=0,D(y)(1)=0,D(y)(0)=D(y)(0)},
y(x)) assuming D(y)(0)<infinity:

simplify(eval(ans,
map(limit,
simplify(solve(ans,
indets(ans,name) minus indets(deqs,name)),
size),
x=0, right))) assuming y(0)<infinity;

1         / (n + 1)  2    (n - 1)  2      4  2
y(x) = ----------------- \x        n  - x        n  + 2 x  n
/ 2          \
24 \n  + 3 n + 2/

5  2      (n + 3)        4        5        (n + 1)
- 2 x  n  + 6 x        n + 6 x  n - 6 x  n - 3 x        n

(n + 5)      (n - 1)         (n + 1)      (n + 5)
- 2 x        n - x        n - 16 x        - 2 x

(n - 1)      5      4       (n + 3)\
+ 6 x        - 4 x  + 4 x  + 12 x       /

fixup := proc(de,sol) local result;
result:=simplify(eval(sol,
map(u->lhs(u)=limit(rhs(u),x=0,right),
simplify(solve(sol,
indets(sol,name) minus indets(de,name)),
size))));
simplify(result,size);
end proc:

fixup(deqs, ans);

1         //  2        \  (n - 1)
y(x) = ----------------- \\-n  - n + 6/ x
2
24 n  + 72 n + 48

/ 2           \  (n + 1)               (n + 3)
+ \n  - 3 n - 16/ x        + (6 n + 12) x

/ (n + 5)    4                \        \
- 2 \x        + x  (n + 2) (x - 1)/ (n + 1)/
```

polar...

```restart:

ssol:=[solve(w^11=-5-5*I)]:

M:=convert(sort(ssol,(a,b)->is(Re(a)>Re(b)))[1],polar);

/ (1/11)  (1/22)    3    \
polar|5       2      , - -- Pi|
\                   44   /

M:=convert(evalc(M),exp);

(1/11)  (1/22)    /  3      \
5       2       exp|- -- I Pi|
\  44     /

evalf(M);

1.167308782 - 0.2539324823 I

simplify(M^11);

-5 - 5 I

m:=-infinity: # only need max of Re, no need to sort them all
for i from 1 to nops(ssol) do
new:=ssol[i];
if is( Re(new) > Re(m) ) then
m:=ssol[i];
end if;
end do:

m:=convert(m,polar);

/ (1/11)  (1/22)    3    \
polar|5       2      , - -- Pi|
\                   44   /

m:=convert(evalc(m),exp);

(1/11)  (1/22)    /  3      \
5       2       exp|- -- I Pi|
\  44     /

evalf(m);

1.167308782 - 0.2539324823 I

simplify(m^11);

-5 - 5 I

#plots:-pointplot([seq([(Re,Im)(z)],z in ssol)]);
```

diff...

```restart:

n := 3:
f := Vector(n):

f[1] :=  x->sin(x)/x;

sin(x)
x -> ------
x

f[2] := unapply( simplify(-diff(f[1](x),x))/x, x);

cos(x) x - sin(x)
x -> - -----------------
3
x

f[3] := unapply( simplify(-diff(f[2](x),x)/x), x);

2
sin(x) x  + 3 cos(x) x - 3 sin(x)
x -> - ---------------------------------
5
x
```

some ways...

Note that the 1.51333... is not in itself strange -- it's a consequence of expanding your original input, to get 0.2/15 + 1.5 = 1.51333...

```restart:

x/3=(x+0.2)/15+1.5;

1     1
- x = -- x + 1.513333333
3     15

sol:=solve(%):

evalf[4](sol);

5.675

convert(sol,rational);

227
---
40

fnormal(sol,Digits-1);

5.67500000

evalf(convert(sol,rational));

5.675000000

restart;

strip:=Z->subsindets(Z,{float},z->parse(sprintf("%g",z))):

x/3=(x+0.2)/15+1.5;

1     1
- x = -- x + 1.513333333
3     15

sol:=solve(%):

strip(sol);

5.675

# Also see main menubar's Tools->Options->Precision
# and "Round screen display to"
```

':-parlist'=parlist...

You can use the global name :-parlist, with uneval quotes.

```> myproc1:=proc({parlist::list:=[]})
> return parlist[1];
> end proc:

> myproc2:=proc(parlist::list)
> return myproc1(':-parlist'=parlist);
> end proc:

> myproc2([1,2]);

1
```

example...

I don't know how well these stand up for other examples, but for this example

```restart:

ODE:=x*ln(x)*diff(y(x),x)-y(x)=2*x^2-4*x^2*ln(x);

/ d      \             2      2
x ln(x) |--- y(x)| - y(x) = 2 x  - 4 x  ln(x)
\ dx     /

# you wish to automate resolving the constant in this result
dsolve({ODE}, y(x));

/           2            \
{ y(x) = -2 x  + ln(x) _C1 }
\                        /

proc(z)
eval(z,limit(solve(z,_C1)[],x=0,right)) assuming y(0)<infinity;
end proc(dsolve({ODE}, y(x)));

/           2\
{ y(x) = -2 x  }
\            /

dsolve({ODE, y(0)=y(0)}, y(x)) assuming y(0)<infinity;

2
y(x) = -2 x
```

compound...

```f := unapply(x**2,x); # granted, you got the expression x**2 from some program

2
x -> x

g := unapply(2*x,x); # granted, you got the expression 2*x from some program

x -> 2 x

joperator := g@f;

g@f

int(j, a..b);

2  3   2  3
- b  - - a
3      3

j(x);

2
2 x

int(j(x), x=a..b);

2  3   2  3
- b  - - a
3      3

jexpression := subs(y=x**2, 2*y); # no need to form those operators at all

2
2 x

int(jexpression, x=a..b);

2  3   2  3
- b  - - a
3      3
```
 3 4 5 6 7 8 9 Last Page 5 of 48
﻿