Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hello;

Hope you are fine. I need to learn how can I call my code in the other file of maple, define new value for A and can get results. For this purpose, I just take an simple example as

questionmaple.mw

restart; A := 5; B := 10; AAA[0] := 10; for i from 0 while i <= A do AAA[i+1] := B*i*AAA[0] end do

5

 

10

 

10

 

0

 

100

 

200

 

300

 

400

 

500

(1)
 

``

Download questionmaple.mw

Is there a generalized compressibility chart in Maple?

Hello guys,

From time to time I use the procedure below to chain functions to the right of the expression to be evaluated.

`&/`:=()->args[-1](args[1],args[2..-2]):

For example:

(sin(x)^2+cos(x)^2)&/simplify                      1

For functions that work with just one argument, it's okay, but with functions that take more than one argument (like convert, subs), I don't know how to implement it.

0.76&/ convert(???,fraction)

(a*x+*x*b)&/simplify&/subs(a=2,b=3,???)

If someone more experienced can help, I'd be very grateful.

Oliveira

Let's say I have a file test.mpl file in the path ~/maple/Packages/MyPackage/test.mpl.

From the code in this file, I wish to save something to a file in the directory at the relative path ./Animations, which has absolute path ~/maple/Packages/MyPackage/Animations.

Now, on my machine, because I know the path to this directory I can easily save using the absolute path. 

What if I send this directory MyPackage (which is essentially a package) to someone else. Maybe they keep it in a different location such as ~/projects/maple-projects/MyPackage.

I would like that this person be able to run test.mpl and it will save the aforementioned something to a file in the relative location ./Animations, which on their machine is the absolute path ~/projects/maple-projects/MyPackage/Animations.

I am stuck on how to accomplish this.

I found out that if I am in a worksheet that is in the directory MyPackage then I can use interface(worksheetdir) to find out the path to the worksheet, so if everything were run from a worksheet contained in the MyPackages directory then I could use a relative path to the Animations directory. 

Problem is, the normal usage of test.mpl is to just create some new worksheet and read the file and use it. But a new worksheet like this is located in the home directory by default.

restart;

A:= Matrix();

A := Matrix(1, 0, {})

(1)

i_choices:= [seq(i,i=0..10,1)];

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

(2)

j_choices:= [seq(j,j=0..10,1)];

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

(3)

for i in i_choices do:
 for j in j_choices do:
   A[i,j] :=i+j;
   print(A[i,j]);
 od:
od;

Error, Matrix index out of range

 

Download test_Matrix.mw

I would ask, why is the value of the global variable changed in procedure?

for example, we first define a global A2 and a proc()
but the value of A2 is changed in proc()?

How to fix this error?

Dill_ABC_Model_PDE_System_Solution.mw

The attached Maple 2019  document attempts to solve a non-linear system of two coupled, time-dependent first-order PDE's, given a list of initial and boundary conditions.  The system models the optical transmittance through a thin photoresist layer whose transmittance changes upon exposure to the incident exposure energy, and hence, the cumulative transmittance through the layer is itself a function of both the exposure time and the distance traveled through the resist layer.  The list of fixed parameters, P, defines the characteristics of a particular photoresist (hereafter "pr") and an assumed exposure irradiance.

My first attempt towards a general solution without initial or boundary conditions (hereafter "ics" & "bcs") apparently "succeeds" (in that no error messages are thrown), however, the form of the solution is quite complicated and difficult (for me at least) to interpret.  I think I understand that the _Cn are undefined constants that require supplying ics & bcs to determine the solutions for the transmitted intensity I(z,t) & the normalized molar fraction of the photo-active component in the pr, M(z,t).  However I do not understand what the symbol _f refers to in the returned solutions.

I make a second attempt to solve the system numerically, supplying a list of the [ics,bcs] as arguments to Pdesolve, however the error message "Error, (in pdsolve/numeric/process_PDEs) PDEs can only contain dependent variables with direct dependence on the independent variables of the problem, got {Iota(0, t), Iota(z, 0), Mu(0, t), Mu(z, 0)}" raises the question of whether I have misunderstood the required syntax in using Pdesolve or that the system as posed is in fact insoluble by Maple.

I would appreciate any insights that readers of this post can contribute, as my experience using Maple and PDesolve in particular must be considered embryonic at best.

Scott Milligan

Is their way to create a Random simple directed graph using random graphs package

RandomDigraph function I dont see an option to restrict it to give only simple graphs

Kind help if any code or way I can do that

One more thing is I dont see any directed special graph in maple

I would like to read data from a google sheet document. I can download a local copy to excel format, but then I'm no longer tied to the origional file.

An example of uniform motion along a generalized coordinate using the Draghilev method. (This post was inspired by school example in one of the forums.)
The equations used in the program are very simple and, I think, do not require any special comments. DM is a procedure that implements the Draghilev method with "partial parameterization".

DM_V.mw

When K = 1, parameterization is carried out by changing the angle of rotation of the wheel. That is, uniform rolling is carried out.

For K = 4, the coordinate corresponding to the position of the slider is parametrized.

 

When K = 6, the slider moves with acceleration, according to a given equation. Hence, we have carried out the parameterization with respect to “time”.



With the help of such techniques, we can obtain the calculation of the kinematics of both lever mechanisms and various types of manipulators.

Let's say I am solving a system of differential equation numerically with dsolve. 

In psolve, I use the option output = Array(...), and I assign the result of the call to a variable p. Given my problem such calls can take a few minutes to run.

Later I use odeplot and pass in this variable p. In this workflow I am doing all this in a single worksheet.

Now, I'd like to run dsolve multiple times and save the results of calls to files so that I can plot them later (what I am actually doing is running some code using the Grid package, and I would like each parallel process to save the plot data).

It would actually be great if I could run this code as a batch file. I am not sure how to do this yet (I read about some command line mode that would be best for this). 

So my questions are

- What is the recommended way to save data to files for loading later on?

- Does the answer the the above question work in command-line mode?

Hi Everyone, 

ich have a question, that is probably rather trivial. I am currently doing some calculations with the differential geometry package. (I know the Physics package was recommended, however, the DG package seems more appropriate for my purposes after having a look through the Physics help page)

My goal is to substitute a functional expression into equations derived in curvilinear (spherical and helical) coordinates. my problem now is that maple won't expand the differentials of the expressions I have substituted. 

I hope the answer isn't too trivial. Although I assume it will be :) 

NULL

restart

with(DifferentialGeometry); with(Tensor); with(Tools); Preferences("ShowFramePrompt", false); with(VectorCalculus); BasisFormat(false)
``

DGsetup([r, theta, phi], M)

DGsetup([r, theta, phi], M)

(1)

Defining the Metric Tensor and Calculating the Connection Coefficients

 

g := evalDG(`&t`(dr, dr)+r^2*sin(phi)^2*`&t`(dtheta, dtheta)+r^2*`&t`(dphi, dphi))

_DG([["tensor", M, [["cov_bas", "cov_bas"], []]], [[[1, 1], 1], [[2, 2], r^2*sin(phi)^2], [[3, 3], r^2]]])

(1.1)

g_inv := InverseMetric(g)

_DG([["tensor", M, [["con_bas", "con_bas"], []]], [[[1, 1], 1], [[2, 2], 1/(r^2*sin(phi)^2)], [[3, 3], 1/r^2]]])

(1.2)

C := Christoffel(g)

DGinfo(C, "ObjectComponents")

[[[1, 2, 2], -r*sin(phi)^2], [[1, 3, 3], -r], [[2, 1, 2], 1/r], [[2, 2, 1], 1/r], [[2, 2, 3], cos(phi)/sin(phi)], [[2, 3, 2], cos(phi)/sin(phi)], [[3, 1, 3], 1/r], [[3, 2, 2], -sin(phi)*cos(phi)], [[3, 3, 1], 1/r]]

(1.3)

Defining the PDF as a Tensor (Metric) Density

 

f := f__1(r, theta, phi)

f__1(r, theta, phi)

(2.1)

rho := MetricDensity(g, -1)

_DG([["tensor", M, [[], [["bas", -1]]]], [[[], 1/(r^4*sin(phi)^2)^(1/2)]]])

(2.2)

Tools:-DGinfo(rho, "TensorDensityType")

Convective Operator

 

CONV := CovariantDerivative(v*f, C)

CONV_1 := simplify(ContractIndices(CONV, [[1, 2]]))

CONV_2 := expand(subs(f__1(r, theta, phi) = f__2(r, theta, phi)*rho, CONV_1))

2*f__2(r, theta, phi)*_DG([["tensor", M, [[], [["bas", -1]]]], [[[], 1/(r^4*sin(phi)^2)^(1/2)]]])*v__r/r+v__phi*(diff(f__2(r, theta, phi), phi))*_DG([["tensor", M, [[], [["bas", -1]]]], [[[], 1/(r^4*sin(phi)^2)^(1/2)]]])+v__phi*f__2(r, theta, phi)*(diff(_DG([["tensor", M, [[], [["bas", -1]]]], [[[], 1/(r^4*sin(phi)^2)^(1/2)]]]), phi))+cos(phi)*f__2(r, theta, phi)*_DG([["tensor", M, [[], [["bas", -1]]]], [[[], 1/(r^4*sin(phi)^2)^(1/2)]]])*v__phi/sin(phi)+(diff(f__2(r, theta, phi), theta))*_DG([["tensor", M, [[], [["bas", -1]]]], [[[], 1/(r^4*sin(phi)^2)^(1/2)]]])*v__theta+v__r*(diff(f__2(r, theta, phi), r))*_DG([["tensor", M, [[], [["bas", -1]]]], [[[], 1/(r^4*sin(phi)^2)^(1/2)]]])+v__r*f__2(r, theta, phi)*(diff(_DG([["tensor", M, [[], [["bas", -1]]]], [[[], 1/(r^4*sin(phi)^2)^(1/2)]]]), r))

(3.1)

NULL

In particular, the last line should simplify quite a bit when expanding derivatives.

Download Tensor_Calc_simplified.mw

I hope the solution is not too obvious...

My expression is

G1*P3 + G1*P5 + G1*P6 + G2*P3 + G2*P6 + G3*P2 + G3*P5 + G4*P2 + G4*P3 + G4*P5 + G4*P6 + G5*P2 + G5*P3 + G5*P5 + G5*P6 + G6*P3 + G6*P6 + G7*P2 + G7*P5 + G8*P2 + G8*P3 + G8*P5 + G8*P6

I want this to become as short (in terms of display characters) as possible. I tried simplify, which gives

(G1 + G2 + G4 + G5 + G6 + G8)*P3 + (G1 + G3 + G4 + G5 + G7 + G8)*P5 + (G1 + G2 + G4 + G5 + G6 + G8)*P6 + P2*(G3 + G4 + G5 + G7 + G8)

How do I get

(G1 + G2 + G4 + G5 + G6 + G8)*(P3+P6) + (G1 + G3 + G4 + G5 + G7 + G8)*P5 + (G3 + G4 + G5 + G7 + G8)*P2

which is shorter and which you can get from directly looking at the expression? The Terms Gi and Pj are just scalar variables as a placeholder. Using collect seems only to work on one variable.

Good day to all,  I have plotted a simple graph for my problem. I am trying to change this view but failed. I am attaching my maple worksheet in which I have plotted a line graph but now trying to draw a graph of that function that looks like the picture which is attached as a reference below.  

worksheet.mw

 

) Write a procedure that generates a plot of a ‘rose’. If the number of petals is even, have your procedure colour in the petals aquamarine, if the number of petals is odd, colour in the petals pink.

Test your procedure by generating two flowers, one with an even number of petals and one with an odd number of petals.

1 2 3 4 5 6 7 Last Page 2 of 1962