Applications, Examples and Libraries

Share your work here

Hi all,

Look at my pretty plot.  It is defined by

x=sin(m*t);
y=sin(n*t);

where n and m are one digit positive integers.

You can modify my worksheet with different values of n and m.

pillow_curve.mw

pillow_curve.pdf

The name of the curve may be something like Curve of Lesotho.  I saw this first in one of my father's books.

Regards,
Matt

 

The order in which expressions evaluate in Maple is something that occasionally causes even advanced users to make syntax errors.

I recently saw a single line of Maple code that provided a good example of a command not evaluating in the order the user desired.

The command in question (after calling with(plots):) was

animate(display, [arrow(<cos(t), sin(t)>)], t = 0 .. 2*Pi)

This resulted in the error:

Error, (in plots/arrow) invalid input: plottools:-arrow expects its 3rd argument, pv, to be of type {Vector, list, vector, complexcons, realcons}, but received 0.5000000000e-1*(cos(t)^2+sin(t)^2)^(1/2)
 

This error indicates that the issue in the animation is the arrow command

arrow(<cos(t), sin(t)>)

on its own, the above command would give the same error. However, the animate command takes values of t from 0 to 2*Pi and substitutes them in, so at first glance, you wouldn't expect the same error to occur.

What is happening is that the command 

arrow(<cos(t), sin(t)>)

in the animate expression is evaluating fully, BEFORE the call to animate is happening. This is due to Maple's automatic simplification (since if this expression contained large expressions, or the values were calculated from other function calls, that could be simplified down, you'd want that to happen first to prevent unneeded calculation time at each step).

So the question is how do we stop it evaluating ahead of time since that isn't what we want to happen in this case?

In order to do this we can use uneval quotes (the single quotes on the keyboard - not to be confused with the backticks). 

animate(display, ['arrow'(<cos(t), sin(t)>)], t = 0 .. 2*Pi)

By surrounding the arrow function call in the uneval quotes, the evaluation is delayed by a level, allowing the animate call to happen first so that each value of t is then substituted before the arrow command is called.

Maple_Evaluation_Order_Example.mw

Download pendulumprojection.mw

Most of the time in multivariable calculus the vectors we are decomposing with respect to a given direction are attached to a specific point and this "orthogonal decomposition" should be visualized as a triplet of vectors with initial point at that given point such that the two projections sum to the original vector. Keep in mind our high school physics pendulum example where we need to evaluate both the component of the downward gravitational force along the tangential direction of motion of the pendulum for the equations of motion as well as along the perpendicular direction to the motion to evaluate the tension in the string or wire holding the pendulum mass.

We create an Explorable graphic to visualize this idea and then create an animation which requires a bit of Maple expert user knowledge to accomplish (thanks Maplesoft!). A delayed evaluation of the arrow command from the plot package is required in order to animate that arrow so that it waits for the animation command to feed it actual numerical values for the vector to be plotted.

My worksheet URL:
http://www34.homepage.villanova.edu/robert.jantzen/courses/mat2500/handouts/pendulumprojection.mw

As a continuation of the posts:
https://www.mapleprimes.com/posts/208958-Determination-Of-The-Angles-Of-The-Manipulator
https://www.mapleprimes.com/posts/209255-The-Use-Of-Manipulators-As-Multiaxis
https://www.mapleprimes.com/posts/210003-Manipulator-With-Variable-Length-Of
But this time without Draghilev's method.
Motion along straight lines can replace motion along any spatial path (with any practical precision), which means that solving the inverse problem of the manipulator's kinematics can be reduced to solving the movement along a sequential set of segments. Thus, another general method for solving the manipulator inverse problem is proposed.
An example of a three-link manipulator with 5 degrees of freedom. Its last link, like the first link, geometrically corresponds to the radius of the sphere. We calculate the coordinates of the ends of its links when passing a straight line segment. We do this in a loop for interior points of the segment using the procedure for finding real roots of polynomial systems of equations RootFinding [Isolate]. First, we “remove” two “extra” degrees of freedom by adding two equations to the system. There can be an infinite set of options for additional equations - if only they correspond to the technical capabilities of the device. In this case, two maximally easy conditions were taken: one equation corresponds to the perpendicularity of the last (third) link directly to the segment of the trajectory itself, and the second equation corresponds to the perpendicularity to the vector with coordinates <1,1,1>. As a result, we got four ways to move the manipulator for the same segment. All of these ways are selected as one of the RootFinding [Isolate] solutions (in text  jj=1,2,3,4).
In this text jj=4
without_Draghilev_method.mw       

As you can see, everything is very simple, there is practically no programming and is performed exclusively by Maple procedures.

 

Here is a very nice (but not easy) elementary problem.
The equality
ceil(2/(2^(1/n)-1)) = floor(2*n/ln(2));

             

is not an identity, it does not hold for each positive integer n.
How to find such a number?

[This is a re-post, because the original vanished when trying a conversion Question-->Post]

The problem appears in the recent book:
Richard P. Stanley - Conversational Problem Solving. AMS, 2020. 

The problem is related to a n-dimensional tic-tac-toe game. The first counterexample (2000) was wrong due to a multiprecision arithmetic error.
The  author of the book writes 
"To my knowledge, only eight values of n are known for which the equation fails,
and it is not known whether there are infinitely many such values",

but using Maple it will be easy to find more.

A brute-force solution is problematic because the smallest counterexample is > 7*10^14.

restart;
a := 2/(2^(1/n)-1): b := 2*n/ln(2):
asympt(b-a, n);

        

It results:  b - a → 1 (for n →oo);
So, to have a counterexample, b must be close to an integer
m ≈ 2*n/ln(2)  ==> n/m ≈ ln(2)/2

The candidates for n/m will be obviously the convergents of the continued fraction of the irrational number ln(2)/2.
 

convert(ln(2)/2, confrac, 200, 'L'):
Digits:=500:
for n in numer~(L[3..]) do
  if not evalf(ceil(a)=floor(b)) then printf("n=%d\n", n) fi;
od:

n=777451915729368
n=140894092055857794
n=1526223088619171207
n=54545811706258836911039145
n=624965662836733496131286135873807507
n=1667672249427111806462471627630318921648499
n=36465374036664559522628534720215805439659141
n=2424113537313479652351566323080535902276508627
n=123447463532804139472316739803506251988903644272
n=97841697218028095572510076719589816668243339678931971
n=5630139432241886550932967438485653485900841911029964871
n=678285039039320287244063811222441860326049085269592368999
n=312248823968901304612135523777926467950572570270886324722782642817828920779530446911
n=5126378297284476009502432193466392279080801593096986305822277185206388903158084832387
n=1868266384496708840693682923003493054768730136715216748598418855972395912786276854715767
n=726011811269636138610858097839553470902342131901683076550627061487326331082639308139922553824778693815

 

So, we have obtained 16 counterexamples. The question whether there are an infinity of such n's remains open.

 

With this application, the differential equation of forced systems is studied directly. It comes with embedded components and also with native Maple code. Soon I will develop this same application with MapleSim. Only for engineering students.

Damped_Forced_Movement.mw

Lenin AC

Ambassador of Maple

One of the most interesting help page about the use of the Physics package is Physics,Examples. This page received some additions recently. It is also an excellent example of the File -> Export -> LaTeX capabilities under development.

Below you see the sections and subsections of this page. At the bottom, you have links to the updated PhysicsExample.mw worksheet, together with PhysicsExamples.PDF.

The PDF file has 74 pages and is obtained by going File -> Export -> LaTeX (FEL) on this worksheet to get a .tex version of it using an experimental version of Maple under development. The .tex file that results from FEL (used to get the PDF using TexShop on a Mac) has no manual editing. This illustrates new automatic line-breakingequation labels, colours, plots, and the new LaTeX translation of sophisticated mathematical physics notation used in the Physics package (command Latex in the Maplesoft Physics Updates, to be renamed as latex in the upcoming Maple release). 

In brief, this LaTeX project aims at writing entire course lessons or scientific papers directly in the Maple worksheet that combines what-you-see-is-what-you-get editing capabilities with the Maple computational engine to produce mathematical results. And from there get a LaTeX version of the work in two clicks, optionally hiding all the input (View -> Show/Hide -> Input).

PhysicsExamples.mw   PhysicsExamples.pdf

PS: MANY THANKS to all of you who provided so-valuable feedback on the new Latex here in Mapleprimes.

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

If you are interested in experimenting with simple antenna arrays, this worksheet may prove useful.  I have provided a few examples of arrays that repeat in the x, y and z directions, but it will be very easy to tweak this tool if you are more interested in circular or triangular arrays.

This is one of the example arrays:

Antenna_arrays.mw

antenna_arrays.pdf

In two recent questions

dnaviaux  raised concerns about saving informations he could include in a typeset report.

In the first question these informations were mainly printf terminal outputs, while the second question was oriented to informations of type Table (in the sense of DocumentTools:-Layout:-Table).

Acer has given a direct answer to this last question.
On my side I proposed a less direct one based on a LaTeXapproach.


Since several years I use to generate a LaTeX source code for typeset reports directly from Maple (this is not very difficult once you know LaTeX).
These reports often contain data tables Mbut latex(M)is not the good way to code these data tables into LaTeX.
That is why I turned towards the LaTeX/tabularstructure

\begin{tabular}{...}
...
\end{tabular]


Data tables are very simple structures and converting them programmatically from Maple Matrix into  LaTeX tabular is rather simple: the most important thing you must remember is that some characters have a special role in LaTeX  (for instance "\" , "_" and "$") while having a special meaning in Maple too: so beware of conflicts.

The procedure Tabular in the attached file takes as argument a Matrix and returns the LaTeX code of its tabular counterpart.
Note that it could be easily extendend to accept a DataFrameas input.
This is a very simple simple version and fonts (\rm, \bf, \it... or others), styles (\scriptsize, \large, ...) and much more customization features could be accounted for without any difficulty.

For this particular example inspired by dnaviaux first question, it would be probably better to replace the LaTeX code by one of thes two:

\begin{tabular}{|c @{ $\pm$  } c|}
....
Asdfsdg & +5.190e+01 & 2.5950e+00 \\ 

or :

\begin{tabular}{|c|c|}
....
Asdfsdg & \multicolumn{2}{c|}{$+8.680e-01 \pm 0.9190$} \\ 





dnaviaux second question concerned a DocumentTools:-Layout:-Table object.
For what I understood this table has a simple structure (no rowspan neither columnspan used).

But, knowing that tabular can manage merged columns (\multicolumn) and merged rows (\multirow, provided the ad hoc pasckage is used), I wondered if it would be possible to generate the LaTeX/tabular code corresponding to a Table using rowspan and columnspan?

This is done by the procedure Tabular_Table in the attached file.
Here again this is a very simple procedure which doesn't exploit all the informations a Table structure contains (backgroundstylefillcoloralignalignmentseparator [Tabular_Table separates all columns and rows] ...).

The "raw" rendering is not bad but could be improved:

  • adjust the way \multirowcenters the content of a cell (Xis badly placed in example 3)
  • adjust the spaces between line/clineand the text
    • by using the package cellspace 
    • or my modufying \arraystretch with \renewcommand.
  • one could also add a legend with \caption
  • parameterize Tabular_Table to accept other column separators
  • manage the colors (for instance a blue for a math expression and a black for a text)
  • ...

Finally Tabularand Tabular_Tablecould have an optional argument file:

{file::{symbol, string}:= terminal} 

set by default to terminalor wich could be the name of a  .texfile 


This work is still under developpement and I would be happy to exchange with you on this topic.
Happy New Year to all of you

 

Tabular_from_Maple.mw

Here is the content of the .tex file (I used Welcome-to-CoCalc.texto create/compile it)

\documentclass{article}

% set font encoding for PDFLaTeX, XeLaTeX, or LuaTeX
\usepackage{ifxetex,ifluatex}
\if\ifxetex T\else\ifluatex T\else F\fi\fi T%
  \usepackage{fontspec}
\else
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{lmodern}
\fi

\usepackage{hyperref}

% DO NOT FORGET THIS PACKAGE !!!
\usepackage{multirow}

\title{Tabulars from Maple}
\author{mmcdara}


\begin{document}
\maketitle

\begin{itemize}
\item[\bf{Example 1}]

\begin{tabular}{|c|c|c|}
\hline 
\hline 
Quantity & Nominal value & Uncertainty \\ 
\hline 
Asdfsdg & +9.060e+01 & 4.5298e+00 \\ 
\hline 
Bdfg & +1.437e+01 & 7.1870e-01 \\ 
\hline 
C123 & +8.025e+01 & 4.0125e+00 \\ 
\hline 
Ddf sdfg dsfg  & +9.614e+00 & 4.8072e-01 \\ 
\hline 
\hline 
\end{tabular}

\item[]\vspace*{10mm}

\item[\bf{Example 3}]

\begin{tabular}{| c | c | c | c | c |}
\hline 
\multicolumn{1}{|c|}{\multirow{4}{*}{X}} & \multicolumn{2}{c|}{\multirow{1}{*}{A1}} & \multicolumn{1}{c|}{\multirow{2}{*}{A2}} & \multicolumn{1}{c|}{\multirow{1}{*}{A3}} \\ 
\cline{2-2} 
\cline{3-3} 
\cline{5-5} 
 & \multicolumn{1}{c|}{\multirow{2}{*}{B1}} &\multicolumn{1}{c|}{\multirow{1}{*}{B2}} & & \multicolumn{1}{c|}{\multirow{3}{*}{B3}} \\ 
\cline{3-3} 
\cline{4-4} 
 &  & \multicolumn{2}{c|}{${\cos \left( \omega\,t+\phi \right) }^{\mathstrut}_{\atop{}{\mathstrut}}$} &  \\ 
\cline{2-2} 
\cline{3-3} 
\cline{4-4} 
 & \multicolumn{3}{c|}{${{\frac {1}{\Gamma  \left( x \right) }\sqrt {{{\rm e}^{-{\frac {{t}^{2}}{\pi }}}}}}}^{\mathstrut}_{\atop{}{\mathstrut}}$} &  \\ 
\hline 
\end{tabular} 

\end{itemize}

\end{document}


Image of the resulting PDF:

 

For comparison here is the Tableof Example 3 that Mapledisplays in the worksheet

Recently I came back on the general problem of drawing the syntactic graph of a mathematical expression.
Probably some of you have already done this as students for it is a classic when you learn recursive procedures, chained lists or graphs.

I wasn't interested in doing this with Maple, because Maple had already done  a part of the job thanks to the procedure ToInert.
More of this, the package GraphTheory seemed to possess all the required features to obtain quickly this syntactic graph.
Nevertheless it took me a lot of time to fix (almost all) the problems.
The issues are mainly of two orders:

  1. ToInert is very verbose: a necessary feature when you want to have a non ambiguous syntax of an expression, but partly useless for simple visualization.
    Here is an example
    ToInert(f(x))
    _Inert_FUNCTION(_Inert_NAME("f"), _Inert_EXPSEQ(_Inert_NAME("x")))

     

  2. GraphTheory 
    Once the inert form of the expression is known, it is necessary to put it in a form that can be manipulated by the procedures of the GraphTheory package.
    More precisely one needs to transform this inert form into a set of lists [a, b], where a and b are two neighboring vertices of the syntactic graph and [a, b] the directed arc from a to b.
    As the syntactic graph is a tree, this implies using edges {a, b} instead of arcs [a, b].
    The problem is that some operators are commutative while others are not: for the latter this means that the edges and vertices on the syntactic graph must appear in an order that respects the non-commutativity.
    Here his a toy example where I manually buid the syntactic graphs of a/b and b/a: the two graphs are identical and this comes from the fact that edges in Graph( edges )  must be a set, thus an ordered structure whose order doesn't care about non-commutativity.

    restart:
    with(GraphTheory):
    # The first is aimed to represent the expression a/b
    # while the second is aimed to represent the expression b/a
    Gdiv := Graph({{"/", "a"}, {"/", "b"}}):
    g1 := DrawGraph(Gdiv, style=tree, root="/", title=a/b):
    
    Gdiv := Graph({{"/", "b"}, {"/", "a"}}):
    g2 :=DrawGraph(Gdiv, style=tree, root="/", title=b/a):
    
    plots:-display(<g1 | g2>)
    

    Download ab_ba.mw

     

After several attempts, I decided to discard the GraphTheory package, that is to deprive myself of all the interesting features one needs to manipulate a graph.

The result is given on the attached file (... and the content of the worksheet can't be loaded as usual).

Download Syntactic_Graph.mw

Here is an example


Twelve test cases are given, all the corresponding syntactic graphs are correct, but one of them (test case iexpr=1) seems incorrect because the right child of a parent P is located to the right of the left child of a parent P', even though P' is to the right of P.
This could be corrected by modifying the way the posiitons are computed in procedure Place.


PS : It doesn't seem that Maple has a built-in procedure to construct the syntactic graph of a mathematical expression.
But maybe I'm wrong?


 

 

In the two examples below (in the second example, the range for the roots is simply expanded), we see bugs in both examples (Maple 2018.2). I wonder if these errors are fixed in Maple 2020?
 

restart;

solve({log[1/3](2*sin(x)^2-3*cos(2*x)+6)=-2,x>=-7*Pi/2,x<=-2*Pi}, explicit, allsolutions); # Example 1 - strange error message
solve({log[1/3](2*sin(x)^2-3*cos(2*x)+6)=-2,x>=-4*Pi,x<=-2*Pi}, explicit, allsolutions);  # Example 2 - two roots missing

Error, (in assume) contradictory assumptions

 

{x = -(11/3)*Pi}, {x = -(10/3)*Pi}

(1)

plot(log[1/3](2*sin(x)^2-3*cos(2*x)+6)+2, x=-7*Pi/2..-2*Pi);
plot(log[1/3](2*sin(x)^2-3*cos(2*x)+6)+2, x=-4*Pi..-2*Pi);

 

 

Student:-Calculus1:-Roots(log[1/3](2*sin(x)^2-3*cos(2*x)+6)=-2, x=-7*Pi/2..-2*Pi);  # OK
Student:-Calculus1:-Roots(log[1/3](2*sin(x)^2-3*cos(2*x)+6)=-2, x=-4*Pi..-2*Pi);  # OK

[-(10/3)*Pi, -(8/3)*Pi, -(7/3)*Pi]

 

[-(11/3)*Pi, -(10/3)*Pi, -(8/3)*Pi, -(7/3)*Pi]

(2)

 


I am glad that  Student:-Calculus1:-Roots  command successfully handles both examples.

 

Download bugs-in-solve.mw

Spectroscopy is both qualitative and quantitative, so one can use spectral data tables of elements to do some fairly accurate Light Engineering.

Some nifty emulation of the spectral distributions of many non-LED popular lamps, which allows for direct utility calculations based on many different parameters including chromaticity, space type, lifetime, occasion, application, cost and efficiency. 7 such parameters are used with constrained weight optimization to fish out some of the more popular lamp types used in many situations today.

References (inline) the following docs:

The Science of Color, the Emission Spectra of the Elements and Some Lamp Engineering Applications

and

The Double Amici Prism Hand-held Spectroscope

First link main Theory, second link experimental verification.

Usage: Maple 18 main document code with library and data files. Download, unzip and run document for some quick results. Don't move library/data files relative to main doc. For further results and particular details, such as particular spectra & lamps, UN-comment the relevant commands in sections and execute individually after you have executed the entire sheet at least once.

Will be modified some time later to deal with LEDs. Based on elemental spectral data published by NIST. Suggestions 4 Improvements/Errors @ followup, here.

Elements.zip

For sample pics generated with the above code, click on the first reference link. All pictures therein were generated using this code.

--

Cheers,

Yiannis

A customer wondered if it was possible to create 2-line tickmarks on Maple plots like so

 

 

We achieved this using typeset, fractions, and backticks. Worksheet follows.

2line-tickmarks-mprimes.mw

 

Hi,
This post is inspired by a recent question maple least square fit error... where the OP was simulating what appeared to be a stochastic process known as the Drunkard's walk (see for instance The_Drunkard's_Walk).


In the case of the PO, the drunk took a step forward or a step backward (say along a narrow, long corridor) with equal probabilities. In addition one assumes that the step the drunkhard takes is independent of all the steps he did before.
His move is what is called a (1D) Random_walk

This little application based on MAPLETS (ok, I know that some people see them as old-fashioned technology).

It draws a sequence of several drunkard's walks, all of identical number of steps, and interactively plots the current histogram of the arrival point (the point where he is at the end of his walk -which should be the door if the same pub he started from if he is an inveterate drunkhard or if he knows a little about statistics- ).

The code contains 2 procedures :

  • f_step_by_step (n, Discrete=false/true) 
    n : number of steps
    Discrete = false (default value) plot the histogram of the arrivals point as if these points were realizarions of a continuous random variable
    In this simple model these arrivals can take only integer values between -n and +n included; the Discrete=true option is recommended but it takes more walks for it to converge to the asymptotic distribution (see below).

    Once launched, f_step_by_step opens a maplet containing a Plotter and 2 buttons. A first walk is displayed, clic the "Plot" button to draw another and repeat the operation as many times as you want.
     
  • f_automatic (n, m, Discrete=false/true) 
    d and Discrete both have the same meaning than for f_step_by_step.
    m is the number of random walk you want to draw
    The code is set to draw 1000 walks of 1000 steps ; this correspong roughly to 250 Mb of memory used.

    f_automatic contains a call to Threads:-Sleep to delay the display, the argument of Sleep is set to 0.25 second and must be modified within the procedure (its value could be passed to f_automatic as an argument).

    In my opinion it is the more interesting of the two procedures.
     

The values of the current mean and standard deviation are displayed as title.

The purpose is before all educative and can be seen as an illustration of the (one of) Central Limit Theorem(s) (CLT)

A little bit of theory:
Let X[n] the position of the drunkhard after n steps; his position X[n+1] is either X[n]-1 or X[n]+1 with equal probabilities.
The displacement X[n+1]-X[n] is a discrete random variable S with outcomes -1 and +1 and it's easy to find its variance is equal to 1.
The position of the trunkard after n steps is just a realization of the n independant and identically distributed, random variables S1, ...Sn whose distribibution is equal to the one of S.
Thus :

  • Expectation (S1 + ... +Sn)  = 0 
  • Variance (S1 + ... +Sn)  = n 
    For n=1000 steps, the standard deviation of the arrivals is about 31.6)

CLT says that the distribution of S1 + ... +Sn  tends to a Gaussian distribution as n tends to infinity.

What is the exact distribution of the arrivals?
Another way to represent S is to write S = 2*B-1 where B is a Bernoulli random variable with parameter 1/2. The random variable "Arrival" is  twice the sum of N indpendent rabdom variables such like S 
and thus its distribution is 2*Binomial(N, 1/2)-N.

What is the rate of convergence of the histogram to the true probability function?
For a sample of size N drawn from a continuous random variables, its histogram has:

  • a bias error of order 1/K (K being the number of bins)
  • a Linfinity error of order  K*sqrt( log(K) / M )  (M number of drunkhard's walks)
    see for instance Lec2_density.pdf

Using the option Discrete=true corresponds to the choice K=2*N+1, in this case the choice with the highest Linfinity error (the larger K the smaller the bias but the larger the  Linfinity error).
This is the reason I introduced the possibility to graw histograms and bar (column) graphs: for the same value of M the Linfinity error of the histogram (for instance with the default number of bins Maple uses) is nuch slower than the one of the comumn graph.



A few "internal" parameters.
I already spoke about the delay to display txo succesive walks.
Other parameters could be:

  • The value of minbins in the case discrete=false (default)
    This value is fixed to 2*sqrt(M).
     
  • The width in the "view" option of the plot: it's left part displays the drunkhard's walk and it's right one the histogram of the arrivals (after a rotation of -Pi/2). 
    This value si fixed to 5/4*M.
    Note that the histogram is dynamically rescaled in order it's height is always 1/4*number_of_steps.
     
  • The height of the view option is set to -Q..Q where Q is equal to 4 standard deviations of the theoritical distribution of the arrivals.
    The continuous envelope of this distribution is red plotted in red (its height is normalized to M/4, see above). 
    One can show this standard deviation iverifies sqrt(M).
    In my opinion using a full vertical scale (-M..M) doesn't give pretty drunkward's walkes because they seem to more concentrated around the value 0.
     



WATCHOUT
Starting from 0 any walk with an odd number of steps will give an odd arrival and any walk with an even number of steps will give an even arrival. Thus the exact number of outcomes for the arrivals are:

  • 2*n if n is odd
  • 2*n-1 if n is even
     


Other application
This maplet can be used as illustration of the Galton Board (also known as the Bean_machine)


Why using maplets?
Another solution could have been to use animate. But to draw the M drunkard's walks, you would have had to use M frames. An excessive task that I'm not even sure Maple would have been able to handle.
I guess that imbeded components could do the job too, but I'm not as comfortable with them as I am with maplets.

To illustrate what the code does an image of the final result is given below.

Drunkard_walk.mw


One forum had a topic related to such a platform. You can download a video of the movement of this platform from the picture at this link. The manufacturer calls the three-degrees platform, that is, having three degrees of freedom. Three cranks rotate, and the platform is connected to them by connecting rods through ball joints. The movable beam (rocker arm) has torsion springs.  I counted 4 degrees of freedom, because when all three cranks are locked, the platform remains mobile, which is camouflaged by the springs of the rocker arm. Actually, the topic on the forum arose due to problems with the work of this platform. Neither the designers nor those who operate the platform take into account this additional fourth, so-called parasitic degree of freedom. Obviously, if we will to move the rocker with the locked  cranks , the platform will move.
Based on this parasitic movement and a similar platform design, a very simple device is proposed that has one degree of freedom and is, in fact, a spatial linkage mechanism. We remove 3 cranks, keep the connecting rods, convert the rocker arm into a crank and get such movements that will not be worse (will not yield) to the movements of the platform with 6 degrees of freedom. And by changing the length of the crank, the plane of its rotation, etc., we can create simple structures with the required design trajectories of movement and one degree of freedom.
Two examples (two pictures for each example). The crank rotates in the vertical plane (side view and top view)
PLAT_1.mw


and the crank rotates in the horizontal plane (side view and top view).

The program consists of three parts. 1 choice of starting position, 2 calculation of the trajectory, 3 design of the picture.  Similar to the programm  in this topic.

 

 

First 7 8 9 10 11 12 13 Last Page 9 of 68