## Energy methods with Maple

Maple 2015

Developed and then implemented with open code components. It is very important to note this post is held for students of civil engineering and mechanics. Using advanced mathematical concepts to concepts in engineering.

Metodos_Energeticos_full.mw

(in spanish)

Atte.

L.Araujo.C

## Problem on the solution of a linear ODE with a fre...

Int(piecewise(t < T1, exp((1/2)*t*(1+2*I-I*sqrt(3))), t < T2, -1000*exp((1/2)*t*(1+2*I-I*sqrt(3)))*(-1/1000+T1-t), T2 <= t, -1000*exp((1/2)*t*(1+2*I-I*sqrt(3)))*(-1/1000-T2+T1)), t)

Suppose I have a file, test.txt, which the content is

2
2 0.0 0.0 0.0
1 0.0 0.0 1.6

I would like to save

Z:=2;

C[1,1]:=2;C[2,1]:=0.0;C[3,1]:=0.0;C[4,1]:=0.0;

C[1,2]:=1;C[2,2]:=0.0;C[3,2]:=0.0;C[4,2]:=1.6;

However, if I use readdata("...",4), seems it do not work.

Is there any flexible command in maple can readfile with different column? Thank you very much!

## Issue with testeq?...

Consider the equation

eqn1:=5^(2*abs(y-1)+2) = (1/15625)*625^abs(y-1);

and note that

eval( eqn1, y=-3);
eval( eqn1, y=5);

both return valid solutions. So why does

testeq(eqn1);

throw a numeric exception.

Given the manual description of testeq(), I would expect it to return either true or FAIL - but not a numeric exceprion!!!!

Any ideas?

## Program includes other file...

Hi,

Suppose I have a file, 1.mw, which includes a subroutine

aver:=proc(a,b)

local res;
res:=(a+b)/2;

return res;

end proc:

Now I am writing another file, 2.mw. I would like to load the subroutine, aver, in 1.mw. How shall I write in 2.mw to use that subroutine in 1.mw?

Thank you very much

## Why does Maple calculate so slowly?...

PS,
PiFast43 is freely available at,

http://numbers.computation.free.fr/Constants/PiProgram/pifast.html

## Particular Solution...

Dear's, I am facing some problem to find the particular solution please find the attachment.

Help-1.mw

PhD (Scholar)
Department of Mathematics

## colorbar for a 3D plot in Maple 2015.1

by: Maple 2015

The question of colorbars for plots comes up now and then.

One particular theme involves creating an associated 2D plot as the colorbar, using the data within the given 3D plot. But the issue arises of how to easily display the pair together. I'll mention that Maple 2015.1 (the point-release update) provides quite a simple way to accomplish the display of a 3D plot and an associated 2D colorbar side-by-side.

I'm just going to use the example of the latest Question on this topic. There are two parts to here. The first part involves creating a suitable colorbar as a 2D plot, based on the data in the given 3D plot. The second part involves displaying both together.

Here's the 3D plot used for motivating example, for which in this initial experiment I'll apply shading by using the z-value for hue shading. There are a few ways to do that, and a more complete treatment of the first part below would be to detect the shading scheme and compute the colorbar appropriately.

Some of the code below requires update release Maple 2015.1 in order to work. The colors look much better in the actual Maple Standard GUI than they do in this mapleprimes post (rendered by MapleNet).

```f := 1.7+1.3*r^2-7.9*r^4+16*r^6:

P := plot3d([r, theta, f],
r=0..1, theta=0..2*Pi, coords=cylindrical,
color=[f,1,1,colortype=HSV]):

P;```

Now for the first part. I'll construct two variants, one for a vertical colorbar and one for a horizontal colorbar.

I'll use the minimal and maximal z-values in the data of 3D plot P. This is one of several aspects that needs to be handled according to what's actually inside the 3D plot's data structure.

```zmin,zmax := [min,max](op([1,1],P)[..,..,3])[]:

verthuebar := plots:-densityplot(z, dummy=0..1, z=zmin..zmax, grid=[2,49],
size=[90,260], colorstyle=HUE,
style=surface, axes=frame, labels=[``,``],
axis[1]=[tickmarks=[]]):

horizhuebar := plots:-densityplot(z, z=zmin..zmax, dummy=0..1, grid=[49,2],
size=[300,90], colorstyle=HUE,
style=surface, axes=frame, labels=[``,``],
axis[2]=[tickmarks=[]]):
```

Now we can approach the second part, to display the 3D plot and its colorbar together.

An idea which is quite old is to use a GUI Table for this. Before Maple 2015 that could be done by calling plots:-display on an Array containing the plots. But that involves manual interation to fix it up to look nice: the Table occupies the full width of the worksheet's window and must be resized with the mouse cursor, the relative widths of the columns are not right and must be manually adjusted, the Table borders are all visible and (if unwanted) must be hidden using context-menu changes on the Table, etc. And also the rendering of 2D plots in the display of the generated _PLOTARRAY doesn't respect the size option if applied when creating 2D plots.

I initially thought that I'd have to use several of the commands for programmatic content generation (new in Maple 2015) to build the GUI Table. But in the point-release Maple 2015.1 the size option on 2D plots is respected when using the DocumentTools:-Tabulate command (also new to Maple 2015). So the insertion and display is now possible with that single command.

```DocumentTools:-Tabulate([P,verthuebar],
exterior=none, interior=none,
weights=[100,25], widthmode=pixels, width=420);```

```DocumentTools:-Tabulate([[P],[horizhuebar]],
exterior=none, interior=none);
```

We may also with to restrict the view, vertically, and have the colorbar match the shades that are displayed.

```DocumentTools:-Tabulate([plots:-display(P,view=2..5),
plots:-display(verthuebar,view=2..5)],
exterior=none, interior=none,
weights=[100,25], widthmode=pixels, width=420);
```

```DocumentTools:-Tabulate([[plots:-display(P,view=2..5)],
[plots:-display(horizhuebar,view=[2..5,default])]],
exterior=none, interior=none);
```

I'd like to wrap both parts into either one or two procedures, and hopefully I'd find time to do that and post here as a followup comment.

Apart from considerations such as handling various kinds of 3D plot data (GRID vs MESH, etc, in the data structure) there are also the matters of detecting a view (VIEW) if specified when creating the 3D plot, handling custom shading schemes, and so on. And then there's the matter of what to do when multiple 3D surfaces (plots) have been merged together.

It's also possible that the construction of the 2D plot colorbar is the only part which requires decent programming as a procedure with special options. The Tabulate command already offers options to specify the placement, column weighting, Table borders, etc. Perhaps it's not necessary to roll both parts into a single command.

3dhuecolorbarA.mw

acer

## Temperamental Maple...

Hi all.

I am using Maple2015.

I typed in as input y=x/sqrt(1-x^2).

I hit enter.  The output is:

I know the 2 answers are equivalent.

My question is why did Maple swap 1-x^2 to -x^2+1???

Any advice to swap it back would be greatly appreciated.

## Maple 2015.1

by: Maple 2015

I wanted to let everyone know that there is a Maple 2015 update available. Maple 2015.1 provides:

• Support for high-resolution monitors (e.g. 4K, UHD)
• Updated translations for Brazilian Portuguese, French, Japanese, and Simplified Chinese
• Enhancements to the Explore command
• Improvements to the DataSets package
• Updates to the Microsoft Excel plug-in
• Enhancements to unit handling
• A variety of improvements to the math engine, interface, and documentation

To get this update, you can use Tools>Check for Updates from within Maple, or visit Maple 2015.1 Downloads.

If you are a MapleSim 2015 user, you already have this update, as it was part of the MapleSim 2015 installation.

Kim

## Issue using matrix sparse storage...

Consider the following code, which just generates two "identical" matrices, differing only in their requested storage type, and then does some simple manipulations.

restart;
#
# Define matrix using sparse storage
#
testM:= Matrix( 40,40,
(i,j)->`if`(j>=i,1,0),fill=0,
storage=sparse
):
#
# Define identical(?) matrix with rectangular storage
#
nm:= Matrix( 40,40,
testM,
storage=rectangular
):
#
# Define procedure to return some matrix properties
#
matData:= proc( myMat::Matrix)
return op(3, myMat)[2], # check storage type
myMat[5, 1..-1], # get 5-th row
end proc:
#
# Get properies of the two matrices - should be identical
# but check result of adding elements in the 5-th row
#
matData(testM);
matData(nm);

The matData procedure ought to produce the same results for the two matrices, with the exception of the storrage type. But the 'add()' command does not. The 'myMat[5, 1..-1]' command produces the same vector, the 5-th row - but stick an add() wrapper around it and all hell breaks loose.

Is this a bug or am I missing something?

Suggestions such as avoiding sparse data storage are not really acceptable: the above is a much simplified version of my original problem where I was using graph theory to play with a "cost function" and (with G a graph) the command,

WeightMatrix(MinimalSpanningTree(G))

returned a sparse-storage matrix - and I didn't notice. There appears to be no option on the WeightMatrix() command to control the storage tyoe of the returned matrix. Result was that all subsequent code based on slicing/dicing/and particularly 'add()ing' sub-blocks of this weight matrix fell apart

Don't get me wrong: I can sort of accept that the weight matrix of minimal spanning tree would (hopefully) be mainly zeros so sparse-storage might be a good default option but I don't see why the results of a command such as

should vary depending on the internal storage used for the matrix, particularly when I have no control over the storage type being adopted

## Degree of a Polynomial...

can I extract a certain non numeric degree from an expression?

for example, I want to get degree "n-1" from "x^(n-1)+y".

any thoughts?

## Operations with polynomials with Maple.

Maple 2015

Here we have a very brief introduction to the use of embedded components, but effective for the study of the polynomials in operations and some products made with maple 2015 to strengthen and raise the mathematics today.

Operaciones_con_Polinomios.mw

(in spanish)

Atte.

L.AraujoC.

 First 67 68 69 70 71 72 Page 69 of 72
﻿