Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

In this app you can use from the creation of curve, birth of the position vector and finally applied to the displacement and the distance traveled. All this application revolves around the creation of a path and the path of a particle over this generated by vectors. You will only have to insert the vector components and the times to evaluate. Designed for engineering students guided through Maple. In Spanish.

Displacement_and_distance_traveled_with_vectors.mw Updated

Displacement_and_distance_traveled_with_vectors_updated_2020.mw 

Video

https://www.youtube.com/watch?v=jOcKYZ5EEM0

Lenin Araujo C

Ambassador of Maple

Hi

I use some commands like the evalf[10]

But they don't work for the definite double integral in attached file.

It leads to "Error, (in type/algfun) too many levels of recursion"

Please help me to find the answer

Thank You Very Much

Double-Int.mw

 

Hi,

is there a way to control the way axes tickmark numbers are formated, especially number of decimal places? I have 3 consecutive plot comands with the same options for similar functions in the same x range (and similar y range) and the thickmarks on each plot have differently formated numbers on axes:

1)

2)

3)

 

in each case I'm calling:

plot(func..., opt2d, labels = [x, U...])

the opt2d are:

fntsz2 := 14;
opt2d := (x = 90 .. 160, size = [500, 200], font = ["Arial", fntsz2], labelfont = ["Arial", fntsz2], labeldirections = [horizontal, vertical]);

I'd like to get all the plots formatted like in the 3rd case: x axis: ticks starting at min (90), numbers rounded to integers; y axis: "0" before decimal point, 2 decimal places.

 

regards

Wojtek

Assume I had a 2D line

how to put and draw this line into a new geometric world defined by patch?

 Can anyone help me with this problem. I am trying to solve it and its given me an error message "Error, (in dsolve/numeric/bvp) cannot determine a suitable initial profile, please specify an approximate initial solution".


 

restart

with(ODETools):

with(student):

dsolve[interactive]()

with(plots)

with(plottools)

inf := 5

unprotect('gamma')

NULL

equ1 := diff(f(eta), `$`(eta, 3))-(3/4)*f(eta)*(diff(f(eta), `$`(eta, 2)))+(1/2)*(diff(f(eta), eta))^2-theta(eta)-N*gamma(eta) = 0:

equ2 := diff(theta(eta), `$`(eta, 2))-(3/4)*f(eta)*(diff(theta(eta), eta)) = 0:

equ3 := diff(gamma(eta), `$`(eta, 2))-(3/4)*L__e*P__r*f(eta)*(diff(gamma(eta), eta)) = 0:

Bcs := f(0) = 0, (D(f))(0) = 0, theta(0) = 1, (D(f))(inf) = 0, theta(inf) = 0, gamma(0) = 1, gamma(inf) = 0

f(0) = 0, (D(f))(0) = 0, theta(0) = 1, (D(f))(5) = 0, theta(5) = 0, gamma(0) = 1, gamma(5) = 0

(1)

Parameter := [P__r = .72, N = 1, L__e = 1]:

S1 := dsolve({Bcs, subs(Parameter, equ1), subs(Parameter, equ2), subs(Parameter, equ3)}, {f(eta), gamma(eta), theta(eta)}, type = numeric)

Error, (in dsolve/numeric/bvp) cannot determine a suitable initial profile, please specify an approximate initial solution

 

``


 

Download Numerical.mw

 Looking forward to your favorable response.

Kind regard

I have just installed jEdit. Have written 2 files.Started with "open in mode  maple". So text gets nicely coloured. Can save the files ok as .mpl. I have several questions
1) How do I make the code indent/format?

2)How should I test the code? Can jEdit show me errors? I am running jEdit and maple side by side. Save, Read, hit bug...

3)How do I format an imported .mpl from maple?

4)How do I get $include to work?

Testr1:=proc(a,b)
description "Jedit test";
local A,B;
A:=a;B:=b;
if is(A<B) then print ('smaller')
elif is(A>B) then print('bigger')
else print('cant_say')
end if;
return cos(A+B), sin(A-B),A,B;
end proc;
TestjEdit:=module()
option pagkage;
export Testr1;
$include "Testr1.mpl"
end module;
#imported file
Antisym := proc (V::{Matrix(3,3,shape = antisymmetric,algebraic), Vector(3)})
local M; description "converts vector to antisymmetric matrix and back"; if 
type(V,Vector) then M := Matrix(3,3,shape = antisymmetric); M[1,2] := -V[3]; M
[1,3] := V[2]; M[2,3] := -V[1] else M := Vector(3,[-V[2,3], V[1,3], -V[1,2]])
end if; M end proc;

restart

currentdir()

"C:\Users\Ronan\Documents\MAPLE\Rational_Trigonometry"

(1)

read "C:\\Users\\Ronan\\Documents\\jEdit\\Testr1.mpl"

proc (a, b) local A, B; description "Jedit test"; A := a; B := b; if is(A < B) then print('smaller') elif is(B < A) then print('bigger') else print('cant_say') end if; return cos(A+B), sin(A-B), A, B end proc

(2)

"print("'Testr1'")"

(3)

Testr1(2, 4)

cos(6), -sin(2), 2, 4

(4)

Testr1(x, 5)

cos(x+5), sin(-5+x), x, 5

(5)

Testr1(x, x+1)

cos(2*x+1), -sin(1), x, x+1

(6)

restart

read "C:\\Users\\Ronan\\Documents\\jEdit\\TestjEdit.mpl"

$include "Testr1.mpl";
^

Error, while reading ``C:\Users\Ronan\Documents\jEdit\TestjEdit.mpl``

 

TestjEdit:-Testr1(2, 1)

Error, `TestjEdit` does not evaluate to a module

 

``


 

Download Jedit_testing.mw
 

restart

currentdir()

"C:\Users\Ronan\Documents\MAPLE\Rational_Trigonometry"

(1)

read "C:\\Users\\Ronan\\Documents\\jEdit\\Testr1.mpl"

proc (a, b) local A, B; description "Jedit test"; A := a; B := b; if is(A < B) then print('smaller') elif is(B < A) then print('bigger') else print('cant_say') end if; return cos(A+B), sin(A-B), A, B end proc

(2)

"print("'Testr1'")"

(3)

Testr1(2, 4)

cos(6), -sin(2), 2, 4

(4)

Testr1(x, 5)

cos(x+5), sin(-5+x), x, 5

(5)

Testr1(x, x+1)

cos(2*x+1), -sin(1), x, x+1

(6)

restart

read "C:\\Users\\Ronan\\Documents\\jEdit\\TestjEdit.mpl"

$include "Testr1.mpl";
^

Error, while reading ``C:\Users\Ronan\Documents\jEdit\TestjEdit.mpl``

 

TestjEdit:-Testr1(2, 1)

Error, `TestjEdit` does not evaluate to a module

 

``


 

Download Jedit_testing.mw

 

I wonder what the built-in algorithm is used in "fsolve". From some references, it seems to be Newton iteration. 
But fsolve succeeds to quickly find a root of multiplicity more than 1, which can't be achieved by Newton iteration. So I wonder whether there are other techniques involved? Thank you!

The expression is:

sqrt(Dp)*(-Dp*sqrt(s+thetac)*alpha1*pinf*s^2-2*Dp*sqrt(s+thetac)*alpha1*pinf*s*thetac-Dp*sqrt(s+thetac)*alpha1*pinf*thetac^2+A2*Dp*sqrt(s+thetac)*alpha1*s+A2*Dp*sqrt(s+thetac)*alpha1*thetac+Dc*sqrt(s+thetac)*alpha1*pinf*s^2+Dc*sqrt(s+thetac)*alpha1*pinf*s*thetac+A1*Dc*alpha1*s^2+A1*Dc*alpha1*s*thetac+A1*sqrt(Dc)*sqrt(s+thetac)*s^2+A1*sqrt(Dc)*sqrt(s+thetac)*s*thetac-A2*Dc*sqrt(s+thetac)*alpha1*s)*exp((-lh+x)*sqrt(s)/sqrt(Dp))/((s+thetac)^(3/2)*s*(Dc*s-Dp*s-Dp*thetac)*(-sqrt(Dp)*alpha1+sqrt(s)))

Is there a way to solve these equations x+y = 373320 and z = (x+y) / 0.44 - y -  y* (1 - 0.99) for x,y,z in Maple or excel?

Even if we set y = 37320 - x 

and plug that in we get z= 37320/0.44 - (37320-x) - (37320 - x) * (1-0.99) there are still two unknown z and x

Maybe some optimization?  Thanx for any input

Here in this video you can observe the correct insertion of vectors; Making use of the keyboard, ascii code and tool palette of our Maple program. As our worksheet is very large, I made the explanation in two parts; I recommend that you observe this first part of performing any execution on your Maple worksheet. You can contrast your results with the apps also made in this software. In Spanish.

Shortcut_in_Vectors_for_Engineering.mw

Movie # 01

https://www.youtube.com/watch?v=EJtAli54q_A

Movie # 02

https://www.youtube.com/watch?v=m-JUmhkbWI8

Lenin Araujo Castillo

Ambassador of Maple

Dear all, 

I am using a custom wrapper to access the subroutines defined in a fortran DLL. The fortran code is pretty basic: it takes three arguments, a, b, mult. Being a subroutine. it returns the result in 'mult'.

Currently, I can get the result from fortran DLL in my wrapper code. I am not able to get it back in Maple. 

My fortran code is as under: 

      subroutine multiply(a1,b1, mult1) bind (C, name="multiply")

        use iso_c_binding
        implicit none

        real (c_double), intent(in), VALUE :: a1
        real (c_double), intent(in), VALUE :: b1
        real (c_double), intent(out) :: mult1

        mult1 = a1*b1

        return
      end subroutine multiply

I tried using this subroutine from a regular C file and it works, so this code works the way it should. 

Now the custom wrapper that I use (obtained by editing the auto-generated wrapper)

/* MWRAP_multiply Wrapper
   Generated automatically by Maple 2015.0.
   Do not edit this file. */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mplshlib.h>

#include <maplec.h>

typedef void *MaplePointer;
static MKernelVector mapleKernelVec;
static ALGEB *args;

/* main - MWRAP_multiply */
//ALGEB M_DECL MWRAP_multiply( MKernelVector kv,
//	void (M_DECL *fn) ( FLOAT64 a1, FLOAT64 a2, FLOAT64 a3 ),
//	ALGEB fn_args )

ALGEB mmultiply(MKernelVector kv, ALGEB fn_args)

{
    FLOAT64 a1;
    FLOAT64 a2;
    FLOAT64 a3;

    int i;
    mapleKernelVec = kv;
    args = (ALGEB*) fn_args;

    if( MapleNumArgs(mapleKernelVec,(ALGEB)args) != 3 )
        MapleRaiseError(mapleKernelVec,"Incorrect number of arguments");

     /* float[8] */
    a1 = MapleToFloat64(mapleKernelVec,args[1]);

    /* float[8] */
    a2 = MapleToFloat64(mapleKernelVec,args[2]);

    /* float[8] */
    a3 = MapleToFloat64(mapleKernelVec,args[3]);

    //(*fn)(a1, a2, a3);
    multiply(a1, a2, &a3);

    MaplePrintf(kv, "Output from multiply %f", a3);

    return( ToMapleNULL(mapleKernelVec) );
}

Since the fortran subroutine calls are call by reference, we need to pass the address of a3, (&a3). Then I compile this to create the DLL using: 

gcc -shared -fPIC -o libmmultiply.so mult.f90 mwrap_multiply.c -I /opt/maple2015/extern/include/ -L /opt/maple2015/bin.X86_64_LINUX/ -lmaplec -lgfortran

And then copying the resulting DLL (libmmultiply.so) to the Maple/bin folder. 

Then in Maple : 

mult := define_external("mmultiply",MAPLE,LIB="libmmultiply.so");

mult1 := 0.01;

mult(2., 3., mult1);
### Printed in Maple: Output from multiply 6.000000

mult1;
### Still 0.01 (we want this to be 6.0)

So, it can be seen that the fortran subroutine is successfully executed, so we get 6.0 as the output. However, this does'nt get assigned to 'mult1. The reason for this, I feel, is that the reference to the original variable 'mult1' in Maple is lost in the wrapper, and so the resulting value doesn't update 'mult1'. 

How can I get the resulting value back in Maple ? I want to get this in 'mult1', as most fortran legacy codes use the subroutine method of returning results by updating the arguments. 

Thanks 

Chintan Pathak 

I have gotten an expression:

eq21 := collect(eq20, [exp(-sqrt(s)*x/sqrt(Dp)), exp(sqrt(s)*(-lh+x)/sqrt(Dp)), exp((-2*lh+x)*sqrt(s)/sqrt(Dp)), exp((lh-x)*sqrt(s+thetac)/sqrt(Dc))], simplify);

q(x, s) = exp(-sqrt(s)*x/sqrt(Dp))*_F1(s)+sqrt(Dp)*(-Dp*sqrt(s+thetac)*alpha1*pinf*s^2-2*Dp*sqrt(s+thetac)*alpha1*pinf*s*thetac-Dp*sqrt(s+thetac)*alpha1*pinf*thetac^2+A2*Dp*sqrt(s+thetac)*alpha1*s+A2*Dp*sqrt(s+thetac)*alpha1*thetac+Dc*sqrt(s+thetac)*alpha1*pinf*s^2+Dc*sqrt(s+thetac)*alpha1*pinf*s*thetac+A1*Dc*alpha1*s^2+A1*Dc*alpha1*s*thetac+A1*sqrt(Dc)*sqrt(s+thetac)*s^2+A1*sqrt(Dc)*sqrt(s+thetac)*s*thetac-A2*Dc*sqrt(s+thetac)*alpha1*s)*exp(sqrt(s)*(-lh+x)/sqrt(Dp))/((s+thetac)^(3/2)*(-sqrt(Dp)*alpha1+sqrt(s))*s*(Dc*s-Dp*s-Dp*thetac))+(sqrt(Dp)*alpha1+sqrt(s))*_F1(s)*exp((-2*lh+x)*sqrt(s)/sqrt(Dp))/(-sqrt(Dp)*alpha1+sqrt(s))+Dc*A1*exp((lh-x)*sqrt(s+thetac)/sqrt(Dc))/((Dc*s-Dp*s-Dp*thetac)*sqrt(s+thetac))-(-pinf*s-pinf*thetac+A2)/((s+thetac)*s)

I need to further simplify the coefficient of

exp(sqrt(s)*(-lh+x)/sqrt(Dp))

Would you like to give some tips?

Thanks.

 

Can any one correct my code in module for it to work. The procedure is just add 2 and return.My_Module_Mistake.mw
 

restartaction1:-Mproc(2)

Error, `action1` does not evaluate to a module

 

action1:-Mproc(2)

Error, `action1` does not evaluate to a module

 

with(MathematicalFunctions);
action1:=module ()
        export Mproc,y;
                Mproc:= proc (n)
                        y:=n+2;                
                end proc;
end module()


 

Download My_Module_Mistake.mw

 

On 5/July/2017, Kitonum responded to the 3/July/2017 MaplePrimes question "How to perform double integration over subdomain" by providing code for a procedure IntOverDomain that implements Green's theorem applied to a planar region whose boundary is a simple, closed, rectifiable, oriented curve (SCROC by some authors).

I was intrigued. First, this is a significant extension of existing Maple functionalities. Second, the implementation admits boundaries defined piecewise with sections defined parametrically; or sections that are polygonal lines defined by a list of nodes.

But how was the line integral around such boundaries coded? In the worksheet "IntOverDomain_Deconstructed," I summarize the existing Maple functionality for implementing iterated double integrals over specified domains, then analyze how Kitonum coded Green's theorem as an extension of Maple's capabilities. After recognizing the great coding skills of Kitonum, I conclude with a short wishlist of related extensions that I would like to see added to Maple in the future.

 

Download the worksheet: IntOverDomain_Deconstructed.mw

Hi , you all

I have another question of the day. As I get deeper in my math I find these little things popping up that I don't understand what they mean or provide for the answer

 =

Now that gamma in the denominator is what concerns me.  I haven't found any reference to this use for gamma, So , I come here to find the answer.

Thanks Bill

First 917 918 919 920 921 922 923 Last Page 919 of 2214