Ronan

827 Reputation

14 Badges

11 years, 199 days
East Grinstead, United Kingdom

MaplePrimes Activity


These are replies submitted by Ronan

@Kitonum  Hi, I was looking for a way not to directly place the transformation formulas inside the plot function. This is what post question was about.

@vv Thank you. Wouldn't have thought of that. Any idea whay that works. Now it won't work for a point. Any Idea on that?

ff := unapply(display(point([d[1][1], d[1][2], d[1][3]], colour = red, symbolsize = 50, symbol = solidsphere)), t)

Error, (in plottools:-point) incorrect arguments for creating points structure, try providing the dimension option
 

@tomleslie  Very interesting, At this point animating an STL might be a bit ambisious for me. Can't get Maple to read my STL. I made a simple model. It is so long since I did an animation can't get anything working. Slmple one, line([0,0,0],[sin(t),0,0]) say t=0..3. Obiviously the line length should cannge with time.  Bisicially I want to rotate the model. I can apply a rotation matrix. I  am just not quite getting what to do.
 

restart

with(plots)

[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fieldplot, fieldplot3d, gradplot, gradplot3d, implicitplot, implicitplot3d, inequal, interactive, interactiveparams, intersectplot, listcontplot, listcontplot3d, listdensityplot, listplot, listplot3d, loglogplot, logplot, matrixplot, multiple, odeplot, pareto, plotcompare, pointplot, pointplot3d, polarplot, polygonplot, polygonplot3d, polyhedra_supported, polyhedraplot, rootlocus, semilogplot, setcolors, setoptions, setoptions3d, shadebetween, spacecurve, sparsematrixplot, surfdata, textplot, textplot3d, tubeplot]

(1)

with(plottools)

[annulus, arc, arrow, circle, cone, cuboid, curve, cutin, cutout, cylinder, disk, dodecahedron, ellipse, ellipticArc, exportplot, extrude, getdata, hemisphere, hexahedron, homothety, hyperbola, icosahedron, importplot, line, octahedron, parallelepiped, pieslice, point, polygon, prism, project, rectangle, reflect, rotate, scale, sector, semitorus, sphere, stellate, tetrahedron, torus, transform, translate]

(2)

``

``

``

"grll:=plot(line([0,0,0],[ sin(t),t=0..2,0,0], , colour=red,thickness=3)) ;  #` ,line`([0,0,0],[0,20*Omega2(t),0],colour=yellow,thickness=3) ,line([0,0,0],[0,0,20*Omega3(t)],colour=blue,thickness=3)]"

Error, invalid function arguments

"grll:=plot(line([0,0,0],[sin(t),t=0..2,0,0],,colour=red,thickness=3)) ;  #` ,line`([0,0,0],[0,20*Omega2(t),0],colour=yellow,thickness=3) ,line([0,0,0],[0,0,20*Omega3(t)],colour=blue,thickness=3)]"

 

``

display(grll)

Error, (in plots:-display) expecting plot structure but received: grll

 

grf := [point([1, -.2, 0], colour = red, symbolsize = 50, symbol = solidsphere), point([-1, -.2, 0], colour = orange, symbolsize = 50, symbol = solidsphere), point([0, 1, 0], colour = green, symbolsize = 50, symbol = solidsphere), line([0, 0, 0], [1, -.2, 0]), line([0, 0, 0], [-1, -.2, 0]), line([0, 0, 0], [0, 1, 0]), line([0, 0, 0], [.5, 0, 0], colour = red, thickness = 4), line([0, 0, 0], [0, .5, 0], colour = yellow, thickness = 4), line([0, 0, 0], [0, 0, .5], colour = blue, thickness = 4)], scaling = constrained

grf := [POINTS(Matrix(1, 3, {(1, 1) = 1.0, (1, 2) = -.2, (1, 3) = .0}, datatype = float[8]), COLOUR(RGB, 1.00000000, 0., 0.), SYMBOL(_SOLIDSPHERE, 50)), POINTS(Matrix(1, 3, {(1, 1) = -1.0, (1, 2) = -.2, (1, 3) = .0}, datatype = float[8]), COLOUR(RGB, .80000000, .19607843, .19607843), SYMBOL(_SOLIDSPHERE, 50)), POINTS(Matrix(1, 3, {(1, 1) = .0, (1, 2) = 1.0, (1, 3) = .0}, datatype = float[8]), COLOUR(RGB, 0., 1.00000000, 0.), SYMBOL(_SOLIDSPHERE, 50)), CURVES([[0., 0., 0.], [1., -.2, 0.]]), CURVES([[0., 0., 0.], [-1., -.2, 0.]]), CURVES([[0., 0., 0.], [0., 1., 0.]]), CURVES([[0., 0., 0.], [.5, 0., 0.]], COLOUR(RGB, 1.00000000, 0., 0.), THICKNESS(4)), CURVES([[0., 0., 0.], [0., .5, 0.]], COLOUR(RGB, 1.00000000, 1.00000000, 0.), THICKNESS(4)), CURVES([[0., 0., 0.], [0., 0., .5]], COLOUR(RGB, 0., 0., 1.00000000), THICKNESS(4))], scaling = constrained

(3)

``

plots:-display(grf)

 

``


 

Download Anim_How.mw

@Preben Alsholm  Firstly the 1st part was my copy and past carelessness. So Theta(t) is the displacement say 0.5rads. So solve

the for t. Took a while to understand. Like the animation.

@Preben Alsholm Most informative.

@Preben Alsholm  Thank you that worked well. If I solved it without using initial conditions. Then slove for the 1st constant. then differentiate I am also having trouble solving for  he second constant  even using  D(Theta)(0) = Vmax or  D(Theta)(0) := Vmax. I am asking this too not to be diffiicult but I am exploring/learning different approaches.

@Carl Love  Thank you. This is my intrepretation of you advice. It works well.


 

restart

mylibdir := cat(kernelopts(homedir), kernelopts(dirsep), "maple", kernelopts(dirsep), "toolbox", kernelopts(dirsep), "personal", kernelopts(dirsep), "lib")

"C:\Users\Ronan.Ronan-PC\maple\toolbox\personal\lib"

(1)

NULL

``

libname := mylibdir, libname

"C:\Users\Ronan.Ronan-PC\maple\toolbox\personal\lib", "C:\Program Files\Maple 2016\lib", "C:\Users\Ronan.Ronan-PC\maple\toolbox\personal\lib"

(2)

NULL

NULL

NULL

RTest := module () local ModuleLoad; export Sums; option package;  ModuleLoad := proc () global Clr; Clr := B end proc; Sums := proc (p1, p2, c := Clr) if c = B or c = b then p1+p2 elif c = G or c = g then p1-p2 elif c = R or c = r then if p2 = 0 then "Not Valid" else p1/p2 end if else "Error" end if end proc; ModuleLoad() end module;

_m650941920

(3)

NULL

savelib('RTest')

restart

NULL

with(RTest)

[Sums]

(4)

"At This point I want the value of Clr to be automaticially   B"

Sums(2, 3)

5

(5)

RTest:-Sums(2, 3, b)

5

(6)

NULL

RTest:-Sums(2, 3, r)

2/3

(7)

RTest:-Sums(2, 3, g)

-1

(8)

Clr := R

R

(9)

RTest:-Sums(2, 3)

2/3

(10)

Clr := g

g

(11)

RTest:-Sums(2, 3)

-1

(12)

RTest:-Sums(2, 3, r)

2/3

(13)

RTest:-Sums(2, 3, g)

-1

(14)

RTest:-Sums(2, 0, r)

"Not Valid"

(15)

``

RTest:-Sums(2, 3)

-1

(16)

``


 

Download Module_Test_global_Var1.mw

@Markiyan Hirnyk I ran it for 15hrs. Still no answer. CPU was maxed most of the time. Had to kill the process. Yes I meant "solvable".

Regards

Ronan

I have your worksheet running as you posted it. 4+ hours now. CPU is hitting 100% on 2.9GHz 1st gen I7. Total memory usage on computer 4.75Gig. Maple memory 833.93M.  Pyhsical memory of computer 12Gig.

@Mac Dude Ok. Have downloaded it. Will work on it over the next week. Sure I'll have a few questions.

restart;



MyTypes := {algebraic, ''[algebraic$_], 'Vector(_, algebraic)'''$_ = 2 .. 3};

TypeTools:-AddType(MyType, MyTypes);

MyProc := proc (Q1::(depends(And(MyType, satisfies(proc (Q1) options operator, arrow; andmap(proc (T) options operator, arrow; Q1::T implies Q2::T and Q3::T end proc, MyTypes) end proc)))), Q2, Q3) if Q1::algebraic then print('algebraic*inputs') elif Q1::[algebraic$2] then print('List*inputs', 2, 'elements') elif Q1::[algebraic$3] then print('List*inputs', 3, 'elements') elif Q1::'Vector(2, algebraic)' then print('vector', 2) else Q1::'Vector(3, algebraic)'; print('vector', 3) end if end proc;
MyProc(sqrt(1-2*x), 2*x, 3);
                        algebraic inputs
MyProc([1, x], [2, 3], [1, sqrt(1-2*x)]);
                    List inputs, 2, elements
MyProc([1, x, 1], [2, 3, 2], [1, sqrt(1-2*x), 2]);
                    List inputs, 3, elements
MyProc(`<,>`(1, 1), `<,>`(2, 3), `<,>`(1, 2));
                           vector, 2
MyProc(`<,>`(1, 2), `<,>`(2, 3), `<,>`(1, 2));
                  proc(n, f, t)  ...  end;, 2
MyProc(`<,>`(1, 2, 3), `<,>`(2, 3, 6), `<,>`(1, -5, 2));
                  proc(n, f, t)  ...  end;, 3
MyProc(`<,>`(1, x, 1), `<,>`(2, 3, 3), `<,>`(1, 2, 7));
                  proc(n, f, t)  ...  end;, 3
MyProc(sqrt(1-2*x), 2, [3, 1]);
Error, invalid input: MyProc expects its 1st argument, Q1, to be of type And(MyType, satisfies(proc (Q1) options operator, arrow; andmap(proc (T) options operator, arrow; Q1::T implies Q2::T and Q3::T end proc, MyTypes) end proc)), but received (1-2*x)^(1/2)
MyProc([1, `<,>`(2)], [sqrt(1-2*x), 3], [1, 2]);
Error, invalid input: MyProc expects its 1st argument, Q1, to be of type And(MyType, satisfies(proc (Q1) options operator, arrow; andmap(proc (T) options operator, arrow; Q1::T implies Q2::T and Q3::T end proc, MyTypes) end proc)), but received [1, Vector(1, {(1) = 2})]



@Carl Love I have made some progress with understanding this. I can see how it works. It does seem to have a problem with Vectors. Get this as an output.

proc(n, f, t)  ...  end;, 2
 Sometimes it works with  vectors.

I want to put this set of "types" into Packege. Obiviously the most efficient thing is the types get defined globally at the start of the package and then can be used as needed in individual procedures in the package. I tried placing part of your 1st answer into the package.

uses TT= TypeTools;
global _T1, _T2L, _T2V, _T3L, _T3V, _MyType;
local
     MyTypes:= {_T1, _T2L, _T2V, _T3L, _T3V},
     AllMyTypes:= MyTypes union {_MyType},

     ModuleLoad:= proc()
     local
          g, #iterator over module globals
          e
     ;
          #op([2,6], ...) of a module is its globals.
          for g in op([2,6], thismodule) do
               e:= eval(g);
               if g <> e and e in AllMyTypes then
                    error "The name %1 must be globally available.", g
               end if
          end do;
          TT:-AddType(_T1, algebraic);
          TT:-AddType(_T2V, 'Vector(2, algebraic)');
          TT:-AddType(_T2L, [algebraic $ 2]);
          TT:-AddType(_T3V, 'Vector(3, algebraic)');
          TT:-AddType(_T3L, [algebraic $ 3]);
          TT:-AddType(_MyType, MyTypes)
     end proc,

That didn't work. I don't know how much of it I need. Do I need to use all of the module on procedures that check input types

You 1st answer works fine with the tested inputs on the vectors. I found if I only enter 2 parameters it crashes Maple, looses kernel connection.

This leads to another question. Can a procedure have a variable number of imputs? Outside of putting them in a list first. An axample here would be angle formed be 3 points or 2 vectors or 2 lines.

 Could an input be allowed to be Null? Or C takes on a default value is not entered.

Just to note here. Only some of the procedures in the package need to test the input parameters and usually not all types would need to be tested.

 

 

 

Good basic overhaul on the look for the forum. Others have suggested improvements on this so don't need to recover that ground.

Have been experiencing some problems.

Some times when I hit return I loose my reply or it jumps to the end of the discussion i.e off the reply window. I am having problems posting a worksheet, nothing happens. The insert contents button seems frozen. How do you insret code (like the way Car Love and others do)? I tried copy and paste but it looked a mess.

@Joe Riel That works well and is simple to impliment. One thing I dont understand, how does the test produce an error on mixed input types. It only appears to test the 1st eleme A but on mixed input types produces the error as required. Haven't tested for vectors yet.

 

@Mac Dude  Thank you.  Got it to work. I manually made a folder on the C drive "libR". Then ran the work sheet. That created the help file and added the 2 document. Great. I Underatand to edit the help contents delete the .help file and after modyfing the worksheets run the "help edit to databse" again. All good so far.

 

One more question on this.

This first worksheet added opens in the browser when searched for. The second one opens as a worksheet in Maple.

Any Idea why?

 Edit:- I fixed the problem additional help files not opening in the browser. This is what the document properties "Active"= true opens the help as the maple worksheet, false opens the help in the browser.

I have not tried moving the  .help file to where the .mla file is yet. Is that important?

 

NULL

NULL

currentdir();

"C:\Users\Ronan.Ronan-PC\Documents\MAPLE\Rational Trinonometry"

(1)

 

``

HelpTools[Database][Create]("C:/libR/RatTrig.help");

"C:/libR/RatTrig.help"

(2)

HelpTools[Database][Add]("C:/libR/RatTrig.help");

["C:\Program Files\Maple 2016\lib\maple.help", "C:\Program Files\Maple 2016\lib\update.help"]

(3)

HelpTools[Database][GetActive]();

["C:/libR/RatTrig.help", "C:\Program Files\Maple 2016\lib\maple.help", "C:\Program Files\Maple 2016\lib\update.help"]

(4)

``

makehelp("RationalTrigonometry", "Rational Trigonometry Overiew Help.mw", "C:/libR/RatTrig.help", browser = ["Rational Trigonometry", "Overview"]);

["C:/libR/RatTrig.help", "C:\Program Files\Maple 2016\lib\maple.help", "C:\Program Files\Maple 2016\lib\update.help"]

(5)

makehelp("RationalTrigonometry,Quadrance", "Help Quadrance.mw", "C:/libR/RatTrig.help", browser = ["RationalTrigonometry", "Quadrance"]);

``

NULL

 

Download help_edit_to_Database.mw

 

First 14 15 16 17 18 19 20 Page 16 of 20