Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

gam := 1.4;
p[L] := 1;
u[L] := 0;
rho[L] := 1;
p[R] := 1;
u[R] := 1;
rho[R] := 1;
p1 = 1/2*(p[L]+p[R]);
A[L] := 2/((gam+1)*rho[L]);
A[R] := 2/((gam+1)*rho[R]);
B[L] := (gam-1)*p[L]/(gam+1);
B[R] := (gam-1)*p[R]/(gam+1);
a[L] := (gam*p[L]/rho[L])^(1/2);
a[R] := (gam*p[R]/rho[R])^(1/2);
if p1 > p[L] then
     f[L] := (p1-p[L])*(A[L]/(p1+B[L]))^(1/2);
     df[L] := (A[L]/(p1+B[L...

Hello,

These days I thought a question:how to creat a variable delay?

As illustrated in Fig.1, if delay time T is constant, then the output is y(t)=u(t-T), so we can use a block named "Pade Delay" in maplesim to achieve our purpose.As shown in Fig.3.

If delay time is variable,namely,T(t), then the output is y(t...

Hi All,

 

I'm new here and to Maple and this is my first post.

 

How do I get maple to evalaute the following expression:

 

sum(exp(-1/2*(((psi-theta) + 2*pi*n) / (sigma))^2), n=1..infinity);

 

psi and theta are angles, sigma is a constant - basically psi, theta and sigma are numbers. In fact the summation is where n is a member of Z (set of integers) but I will be happy with a solution for n= 1..infinity.

Solving the system

 a1 := 2*x2-x3-x4-x5-x6-x7;
 a2 := -2*x1+2*x3-x4-x5-x6-x7;
 a3 := x1-2*x2+2*x4-x5-x6-x7;
 a4 := x1+x2-2*x3+2*x5-x6-x7;
 a5 := x1+x2+x3-2*x4+2*x6-x7;
 a6 := x1+x2+x3+x4-2*x5+2*x7;
 a7 := x1+x2+x3+x4+x5-2*x6; b := x1+x2+x3+x4+x5+x6+x7;
 solve({x1 >= 0, x2 >= 0, x3 >= 0, x4 >= 0, x5 >= 0, x6 >= 0, x7 >= 0,
 b = 1, a1 <= 0, a2 <= 0, a3 <= 0, a4 <= 0, a5 <= 0, a6 <= 0, a7 <= 0},...

Though I have been a casual Maple user since M12, I really don't know how to use it well, and am just learning it. I set myself a few tasks to help me discover its potential. I find that I learn better if I have some goal, even if it is just a sample goal.

In the accompanying file, I want to see how to use M14, and explore how to use Legendre polynomials.

Q: In (3.4), is there a cleaner way to declare the sequence?

Q: Am I using sequences correctly in this file?

I am trying to duplicate the material that is shown in the accompanying PDF file, where the plot actually comes from the calculations, much as I am trying to do with Maple 14.

Q: (3.9) gets the correct coefs, but not very pretty...is there a better way?

Q: I eventually stumbled upon (3.10), which looks correct, but when I dragged it to the plot and dropped it, I got only the first Legendre polynomial, not n of them. How do I get that?

Q: How do I show that I dropped L on the plot? The legend shows Curve 1 and 2.

Q: Is there a way to combine (3.8) and (3.9) into one stem, for example, by using array subscripts? I tried and failed.

Legendre_polynomial_.mw

Legendre_polynomial_.pdf

how can I find the average of numberrs in a list. For example, I want to find the average of [4,6,8]. Thanks!

Hi:

I have a number of functions all enclosed inside the Sum functionin the  following form:

Test:=Sum(f1(n)+f2(n)),n=1..infinity);

Each of the functions f1, etc are fairly complicated, and there are more than two, but this example will do.

How do I get Maple to expand Test into the form:

Test:=Sum(f1(n),n=1..infinity) + Sum(f2(n),n=1..infinity);

I've tried every combination of expand, simplify, combine collect, that I can think of - nothing works.

Hey folks and (almost) Merry Christmas!

 

How do I check if a number is a permutation of another number (doesn't have to be a cyclic one though)

 

E.g...

 

Let x = 123456789

 

How would I test to see that, for example, 847591236 is a permutation of x without generating every permutation of x?

I feel there should be an obvious command for this but I can't seem to find any...

 

I've had a few request to provide some more information on External Calling, so I thought I would make a few posts about it. This first post will be a high level description of External Calling and how it works, with examples coming later. As External Calling is an advanced topic, I am going to assume you know how to compile a shared library and are generally familiar with the C language. Although this first post won't require any real programming knowledge.

What is External Calling?

External Calling is the name for Maple's ability to connect to and call functions from other programming languages. Maple uses this for various reasons. We have written our own libraries in C, C++ and Java to solve particular problems. We partner with various labs around the world who have developed code, often in languages like C or C++, so external calling is used to interface with their code. We also connect to high performance libraries like NAG and BLAS to provide those high performance routines in Maple. Of course, you can use External Calling to connect Maple to your code as well.

Although Maple can call various programming languages, the most common languages we connect to are C and C++, and those are the languages I am going to focus on.

How does it work?

In Maple, you call ?define_external or use the ?ExternalCalling package. Both these methods take a description of the function that you want to call and returns a Maple procedure. Normally you would assign the procedure to a name and then call the externally defined function just like any other Maple procedure.

There are a couple different ways to use define_external to connect to a shared library, the differences are mostly concerned with how the parameters given in Maple are converted to parameters used in the external function.

  • Wrapperless external calling. With wrapperless external calling, Maple calls a function implemented in the shared library by automatically converting the values given in Maple into valid types for the external function.
  • Generated wrappers: With generated wrappers, Maple automatically generates a small C library that handles conversions from Maple values to the values used in the external function. Using generated wrappers allows Maple to handle more data types, like call back procedures.
  • Custom wrappers: A custom wrapper is a C function that you write yourself. This function accepts arguments as Maple data structures and returns a Maple data structure. You are responsible for converting the Maple data structures into whatever forms you need and converting your computed value back into a Maple data structure. Maple provides the External Calling API to assist in working with Maple from the externally defined function.

The first two forms of external calling are the easiest to do, however they are also the most limited. Internally we exclusively (I think) use the third, custom wrapper, form of external calling. That is the form I am going to talk about.

Custom Wrapper

The name "custom wrapper" is a bit of a misnomer. The function that you write does not need to "wrap" anything, it can implement anything you want. As long as you can convert the result into a Maple data structure, you can pass it back into Maple. In fact Maple also supports returning generic data, via the ?MaplePointer routines, but that is a more complex topic for a later blog post.

Your external function is simply a C function with the following calling convention:

ALGEB CustomWrapper( MKernelVector kv, ALGEB args )

ALGEB is the C data type that represents a Maple data structure. The MKernelVector is a data structure that acts as an intermediary between your external calling routines and the Maple engine. You will need to pass this structure back into the External Calling API functions. Both of these types, plus the External Calling API functions are defined in a header, maplec.h, that needs to be included in your code. I will provide more details when I provide examples.

The External Calling API

The External Calling API is a set of functions that we make available for working with the Maple Engine from external code. Maple also allows third party applications to load the Maple engine as a shared library, we call this ?OpenMaple. The External Calling functions are also available in OpenMaple, so you will often see OpenMaple used in the Maple help pages. Most functions can be used in both OpenMaple and External Calling, except for a few that are OpenMaple specific and involve starting and stopping the Maple Engine.

Maple's help system documents all the External Calling functions so you can see what is available. There is an overview of the external calling functions on this page, ?ExternalCalling,C,API. Briefly, however there are functions for converting Maple types to C and back, creating and interacting with Maple data structures (list, set, rtable, table, string, etc), creating and interacting with Maple language elements (names, procedures, etc), printing to the Maple interface, memory allocation, evaluating Maple statements and raising exceptions. There is even a C interface to the Task Programming Model.

Next Time...

In my next post I will provide some examples of using the External Calling API to actually do stuff in an externally defined procedure.  However, I am going to spend some time trying to figure out the easiest way for you to get the tools you'll need to be able to develop externally defined functions yourself, so my next post might take a bit of time.

Darin

Hello,

it's my first utilisation of MAPLE, and I want to determine the max of a function y(x). I have this differentiel equation with 2 variables :

a*diff(y(x),x,x) + b*(diff(y(x),x)-diff(z(x),x)) + c*diff(y(x),x) + d*y(x) + e*(y(x)-z(x))= 0;

I resolve it whith the function "dsolve", and now and I want to calculat the max of the function y(x).

can any body help me ??!!!

thanks

 

The original function is 6x^2+5x-4/2x^2-7x-4. The equation of the line which is tangent to the curve at the point (0,1) is -12/35x - 1/35. Is this correct? I used the command Tangent(f(x),x=-3). The equation of the line which is normal to the curve at the point (-3,1). is 35/12 + 39/4 . Is this correct?

g(theta) := array([[cos(theta), -sin(theta)],[sin(theta), cos(theta)]]);
dg := map(diff, g(theta), theta);
invg := inverse(g(theta));
w := multiply(invg, dg);
w := map(simplify, w);

crossprod(-w, w); <- have error?

How to cross product between matrix?

As i know wedge product is cross product, so i use cross product

I am trying to plot a function and its horizontal and vertical asyptotes into one graph. I have been trying but unable to get the results I need. I am getting too many Maple errors. What is the correct way to do this? The function is : 6x^2+5x-4/2x^2-7x-4. The asymptotes are y=3,x=-1/2,x=4.asymptote_and_functi.mw

Hi,

I would like to plot three dimention using plot3d,

How to make label using plot3d. If i assume the label is [a,b,d] how to insert in plot label

could you please help me with provide Example.

when i type in the command plot3d(sin(x*y),x=-Pi..Pi,y=-x..x) maple keeps returning error. why is that so?

First 1740 1741 1742 1743 1744 1745 1746 Last Page 1742 of 2224