Items tagged with components

Run the following command in Maple:

Explore(plot(x^k), k = 1 .. 3);

 

Once you’ve run the command, move the slider from side to side. Neat, isn’t it?

With this single line of code, you have built an interactive application that shows the graph of x to the power of various exponent powers.

 

The Explore command is an application builder. More specifically, the Explore command can programmatically generate interactive content in Maple worksheets.

Programmatically generated content is inserted into a Maple worksheet by executing Maple commands. For example, when you run the Explore command on an expression, it inserts a collection of input and output controllers, called Embedded Components, into your Maple worksheet. In the preceding example, the Explore command inserts a table containing:

  • a Slider component, which corresponds to the value for the exponent k
  • a Plot component, which shows the graph of x raised to the power for k

Together these components form an interactive application that can be used to visualize the effect of changing parameter values.

Explore can be viewed as an easy application creator that generates simple applications with input and output components. Recently added packages for programmatic content generation broaden Maple’s application authoring abilities to form a full development framework for creating customized interactive content in a Maple worksheet. The DocumentTools package contains many of these new tools. Components and Layout are two sub-packages that generate XML using function calls that represents GUI elements, such as embedded components, tables, input, or output. For example, the DocumentTools:-Components:-Plot command creates a new Plot component. These key pieces of functionality provide all of the building blocks needed to create customizable interfaces inside of the Maple worksheet. For me, this new functionality has completely altered my approach to building Maple worksheets and made it much easier to create new applications that can explore hundreds of data sets, visualize mathematical functions, and more.

I would go so far as to say that the ability to programmatically generate content is one of the most important new sources of functionality over the past few years, and is something that has the potential to significantly alter the way in which we all use Maple. Programmatic content generation allows you to create applications with hundreds of interactive components in a very short period of time when compared to building them manually using embedded components. As an illustration of this, I will show you how I easily created a table with over 180 embedded components—and the logic to control them.

 

Building an interface for exploring data sets:

In my previous blog post on working with data sets in Maple, I demonstrated a simple customized interface for exploring country data sets. That post only hinted at the much bigger story of how the Maple programming language was used to author the application. What follows is the method that I used, and a couple of lessons that I learned along the way.

When I started building an application to explore the country data sets, I began with an approach that I had used to build several MathApps in the past. I started with a blank Maple worksheet and manually added embedded components for controlling input and output. This included checkbox components for each of the world’s countries, drop down boxes for available data sets, and a couple of control buttons for retrieving data to complete my application.

This manual, piece-by-piece method seemed like the most direct approach, but building my application by hand proved time-consuming, given that I needed to create 180 checkboxes to house all available countries with data. What I really needed was a quicker, more scriptable way to build my interface.

 

So jumping right into it, you can view the code that I wrote to create the country data application here:PECCode.txt

Note that you can download a copy of the associated Maple worksheet at the bottom of this page.

 

I won’t go into too much detail on how to write this code, but the first thing to note is the length of the code; in fewer than 70 lines, this code generates an interface with all of the required underlying code to drive interaction for 180+ checkboxes, 2 buttons and a plot. In fact, if you open up the application, you’ll see that every check box has several lines of code behind it. If you tried to do this by hand, the amount of effort would be multiplied several times over.

This is really the key benefit to the world of programmatic content generation. You can easily build and rebuild any kind of interactive application that you need using the Maple programming language. The possibilities are endless.

 

Some tips and tricks:

There are a few pitfalls to be aware of when you learn to create content with Maple code. One of the first lessons I learned was that it is always important to consider embedded component name collision and name resolution.

For those that have experimented with embedded components, you may have noticed that Maple’s GUI gives unique names to components that are copied (or added) in a Maple worksheet. For example, the first TextArea component that you add to a worksheet usually has the default name TextArea0. If you next add another TextArea, this new TextArea gets the name TextArea1, so as to not collide with the first component. Similar behaviour can be observed with any other component and even within some component properties such as ‘group’ name.

Many of the options for commands in the DocumentTools sub-packages can have “action code”, or code that is run when the component is interacted with. When building action code for a generated component, the action code is specified using a long string that encapsulates all of the code. Due to this code being provided as a long string, one trick that I quickly picked up is that it is important to separate out the names for any components into sub-strings inside of a longer cat statement.

For example, here is a line that is contained within a longer cat statement in the preceding code:

cat( "DocumentTools:-SetProperty( \"", "ComboBox_0", "\", 'value', \"Internet Users\" );\n" )

It is necessary to enclose “ComboBox_0” in quotes, as well as to add in escaped quotes in order to have the resulting action code look like (also note the added new line at the end):

“DocumentTools:-SetProperty( “ComboBox_0”, ‘value’, “Internet Users” );”

Doing so ensures that when the components are created, the names are not hard-coded to always just look for a given name. This means that the GUI can scrape through the code and update any newly generated components with a new name when needed. This is important if “ComboBox_0” already exists so that the GUI can instead create “ComboBox_1”.

 

Another challenge for coding applications is adding a component state. One of the most common problems encountered with running any interactive content in Maple is that if state is not persistent, errors can occur when, for example, a play button is clicked but the required procedures have not been run. This is a very challenging problem, which often require solutions like the use of auto-executing start-up code or more involved component programming. Some features in Maple 2016 have started working to address this, but state is still something that usually needs to be considered on an application by application basis.

In my example, I needed to save the state of a table containing country names so that the interface retains the information for check box state (checked or unchecked) after restart. That is, if I saved the application with two countries selected, I wanted to ensure that when I opened the file again those same two countries would still be selected, both in the interface as well as in the table that is used to generate the plot. Now accomplishing this was a more interesting task: my hack was to insert a DataTable component, which stored my table as an entry of a 1x1 Matrix rtable. Since the rtable that underlies a DataTable is loaded into memory on Maple load, this gave me a way to ensure that the checked country table was loaded on open.

Here, for example, is the initial creation of this table:

"if not eval( :-_SelectedCountries )::Matrix then\n",
"    :-_SelectedCountries := Matrix(1,1,[table([])]):\n",
"end if;\n",

For more details, just look for the term: “:-_SelectedCountries” in the preceding code.

I could easily devote separate posts to discussing in detail each of these two quick tips. Similarly, there’s much more that can be discussed with respect to authoring an interface using programmatic tools from the DocumentTools packages, but I found the best way to learn more about a command is to try it out yourself. Once you do, you’ll find that there are an endless number of combinations for the kinds of interfaces that can be quickly built using programmatic content generation. Several commands in Maple have already started down the path of inserting customized content for their output (see DataSets:-InsertSearchBox and AudioTools:-Preview as a couple of examples) and I can only see this trend growing.

Finally, I would like to say that getting started with programmatic content generation was intimidating at first, but with a little bit of experimentation, it was a rewarding experience that has changed the way in which I work in Maple. In many cases, I now view output as something that can be customized for any command. More often than not, I turn to commands like ‘Explore’ to create an interface to see how sweeping through parameters effects my results, and any time I want to perform a more complex analysis or visualization for my data, I write code to create interfaces that can more easily be customized and re-used for other applications.

If you are interested in learning more about this topic, some good examples to get started with are the examples page for programmatic content generation as well as the help pages for the DocumentTools:-Components and DocumentTools:-Layout sub-packages.

To download a copy of the worksheet used in this post, click here (note that the code can be found in the start-up code of this worksheet): CountryDataPEC.mw To create the datasets interface, simply run the CountrySelection(); command.

I am working on modelling a helicopter blade. Maplesim's Flexible Beam model cannot handle composite material cross section and pre-twist angle. I need to build a custom component based on Hodges's beam model. When I use the Custom Component template, add port and choose port type, there is no "frame" type, which is needed to connect other multibody components. Is it possible to create custom multibody component? If so, how can I make it? Thanks! 

Maple is a scientific software based on Computational Algebraic System (SAC) which has enabled this work entirely solve applied to Civil Engineering, Mechanical and Mecatrónica.The present problems in education, research and engineering are developed with static work sheets ie coding used innecesaria.Maple proposed models are shown below with an innovative structure; with the method of graphics algorithms and embedded components; putting aside the traditional and obsolete syntax; using dynamic worksheets as viable and optimal solutions to interpret and explain problems Ingineering.Design Advanced Analysis Tools (Applied Mathematics) Sophisticated Applications (efficient algorithms) and Multiple deployment options (different styles); this allowed generate math apps (applications engineering); can be interactive on the internet without the need to have the software installed on our computer; This way our projects can be used with a vision of sustainability around the world. Resulting in the generation of data and curves; which in turn will help you make better decisions analytical and predictive modeling in manufacturing and 3D objects; which would lead to new patterns of contrasting solutions.

ECI_2016.pdf

ECI_2016v_full.mw

Lenin Araujo Castillo

Ambassador of Maple - Perú

 

 

 

ABSTRACT. In this paper we demonstrate how the simulation of dynamic systems engineering has been implemented with graphics software algorithms using maple and MapleSim. Today, many of our researchers the computational modeling performed by inserting a piece of code from static work; with these packages we have implemented through the automation components of kinematics and dynamics of solids simple to complex.

It is very important to note that once developed equations study; recently we can move to the simulation; to thereby start the physical construction of the system. We will use mathematical and computational methods using the embedded buttons which lie in the dynamics leaves and viewing platform cloud of Maplesoft and power MapleNet for online evaluation of specialists in the area. Finally they will see some work done; which integrate various mechanical and computational concepts implemented for companies in real time and pattern of credibility.

 

Selasi_2015.pdf

(in spanish)

 

Lenin Araujo Castillo

 

 

Do you have physical components like MOSFETs and IGBTs in your library? How can I have a look at the tool and library block sets?

As a very good application for viewing and calculation of the components of acceleration either tangential or normal. Besides immediately it is shown an Application for physics.

Componentes_de_la_Acelelación.mw

(in spanish)

L. Araujo C.

 

 

Here we see the projection of a vector onto another using different concepts ranging from linear algebra to vector calculus. Implemented components thus seen in three-dimensional space.

 

Proyecciones_Vectoriales.mw

(in spanish)

L.Araujo C.

I wish to display the following screen output from a procedure A(), in a textbox of mathcontainer or any other suitable component.

 

This output to screen listing is generated by print statements in the procedure A().

I have placed the procedure call A() in a textbox and then am using a button component to execute it with the objective of displaying the above output in another component display box; either a textbox or a MathContainer box...  I can see that A() executes, but do not know how to get the result to display in a component box.

Can anyone offer any help?

In this work the theme of vector analysis shown from a computational point of view; this being a very important role in the engineering component; in civil and mechanical special it is why, using the scientific software Maple develops interactive solutions for long processes through MapleCloud calculations. At present the majority of professors / researchers perform static classes open source leaves; so that our students learn and memorize commands, thus generating more time learning in the area. Loading Bookseller VectorCalculus develop topics: vector algebra, differential operators, conservative fields, etc. Maplesoft making processes provide immediate calculations long operation Embedded Components displayed in line with MapleNet integrations. Today our future engineers to design solutions and will be launched in the cloud thus being a process with global qualification in the specialty. Significantly Maple is a scientific software which allows the researcher to design their own innovations and not use themes for their manufacturers.

 

III_CRF_2015.pdf

CRF_2015.mw

 

L.AraujoC.

 

 

We find recent applications of the components applied to the linear momentum, circular equations applied to engineering. Just simply replace the vector or scalar fields to thereby reasoning and use the right button.

 

Momento_Lineal_y_Circular.mw

(in spanish)

Atte.

L.AraujoC.

Developed and then implemented with open code components. It is very important to note this post is held for students of civil engineering and mechanics. Using advanced mathematical concepts to concepts in engineering.

Metodos_Energeticos_full.mw

(in spanish)

Atte.

L.Araujo.C

 

 

 

 

 

Hello. Earlier, I asked about it, (see http://www.mapleprimes.com/questions/203573-How-To-Do-Simple-Operations-On-Tensors). However, not all I was able to understand. Below I will give a try, and maybe you'll show me where I'm wrong.

Also, I'm interested in how you can determine the components of the tensor in a different coordinate system connected with the original in any conversion. Thank for your help.

restart; with(Physics); with(DifferentialGeometry)

ds := Physics:-`^`(dx__1, 2)+Physics:-`^`(dx__2, 2)+Physics:-`^`(dx__3, 2)

dx__1^2+dx__2^2+dx__3^2

(1)

Physics:-Setup(coordinates = (X = [x__1, x__2, x__3]), dimension = 3, metric = ds, quiet)

[coordinatesystems = {X}, dimension = 3, metric = {(1, 1) = 1, (2, 2) = 1, (3, 3) = 1}]

(2)

g_[]

g_[mu, nu] = (Matrix(3, 3, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (2, 2) = 1, (2, 3) = 0, (3, 3) = 1}, storage = triangular[upper], shape = [symmetric]))

(3)

``

u__1 := Physics:-`*`(Physics:-`*`(P, Physics:-`^`(Physics:-`*`(Physics:-`*`(4, Pi), G), -1)), Physics:-`*`(x__3, Physics:-`*`(x__1, Physics:-`^`(Physics:-`^`(r, 3), -1)))-Physics:-`*`(Physics:-`*`(1-Physics:-`*`(2, nu), x__1), Physics:-`^`(Physics:-`*`(r, r+x__3), -1))):u__2 := Physics:-`*`(Physics:-`*`(P, Physics:-`^`(Physics:-`*`(Physics:-`*`(4, Pi), G), -1)), Physics:-`*`(x__2, Physics:-`*`(x__3, Physics:-`^`(Physics:-`^`(r, 3), -1)))-Physics:-`*`(Physics:-`*`(1-Physics:-`*`(2, nu), x__2), Physics:-`^`(Physics:-`*`(r, r+x__3), -1))):u__3 := Physics:-`*`(Physics:-`*`(P, Physics:-`^`(Physics:-`*`(Physics:-`*`(4, Pi), G), -1)), Physics:-`*`(Physics:-`*`(2, 1-nu), Physics:-`^`(r, -1))+Physics:-`*`(Physics:-`^`(x__3, 2), Physics:-`^`(Physics:-`^`(r, 3), -1))):

`e__1,1` := diff(u__1, x__1):`e__2,2` := diff(u__2, x__2):`e__3,3` := diff(u__3, x__3):

`e__1,2` := Physics:-`*`(Physics:-`^`(2, -1), diff(u__1, x__2)+diff(u__2, x__1)):`e__1,3` := Physics:-`*`(Physics:-`^`(2, -1), diff(u__1, x__3)+diff(u__3, x__1)):`e__2,3` := Physics:-`*`(Physics:-`^`(2, -1), diff(u__2, x__3)+diff(u__3, x__2)):

`e__2,1` := `e__1,2`:

`e__3,1` := `e__1,3`:

`e__3,2` := `e__2,3`:

  E := matrix(3, 3, proc (i, j) options operator, arrow; e[i, j] end proc)

Matrix(3, 3, {(1, 1) = e[1, 1], (1, 2) = e[1, 2], (1, 3) = e[1, 3], (2, 1) = e[2, 1], (2, 2) = e[2, 2], (2, 3) = e[2, 3], (3, 1) = e[3, 1], (3, 2) = e[3, 2], (3, 3) = e[3, 3]})

(4)

Physics:-Define(E[i, j])

{gamma[mu], E[i, j], sigma[mu], Physics:-d_[mu], Physics:-g_[mu, nu], delta[mu, nu], epsilon[alpha, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(5)

Physics:-TensorArray(%)

{E[i, j], Array(1..3, 1..3, 1..3, {(1, 1, 1) = 0, (1, 1, 2) = 0, (1, 1, 3) = 0, (1, 2, 1) = 0, (1, 2, 2) = 0, (1, 2, 3) = 0, (1, 3, 1) = 0, (1, 3, 2) = 0, (1, 3, 3) = 0, (2, 1, 1) = 0, (2, 1, 2) = 0, (2, 1, 3) = 0, (2, 2, 1) = 0, (2, 2, 2) = 0, (2, 2, 3) = 0, (2, 3, 1) = 1, (2, 3, 2) = 1, (2, 3, 3) = 1, (3, 1, 1) = 0, (3, 1, 2) = 0, (3, 1, 3) = 0, (3, 2, 1) = -1, (3, 2, 2) = -1, (3, 2, 3) = -1, (3, 3, 1) = 0, (3, 3, 2) = 0, (3, 3, 3) = 0}), Array(1..3, {(1) = x__1, (2) = x__2, (3) = x__3}), Array(1..3, {(1) = Physics:-Psigma[1], (2) = Physics:-Psigma[2], (3) = Physics:-Psigma[3]}), Array(1..3, {(1) = Physics:-d_[1], (2) = Physics:-d_[2], (3) = Physics:-d_[3]}), Array(1..3, {(1) = Physics:-Dgamma[1], (2) = Physics:-Dgamma[2], (3) = Physics:-Dgamma[3]}), Matrix(3, 3, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = 1, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1}), Matrix(3, 3, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = 1, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1})}

(6)

``

Physics:-Setup(dimension)

[dimension = 3]

(7)

NULL

Physics:-Define(E[i, j], query)

[E, [0, 0, 0], 0]

(8)

DifferentialGeometry:-DGsetup([y__1, y__2, y__3], M):

Phi1 := DifferentialGeometry:-Transformation(N, M, [y__1 = Physics:-`*`(Physics:-`^`(sqrt(6), -1), x__1)+Physics:-`*`(Physics:-`*`(2, Physics:-`^`(sqrt(6), -1)), x__2)+Physics:-`*`(Physics:-`^`(sqrt(6), -1), x__3), y__2 = Physics:-`*`(Physics:-`^`(sqrt(2), -1), x__1)-Physics:-`*`(Physics:-`^`(sqrt(3), -1), x__2)+Physics:-`*`(Physics:-`^`(sqrt(3), -1), x__3), y__3 = Physics:-`*`(Physics:-`^`(sqrt(2), -1), x__1)-Physics:-`*`(Physics:-`^`(sqrt(2), -1), x__3)]):

NULL

 

Download 1.mw

When I create a component, here a label component, and set a name property and then click OK, that name seems to go into some list never to be erased. If I then delete the first name and put in a new name and click OK. thus saving it, and the then try to use that name again on a different component, I am told that the name is already in use. Well, no existing component has the name, but it is still in Maple's list of components. If I go to edit an action for any component and input %+command completion, I get a list of components which includes the deleted name which does not belong to any existing component. Since the name is on this list, I cannot reuse the component name.

How do I clean up this erroneous list of component names, so that a mistake in naming one component doesn't forever prevent me from using it on the component for which it was intended?

 

Hi! I'm trying to use MapleSim 7 to simulate some very simple physical situations, however after great many hours spent at this, I'm still unable to convince MapleSim to load and run even the simplest Modelica models, like:

model Main
  Modelica.Mechanics.MultiBody.Parts.Body o(r_CM = zeros(3));
  inner .Modelica.Mechanics.MultiBody.World world;
equation
  o.frame_b.f = {0,-9.8,0};
end Main;

It will report that o and world are "unknowns" and apparently does not recongize Modelica.Mechanics.MultiBody.Parts.Body nor Modelica.Mechanics.MultiBody.World. Do I need to do some extra steps to import extra libraries or enable some non-default components?  I went through various YouTube and other tutorials and didn't find a mention of anything.

When I look at some examples, often they refer to things like Maplesoft.Multibody.World - but these are proprietary Maple packages, and I need my code to use standard Modelica. Does this mean that MapleSim cannot run generic Modelica code like this?

I also tried running e.g. https://github.com/xogeny/HarmonicMotion and some other examples, with absolutely no success either. I'm quite confused because MapleSim has a lot of advertising about Modelica support... :-(

Hi! I'm trying to use MapleSim 7 to simulate some very simple physical situations, however after great many hours spent at this, I'm still unable to convince MapleSim to load and run even the simplest Modelica models, like:

model Main
  Modelica.Mechanics.MultiBody.Parts.Body o(r_CM = zeros(3));
  inner .Modelica.Mechanics.MultiBody.World world;
equation
  o.frame_b.f = {0,-9.8,0};
end Main;

It will report that o and world are "unknowns" and apparently does not recongize Modelica.Mechanics.MultiBody.Parts.Body nor Modelica.Mechanics.MultiBody.World. Do I need to do some extra steps to import extra libraries or enable some non-default components?  I went through various YouTube and other tutorials and didn't find a mention of anything.

When I look at some examples, often they refer to things like Maplesoft.Multibody.World - but these are proprietary Maple packages, and I need my code to use standard Modelica. Does this mean that MapleSim cannot run generic Modelica code like this?

I also tried running e.g. https://github.com/xogeny/HarmonicMotion and some other examples, with absolutely no success either. I'm quite confused because MapleSim has a lot of advertising about Modelica support... :-(

1 2 3 Page 1 of 3