# Items tagged with variablesvariables Tagged Items Feed

### How to assign a value to each of the variables of ...

April 21 2015
1 2

My problem is the following; Let's say that I want to make a simple program of designing of a steel beam. In order to do so, there is a respectable number of parameters that have to be taken into account - forces, geometrical characteristics etc -. So for example, I have an excel file that has the following rows

1) A row of variables  :                          LENGTH   MOMENT_OF_INERTIA   AXIAL_FORCE    HEIGHT_OF_SECTION

2)A row of a value for each one variable :      5                556                       130                       300

the traditional approach in maple to intoduce these values to the program would be:

LENGTH:=5
MOMENT_OF_INERTIA:=556
AXIAL_FORCE:=130                etc etc

and then when for example we write

MOMENT_OF_INERTIA/LENGTH       we get

556/5=111.2

..but for problems like this the variables may be 50 in number, even more.. and it would be very timeconsuming to define all these parameters one by one..
so what I have been looking for so much these days is a predefined maple procedure - if there is one.. - that takes a matrix which we have created in advance and that includes all the names of the variables that we want to have in the problem - let's name it VARIABLES - takes as well a matrix that we also have created in advance and includes the value that we want each of our variables to get in the problem - let's name it VALUES - and make the correspondense automatically, so as to when we introduce an epression in maple thereafter, like     MOMENT_OF_INERTIA/LENGTH, when we press enter to get  556/5=111.2  (and not just a reproducing of what we already wrote , MOMENT_OF_INERTIA/LENGTH ..).. Do you think that there is an easy way to do so??

### Compare Multiple Functions (with many variables)...

April 21 2015
0 2

Hello maple users,

I want to compare 5 functions and see which one gives the best result (highest score). Unfortunatelly, I can't say one function always gives higher results than others. I have 8 variables and it makes the comparison complicated.

I assume 4 of them are constant and the other 4 or not.

c=0.1

p=1

w=0.5

wu=0.8

for Pb= 0:0.025:0.20                   Pb and Pa are probabilities, between 0-20, 0.025 increments
for Pa= 0:0.025:(Pb-0.025)      ** Pa is always less than Pb
for Ha= 0:50                      Ha takes values between 0-50
for Hb= 0:(Ha-1)            ** Hb is always less than Ha

I attached the data file. I appreciate if someone tells me how to compare these functions. Should I put more assumptions to make it easier? Thank you.

data1.mw

### solving simultaneous equations, gettin _Z in resul...

March 29 2015
1 2

Hi,

I was trying to find the solution for two theta variables in a couple of simultaneous equations (infact this is an iverse kinematics problem for a two link system pendulum).
The following are the initial inputs/equations to be manipulated:

Then I use the folowing command to rearrange for the theta values which I am after:

which gives me the result:

This is all fine until I give in values for l1, l2, x and y:

results:

I have a RootOf in there with a _Z term poping up here and there. I know that this configuration of the two link mechanism in fact dows have a solution and that these numbers are reasonable. Thus I have three questions:

Why does this happen?
What does the "signum" mean here?
how do I go about getting the nummerical values?

Many thanks,
- pjf

### Multiple Equation solver...

March 08 2015
1 2

Hi,

I am new to Maple and have a problem when solving three equations with three variables. But when  I plug in into solve function then it gives no answer.

eqn1 := 24900 = A*exp(-X*1.293995859*10^22)+A*exp(-Y*1.293995859*10^22)+5852.27;

eqn2 := 6000 = A*exp(-X*1.293995859*10^22)+2422.929937;

eqn3 := 19100 = A*exp(-Y*1.293995859*10^22)+8275.199937;

Variables are [A,X,Y]

### Integration Variables in Maple...

November 14 2014
2
4

A customer on Twitter recently asked why Maple gives the following result:

The issue here is that the  in  is the same as the integration variable. 140 characters is not a lot to work with for a reply, so here is a longer explanation.

First, note that the process of integration treats the integration variable differently than the other variables, so that replacing another variable by the integration variable has a different effect depending on whether the replacement is done before or after the integration is performed. Consider this simple example:

 (4)

 (5)

 (6)

 (7)

In other words, integration does not commute with substitution. This is a fundamental property of integration and in fact, Maple's eval has special rules to take this into account when you ask it to replace the integration variable.  For example, if you evaluate the inert form of the integral at , the substitution is performed explicitly:

 (8)

 (9)

However, if you try to evaluate at , the evaluation is delayed until after the integral is evaluated:

 (10)

 (11)

The eval command knows it shouldn't substitute into an integral when the substitution involves the variable of integration.

However, in the user's example, asking Maple for  is equivalent to substitution directly before the integration is performed, like this:

 (12)

which of course gives:

 (13)

Another way to have the two  variables be considered distinct is to explicitly make the integration variable a dummy by declaring it local:

Now the s are treated differently:

 (14)

Austin Roche

Senior Math Developer

Maplesoft

### Remove all variables except specified one's...

November 05 2014
0 2

Hello,

I'd like to clean up my project a bit. In a chapter of a project I made lots of calculations and declared a many (30) variabeles (Table, Numeric, Formula, ..)

Is there a way to remove all variable's except specified one's? (If it is possible I don't want to use an external file to write it to and read it back after a restart)

Is there a way to do a "restart" and preserve only the one's (2) that I need for my next chapter?
Or if not, without a "restart" and remove all variables except specified one's?

### Can I make an assumption like C[i,j] = C[j,i] for ...

October 31 2014
4 4

Hi guys.

I have variables that look like C[i,j,k,l], where i,j,k,l can range between 1..3 for example. Is there a simple way to create a pattern-based assumption for something like C[i,j,k,l] = C[j,i,k,l] for all i,j,k,l ?

Kind regards,

woggy

### Solving for values...

October 30 2014
1 3

I'm trying to solve a series of equations and then graph them. I'm trying to solve for the variables involved:

values := solve({eq1, eq2, eq3, eq4, eq5, eq6, eq7, eq8, eq9,

eq10, eq11, eq12, eq13, eq14, eq15, eq16}, {a, b, b, c, d, e, f,

g, h, i, j, k, l, m, n, o, p});

. . . but it gives me this:

Warning, solving for expressions other than names or functions is not recommended.

values :=

### dsolve with some difficult ode...

October 22 2014
0 4

I got a problem with a difficult ode,the commands are below.

restart;
sys := 1.*(diff(x(t), t, t)) = piecewise(b(t) = 1, 0, 1003.0-1000.*x(t)-30.*(diff(x(t), t))-25.*signum(diff(x(t), t)-.1)-.3*signum(diff(x(t), t))*exp(-2*abs(diff(x(t), t)))), x(0) = 1, (D(x))(0) = 0;
mu := 100;
stick := [diff(x(t), t) = .1, b(t) = piecewise((1000.-1000.*x(t))^2 < 10000, 1, 0)];
slip := [[0, 10000 < (1000.-1000.*x(t))^2], b(t) = 0];
sol:=dsolve({sys,b(0)=0},numeric,discrete_variables=[b(t)::float],events=[stick,slip],event_maxiter=1000000,output=listprocedure,maxfun=0,range=0..8);

### How to query for the SIZE of a varibale in maple ?...

October 19 2014
0 7

Is there any command in maple that can show us an assigned varibale how much bytes occupied on memory ?

a:=["just a string", 3.14 , 123 , x/y]

d:=array( 1 .. 2, 1 .. 2, [( 1, 1 ) = ("just a string"), ( 1, 2 ) = (3.14), ( 2, 1 ) = (123), ( 2, 2 ) = (x/y)  ] )

c:=a x^2 + b x + c

 >
 (1)
 >

It should be great for benchmarking !

### System of multivariable linear inequalities (12 va...

September 26 2014
4 30

Hi there.

I'm kind of new to Maple and i'm trying to solve a Linear Algebra problem for my class of Linear Algebra of the course of Physics. Also, my first language is portuguese so forgive for my not-so-perfect english.

I have a (solved) linear system of 7 equations and 12 variables (A, B, C, D, E, F, G, H, I, J, K, L) that is the following:

• A = 33 - K - L
• B = 1 + F - J
• C = -15 - F + J + K + L
• D = 15 + H - K
• E = 16 - F - H + J + K
• G = 34 - H - J - L
• I = 18 - J - K

Note: I'm using letters (A, B, ..., L) instead of X1X2, ..., X12 because it's easier to write it like this here and because I don't know if the Xn notation is allowed on Maple (i don't think so).

So, the system is possible but undetermined (with 5 degrees of freedom), being F, H, J, K and L the free variables.

Until here, everything's fine. The problem arises when the professor asks us for every solution of the system that satisfies the condition that all the variables (form A to L) are positive integers (A, B, C, D, E, F, G, H, I, J, K, L ϵ IN → natural numbers).

From my understanding, that gives rise to a system of linear inequalities with 12 variables and the following inequalities:

• A = 33 - K - L > 0
• B = 1 + F - J > 0
• C = -15 - F + J + K + L > 0
• D = 15 + H - K > 0
• E = 16 - F - H + J + K > 0
• G = 34 - H - J - L > 0
• I = 18 - J - K > 0
• > 0
• > 0
• > 0
• > 0
• > 0                            (and A,B,C,D,E,F,G,H,I,J,K,L ϵ IN)

After some research, i found that a possible way to solve this type of system of linear inequalities is trough a method of elimination (analog to Gauss-Jordan's elimination method for systems of linear equations) named Fourier-Motzkin. But it's hardwork and i wanted to do it on the computer. After some research, i came across with the following Maple command:

SolveTools[Inequality][LinearMultivariateSystem]

http://www.maplesoft.com/support/help/Maple/view.aspx?path=SolveTools%2fInequality%2fLinearMultivariateSystem

So, I tried to use that command to solve my system, with the following result (or non-result):

with(SolveTools[Inequality]);
LinearMultivariateSystem({F > 0, H > 0, J > 0, K > 0, L > 0, 1+F-J > 0, 15+H-K > 0, 18-J-K > 0, 33-K-L > 0, 34-H-J-L > 0, -15-F+J+K+L > 0, 16-F-H+J+K > 0}, [F, H, J, K, L]);

Error, (in SolveTools:-Inequality:-Piecewise) piecewise takes at least 2 parameters

So, i really need help solving this as the professor told us that the first one to solve would win a book, eheh. I don't know what I'm doing wrong. Maybe this Maple command is not made for 12 variables? Or maybe i'm just writing something on a wrong form. I've never used Maple before so i can be doing something really stupid without knowing it.

I would really apreciate an answer, as my only goal as a future physicist is to unveil the secrets of the Cosmos to us all.

Thank you again.

Miguel Jesus

### How do I solve a complex multi-regression problem?...

September 25 2014
1 0

Hi all.  I have researched into this problem.  But I could not find a solution to this.

Here is an example.

I have a set of independent variables, say there are 5 of them.  They are 1. Gender 2. Age group 3. Full or part time 4. First language.

I have a set of dependent variables.  Let us consider for an example 6 of them.  They are (i) Develops breast cancer (ii) Develops skin cancer (iii) Develops lung cancer (iv) develops prostate cancer (v) Lives till 50 (vi) Lives till 60 ...

How do I perform the following prediction:

(A) If a person is male and above 50, what are the chances that he is likely to develop prostate cancer?

(B) If a person is female and works part time, what are the chances that she is likely to develop breast cancer and lives till 60?

I need to develop a code and formula to do this?  Can someone please advise?

Many thanks.

Kind regards,

Kris

### Integral limits ...

September 25 2014
0 6

I have a proc as follows:

F:=proc(f,n)
L:=[f];
for j from 1 to n do;
J:=int(1/subs(t=x[j],L[j]),x[j]=2..x[j+1]);
L:=[op(L),J];
end do;
end proc;

I chose to use index variables. However when I try to apply a member of the output list as a function of the outermost limit, I do not get any output when I try to evaluate the function. I suspect maple is having trouble with the variables withing the integral. How can I make this work?

I'd like to have a function that I can evaluate:

g:=F(log(t),3)[3];
f:=unapply(g,x[3]);

f(2.1);

Thanks!

September 23 2014
1 2

### Defining a Function of a Pre-Defined Number of Var...

August 07 2014
1 7

I'm writing some code that computes a positive integer N and I'd like Maple to define a function of N variables. I've tried writing

f := (seq(t[i],i=1..N))-> MY EXPRESSION;