Carl Love

## 26396 Reputation

11 years, 146 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

## Truncate the series...

My first approach would be to take the series definition given at ?JacobiTheta and truncate the series. Given that your nome has modulius << 1, five terms of the series should be more than enough.  For example,

restart;
nome:= evalhf(0.1*exp(0.1*Pi*I)):
z:= evalf[15](expand(Pi*I*(a+b*I))):
Nterms:= 5:
CodeTools:-Usage(
plot3d(argument(JT1(z,nome))
,b= -4..4, a= -4..4
,grid= [300,300]
,style= surface
,axes= box
,orientation= [-90,0,0]
)
);

memory used=4.56MiB, alloc change=10.98MiB, cpu time=515.00ms, real time=524.00ms (On an Intel i7)

My experience going from 3 to 5 terms is that each additional term contributes one more level to the fractal "forking".

I'm very pleased to know that evalhf now works with complex numbers. The page ?evalhf,fcnlist needs to be updated to include argument, Re, and Im, and perhaps others.

## Use unapply to make Dist an operator...

Replace the line

Dist := int(Density, t);

with

Dist := unapply( int(Density, t), t);

This will make Dist an operator, so that the expression Dist(t-1) makes sense.

## Plot une liste des points...

The plot command will accept a list of points defining a curve. Each point is represented as a list with two elements. For example:

plot( [ [0,0], [1,1], [1,2], [2,3] ] );

The list can be arbitrarily long.

## _ValuesMayBeLost...

Three points:

1. This problem is different than the one in the original post: The linear term in f has been changed from -3x to -x.
2. The new equation has infinitely many real solutions.
3. In this case, allvalues sets the global _ValuesMayBeLost to true, so the answers it gives may not include all values.

## Remove "fi"...

"fi" and "end if" mean exactly the same thing, but you can't have them both. I suggest removing the "fi". Do the same thing two lines below that. Also, you need to remove the ";" at the end of the first line.

## select(type, L, even)...

The type ?even is predefined, and ?select is a command. Putting them togther, letting L be your list above, the command is

select(type, L, even)

For those who like fewer words, the following does the same thing:

select(`::`, L, even)

## sprintf("%a") inserts the backslashes!...

There is a simple command to insert the backslashes! But I didn't find it until I had given up looking for such in the extremely bloated StringTools package (and I looked at every command there). The old original sprintf command has a format option, %a, that formats anything so that it can be reparsed.

restart;
p:= "Einstein said, \"Everyone's....\"....";
p:=  "Einstein said, "Everyone's...."...."
sprintf("%a", p);
""Einstein said, \"Everyone's....\"....""

Of course, you see that it added the backslashes. But also note the extra quotes at beginning and end. These are so that it will parse as a string literal, rather than as a string containing other Maple code.

assign(b,parse(%));
b;
"Einstein said, "Everyone's...."...."

## Capping with tubeplot...

I had thought about the issue of capping before I posted my previous answer. The capping is the most difficult part, and I thought that it would've been a waste to have spent time on it if if turned out that the whole tubeplot idea didn't meet your needs. I had considered plottools:-cylinder, but it is quite difficult (though not impossible) to use because it only generates cylinders with axes parallel to the z-axis. So they would have to be individually rotated at random. I also considered representing each cap as a parametric surface; it's a lot of analytic geometry to get the parameters right.

It turns out that the caps can be generated with tubeplot, if you're willing to accept caps that are not perfectly flat; rather, they are slightly conical, like cylinders of hard candy wrapped in paper which is twisted at the ends. The radius of the tube can vary (with the same parameter, t, that is used as the parameter of the tube's curve), and we simply need to make it go abruptly to 0 at both ends. I do this with a step function created with piecewise.

restart;
Npts:= 12:
Gen:= (N,R)-> RandomTools:-Generate(list(float(range= 1..R), N)):
x,x1,y,y1,z,z1:= seq(Gen(Npts,20), k= 1..6):
R:= Gen(Npts,3):  # random radius parameter
candy:= piecewise(t <= 0, 0, t < 1, 1, 0):
P:=(x,x1,y,y1,z,z1,R)->
:
S:=(x,x1,y,y1,z,z1,R)->
plots:-tubeplot(P(x,x1,y,y1,z,z1,R), t= 0..1, tubepoints= 20)
:
plots:-display([seq](S(x[k],x1[k],y[k],y1[k],z[k],z1[k],R[k]), k= 1..Npts));

## Misspelled "init1" as "inti1"...

You misspelled init1 as inti1 in both DEplot commands. You also misspelled title in your display command.

## T:= [seq](expand(cos(n*arccos(x))), n= 2...

T:= [seq](expand(cos(n*arccos(x))), n= 2..6);

[    2           3             4       2              5        3
[2 x  - 1, 4 x  - 3 x, 8 x  - 8 x  + 1, 16 x  - 20 x  + 5 x,

6         4         2     ]
32 x  - 48 x  + 18 x  - 1]

plots:-display(Array([seq](plot(T[n], x= -1..1, title= sprintf("n=%d",n+1)), n= 1..nops(T))));

## Need backslashes....

If you want to parse a string as a string literal, and that string literal contains quotes, then you'll need to backslash the quotes, just as you would if you'd entered it from the keyboard. Something like this:

restart;
p:= "assign(b,\"Einstein said, \\\"Everyone's....\\\"....\")";
p:= "assign(b,"Einstein said, \"Everyone's....\"....")"
writeline("junk.mpl", p):
fclose("junk.mpl");
restart;
p:= "assign(b,"Einstein said, \"Everyone's....\"....")"
parse(p, statement);
b;
"Einstein said, "Everyone's...."...."

## Works for me...

It works for me. You'll need to post an example of it not working for you.

restart;
p:= "acat:= \"a cat\"";
p:= "acat:= "a cat""
writeline("junk.mpl", p);
15
restart;
p:= "acat:= "a cat""
parse(p, statement);
acat:= "a cat"
"a cat"
acat;
"a cat"

## enclose solutions in a list...

The two solutions need to be enclosed in square brackets so that they both can be plotted.

c:= x^2+(y-3)^2=25:
cplot:= [solve](c,y):

Notice the square brackets in the above command.

plot(cplot, x= -5..5, scaling= constrained);

## tubeplot...

How about this? I just made some modifications to your code. For each cylinder I pick two points and the radius at random. The points are the centers of the endcaps. Then I do a tubeplot of the line segment connecting the points.

with(RandomTools):
with(plots):

x:=Generate(list(integer(range=0..20),100)): # random coordinate for x parameter
x1:= Generate(list(integer(range= 0..20), 100)):
y:=Generate(list(integer(range=0..20),100)): # random coordinate for y parameter
y1:= Generate(list(integer(range= 0..20), 100)):
z:=Generate(list(integer(range=0..20),100)): # random coordinate for z paramete
z1:= Generate(list(integer(range= 0..20), 100)):

P:=(x,x1,y,y1,z,z1,R)-> [x+(x1-x)*t, y+(y1-y)*t, z+(z1-z)*t, radius= R]: # equation for one cylinder
S:=(x,x1,y,y1,z,z1,R)-> tubeplot(P(x,x1,y,y1,z,z1,R), t= 0..1, tubepoints= 20): # 3D plot in space

display3d({seq}(S(x[k],x1[k],y[k],y1[k],z[k],z1[k],R[k]),k=1..12));

## csgn(x)*x = abs(x) for real x....

If you replace abs(x) with csgn(x)*x, then f(x) is analytic in a disk in the complex plane about x=1, and the taylor command (in M16) produces the expected result. This is equal to abs(x) for real x.

The fact that Maple (16) does not give a Taylor series expansion for sqrt(abs(x)) about x=1 shows that a bug has been corrected, not that a bug has been introduced.

 First 377 378 379 380 381 Page 379 of 381
﻿