Items tagged with assign assign Tagged Items Feed

Dear Maple users

I have done some experiments with the new Workbook feature in Maple 2016. It is a very welcome addition, indeed. Earlier I have created Maple files in which data from an external Excel file was imported and being used for certain calculations. In order to make recalculations work properly, one need to let the Excel file follow the Maple file. That's where a Workbook come in handy! I tried placing those two files in a Workbook. It didn't work completely as advertised, I think. I moved the Workbook to another location on the harddrive to make sure it wouldn't interfere with the original files outside the Workbook. Then I recalculated the Maple document inside the Workbook. The good thing: The data from the Excel file was still present. The bad thing: If I changed some data in the Excel file inside the Workbook, it didn't register in the Maple file when updating it!

Maybe I should explain that I did import data from the Excel file into Maple via the menu: Tools > Assistants > Import Data... The data was retrieved as a matrix within the Maple file and assigned to a variable and used for plots ...

Why doesn't the above procedure work properly? I hope one don't need to use the Workbook URI to reference files within the workbook. It is not that userfriendly!

 

Regards,

Erik

Using Maple 2016, I created a new Document with one line:

A=(1,2,3)

Right-clicking on this expression I thought I could choose Assign to a Name, as is done in Clickable Calculus Series - Part 3: Multivariate Calculus, found here:

https://www.youtube.com/watch?v=GYN-GetHRFA

However, Assign to a Name does not appear in the context menu.

On the other hand, if I write

B=1,2,3

(with no parentheses) and right-click on this expression then Assign to a Name does appear in the context menu.

Any insights on this?

Thanks. 

Dear All

I have simple problem related to ploting of 2-D graph

What I need is listed as below:

1. How I can re-scale axes by 1/2.

2. How to give custom gap between graph and its title.

3. How to place two legends in vertical format in opposite to horizontal.

4. How to assigne custom gap between legends and graph

5. How to place label 'q[b]' on the right side of vertical axes.


f[1] := 0.6553e-2+0.61277e-1*cos(.9976156575*x)-0.3448e-2*cos(1.995231315*x)+0.164e-3*cos(2.992846972*x)

0.6553e-2+0.61277e-1*cos(.9976156575*x)-0.3448e-2*cos(1.995231315*x)+0.164e-3*cos(2.992846972*x)

(1)

f[2] := 0.6601e-2+0.61212e-1*cos(.9878156204*x)-0.3834e-2*cos(1.975631241*x)+0.182e-3*cos(2.963446861*x)

0.6601e-2+0.61212e-1*cos(.9878156204*x)-0.3834e-2*cos(1.975631241*x)+0.182e-3*cos(2.963446861*x)

(2)

plot([diff(f[1], x), diff(f[2], x)], x = -3.2 .. 3.2, color = ["Red", "Green"], linestyle = [solid, dash], legend = ["undistorted ( n=0.0, q=0.0)", "undistorted"], labels = [tau*``, q[b]*`\` `], labeldirections = [HORIZONTAL, VERTICAL], size = [500, "golden"], title = "Radial velocity curve of Polytropic Model of Index N=3", titlefont = ["ROMAN", 15], legendstyle = [font = ["HELVETICA", 9], location = bottom]);

Download My_Plot_in_2D.mw

 

Regards

Hey,


I want to assign a value to a symbol stored in a vector. I know the position of the symbol in the vector. Is there an easy way to do this?

Here to illsutrate my problem:

restart:

vec:=<a,b,c>:

vec(1):=1;    # expected result: a:=1

vec := Vector(3, {(1) = 1, (2) = b, (3) = c})

(1)

a;            # expected result: 1

a

(2)

 

 

Download point_to_element.mw

 

 

I got a set of ecuations to solve, like this one:

eq[1]:=W[1,0]*(a*HRa[1,0]+b*ga[1,0]+c)=d*SR[1,1]

a,b,c,d are numbers, like 2.0458 and so on.

 

When I want to solve the set, I need to tell Maple the command solve:

solve( {seq(eq[i],i=1..N)},{variables});  (N is an integer of course)

 

To set the variables, one must check each equation to write: {W[1,0],HRa[1,0],ga[1,0]...} and so on.

I know that I can use the command is(variable,assignable) to check if a variable has not a value assigned already and, according to true/false I can construct the set {variables} and solve the set of equations.

That´s an easy solution if I need to check variables under a certain pattern, like: X[1].X[2],X[3] since I can create a loop and check them one after the other. But my problem is that I have different names for variables or that variables change to assignable from assigned according to other conditions, so I can never be sure if W[1,0] is going to be a variable to compute in all steps instead of SR[1,1].

for example:

if a>3 then
SR[1,1]:=1/2;
else
W[1,0]:=300:
end if;

So, when I need to type solve, the {variables} part is different according to each case. Is there any command that allow me to insert an expression and Maple can return me the variables or parameters in the expression that are not numeric already?


Thanks in advance.

I want to compute some matrix multiplications and i need this expression to be 1 always, i.e,

x^2+y^2+z^2+w^2=1

for every calculation I do.

I have tried x^2+y^2+z^2+w^2:=1 and assign(x^2+y^2+z^2+w^2,1) but it doesn't work.

What I should type to make it work?

 

Thank you

 

 

Suppose I have a table of variables

 

f[1]:=a;

f[2]:=b;

 

numelems(f); gives 2.

 

In case I have not assign f, 

unassign(f);
numelems(f); gives error message.

 

Is there any simple way let maple detect that if it is unassined, numelems(f), can provide zero?

 

Thank you very much

 

Dear Maple users

I am unsure how to handle events and their probabilities in Maple. Let's say I know that an event A has the probability say 0.3 and another event B has probability 0.8. I would like to make the following assignments:

P(A):=0.3:

P(B):=0.8

and maybe defining the conditional probability:

P(A|B):=0.55

but I am not allowed to do so in Maple because if will regarded as a function definition. My purpose is to make simple calculations with those probabilities for example:

P(C):=P(A)*P(B)  etc.

My problem is therefore more of a notational problem than a mathematical one. I hope someone can advice me on a proper setup. I am using 2D math notation, by the way. I could of course name the variables containing the probability using simple names like X1, X2, etc., but then I need constantly to remember what they really mean. The above assignments would be much better, because they are easier to handle mentally.

Regards,Erik

Here is my code

ma[1] := [-885.880598855072776, [bh = 0., g0h = 0., g1h = 0.825946224722250e-4]]

ma[2] := [-877.957885609114328, [bh = 347.116836805625, g0h = 0., g1h = 0.164861392564e-3]]

ma[3] := [-863.445203144006655, [bh = 0., g0h = 0., g1h = 0.787090377403668e-4]]

avb := 90.5276611129000; avg0 := 0; avg1 := 0.92225359e-4;

for j from 1 to 3 do

assign(ma[j][2]);

A[j] := [(avb-bh)^2, (avg0-g0h)^2, (avg1-g1h)^2] 

end do;

 

Result is that

A[1] := [4763.19965962732, 0., 1.13103562500664*10^(-10)]

Error, invalid left hand side in assignment

 it only shows A[1], but no A[2] and A[3]

Please help!

But I have not found how to do it.

I'd like to tell a new worksheet to use assignments created in another document. This is to save time retyping equations.

And, is this something that others like to do ?

 

Thanks.

Cheers !

I am trying separation of variables in Maple. I get an equation that has the form   

And now I want to tell Maple to assign the terms with 1/R in them to one variable, say eq21, and the term with 1/Z to second variable, say eq22 The idea is that I can later more easily work with each separate ode. 

I do not know to separate those apart. I could offcourse copy and paste by hand, but I want to automate this.

I tried match() and patmatch() but I am not seeing the way. Here is the code:

restart;
T:=  (r,z)-> Z(z)*R(r);
eq1:= diff(T(r,z),r$2)+1/r*diff(T(r,z),r)+diff(T(r,z),z$2);
eq2:=expand(eq1/(Z(z)*R(r)));

#need now way to break the above into 2 different variables.

ps. I know I can do this:

restart;
T:=  (r,z)-> Z(z)*R(r);
eq1:= diff(T(r,z),r$2)+1/r*diff(T(r,z),r)+diff(T(r,z),z$2);
eq2:=expand(eq1/(Z(z)*R(r)));
eq3:=collect(eq2,1/R(r));
eq21:=op(1,eq3);
eq22:=op(2,eq3);

But this for me is not the right way to do it. I think there should be more algebraic way.

 

Hello People in Mapleprimes,

 

I have a question about the codes in the help page of assign.

Please tell me about this.

The folliowing codes were written there:

code (A)

assign(a,c):

assign(a=d,b=2):

a,b,c;

 

The output of these was 

d,2,d

 

I think that assign(a,c) means assign(a=c) or a:=c, not c:=a.

If what I wrote was true, the output of the above code should be

d,2,c.

And, if I changed assign(a,c) to assign(c,a), the output was d,2,d, which is the output written on the helppage 

of the assign. On the other hand, the output of code A was surely d,2,d.

Why does assign(a,c) have the same meaning as assign(c,a)?

 

Best wishes

 

taro

I have the following situation:

HB:=Bend(L,a,n);

Bend is a proc, that returns a Record with info based on its parameters. I would like to get access to the name I assign to (i.e. HB) in the proc. Any chance?

Mac Dude

PS: I can of course kludge things by adding an argument to the proc Bend. But I'd like to avoid that.

I have written a program and at one point I have an assignment statement like BG(i, j) :=1    When ever I run the program, I get a dialog box which asks me to choose between "function definition" and "remember table assignment."  Is there a way to tell the program that I want this to be a table assignment in the code so that I don't always have to answer the question?

Today I have a problem with assign that never arised before. I solved a system of equations with two solutions and wanted to assign, e.g. the second one. Does anybody know why "assign" here does not work, even though I often used it before in the same way. (I also tried it with the array-solution, but I received the same problem.

Output:

 

  {rH = 0., rL = 0., xH = 0.2289428485, xL = 0.2289428485}, {

    rH = 22.70954353, rL = 32.28670872, xH = 0.4250775404,

    xL = 0.4393791233}
  {rH = 0., rL = 0., xH = 0.2289428485, xL = 0.2289428485}, {

    rH = 22.70954353, rL = 32.28670872, xH = 0.4250775404,

    xL = 0.4393791233}
assign {rH = 22.70954353, rL = 32.28670872, xH = 0.4250775404,

  xL = 0.4393791233}
                         rL, rH, xL, xH


I would be very glad, if anybody could help me.

And here is the whole algorithm:

 

 

 

 

1 2 3 4 5 6 7 Last Page 1 of 24