acer

17433 Reputation

29 Badges

14 years, 144 days

On google groups. (comp.soft-sys.math.maple and sci.math.symbolic)

On stackoverflow.

On math.stackexchange.com.

MaplePrimes Activity


These are replies submitted by acer

Someone converted this old Question to a Post, today. Please don't do that.

I have reverted it to a Question.

@dingtianlidi 

I use Kitonum's parametrization of the space-curve here, and apply the single procedure (x,y,z)->x*y*z to get the effect of an xyzcoloring colorscheme.

A single procedure with an xyzcoloring colorscheme uses the (normalized) scalar results for hue.

restart:

with(plots):

with(Student:-LinearAlgebra):

A := RotationMatrix(t, <1,1,1>):
Curve := convert(A.<5,0,0>,list);

[(10/3)*cos(t)+5/3, -(5/3)*cos(t)+(5/3)*3^(1/2)*sin(t)+5/3, -(5/3)*cos(t)-(5/3)*3^(1/2)*sin(t)+5/3]

P := spacecurve(Curve,t=0..2*Pi,thickness=5,colorscheme=[red,blue],axes=normal):

huefunc := (x,y,z)->x*y*z;

proc (x, y, z) options operator, arrow; x*y*z end proc

M := op([1,1],P):
m := (rhs-lhs+1)(op([2,1],M)):
dat := [seq(huefunc(M[i,1],M[i,2],M[i,3]),i=1..m)]:
(mindat,maxdat) := [min,max](dat)[]:
newC := Array(map[evalhf](d->(d-mindat)/(maxdat-mindat),dat),datatype=float[8]):

newP := subsindets(P,specfunc(anything,:-COLOR),u->COLOR(HUE,newC)):

newP;

 

Download spacecurve_xyzcolorscheme_hue.mw

Of course, this kind of approach can be robustified and put into a re-usable procedure.

One possible robustification might be to utilize fnormal suitably during the (subtraction in the) normalization of the scalar result values. For example, the coloring function x+y+z would otherwise merely produce roundoff noise for the given example's space-curve (given the particular plane of the data points).

Note: I wrote this to work with the particular result from spacecurve, and not intersectplot. A general approach could work for intersectplot, but the code above would have to be modified. I don't have the time for that right now, sorry...

@dingtianlidi Sorry I was not clear.

I meant that the COLOR substricture could be manuaĺly constructed from the curves x.y.z data. I'll try to find time to show you what I mean, but I've got some pressing thing to do right this moment.

You should contact Maplesoft Technical Support.   You can email them at 

   support@maplesoft.com

Please don't start additional and separate threads here, about this severe lack of function. It's more helpful to keep this all together.

@Carl Love What might be tricky is the deployment of any quaternion package so that it is bundled with the Mobius application that the OP is authoring. The key thing might be to make it directly available to any end-user of the "app".

I was thinking that the Tech Support staff of DigitalEd might know best how to do that part (in the most graceful way appropriate to MapleTA or a Mobius App).

The MapleTA and Mobius products are now produced and sold by DigitalEd, and no longer by Maplesoft.

This site is run by Maplesoft. I doubt that many Mobius users or DigitalEd staff monitor it.

You may be better off trying their tech support,

    http://digitaled.com/support

Another way to get a similar plot (but perhaps not so flexible, as not directly using the parameter), is as follows.

restart;

with(plots):

Cl := x->max(-1,min(1, x)): f := (x,y)->Re(sqrt(x+I*y)):
M := 15: R := 5: local O := 0.1:

F := [Cl((j+O)/R*cos(2*Pi*t)), Cl((j+O)/R*sin(2*Pi*t)),
      signum(k)*(abs(k) - 1.5)/140
      + signum(k)*f(Cl((j+O)/R*cos(2*Pi*t)),Cl((j+O)/R*sin(2*Pi*t)))]:

Pcurves:=display(seq(seq(spacecurve(F, t=0..1, thickness=3,
                           colorscheme=["linear",
                                        [red,ColorTools:-Color("RGB",[1,0,0.001])],
                                         colorspace="HSV"]),
                         k=[-2,-1,1,2]),j=1..R+3)):
Pcurves;

optsurf := grid=[70,70], style=surface, transparency=0.1, color=u:
ee := evalc(Re(sqrt(x+I*y))):
ff := simplify(eval(ee,[x=v*cos(u),y=v*sin(u)])) assuming real:
Psurf:=display(seq(plot3d([v*cos(u), v*sin(u), k*ff],
                          u=0..2*Pi, v=0..4, optsurf),
                   k=[-1,1]),
               view=[-1..1,-1..1,-1..1]):

display(Psurf,Pcurves);

 

Download spacecurve_colorbyparam2.mw

Note: The backend MapleNet server of this site cannot properly render such colored curves when displaying inline here. (Might be an hfarray vs Array thing...) So I've pasted in the .png exports of the plots.

@Stretto I happened to find this old piece of code. (I was coloring spacecurves by torsion and curvature, as functions of the parameter...). Perhaps its results are a little closer to what you're after. You might adust, of course.

restart;

with(plots):

Cl := x->max(-1,min(1, x)): f := (x,y)->Re(sqrt(x+I*y)):
M := 15: R := 5: local O := 0.1:

cfunc:=proc(tt,j)
  local L:=[j/(R+3),j/(R+3)*sin(2*Pi*tt)^2,tt];# print(L);

  ColorTools:-Color("RGB",L)[];

end proc:

SC:=proc(T::list, j, trng::name=range(realcons),
         {numpoints::posint:=3, colorfunc::procedure:=NULL})
  local M,C,t,a,b,i;
  t:=lhs(trng);
  (a,b):=op(evalf(rhs(trng)));
  M:=[seq(eval(T,t=a+i*(b-a)/(numpoints-1)),i=0..numpoints-1)];
  if colorfunc=NULL then C:=NULL;
  else
    C:=':-COLOUR'(':-RGB',Array([seq(colorfunc(a+(i-1)*(b-a)/(numpoints-1),j),
                                     i=1..numpoints)],
                                ':-datatype'='float[8]',':-order'=':-C_order'));
  end if;
  :-PLOT3D(:-CURVES(M,C),':-THICKNESS'(3));
end proc:

display(
  seq(seq(SC([Cl((j+O)/R*cos(2*Pi*t)), Cl((j+O)/R*sin(2*Pi*t)),
              sign(k)*(abs(k) - 1.5)/140
              + sign(k)*f(Cl((j+O)/R*cos(2*Pi*t)),Cl((j+O)/R*sin(2*Pi*t)))],
             j, t=0..1, numpoints=150, colorfunc=cfunc),
          k=[-2,-1,1,2]), j=1..R+3));

cfunc2:=proc(tt,j)
  local L:=[tt,1,1];# print(L);

  ColorTools:-Color("RGB",ColorTools:-Color("HSV",L))[];

end proc:

Pcurves:=plots:-display(
  seq(seq(SC([Cl((j+O)/R*cos(2*Pi*t)), Cl((j+O)/R*sin(2*Pi*t)),
              sign(k)*(abs(k) - 1.5)/140
              + sign(k)*f(Cl((j+O)/R*cos(2*Pi*t)),Cl((j+O)/R*sin(2*Pi*t)))],
             j, t=0..1, numpoints=150, colorfunc=cfunc2),
          k=[-2,-1,1,2]), j=1..R+3)):
Pcurves;

optsurf := grid=[70,70], style=surface, transparency=0.1, color=u:
ee := evalc(Re(sqrt(x+I*y))):
ff := simplify(eval(ee,[x=v*cos(u),y=v*sin(u)])) assuming real:
Psurf:=display(seq(plot3d([v*cos(u), v*sin(u), k*ff],
                          u=0..2*Pi, v=0..4, optsurf),
                   k=[-1,1]),
               view=[-1..1,-1..1,-1..1]):

display(Psurf,Pcurves);

 

Download spacecurve_colorbyparam.mw

@Axel Vogt 

restart;
kernelopts(version);

      Maple 2018.2, X86 64 LINUX, Nov 16 2018, Build ID 1362973

g:=exp(r*cos(theta))/Pi+exp(r*cos(theta))*cos(theta)/Pi:
Int(g, theta = 0 .. Pi):
value(IntegrationTools:-Expand(%)) assuming r>0;

         BesselI(0, r) + BesselI(1, r)

# Or,

int(g, theta = 0 .. Pi):

IntegrationTools:-Expand(%) assuming r>0;

         BesselI(0, r) + BesselI(1, r)

The two separate integrals are obtained by method=lookup, but that is not being successfully used against the sum.

Could you not utilize the assuming mechanism for the key simplifications?

Show us what youve been able to do so far with this homework question.

@zphaze I'll look into this, as well as another kind of evalf-related bug in it that I know of.

Perhaps you're also the fellow who asked about saving the module to an archive. There are a few subtleties (including ModuleLoad material), but nothing not easily resolved.

If you give me a couple of days (it's Sunday night...) I'll look into these bug/issues which I expect are easily resolved, as well as show/verify both the module saving as well as cloud-package creation. I've been meaning to do all that for some time now.

I will post in this thread, when progress is made.

Show us how far you've gotten already with this homework. 

What does it mean, pasting in a polynomial from Mathematica to Maple? How does that statement make sense, without context? You haven't even said in what format or syntax that would act.

Also, are you trying to paste in 10k term expressions into Maple in 2D Input mode? That sounds dubious at best.

Why not write out a poynomial in plaintext form to a text file from Mma, and then read it into Maple?

@kfli The `.` command already goes straight through the kernel to the MKL BLAS dgemm and I doubt that you'd be able to beat that for most large sizes.

I say "most large sizes" because your goal is still very unclear, in terms of what I'd consider necessary in order to arrive at an efficient solution without runaround guesswork.

You haven't stated that your Matrices/Arrays are float[8], but I suspect that they are. You haven't stated whether you need a modest number of very large examples to run fast, or a very large number of small examples to run fast (by avoiding overhead). You haven't stated whether you want to be able to do this kind of inplace BLAS operation (possibly with the actual transposition being avoided):
    C <-  A . B  + C   or    C <-  alpha.A^%T . B^%T + beta*C
etc. If you really need such cases (ie. inplace action on C to avoid garbage collection, without overhead) then please describe the scenarios in fine detail.

 

1 2 3 4 5 6 7 Last Page 2 of 400