MaplePrimes Questions

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

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

 

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

I am importing an excel worksheet xlsx file in to a datafile. Though the formatting in excel is perfect with 3 decimals, the data table stores many values in 14 decimals. How do I convert? What is the command? Can any one help me.

I enclose the doc and excel file for reference and use. I tried in many ways, but failed to convert.MP1_Data.xlsxDoubt_NumberFormat_in_DataTable.mw
 

NULL

 

``

27.90

(1)

BTE := evalf(2.3)*Import("E:/A_PhD2017/MP1_Data.xlsx", "Brake_Thermal_Efficiency")

``

``


 

Download Doubt_NumberFormat_in_DataTable.mw

 

 =  =

In the above output I  am geting trig functions. This is taking the derivative of f(x).  I would like to keep the answer in rational output

ie.

Hey!

 

I have the following Diff. EQ. which I wish to solve:

 

EQ:=(3*x)*(diff(y(t),t,t)+y(t)=0

 

Where y(t) = sum(c[n]*x^n,n=0..infinity)

 

The result should be the following c[n+1] = -c[n]/(3*(n+1))

 

How would I solve this in Maple? Is there any package which can do this? Thank you! 

how to calculate potential energy in terms of gauss curvature?

In this expression,

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

 

I want to simplify the coeffcients of

exp((lh-x)*sqrt(s+thetac)/sqrt(Dc)), exp(sqrt(s)*(-lh+x)/sqrt(Dp)), exp((-2*lh+x)*sqrt(s)/sqrt(Dp)), exp(-sqrt(s)*x/sqrt(Dp)).

 

 

 

I have a big matrix 1000*1000, How Maple could declare the number (corresponding row and coulumn) of element that is maximum?

Suppose the element (113,987) of my matrix has the maximum value, which command returns (113,987)?

 

Dear Colleagues,

I think I can certainly take your help. I am trying to run a for-loop; a dummy code is provided below.

for i from 1 to 10 do

Sol_set[i] := solve(f(x, a)=0, x)

end do:

In some iterations at times I get an error message "division by zero". In that case, the program stops abruptly without completing the task for the remaining iterations.

Can I record the solution for any iteration, say j, that gives me an error message as Sol_set[j] := 0 and run the loop for i=j+1 to 10?

Likewise, I need to complete the loop for all iterations with stopping in between. Wherever there is an error, record some arbitrary solution that I can handle offline.

I would appreciate any help in this regard. Thank you all in advance.

Regards,

Omkar

Hi there,

The command

           dsolve(MyOde, numeric, range=MyRange, method=rosenbrock, output=piecewise)

returns a list of solution pieces which is not sufficiently dense according to how I intend to use it.


Is there a possibility to impose the "number of pieces" or the positions of the "breaks" in this command ?

Thanks in advance for any suggestion.

 

how to find back a patch in maple from Pi+GaussCurvature*Area(triangle) = Pi

restart:
with(LinearAlgebra):
EFG := proc(X)
local Xu, Xv, E, F, G;
Xu := <diff(X[1],u), diff(X[2],u), diff(X[3],u)>;
Xv := <diff(X[1],v), diff(X[2],v), diff(X[3],v)>;
E := DotProduct(Xu, Xu, conjugate=false);
F := DotProduct(Xu, Xv, conjugate=false);
G := DotProduct(Xv, Xv, conjugate=false);
simplify([E,F,G]);
end proc;

UN := proc(X)
local Xu,Xv,Z,s;
Xu := <diff(X[1],u), diff(X[2],u), diff(X[3],u)>;
Xv := <diff(X[1],v), diff(X[2],v), diff(X[3],v)>;
Z := CrossProduct(Xu,Xv);
s := VectorNorm(Z, Euclidean, conjugate=false);
simplify(<Z[1]/s|Z[2]/s|Z[3]/s>,sqrt,trig,symbolic);
end:

lmn := proc(X)
local Xu,Xv,Xuu,Xuv,Xvv,U,l,m,n;
Xu := <diff(X[1],u), diff(X[2],u), diff(X[3],u)>;
Xv := <diff(X[1],v), diff(X[2],v), diff(X[3],v)>;
Xuu := <diff(Xu[1],u), diff(Xu[2],u), diff(Xu[3],u)>;
Xuv := <diff(Xu[1],v), diff(Xu[2],v), diff(Xu[3],v)>;
Xvv := <diff(Xv[1],v), diff(Xv[2],v), diff(Xv[3],v)>;
U := UN(X);
l := DotProduct(U, Xuu, conjugate=false);
m := DotProduct(U, Xuv, conjugate=false);
n := DotProduct(U, Xvv, conjugate=false);
simplify([l,m,n],sqrt,trig,symbolic);
end proc:

GK := proc(X)
local E,F,G,l,m,n,S,T;
S := EFG(X);
T := lmn(X);
E := S[1];
F := S[2];
G := S[3];
l := T[1];
m := T[2];
n := T[3];
simplify((l*n-m^2)/(E*G-F^2),sqrt,trig,symbolic);
end proc:

sph := <f(u,v)|g(u,v)|h(u,v)>;
cur := GK(sph);
X := sph;
Xu := <diff(X[1],u), diff(X[2],u), diff(X[3],u)>;
Xv := <diff(X[1],v), diff(X[2],v), diff(X[3],v)>;
Z := CrossProduct(Xu,Xv);
AreaTriangle := int(int(Z[1]^2+Z[2]^2+Z[3]^2,v=-Pi/2..Pi/2),u=0..2*Pi);
dsolve(Pi+cur*AreaTriangle = Pi, [f(u,v),g(u,v),h(u,v)]);
 

I have a package of routines meant to help Danish highschool students use Maple. I would like to use MapleCloud to distribute this but have run into a major stumbling block:

While Maple is perfectly happy to use non-latin letters such as the Scandinavian letters æ, ø and å it seems that MapleCloud can't handle that. Specifically, strings containing such letters is displayed in garbled form (the non-latin letters are shows as squares), and symbolic names containing such characters seems not to be recognized. The latter problem in particular makes MapleCloud quite useless to me.

I have attached a simple workbook demonstrating the problems to this message.

First 946 947 948 949 950 951 952 Last Page 948 of 2433