Ronan

1207 Reputation

14 Badges

12 years, 219 days
East Grinstead, United Kingdom

MaplePrimes Activity


These are replies submitted by Ronan

Assuming there is no friction. Say the weight is on a pulley. As the pulley is not rotating the forces/torques on the pulley balance.

Each point in the rope is static, i.e is a state of equilibrium. So so the forces balance producing no net motion  So as T1 and T2 act is opposite directions at any given point in the rope they are equal and opposite. T1+T2=0 T2= -T1.  The tension in the rope is just T1. Rope does not break. 

This can be hard to see if you are not used to thinking about it. As simpler example would be a vertical rope attached to the ceiling with a weight hang from it. Say 100N. So there is a reaction force of 100N in the opposite direction at the ceiling. You would not sum the the force and reaction force to get 200N tension in the rope. But as the reaction force negative to the applied force each point in the string experiences both forces which sum to zero.  So each point is static.

Hope that helps explain.

@John Fredsted Thank you. I got $include to work. Just had to be specific on the folder to look in.

TestjEdit:=module()
option package;
export Testr1;
$include "C:/Users/Ronan/Documents/jEdit/Testr1.mpl"
end module;

Regerding question 1. Can jEdit be made to automatically indent the code.? That is what I would like or is this all manual?

Regarding 2 read is displaying a procedure ok with or without the ; How do I get it to display the contents of a module?

read "C:\\Users\\Ronan\\Documents\\jEdit\\TestjEdit.mpl";
                  TestjEdit :=module(0 ... end module

which is not informative.

Q3...as I suspected

@acer I hadn't meant to insist on reading in a .mla. I presume you are refering to my last nights reply "What for the syntax...".

I was posting that before I saw your reply. Rest assured you answer here has dissuaded me from that route. I made the mistake of trying to write a .mpl file to the library archive a few days ago. 

As an aside. It is such a pity the search on Primes is so limited. In a couple of years you answers will be burried and almost impossible to find. 

@acer  Thank you. Your explinations are very well thought out.

Methord 1 is simple though inefficient as you say. I at least I got it to work easily last night.

I gather when you say a plain text file you mean the file was created in a code editor (Emacs, notepad or someother). I thing I understand you reasoning here. So you would not recomend creating a procedure in Worksheet 1 and saving that out as a .mlp then reading or using $include to get the .mlp into the module because that creates 2 files. I haven't used code editors. Don't have a programming background so my think is probably different to a programmers. Hence my unusual approach, aka lack of knowledge.

Method 2. Yes, I see the neatness. I had tried $include before but couldn't get it to work inside Maple. Programming guide says use command line to run it.

I downloaded the Codebuilder package at the weekend. Still failed to get $include to work.  Are you familiar with this package? i posted this question at the weekend https://www.mapleprimes.com/questions/222558-How-Do-I-Use-The-CodeBuilder-Package 

I see this would still create 2 files i.e. the CodeBuilder worksheet and the exported .mlp file. But it may get me used to the idea of a code editor and still be insidde Maple, so can test on the fly.

Conclusion I need to learn a simple code editor. Which would you recomend?

 

@phil2 Ok. Thank you.  I know how to basicially make a package. Hadn't used savelib before though. With your nice example as there are 2 exports f and g, lets keep f as it is (for reference).  Now can you prior to makeing M save g as a proc or module then read/load it into M. Then savelib ('M', lib) , restart, with(M) , f(x) will still work fine but will g work. I have been unable to get g(x) to work. This is the problem I have been having.

@Mac Dude  Ok, I duplicated what you did and that worked as you showed. I then restarted and loaded package with(Rtestm).  Then the Rtest would not work as shown. Any idea why? At least the problem is narrowed down somewhat.

restart

Rtest := proc () ` `*print("this is a test") end proc

proc () ` `*print("this is a test") end proc

(1)

Rtest()

` `*()

(2)

``

currentdir("C:\\Users\\Ronan\\Documents\\MAPLE\\Rational_Trinonometry")

"C:\Users\Ronan\Documents\MAPLE\Rational_Trinonometry"

(3)

libname

"C:\Program Files\Maple 2017\lib", "C:\Users\Ronan\maple\toolbox\personal\lib"

(4)

libdir := libname[2]

"C:\Users\Ronan\maple\toolbox\personal\lib"

(5)

save Rtest, "Rtest.mpl"

restart

Rtest()

Rtest()

(6)

Rtestm := module () export Rtest; option package;  read cat(currentdir(), "/Rtest.mpl") end module

_m2688721854496

(7)

``

LibraryTools:-Save(Rtestm, cat(libdir, "/Rtestm.mla"))

``

``

``

Rtest()

` `*()

(8)

restart

``

currentdir(); libname; libdir := libname[2]

"C:\Users\Ronan\maple\toolbox\personal\lib"

(9)

``

with(Rtestm)

[Rtest]

(10)

``

Rtest()

Rtestm:-Rtest()

(11)

Rtestm:-Rtest()

Rtestm:-Rtest()

(12)

``


 

Download xtest.mw

 

@Mac Dude 

I do have the programming manual. Finding it hard to follow. Getting too mixed up on things here. Thanks for clarifying " ... " for flile names. 

\ and / is right quagmire here. Maple gives folder names as follows in windows.

currentdir();
     "C:\Users\Ronan\Documents\MAPLE\Rational_Trinonometry"

libname;
         "C:\Program Files\Maple 2017\lib",
           "C:\Users\Ronan\maple\toolbox\personal\lib"
To enter a command such as read, have to use / else get an error.
 
read("C:/Users/Ronan/Documents/MAPLE/Rational_Trinonometry/Antisym.mpl");  works
read(cat(currentdir(),"/Antisym.mpl"));   works
read(cat("C:\Users\Ronan\Documents\MAPLE\Rational_Trinonometry","/Antisym.mpl"));      doesn't work
Error, unable to read `C:UsersRonanDocumentsMAPLERational_Trinonometry/Antisym.mpl`
 
read(cat("C:/Users/Ronan/Documents/MAPLE/Rational_Trinonometry","/Antisym.mpl"));  works.
 
I follow what you did in the example module "RatTrig". Now as you have saved "Antisym" as a file previously. Instead of copying the code into the module can you read that file into the module? The programming guide mentions "$include" to do this but I cant get it to work. Ch 11.4 pages 393-396. 
 
At present I don't see the use/advantage of a code editor. Downloaded Vim last year but just didn't know what to do with it.
 
 
 
 

 


This document shows the problem when I read a procedure into a package.

As na aside having a problem with the "." for the file extension. Maple keeps treating it as matrix multiplication.

 

restart

``

currentdir()

"C:\Users\Ronan\Documents\MAPLE\Rational_Trinonometry"

(1)

``

Antisym := proc (V::{Matrix(3, 3, shape = antisymmetric, algebraic), Vector(3)}) local M; description "converts vector to antisymmetric matrix and back"; if type(V, Vector) then M := Matrix(3, 3, shape = antisymmetric); M[1, 2] := -V[3]; M[1, 3] := V[2]; M[2, 3] := -V[1] else M := Vector(3, [-V[2, 3], V[1, 3], -V[1, 2]]) end if; M end proc

``

save Antisym, 'Antisym'

restart

NULL

read "/Users/Ronan/Documents/MAPLE/Rational_Trinonometry/Antisym"

proc (V::{Matrix(3, 3, shape = antisymmetric, algebraic), Vector(3)}) local M; description "converts vector to antisymmetric matrix and back"; if type(V, Vector) then M := Matrix(3, 3, shape = antisymmetric); M[1, 2] := -V[3]; M[1, 3] := V[2]; M[2, 3] := -V[1] else M := Vector(3, [-V[2, 3], V[1, 3], -V[1, 2]]) end if; M end proc

(2)

Antisym(Vector(3, [1, -6, 7]))

Matrix(%id = 18446746730912679686)

(3)

``

``

``

restart

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

"C:\Users\Ronan\maple\toolbox\personal\lib"

(4)

NULL

libname := mylibdir, libname

"C:\Users\Ronan\maple\toolbox\personal\lib", "C:\Program Files\Maple 2017\lib", "C:\Users\Ronan\maple\toolbox\personal\lib"

(5)

currentdir()

"C:\Users\Ronan\Documents\MAPLE\Rational_Trinonometry"

(6)

RTest := module () export Point2, LinePts, Antisym; option package;  Point2 := proc (x1, y1) options operator, arrow; [x1, y1] end proc; LinePts := proc (p1, p2) options operator, arrow; (p2[2]-p1[2])*x+(p1[1]-p2[1])*y-p2[2]*p1[1]+p1[2]*p2[1] end proc; read "/Users/Ronan/Documents/MAPLE/Rational_Trinonometry/Antisym" end module

_m2657233253376

(7)

savelib('RTest')

``

``

``

restart

``

with(RTest)

[Antisym, LinePts, Point2]

(8)

Point2(3, 7)

[3, 7]

(9)

LinePts([3, 7], [5, -2])

-9*x-2*y+41

(10)

Antisym(Vector(3, [1, -6, 7]))

RTest:-Antisym(Vector[column](%id = 18446746730912679806))

(11)

``


 

Download test_Package1.mw

@Mac Dude 

@nm  Ok what does the \\do? It works for reading in the .mpl.

I have now tried this with a couple of other procedures that worked but reading them in, then they don't work. Any ideas on that?

Will get back to it tomorrow night.

 

@Markiyan Hirnyk Hi. I predomately use a CAD system. Maple is my home hobby to learn more maths out of interest. It would take many months of wor for me to write such code. Here is a link to such an add on package for solidworks. http://www.robotworks-eu.com/apps/cutting.htm

 

I was following a blog earlier this year on the Dzhanibekov Effect where some of the paths traced out can be described by the intersection of a sphere with an ellipse apparently best parameterised by Eulers equation of motion. http://arkadiusz-jadczyk.eu/blog/2017/02/hardest-concept-grasp-physics/ 

 

 I have also seen an application of Stewart Gough platforms been used for 5 axes machining.

Here is a post a placed a couple of months ago here for the reverse kinematics of such a platform.  http://www.mapleprimes.com/posts/208301-Stewart-Gough-Reverse-Kinematics

 

@Markiyan Hirnyk  How about the orientation of the end effector of a robot welding or cutting something. And, art for art's sake.

Hello

Maple also do a home user licence. In the UK it is about £180.

@sarra  https://en.wikipedia.org/wiki/Euler_angles

Basicially you have an Euler rotation matrix. You decide the  the angles of rotation along with the x,y,z displacements. Then the equations calculate the positions of the platform corners in terms of the Global X,Y,Z.

Stewart_Gough_6-6_Leg_Equations.pdf

This paper will show you how to setup the equations.  Looks like you are calculating the leg length. I.e. the reverse kinematics. Describe you displacements in x,y,z and alpha,beta, gamma. Let me know how you get on with it.

 

Edit:- I had uploaded the incorrect pdf

 

@DSkoog  Oh Good. Where/How can i fnd out about all the little tweeks and fixes?

First 20 21 22 23 24 25 26 Page 22 of 29