Items tagged with procedures procedures Tagged Items Feed

Hi everyone

I am currently trying to make my own simple package including a few procedures. So far I have been able to write some "code" that actually works when I open the document and hit "enter". I would, however, like to save the package so it can be accessed during any Maple session using the command "with". I have unsuccesfully tried to comprehend the Maple help pages regarding this question but I definitely don't want to mess things up.

This is what I have written:

mat := module ()
description "useful procedures for mathematics, physics and chemistry";
export AtomicWeight;
option package;

   AtomicWeight := proc (x) description "returns the average atomic mass of the naturally ocurring element";
   Units:-AddSystem(NewSystem, Units:-GetSystem(SI), u);
   return evalf(ScientificConstants:-Element(x, atomicweight, system = NewSystem, units))
   end proc

end module;

What should I do to save it correctly?

Thank in advance,
Mads


 

 

 

 

It would be nice if Maple had a procedure which could turn a procedurelist into a listprocedure.
I use these words in the sense they are used in dsolve/numeric.
Thus by a procedurelist I mean a procedure returning lists (of numbers).
By a listprocedure I mean a list of procedures all having the same formal parameters and each returning one number.
Thus a `convert/listprocedure`should accept a procedurelist p as input and give as output the corresponding listprocedure [p1,p2, ... pN] where N is the number of elements in the output from p.

I tried making a `convert/listprocedure` myself and in doing so found that it was not totally trivial.
I had lots of problems but did end up with something that seems to work.

convert-listprocedur.mw

But my main point is that Maple ought to have some such facility either as described available to the user or by changing fsolve, complexplot or what have you, so that procedurelists are accepted.

Hi everyone,

I am a new user of maple and i want to know the procedures to follow when solving 4 differential equations simultaneously.

e.g

ds/dt=Λ0-βcSI/N-μS

dL/dt=Λ1+βcSI/N-μ1L+ΑcIT/N

dI/dt=kL-μ2I

dT/dt=r1L+r2I-ΑcIT/N-μT

Any help will be highly appreciated. Regards

Good day,

Proc_-_Mapleprime.mw

I was wondering what goes wrong with the procedure I wrote.
I inserted a short example, otherwise I didn't know how to explain it.

When looking at the Maple sheet:
It concerns determining the eigenfrequency and then specify a factor to that eigenfrequency.
The first plot is the 'critical range expressed in FREQUENCIES'. I plotted this using a procedure.
Now in the second plot I converted the first plot, which is expressed in FREQUENCIES, to a certain critcal range in LENGTH.

Now my point is that I would like to view the reductiefactorvoetgangers(lengte) when I type in for example lengte:=22; but it gives an error. I don't understand why it does that.

In case of the first plot (expressed in FREQUENCIES), i can just simply fill in eigenfrequentiesysteem:=1.7 and then it gives me an answer for reductiefactorvoetgangerseigenfrequentie(eigenfrequentiesysteem) which is equal to 1 (which is correct).

So if anyone can tell me what I do wrong, I would appreciate.
Thank you

Greetings,
Frank 

Good afternoon Sir.

 

I request you to help me out in writing Maple procedures to execute, Numerical methods such as

  1. Bisection ethod
  2. False position method
  3. Fixed point iteration
  4. Newto-Raphson method
  5. Generalized Newton's method
  6. Mullers method
  7. Graffe's method.

 

With thanks & regards

 

M.Anand

I would like to Maple develop mathematical exercises as do Bagatrix and Algebrator packages as examples. What think you?. The primary and secondary students learn better if they observe the procedure for each year of calculus. I'm sure Maple care enough about the issue and expect changes in future versions.

Hi

I want to simulate taking a card from to decks at the same time, and by doing it sufficiently many times, show that the probability is 1-(1/e).

I've implemented this in Python, but i'm new to maple. Here is what I've done so far.

 

randomDeck:=proc(n::integer)

  local deck:= [seq(1..52)];
local randomDeck:=[];

Simple Maple procedure definition is like this:

f := proc (x, y) sin(x+y)-exp(x)*y end proc:

How can I use indexed parameter declarations, say:

f := proc (x[1], y[2]) sin(x[1]+y[2])-exp(x[1])*y[2] end proc:

where x and y are arrays of unknowns. It seems that this does not work in Maple 13.

Originally, I want to solve a set of n nonlinear equations with n unknowns W[n] using fsolve(), and the output is a set of equations, say:

Hi there, i want to write a procedure which can initiat the sexond procedure accodingly. For example, f1(a,b,c,d,e,f) where a,b,c,d,e,f is set of different atoms. say, Here I only need to deal with a and d type atoms to calculate energy values through f2 procedure.    

f1:=proc(a,b,c,d,e,f)   
.....
.....
end proc;

How i can write a procedure to assign values, like f1(yes,no,no,yes,no,no) or with number as f1(1,0,0,1,0,0) to show i only need a and d results. 

Hi all,

I have a problem with 'Rank' when trying to find the rank of a matrix.

For some purpose, I have to load both with(LinearAlgebra) and with(Statistics) packages.

Without using Statistics[Tally], (not loading the Statistics package), the Rank works fine.

With the Statistics package, Rank sometimes gives an error, saying,


Error, (in Statistics:-Rank) expected 1-dimensional Array, but .....

I now fix this by using LinearAlgebra[Rank].

I am attempting to write a procedure for the numerical integration methods of the composite trapezoidal rule and Simpson's 1/3 rule, however the results that are being produced when I try to test the procedure are differing to the computed integral using the int command.

Here is my attempt so far:

 

> f:= x -> cos(x)*exp(-x/4):


> CompTrap:= proc(f,a,b,n)
local i, aa, h;
h:= (b-a)/n;
aa:= f(a)+f(b);

for i from 1 to n by 1 do

Hello

This is actually somewhat the same question I asked some months ago. I found a way to go around it, but now unfortunately I'm back to the same problem, and I didn't have any answers when I asked.

Here it is a system that I solve numerically:

##############################################

eq1 := diff(W(r), r) = -(1-beta*(W(r)-W0))*(M(r)+4*Pi*r^3*p(r))/(beta*r*(r-2*M(r)));

eq2 := diff(M(r), r) = 4*Pi*r^2*rho(r);

W0 := solve(thetaR = theta0-W0, W0);

Hi,

 

I have two separate procedures, one which solves a series of ODE's using the midpoint runge-kutta method, and one which solves using the Taylor expansion.

I am able to graph the two results (Q1 vs time) on separate graphs within the procedure, however after "end proc" I can't retrieve the figure or plot the two seperate results on the same graph to compare the values.

Is there an easy way of doing this or do I have to rewrite the procedure to include both methods?

I have constructed 2 procedures:

f(n) and h(n) which i build inside a double sum but when trying to calculate it says to many levels of recursion.

but when doing a simple example it works.

so the question is basically: why cant one put functions defined by proc within a sum??

Hello,

 

I would like to do the following procedure from a basic concept, but I can't figure out what I'm doing wrong (sorry for that, I'm a beginner). I have tried to look up some more information about procedures on the Help menu with no success. Here you have what I'm planning to do:

Considering the following function (which approximates the cosine function):

aprcos:=(x,n)->add((-1)^i*(x^(2*i)/(2*i)!),i=0..n)


I would like...

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