MaplePrimes Questions

I wish to process a string of letters into a list of one or more characters which are comma separated at each change of character. The following function will achieve this, but its output is not as list [ ] in the format required.  

Below is a routine to split a character string based on change of character: (ref: https://rosettacode.org/wiki/Split_a_character_string_based_on_change_of_character#Maple)

splitChange := proc (str::string) local start, i, len; start := 1; len := StringTools:-Length(str); for i from 2 to len do if str[i] <> str[start] then printf("%s, ", str[start .. i-1]); start := i end if end do; printf("%s", str[start .. len]) end proc;
splitChange("WPKCPYWYYYXHYY");# 

Here is the output:
W, P, K, C, P, Y, W, YYY, X, H, YY

This print-to screen output is not usable, instead I need the output in list format i.e. ListY:= ["W", "P", "K", "C", "P", "Y", "W", "YYY", "X", "H", "YY"].

Background

 In my model, each of these character strings is a node of a graph, and their adjacencies represent an edges of a graph.  I aim to automatically map strings into a set of directed adjacencies as output; for example:  

AdjSet:= {[W, P], [P, K], [K, C], [C, P], [P, Y], [Y, W], [W,YYY],[YYY, X], [X, H], [H,YY]}.

This set will be the input to a directed graph, e.g: 
M := Digraph(AdjSet); DrawGraph(M);
from which our objective, the adjacency matrix of the nodes can be obtained in MAPLE.  

Help

Can someone please help me by modifying the SplitChange rountine so that it produces output in the form of ListY above? 

Thanks in anticipation of your help

Melvin Brown
 

L := 35; k := .1990625; R := 0.4e-2; r0 := .1;
eq7 := Dmax+deltaH+.5 = 6.76;
eq8 := R*L^2/(4*k)-2*de*deltaH-deltaH^2 = 0;
eq6 := L/(8*((L-1.4*Dmax)^2/(8*Dmax*L)+ln(.7*Dmax/r0)/Pi));
solve({eq6, eq7, eq8}, {Dmax, de, deltaH});
Warning, solutions may have been lost
 

I entered these equations but maple will not solve it. What do I do wrong?

For every (fixed) given integer k = 0,1,2,..., consider the following real valued function of x:

     f(x,k) = exp(x)*HeunC(2*x, 1/2, -1/2, -x^2, k*(k+1) + 1/8, 99/100)

Let xnk denote the n-th positive zero of f(x,k), for n=1,2,3,... Then I am interested to find the asymptotic behaviour of xnk. My hope is that there is an asymptotically linear behaviour of the form

     xnk ~ a + b*n + c*k

with real constants a,b,c.

Note: The last argument "99/100" in the function above is thought to be an approximation for the limit to 1 from below. For instance, I would prefer a value 0.9999999...  

_____________________________________________________

EDIT: The plot below is what I could reach with maple without to get instabilities (l=k)

This result was obtained with:

(Sorry, but I don't know how to insert the true Maple code)

Hi,

In a recent post acer made me discover the joy of Typesetting to customize the outputs (acer, if you read this question: big thanks to you, really funny and powerful!)

I'm interested in using Typesetting for output coloring (for instance) but I would like that these outputs to be left justified.
Up to now I used to use printf to manage the outputs the way I wanted, but I failed combining Typesetting and printf.

Is it possible to exploit the capabilities of Typesetting in printf commands?
Or, at least, is it possible to "left-justify" print outputs programatically?

Thanks for your answers

Hi

Somewhere in the code I've written I've made a mistake: A being a table, I wrote B := eval(A) instead of B := copy(A).
Next A and B were saved in a .m file.

I became aware of my mistake when I read this file in another Maple session.
I modified some entry of B and the corresponding entry of A became modified too.
But this raise the first question: let's say the command B:=eval(A) creates a bon between A and B, why this "bond" is not limited to the current session and by what process is it conserved through  the save/read operations?

To investigate this I wrote this notional piece of code:
 

restart:
A := table([1=x]);
B := eval(A);
FA := "......";   # the name of some file
FB := "......";   # the name of some file
FC := "......";   # the name of some file
save A, B, FC;  # basically what I do in my true code
save A, FA;
save B, FB;

# first attempt
restart;
FC := "......";   # the same name as above
read FC;
B[1] := y;
A[1];
     y


# second attempt
restart;
FA := "......";   # the same name as above
FB := "......";   # the same name as above
read FA;
read FB;
B[1] := y;
A[1];
     x

Why is the "bond" between A and B lost in this second case ?

A-B.mw

How do people test BIBD design in maple?

what are the different when using different field when test design ?

how to design a game that is suitable for the specified field of the design?


I have assumed lambda <-1 yet signum(lambda) returns lambda~.  It should be -1. I need to show that the expression lambda is used in is negative. 

restart

NULL

assume(t > 0, k > 1, lambda = 'real', mu = 'real', mu = 'real', lambda+mu+nu = 1)

about(lambda)

Originally lambda, renamed lambda~:

  Involved in the following expressions with properties
    -real+lambda assumed `property/object`[0]
    lambda+mu+nu assumed `property/object`[1]
  also used in the following assumed objects
  [-real+lambda] assumed 0
  [lambda+mu+nu] assumed 1

 

signum(lambda)

signum(lambda)

(1)

additionally(lambda <= -1)

about(lambda)

Originally lambda, renamed lambda~:

  Involved in the following expressions with properties
    -real+lambda assumed `property/object`[0]
    lambda+mu+nu assumed `property/object`[1]
  is assumed to be: RealRange(-infinity,-1)
  also used in the following assumed objects
  [-real+lambda] assumed 0
  [lambda+mu+nu] assumed 1

 

signum(lambda)

signum(lambda)

(2)

sCDB := (4*(k-1))*(k+1)*`&lambda;`*t^3/((t^2+1)^2*(k^2*t^2+1))

4*(k-1)*(k+1)*lambda*t^3/((t^2+1)^2*(k^2*t^2+1))

(3)

signum(sCDB)

signum(lambda)

(4)

``


 

Download signum_problem.mw

I am trying to add a specific property (radiation length) to the Elements in ScientificConstants.

To do this  I first 

ScientificConstants:-AddProperty(radiationlength); # this seems to work

I then load a table of element name - radiationLength pairs (it is really a bigger table but only these are of interest):

data:=ImportMatrix(cat(libname[1],"/RadiationLengthTable.txt"),source=delimited,\
                       datatype=anything,delimiter="\t"); # works too

(I made the file using downloaded data).

I then want to fill the radiationlength properties for all elements for which I've got the value:

for i from 1 to LinearAlgebra:-RowDimension(data) do
  elemt:=data[i,1]; # the element name as a string
  ScientificConstants:-ModifyElement(cat(elemt),radiationlength=[value=data[i,4],units=g/cm^2]);
end do;

which fails with the error

Error, (in ScientificConstants:-ModifyElement) element ``H `` is not known

H is the first element in the table of radiation lengths so it is getting the right one.

At  issue is that somehow the element name (called descriptor in the Help files) does not seem to get properly evaluated. In fact I tried various ways "by hand", none except just the unevaluated element name (i.e H,He etc. worked).

There must be a way to set these in a loop. Does someone know how?

TIA,

Mac Dude

 

 

help me

into

 

Why I could not unaasign U_hat in my following program?


 

``

restart

II := 1:

qq := 2:

M := 2:

seq(seq(seq(assign(U[i, j, m], h*`#mover(mi("U"),mo("&uminus0;"))`[i, j, m]), i = 0 .. qq), j = 0 .. qq), m = 1 .. 22)

`#mover(mi("U"),mo("&uminus0;"))` := Array(0 .. II, 0 .. JJ, 1 .. M):

Um[1, 1] := Matrix(2, 2, {(1, 1) = 1, (1, 2) = 2, (2, 1) = 3, (2, 2) = 4}); Um[1, 2] := Matrix(2, 2, {(1, 1) = 5, (1, 2) = 6, (2, 1) = 7, (2, 2) = 8})

``

for m to M do `#mover(mi("U"),mo("&uminus0;"))`[0 .. II, 0 .. JJ, m] := ArrayTools:-Alias(Um[1, m], [0 .. II, 0 .. JJ]) end do:

``

for i from 0 to qq do for j from 0 to qq do for m to 22 do `#mover(mi("U"),mo("&uminus0;"))`[i, j, m] := unassign('`#mover(mi("U"),mo("&uminus0;"))`[i, j, m]') end do end do end do

Error, (in unassign/indexed) arguments of type `indexed' must refer to tables or arrays

 

``


 

Download moshkel.mw

Here is a simple little procedure that does not work

et :=proc(x) 

description   "this is a variant of evalf that gets rid of almost 0 nos.(rounding error) and shortens the display to 2 `digits"`;  

if  abs(x) < 10^((-14))  then 0 else  evalf(x,2) end if     end proc;


Error, unable to delimit strings/identifiers


and here is the same procedure that works because I added the # before the description.

et :=proc(x)

# description   "this is a variant of evalf that gets rid of almost 0 nos.(rounding error) and shortens the display to 2 `digits"`;  

if  abs(x) < 10^((-14))  then 0 else  evalf(x,2) end if     end proc;

 

In the help pages they do not say that the description must be hidden by the # sign (nor do they mention that quotes should be used although they are used in the examples.

 

What am I missing?

 

 

 

How can I activate my maple 13?

I have no activatIon left but installed maple

once

My purchase Code is BNN7VMT4BPFN7ESG

Thank. You 

Hi,

Is there any one can tell me how to plot a curve(e.g f(x,1)=2x^2-x-1) by the command spacecurve?

Thanks in advance!

Hello,

Attached is my code where the output of interest is the variable X. What I am trying to do is replace anywhere in this expression that I see "sqrt((nx^2+ny^2+nz^2)c^2) by the variable phi in order to make the expression easier to look at and interpret. This should be a relatively easy thing to accomplish, however I have had problems with doing this. Ive tried using algsubs etc. but nothing seems to work. Could anyone show me how to do this? Is there an easy method that works for doing this for similar problems in the future? I have run across this problem before so I would love to know how to solve it for the future. Thanks in advance.

Also pretty new to maple so thanks for your patience.

 

 

First 651 652 653 654 655 656 657 Last Page 653 of 2308