## How to define function with (conditions, interval,...

how will i go about solving this problem, i want to return somthing like this (this anwser is from another function that did not contain sin, and therefor did not gave me problems).

## Reccurence relation between two operators ...

Hi

Hope a nice day for all

restart;

#  *%   define the product of between two operators, and q real number
a*%b = q*b*%a+1;

# First I would like to give a simple for

a^n*%b;
# and
a*%b^n;

them deduce a general for

b^n*%a^k*%b^N*%a^K-q^(k*N-n*K)*b^N*%a^K*%b^n*%a^k;

where n, k and k greater than 1 and  n geater than k

Simplification.mw

## Subscript error...

Hello

I have a subscripts error, or it seems to be an error.

As you can see on the picture, then I have defined the varible I__K, but when I need it again I get another result or It seems to be another result that looks like this I[K]. I use the esc buttom to recall the varible.

Are there anybody that has a solution to this? I have been looking at other treads, but there seems not to be a solution that works or maybe I'm looking the wrong places.

Regards

Heide

## Odd response to use of local in proc definition...

This one really has me baffled.

What the proc does is not important. This is just about as simple an example as I could write. Maple 2015 is complaining anytime I try to declare a local variable. The second example shows that the local declaration is needed - Maple even introduces it into the procedure that it defines.

`restart;`
`test := proc(  ) local a; a := 3end proc;Error, unexpected `local` declaration in procedure body`
`test := proc(  )# local a; a := 3end proc;Warning, `a` is implicitly declared local to procedure `test`test := proc(x) local a; a := x end proc`

Here's the version information for my current Maple.

`interface( version );Standard Worksheet Interface, Maple 2015.0, Windows 7, February 17 2015 Build ID 1022128`

Can someone explain what is happening, and why I'm just now seeing this?

Doug

```---------------------------------------------------------------------
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu
```

## Create two variable function with distributive pr...

Hello,

I have a two variable function d(a,b) which i don't want to substitute for the result. How can I make this product distributive,e.g. d(a+b,c)=d(a,c)+d(b,c) with independece of the variables I introduce in the function?

Thank you for the help!

I am trying to use the Define() funtion for the tetrad form of the Ricci Tensor. I use the Setup() function to define the tetradmetric and the tetrad labels. However, the function continues do some strange things with the d_ . It should be just a simple sum over the repeated indices, but I am getting imaginary terms.

 (1)

 (2)

 (3)

 (4)

## For-loop seems to affect the Defined tensor expres...

 (1)

 (2)

 (3)

Now, if I type the RicciT from (3) it displays the same result. However,......

 (4)

If I type a different RicciT, then ...

The for loop is changing the tetrad definition of RicciT.

## Subtract member from set...

I know how we can add a member to a mathematical set ,for example :

C := NULL;

C := C, V, B, X;

print(C)

V, B, X

but, my problem is that how we can subtract a member from the defined set ?

Thanks,

 (1)

 (2)

 (3)

 (4)

## Set Uneval globally/ Simplification with unspecifi...

Hello, i got the following problem. I have a function, say u(h,e) whith multiple exponents . As long as Maple does not know that u(h,e) is positiv it won't make the simplification and return u(h,e) as expected. From my view i have two possibilites to solve this problem:

1) Define u(h,e) to be positive. Sounds intuitive, but i didn't manage to find the right definition

2) Give maple the function e.g. u:=e+h^2 and simplify the epression in uneval quotes with assumption positive for e and h.

Whereas I have solution 2, the problem is that i would need excessive amounts of uneval quotes '' at the start of my worksheet, not to run out of them.

I definitly need my epressions in unevaluated forms and would be happy to hear any ideas.

Greetings, Fabian

## Populating a possible game result matrix...

Hello,

I'm trying to define a matrix that will have all the possible game results in a 9 team competition in one round. The results are a column in the form [game 1 home team, game 1 away team, game 2 home team, ... , game 9 away team]

This should give me a matrix with 18 rows, and 512 columns, where each column is a possible game result.

In essense, to continue the pattern of this matrix on for all 512 columns.

I've fiddled with for statements, but it ends up getting very messy given the number of nests that are required.

Thoughts? Any help would be much appreciated,

Thanks, Alex, Australia.

## How to define functions using expressions stored i...

Let a be som expression like
a:=t^2

Now how do I define a function using a.

f:=t->a
doesnt work

## Translating a MATLAB script to Maple...

Hey!

I have this MATLAB script, but as I work in Maple, I'll need to translate it to Maple.
I know how to define symbols and functions, but I don't know which Maple commands to use, of if it needs to be done in another way, so the problem is translating from " dZ = [dx; dy; ax; ay; dm];" and down.

Any help would truly be greatly appreciated! Thank you!

This is the script:

function dZ = meteor_step(~, Z)

P = 1.2; % initial atmospheric pressure
H = 1.39E-4; % scale height of atm pressure
E = 8.11131859E6; % evaporation energy
D = 1; % drag constant
G = 9.814; % acceleration due to gravity
PM = 3.3E3; % density of the meteor

S = 3.986E14; % standard gravitational parameter of Earth (G*M)
R = 6.3674447E6; % radius of the Earth (meters)

x = Z(1);
y = Z(2);
dx = Z(3);
dy = Z(4);
m = Z(5);

atm = P*exp(-y*H);

v = sqrt(dx^2+dy^2);

area = pi * ( (3*m)/(4*PM) )^(2/3);

dist = sqrt(x^2+y^2);
Gv = -9.8;

accel = -(D*atm*area)/m*v;
ax = accel * dx;
ay = accel * dy + Gv;

dm = -(atm*v^3*area)/(2*E);

dZ = [dx; dy; ax; ay; dm];

end

[t, R] = ode45(@meteor_step, [0 250], [0, 100000, 100, -300, 25]);

x = R(:,1);
y = R(:,2);

dx = R(:,3);
dy = R(:,4);

v = (dx.^2+dy.^2).^(1/2);

m = R(:,5);

figure(1);
plot(t, y);
title('Meteor Kinematics: Height vs Time');
xlabel('Time elapsed (s)');
ylabel('Height (m)');

figure(2);
plot(x, y);
title('Meteor Kinematics: Horizontal vs Vertical Position');
xlabel('Horizontal (m)');
ylabel('Vertical (m)');

figure(3);
plot(t, v);
title('Meteor Kinematics: Speed vs Time');
xlabel('Time elapsed (s)');
ylabel('Absolute speed (m/s)');

figure(4);
plot(t, m);
title('Meteor Kinematics: Mass vs Time');
xlabel('Time elapsed (s)');
ylabel('Mass (kg)');

figure(5);
plot(t, dy);
title('Vertical Velocity vs Time');
xlabel('Time elapsed (s)');
ylabel('Vertical velocity (m/s)');

temp = abs(y - 52900);
[~, index] = min(temp);

t(index)
dx(index)/1000
dy(index)/1000

## Define the function......

Hi every Body?

I will define the function f(t) in maple,how?

f(t)=1-t for 0<t<10 and t for t>10

## General Tensor/Matrix Derivative...

Hi everyone,

I have a question regarding the derivation of tensors/matrices.
Let's assume for simplicity, that I have a vector (6x1) s and a matrix A (6x6)defining Transpose(s)*Inverse(A)*s. From this function I want to calculate the derivative w.r.t. s. My approach would be

restartwith(Physics):
with(LinearAlgebra):
Define(s,A)

Diff(
Transpose(s)*Inverse(A)*s, s)

As a result I get

though I'd rather expect something like Inverse(A)*s + Transpose(s)*Inverse(A)

Now as I'm pretty new to Maple, I can imagine that my approach is wrong, but I don't know any better and can't seem to get any information out of the help documents.