Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

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)).

 

 

 

A new code based on higher derivative method has been implemented in Maple. A sample code is given below and explained. Because of the symbolic nature of Maple, this method works very well for a wide range of BVP problems.

The code solves BVPs written in the first order form dy/dx = f (Maple’s dsolve numeric converts general BVPs to this form and solves).

The code can handle unknown parameters in the model if sufficient boundary conditions are provided.

This code has been tested from Maple 8 to Maple 2017. For Digits:=15 or less, this code works in all of the Maple versions tested.

Most problems can be solved with Digits:=15 with atol = 1e-10 or so. This code can be used to get a tolerance value of 1e-20 or any high precision as needed by changing the number of Digits accordingly. This may be needed if the original variables are not properly sacled. With arbitrarily high Digits, the code fails in Maple 18 or later version, etc because Maple does not support SparseDirect Solver at high precision in some of the versions (hopefuly this bug can be removed in the future versions).

For simple problems, Maple’s dsolve/numeric is superior to the code developed as it is implemented in hardware floats. For large scale problems and stiff problems, the method developed is much more superior to Maple and comparable to (and often times better than) state of the art codes for BVPs - bvp4c (MATLAB), COLSYS,TWPBVP, etc.

The code, as written, cannot be used for problems with a singularity at end points (doable in the future). In addition, mixed boundary conditions are not supported in this version of the code (for example, y1(1)=y2(0)). Future updates will include the application of this approach for DAE-BVPs, currently not supported by Maple’s dsolve/numeric command.

A paper has been submitted to JCAM. I welcome feedback on the code and solicit input from Mapleprimes members if they are able to test (and break this code) for any BVP.

 

PDF of the paper submitted, example maple code and the solver as a text file needed are uploaded here. Additional examples are hosted on my website at http://depts.washington.edu/maple/HDM.html


 

 

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

Troesch's problem
This is an inherently unstable, difficult, nonlinear, two-point BVP formulated by Weibel and Troesch that describes the confinement of a place column by radiation pressure. Increasing epsilon increases the stiffness of the ODE.
1. E.S. Weibel, On the confinement of a plasma by magnetostatic fields, Phys. Fluids. 2 (1959) 52-56.
2. B. Troesch, A simple approach to a sensitive two-point boundary value problem, J. Comput. Phys. 21 (1976) 279-290.

Introduction
The package HDM solves boundary value problems (BVPs) using higher derivative methods (HDM) in Maple®. We explain how to solve BVPs using this package. HDM can numerically solve BVPs of ordinary differential equations (ODEs) of the form shown is the fowllowing example.

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

 

 

Reset the program to clear the memory from previous execution command.

restart:

 

Read the txt file which contains the HDM solver for BVPs.

read("HDM.txt");

 

Declare the precision for the entire Maple® sheet.

Digits:=15;

Digits := 15

(1)

 

Enter the first-order ODEs into EqODEs list.

EqODEs:=[diff(y1(x),x)=y2(x),diff(y2(x),x)=epsilon*sinh(epsilon*y1(x))];

EqODEs := [diff(y1(x), x) = y2(x), diff(y2(x), x) = epsilon*sinh(epsilon*y1(x))]

(2)

 

Define the left boundary condition (bc1), and the right boundary condition (bc2). One should collect all the terms in one side.

bc1:=evalf([y1(x)]);

bc1 := [y1(x)]

(3)

bc2:=evalf([y1(x)-1]);

bc2 := [y1(x)-1.]

(4)

 

Define the range (bc1 to bc2) of this BVP.

Range:=[0.,1.];

Range := [0., 1.]

(5)

 

List any known parameters in the list.

pars:=[epsilon=2];

pars := [epsilon = 2]

(6)

 

List any unknown parameters in the list. When there is no unknown parameter, use [ ].

unknownpars:=[];

unknownpars := []

(7)

 

Define the initial derivative in nder (default is 5 for 10th order) and the number of the nodes in nele (default is 10 and distributed evenly across the range provided by the user). The code adapts to increase the order. For many problems, 10th order method with 10 elements are sufficient.

nder:=5;nele:=10;

nder := 5

nele := 10

(8)

 

Define the absolute and relative tolerance for the local error. The error calculation is done based on the norm of both the 9th and 10th order simulation results.

atol:=1e-6;rtol:=atol/100;

atol := 0.1e-5

rtol := 0.100000000000000e-7

(9)

 

Call HDMadapt procedure, input all the information entered above and save the solution in sol. HDMadapt procedure does not need the initial guess for the mesh.

sol:= HDMadapt(EqODEs,bc1,bc2,pars,unknownpars,nder,nele,Range,atol,rtol):

 

Present some details of the solution.

sol[4]; # final derivative

5

(10)

sol[5]; # Maximum local RMSE

0.604570329905172e-8

(11)

 

Store the dimension of the solution (after adjusting the mesh) to NN.

NN:=nops(sol[3])+1;

NN := 11

(12)

 

Plot the interested variable (the ath ODE variable will be sol[1][i+NN*(a-1)] )

node:=nops(EqODEs);
odevars:=select(type,map(op,map(lhs,EqODEs)),'function');

node := 2

odevars := [y1(x), y2(x)]

(13)

xx:=Vector(NN):

xx[1]:=Range[1]:

for i from 1 to nops(sol[3]) do xx[i+1]:=xx[i]+sol[3][i]: od:

for j from 1 to node do
  plot([seq([xx[i],rhs(sol[1][i+NN*(j-1)])],i=1..NN)],axes=boxed,labels=[x,odevars[j]],style=point);
end do;

 

 


 

Download Example_3_Troesch.mws

 

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.

The worksheet below shows a river whose velocity is a function of the distance from its mid point to either bank.

In this worksheet, as an example, a boat of fixed speed crosses the river heading at all times towards its destination which is directly across the river from its starting point. The boat's path is animated.

I presume an experienced boat captain could constantly vary his heading so as to cross in a minimum time.

Can a function for this minimum crossing time heading be found and the worksheet altered to show the minimum time path?

  Rivercrossing.mw

 

my problem is how to put the third order IVP in derivate code for solving third order problems

the problem is y'''+2y"-9y'-18y=18x^2-18x+22

 

Digits := 18;
with(LinearAlgebra);
f := proc (n) -----;

derivative

g := proc (n)----- ;

please i need to know to to reresent it in the f := proc (n) and g := proc (n) where g := proc (n) is the derivative of f(x).

please any help 

Yesterday when I wanted to log in to MapleCloud my login information was no longer recognized. I got this message:

The account type or email address or password is incorrect.

When I tried to login to my Maple account I landed on a page saying, that there were some problems.

This morning I tried again to no avail; then asked to have my password reset, made a new password and tested that I could log in to my Maplesoft Membership and to Maple Primes - both worked fine. I also seemed to be able to log in to MapleCloud - I could see my private files; but when I wanted to upload a new version af an existing workbook I was asked to log in again. I closed Maple down, restarted the program and tried to log in to MapleCloud once more - this time it didn't work. I can still log in to my Maplesoft Membership and to MaplePrimes.

Hi everybody,

 

I want to plot many curves in the form of a table.

For instance, let    p := plot(x, x=0..1, labels=[x*Unit('m'), y*Unit('m')]):

The command   plots:-display(p)  returns a plot  with labels x [[m]] and y [[m]], just as expected.

But the commands (remember I have several plots)
                             plots:-display(<p>);                              # and the generalization plots:-display(<p | p>)
                             DocumentTools:-Tabulate([p]);           # and the generalizationDocumentTools:-Tabulate([p,p])
both provide labels  x Units:-Unit('m') and  y Units:-Unit('m')

Is there a way to fix this and obtain plots withe the expected labels ?

Thank to all of you for yout help

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