## Error: can nog save points as a float matrix...

Hi everyone,

I often get the error 'cannot save points as a float matrix' while I'm trying to plot with the spacecurve command.

loodl2 is a 4 component vector, loodl2c is the 3 component variant.

loodl2:=T1.<loodl,1>: loodl2c:=<loodl2[1], loodl2[2], loodl2[3]>
loodlpl:=spacecurve(loodl2c, k=-10..10, color=red):

also with this syntax:
loodl2c:=loodl2[1..3]

and this syntax:

l2c1:= 2*k: l2c2:=0, l2c3:=8-k:
spacecurve([l2c1, l2c2, l2c3], k=-10..10, color=red):
Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct

It will only plot if I do this:
loodl2c:=<2*k, 0, 8-k>
Can someone help me?

## How can the edge of a 3D surface be highlighted?...

The following are the equation and plot3d of the minimal surface named Catalan:

Catalan := [alpha-sin(alpha)*cosh(beta), 1-cos(alpha)*cosh(beta), 4*sin((1/2)*alpha)*sinh((1/2)*beta)]
plot3d(Catalan, alpha = 0 .. 2*Pi, beta = -3 .. 3, scaling = constrained, title = "Catalan's surface", titlefont = [Courier, bold, 14])

I would like to color and thicken the edge of this surface to emphasize what I presume is the wire which frames the soap film which forms the surface.

Contourplot3d only shows contours at constant values of the z coordinate, however the plot3d display with style option "surface with line" clearly shows the surface's edge contour, among others.

Given the surface equation, is there any way to display the surface edge programmatically e.g. as a spacecurve?

## Deplot3d does not work in Maple2016...

Why Deplot3d does not work in Maple 2016?

For example,

with(DEtools);

DEplot3d({diff(y(x), x) = y(x)-z(x), diff(z(x), x) = z(x)-2*y(x)}, {y(x), z(x)}, x = 0 .. 3, [[y(0) = 1.638, z(0) = 2.31]], y = 0 .. 2, z = -4 .. 4, scene = [x, z(x), y(x)], linecolor = COLOR(HUE, .5));

There is nothing shown in Maple 2016.

## Unwanted line in plot with spacecurve...

Hi, I am trying to plot a parabola in spherical coordinates using the command spacecurve, using

>with(plots);

>spacecurve([cot(phi)/sin(phi), 1.61, phi], phi = -3.14 .. 3.14, numpoints = 3000, axes = normal, coords = spherical, color = red, linestyle = dash, axes = normal)

(I know it is easier in Cartesian coords, but I am doing this as a first version of a more complicated curve, given by the sol. of a system of differential equations).

Maple plots the parabola correctly but it joins the initial and the final points of the plot with a straight line, yielding something that looks like a U with a bar on top (I cannot upload the image). Is there any way to get rid of the line?

## How can Maple calculate this Moment of Inertia...

I am trying to duplicate the answer to a problem of the nutation of a spinning top. The problem is number 6.1.3 in the book Computer Algebra Recipes for Classical Mechanics by Richard Ens and George McGuire.

TopSC := `<,>`(5*sin(z)*exp(-(Pi-z)/(1.5)), 0, z) for z = 0..Pi

Spacecurve TopSC, when rotated about the z axis, generates the surface of revolution of the top.

The solution requires knowing the moments of inertia (MI) of the top about the z axis and the x or y axis.

Does the following integral correctly calculate the MI about the z axis?

int(2*Pi*TopSC[1]*(TopSC[1]^2), [z = 0 .. z, z = 0 .. Pi])

What sequence of Maple 2016 commands will calculate the top's MI about the x or y axis?

## Space curve in spherical coordinates?...

I have an equation for r(t) that involves 3 (slidable) constants; an equation for phi(t) that involves the same three constants and is written in terms of arctan; theta is a slidable constant. How do I plot this on an x,y,z plot? I want an animation in terms of t.

## How to sketch a straight line in three-dimensional...

by: Maple

A wealth of knowledge is on display in MaplePrimes as our contributors share their expertise and step up to answer others’ queries. This post picks out one such response and further elucidates the answers to the posted question. I hope these explanations appeal to those of our readers who might not be familiar with the techniques embedded in the original responses.

The Question: How to sketch a line in space?

vahid65 wanted to know how to sketch the line with equation (x-2)/3 = (y-1)/4 = (z-3)/3 in a three-dimensional space.

This question was answered using two different approaches that we will discuss.

The first approach, given by Preben Alsholm, suggested using these commands: solve, subs, and plots:-spacecurve.

Preben provided the following lines of code:

1. {(x-2)/3 , (y-1)/4 , (z-3)/3} =~t;
2. solve(%,{x,y,z});
3. L:=subs(%,[x,y,z]);
4. plots:-spacecurve(L,t=-5..5,thickness=3,color=red);

The first line sets the three expressions equal to t using the element wise operator =~.  This distributes the operation of equality over the elements of the set of expressions, forming a set of equations.

Result-1: {(x-2)/3=t, (y-1)/4=t, (z-3)/3=t}

The second line invokes the solve command. The solve command, solve(equations, variables), solves one or more equations or inequalities for their unknowns. So in this line, this command was used to solve each expression for its corresponding unknown.

Result-2: {(x= 2+3t, y=1+4t, z= 3+3t}

You may have noticed that the % symbol is used within the command. This symbol is referring to the equation label that was created chronologically last.

The third line uses the subs command. The subs command, subs(x=a,expr), substitutes “a” for “x” in the expression expr. In this case, “a” is the reference to the equation label referenced by (%) and expr is the sequence of variables x,y,z. The square brackets around expr forms a list, and the replacement imposed by the subs command replaces each of the three names x, y, and z with their equivalents in the set of equations returned by the solve command.

Result-3: [2+3t,1+4t, 3+3t ]

Finally the last line uses the plots:-spacecurve function.  This function, spacecurve(sc,r,opts),  graphs a parametrically defined curve in three-dimensional Cartesian space.

In this example the first parameter, sc, is replaced by L since L has the properties of a list. The parameter  r is an equation containing the parameter name and the parameter range; here it is the equation t=-5..5. Last but not least, the opts parameter (which is optional) gives the user the opportunity to specify the optional properties of the graph, properties such as thickness and color of the space curve.

Result 4:

Another contributer, Carl Love, suggested that these commands could be combined using the zip function, zip( f, u, v), which is an unusual application of it. The zip command applies elementwise to corresponding members of the two lists u and v, the binary function f, creating a new list r, whose members are f(uk,vk).

Carl provided the following code:

plots:-spacecurve(  zip(solve, [(x-2)/3 , (y-1)/4 , (z-3)/3] =~ t, [x,y,z]),  t= -5..5, thickness= 3, color= red, axes= normal);

In this case zip is applying solve to u, a list of equations, and v, a list of variables. The equations in u are those in Result-1. The zip function returns the solution of each equation for the indicated variable, that is, the new list r is the list in Result-3. This list is the first argument of plots:-spacecurve. Finally, the parameter range and opts are up to the user’s preferences.

A second approach was suggested by Kitonum. The difference between this approach and the first one is that here we are not using the solve command. Instead, we are treating the line as an intersection of two planes.

Kitonum's code is as follows:

1. L := [(x-2)*(1/3), (y-1)*(1/4), (z-3)*(1/3)]:
2. plots[intersectplot](L[1]-L[2], L[2]-L[3], x = -4 .. 4, y = -4 .. 4, z = -4 .. 4, linestyle = 1, thickness = 3, axes = normal, orientation = [60, 75], view = [-1 .. 3, -4 .. 2, -1 .. 4]);

The first statement initializes a list L that contains all the desired expressions in the given symmetric form of the line.

In the second statement Kionum used the plots[intersectplot] command. This command graphs, in three-dimensional Cartesian space, the intersection of a pair of surfaces. This example uses the calling sequence: intersectplot(expr1, expr2, x=a..b, y=c..d, z= e..f, options)

What are expr1 and expr2 used in Kitonum’s solution? The pairwise differences of L[1] and L[2], and L[2] and L[3] are planes, the intersection of which is the desired line in space.

expr1 = L[1] – L[2] = (x-2)*(1/3)- (y-1)*(1/4)

expr2= L[2] - L[3] = (y-1)*(1/4)-(z-3)*(1/3)

The variables x,y, and z are the coordinate names and define the axes, whereas a, b, c, d, e, f define the ranges. In this case they were taken as -4 or 4.

In the options parameter Kitonum used linestyle, thickness, axes, orientation, and  view. The help page “plot3d,option” details these and other options that apply.

This blog was written by our intern Pia under the supervision of Dr. Robert Lopez. We both hope that you find this useful. If there is a particular question on MaplePrimes that you would like further explained, please let us know.

## Error when plotting spacecurve...

I have:

r:=t-><4cos2t+4sint,5cos3t+4cost,(sin3t+2sint)^2>

with(plots):

then I tried:

spacecurve(r(t), t = 0 .. 2*Pi, thickness = 2, color = black, axes = normal, labels = [x, y, z], numpoints = 150)

But I keep getting the error: Warning, unable to evalute the function to numeric values in the region.

But I thought <4cos2t+4sint, 5cos3t+4cost, (sin3t+2sint)^2> was defined on the region t=0 to 2Pi???

I'm using Maple 2015 if that helps.

## Plotting a 3D vector in Maple...

Hi!

For my lecture advanced dynamics, I got the question to make a sketch of the coordinate system and the particle’s motion, with the following position vector:

r(t) = (a cos(ωt))i + (b sin(ωt))j + (ct)k

In this function, ω is in [rad/s], a and b are in [m], t in [s] and c is [m/s].

I have no idea what this should look like, and I was thinking about plotting this with Maple, but thus far I'm not succeeding in plotting it. Which function or method can I use to visualize this in Maple?

Thanks a lot!

## Plotting 2d space curve ...

Hi I am reading this help document

http://www.maplesoft.com/support/help/Maple/view.aspx?path=SpaceCurve

and I cannot get maple to plot the same exact graph on that page, I receive this error

http://prntscr.com/8gzpt4

It only lets me plot 3 dimensional curves http://prntscr.com/8gzsry

When I downloaded the help document, the command executed. I cannot get it to work on my worksheet.

I even tried adding with(Student[VectorCalculus] ): and that did not help.

I am clueless why this is not working.

Is there a way to upload a maple worksheet so you can see the error.

## Bug in Standard GUI Maple 2015...

In my  Standard GUI Maple 2015 (32 bit)  on Windows 8.1  plots[spacecurve]  command does not work:

plots[spacecurve]([cos(t), sin(t), t], t = 0 .. 2*Pi);

Can someone confirm this bug?

## How to adjust color hue...

In a 3d coordinate system I have a circular spacecurve with z-minimum -4 and z-maximum +4. In the same 3d coordinate system I have a 3d surface plot with z-minimum -0.5 and z-maximum +1.3 . When I choose the color option "Z(Hue)" in order to color-code the z-values on the 3d surface and make the topography more clear, I mostly get a totally green 3d surface. It seems that the color scaling is coupled with the spacecurve with z-values of +-4 . How can I uncouple the color scaling from the spacecurve and couple it with the z-range of the surface, while the color-limits shall be at +-1.3 ?

## Customise Virtual Solar System by Yi Xie...

I am trying to alter the Virtual Solar system Maple worksheet of Yi Xie in the way that I added several objects to the eight planets and Pluto (e.g. Hale-Bopp, Sedna, 2012 VP113 etc.) and would like to adjust the array such that when zooming out and the obrit and labels overlap so that it's unreadable anymore (orbits and labels) that I can switch on and off (respectively display/not display) specific parts, e.g. the inner solar system. In the original file a single array was created from 1..18 (including 9 orbital entries and 9 label entries). What I did is to create arrays for each part of the Solar system, e.g. Inner for the planets+Pluto 1..18, an array for Hale-Bopp with an orbital entry and a label entry, so [1,2], and an array with 6 entries for 3 additional objects like Sedna, Planet X and 2012 VP113. As well as the sun, which only has a single entry as there are no orbital elements necessary and one just makes a 3dplot (I did not label it, so just one entry). All arrays are converted into lists in the end and displayed. Here is the code:

> with(linalg);

> with(plots);

> with(plottools);

> P1 := matrix([[cos(omega[j]), -sin(omega[j]), 0], [sin(omega[j]), cos(omega[j]), 0], [0, 0, 1]]); P2 := matrix([[1, 0, 0], [0, cos(i[j]), -sin(i[j])], [0, sin(i[j]), cos(i[j])]]); P3 := matrix([[cos(Omega[j]), -sin(Omega[j]), 0], [sin(Omega[j]), cos(Omega[j]), 0], [0, 0, 1]]);

> A:=matrix([[a[j]*(cos(E[j])-e[j])],[a[j]*sqrt(1-e[j]^2)*sin(E[j])],[0]]);

> R:=multiply(P3,P2,P1);

> B:=multiply(R,A);

> a := [.38709893, .72333199, 1.00000011, 1.52366231, 5.20336301, 9.53707032, 19.19126393, 30.06896348, 39.48168677, 1/0.5454e-2, 268.2509283, 532.7838156, 300];

> e := [.20563069, 0.677323e-2, 0.1671022e-1, 0.9341233e-1, 0.4839266e-1, 0.5415060e-1, 0.4716771e-1, 0.858587e-2, .24880766, .994920, .7005635, .8570973, .1];

> i := [7.00487, 3.39471, 0.5e-4, 1.85061, 1.30530, 2.48446, .76986, 1.76917, 17.14175, 89.5328, 24.01830, 11.92859, 10];

> Omega := [48.33167, 76.68069, -11.26064, 49.57854, 100.55615, 113.71504, 74.22988, 131.72169, 110.30347, 282.1476, 90.88303, 144.53190, 45];

> omega := [77.45645, 131.53298, 102.94719, 336.04084, 14.75385, 92.43194, 170.96424, 44.97135, 224.06676, 130.8038, 293.03200, 311.18311, 150];

> i := map(x→ convert(x, units, deg, rad) end proc, i);

> Omega := map(x→ convert(x, units, deg, rad) end proc, Omega);

> omega := map(x→ convert(x, units, deg, rad) end proc, omega);

> for j to 13 do omega[j] := arcsin(sin(omega[j]-Omega[j])/sin(arccos(sin(i[j])*cos(omega[j]-Omega[j])))) end do;

> x := array(1 .. 13);

> y := array(1 .. 13);

> z := array(1 .. 13);

> for j to 13 do x[j] := B[1, 1]; y[j] := B[2, 1]; z[j] := B[3, 1] end do;

> Sun := array([1]);

> Inner := array(1 .. 18); for j to 9 do Colors := [black, green, blue, red, black, yellow, green, violet, brown, aquamarine, black, black, red]; Linestyle := [solid, solid, solid, solid, solid, solid, solid, solid, solid, longdash, solid, solid, longdash]; Inner[j] := spacecurve([subs(E[j] = E, x[j]), subs(E[j] = E, y[j]), subs(E[j] = E, z[j])], E = 0 .. 2*Pi, color = Colors[j], linestyle = Linestyle[j]) end do;

> Comet := array([1, 2]); if j = 10 then Colors := [aquamarine]; Linestyle := [longdash]; Comet[1] := spacecurve([subs(E[j] = E, x[j]), subs(E[j] = E, y[j]), subs(E[j] = E, z[j])], E = 0 .. 2*Pi, color = Colors[j], linestyle = Linestyle[j]) end if;

> Oort := array(1 .. 6); for j from 11 to 13 do Colors := [black, black, red]; Linestyle := [solid, solid, longdash]; Inner[j] := spacecurve([subs(E[j] = E, x[j]), subs(E[j] = E, y[j]), subs(E[j] = E, z[j])], E = 0 .. 2*Pi, color = Colors[j], linestyle = Linestyle[j]) end do;

> Sun[1] := plot3d(0.1e-1, 0 .. 2*Pi, 0 .. Pi, style = PATCHNOGRID, coords = spherical, color = red);

> Inner[10] := textplot3d([subs(E[1] = 0, x[1]), subs(E[1] = 0, y[1]), subs(E[1] = 0, z[1]), "Mercury"]); Inner[11] := textplot3d([subs(E[2] = 0, x[2]), subs(E[2] = 0, y[2]), subs(E[2] = 0, z[2]), "Venus"]); Inner[12] := textplot3d([subs(E[3] = 0, x[3]), subs(E[3] = 0, y[3]), subs(E[3] = 0, z[3]), "Earth"]); Inner[13] := textplot3d([subs(E[4] = 0, x[4]), subs(E[4] = 0, y[4]), subs(E[4] = 0, z[4]), "Mars"]); Inner[14] := textplot3d([subs(E[5] = 0, x[5]), subs(E[5] = 0, y[5]), subs(E[5] = 0, z[5]), "Jupiter"]); Inner[15] := textplot3d([subs(E[6] = 0, x[6]), subs(E[6] = 0, y[6]), subs(E[6] = 0, z[6]), "Saturn"]); Inner[16] := textplot3d([subs(E[7] = 0, x[7]), subs(E[7] = 0, y[7]), subs(E[7] = 0, z[7]), "Uranus"]); Inner[17] := textplot3d([subs(E[8] = 0, x[8]), subs(E[8] = 0, y[8]), subs(E[8] = 0, z[8]), "Neptune"]); Inner[18] := textplot3d([subs(E[9] = 0, x[9]), subs(E[9] = 0, y[9]), subs(E[9] = 0, z[9]), "Pluto"]); Comet[2] := textplot3d([subs(E[10] = 0, x[10]), subs(E[10] = 0, y[10]), subs(E[10] = 0, z[10]), Hale-Bopp]); Oort[4] := textplot3d([subs(E[11] = 0, x[11]), subs(E[11] = 0, y[11]), subs(E[11] = 0, z[11]), "2012 VP113"]); Oort[5] := textplot3d([subs(E[12] = 0, x[12]), subs(E[12] = 0, y[12]), subs(E[12] = 0, z[12]), "Sedna"]); Oort[6] := textplot3d([subs(E[13] = 0, x[13]), subs(E[13] = 0, y[13]), subs(E[13] = 0, z[13]), "Planet X ?", color = red]);

> Sun1 := convert(Sun, 'list');
> Inner1 := convert(Inner, 'list');
> Comet1 := convert(Comet, 'list');
> Oort1 := convert(Oort, 'list');
> display(Sun1, Inner1, Comet1, Oort1, scaling = CONSTRAINED);

The first error message appears after the if-condition. Can you tell me where I am making a mistake? Beware: when copy paste the code from Maple to Word and from Word in here the colons at the end of lines have changed into semi-colons. Hope this is no problem in executing the code despite the lines being in the same ">..." e.g. where the labels are defined.

## Fitting a spacecurve...

Hey

I'm trying to fit a spacecurve onto some points I have.

I know, I can use Spline to do this in 2D, but it doesn't work in 3D.

What command(s) can I use to fit a spacecurve onto my points?