## convert function to expression...

Sorry for the simple subject.  Using unapply we can convert an expression to a function.

a:=x^2+sin(x)

a:=unapply(a,x)

a:= x-> x^2+sin(x)

How do you go the other way.  That is convert a function to an expression?

## Splitting an equation by its addition terms....

Hi, I wondered if anyone knows a way to separate out addition (or subtraction) terms in an equation.

For example given eqn1:

eqn1:= (1/2)*p+1+(-4*p^2-p-1)/(3*p^3+7*p^2+2*p+2)

I would like to get the first rational term before the first plus (or minus) sign. In this case it would be (p/2).

This is a trivial example shown above but the real value in this is that I want to customize my own factorizations using the pratial fraction function of Maple. In this case I would not know eqn1 before hand but it would be the solution to some previous factorization and I need just the first term (before the first plus sign).

If anyone knows any tips or tricks that will set me on the right path to doing this it is most appreciated.

## modifying or sorting an expression of a fraction...

Hello people in mapleprimes,

I want to modify the following expression a to b. For it, I used c code.
But, as seen in d, just using c returns a. Originally, I intended phi being between 0 and 1, so
that 1-phi >0. Isn't any better way to modify a to b? and it is better to have maple sort expression remembering 1-phi to be positive, and to have maple give any priority to it in modifying a to b.

```a:=(-2*theta+1)*phi/(phi-1)+theta;
b:=(2*theta-1)*phi/(-phi+1)+theta;
c:=simplify(-1*numer(op(1,aa)))/simplify((-1)*denom(op(1,aa)))+theta;
d:=simplify(c)
(-2*theta+1)*phi/(phi-1) + theta
```

## Mple very long expression...

I'm looking to leanr the sign and to simplify a very long expression , how can i do this ? can anyone help me thank you in a

## Equate two expressions...

Hello!

Hope everything fine with you. Please check the following program

restart; a := 0; b := 1; Rd := .5; Ra := .2; Nc := .6; e := .2; Nr := .3; H := .9; Digits := 20;
with(LinearAlgebra);
L[0] := 1; L[1] := a+1-x;
M := 4; K := 1;
for n while n <= M do
L[n+1] := expand(-((x-2*n-a-1)*L[n]+(n+a)*L[n-1])/(n+1))
end do; printlevel := 2;
for m from 0 while m < M do
for n to 2^(K-1) do
psi[n, m] := simplify(sqrt(m+1/2.)*2^((1/2)*K)*(eval(L[m], x = 2^K*x-2*n+1)))
end do
end do;
f1 := simplify(sum(sum(c[p, q]*psi[p, q], q = 0 .. M-1), p = 1 .. 2^(K-1)));
u := collect(f1, [x], recursive);

u := -3.5276684147527874541*c[1, 3]*x^3+(4.4721359549995793928*c[1, 2]+21.166010488516724724*c[1, 3])*x^2+(-3.4641016151377545871*c[1, 1]-13.416407864998738178*c[1, 2]-34.394767043839677677*c[1, 3])*x+c[1, 0]+3.4641016151377545871*c[1, 1]+7.8262379212492639373*c[1, 2]+14.992590762699346680*c[1, 3]

f := 1+sum(A[i]*(x^(i+1)-(i+1)*x), i = 1 .. M-2)

f:=1+A[1]*(x^2-2*x)+A[2]*(x^3-3*x)

I want to equate the like powers of "x" in f ( mention as red) and u ( mention as red) for any values of M make a system of equations as

Eq[1]:=-3.5276684147527874541*c[1, 3] = A[2];

Eq[2]:=4.4721359549995793928*c[1, 2]+21.166010488516724724*c[1, 3] = A[1];

Eq[3]:=-3.4641016151377545871*c[1, 1]-13.416407864998738178*c[1, 2]-34.394767043839677677*c[1, 3] = -2*A[1]-3*A[2];

Eq[4]:=c[1, 0]+3.4641016151377545871*c[1, 1]+7.8262379212492639373*c[1, 2]+14.992590762699346680*c[1, 3] = 1;

and solve them for any values of A[1] and A[2];

Also attached the program Equate.mw

With my best regards and sincerely.

School of Mathematical Sciences
Peking University, Beijing, China

## Expression vs Layout Palette...

What is the difference between the Expression Palette and the Layout Palette? First I thought that the Layout Palette is supporting the entering of names with e.g. sub- and superscripts, but I learned (the hard way) that the templates of the Layout Palette are "mathematically active".

What is the meaning of the colours green and violett in both palettes?

## Minimize the length of an expression...

Quite often when i use maple I generate expressions that are of vast length, that with a pen and paper can be reduced in length by carefully factorizing, multiplying out and dividing through.

I am wondering if i am missig somethig- if this is a problem all maple users deal with, or if its just a limitation of the program.

Today, maple generated:

d*B[2211](t)/dt = 2*k[a2]*beta*k[d2]*B[2211]*(alpha*beta*R[b]*k[a1]^2+alpha*beta*R[b]*k[a1]*k[a2]+2*alpha*R[b]*k[a1]*k[d1]+2*alpha*R[b]*k[a1]*k[d2]+alpha*R[b]*k[a2]*k[d1]+alpha*R[b]*k[a2]*k[d2]+beta*k[a1]*k[d1]+beta*k[a1]*k[d2]+k[d1]^2+3*k[d1]*k[d2]+2*k[d2]^2)
/(alpha*beta^2*R[b]*k[a1]^2*k[a2]+alpha*beta^2*R[b]*k[a1]*k[a2]^2+alpha*beta*R[b]*k[a1]^2*k[d1]+alpha*beta*R[b]*k[a1]^2*k[d2]+3*alpha*beta*R[b]*k[a1]*k[a2]*k[d1]+3*alpha*beta*R[b]*k[a1]*k[a2]*k[d2]+alpha*beta*R[b]*k[a2]^2*k[d1]+alpha*beta*R[b]*k[a2]^2*k[d2]+alpha*R[b]*k[a1]*k[d1]^2+3*alpha*R[b]*k[a1]*k[d1]*k[d2]+2*alpha*R[b]*k[a1]*k[d2]^2+2*alpha*R[b]*k[a2]*k[d1]^2+3*alpha*R[b]*k[a2]*k[d1]*k[d2]+alpha*R[b]*k[a2]*k[d2]^2+beta^2*k[a1]*k[a2]*k[d1]+beta^2*k[a1]*k[a2]*k[d2]+2*beta*k[a1]*k[d1]^2+3*beta*k[a1]*k[d1]*k[d2]+beta*k[a1]*k[d2]^2+beta*k[a2]*k[d1]^2+3*beta*k[a2]*k[d1]*k[d2]+2*beta*k[a2]*k[d2]^2+2*k[d1]^3+7*k[d1]^2*k[d2]+7*k[d1]*k[d2]^2+2*k[d2]^3)
+(-2*k[d1]-2*k[d2])*B[2211]
+2*k[d1]*B[2211]*(alpha*beta*R[b]*k[a1]*k[a2]+alpha*beta*R[b]*k[a2]^2+alpha*R[b]*k[a1]*k[d1]+alpha*R[b]*k[a1]*k[d2]+2*alpha*R[b]*k[a2]*k[d1]+2*alpha*R[b]*k[a2]*k[d2]+beta*k[a2]*k[d1]+beta*k[a2]*k[d2]+2*k[d1]^2+3*k[d1]*k[d2]+k[d2]^2)*k[a1]*beta
/(alpha*beta^2*R[b]*k[a1]^2*k[a2]+alpha*beta^2*R[b]*k[a1]*k[a2]^2+alpha*beta*R[b]*k[a1]^2*k[d1]+alpha*beta*R[b]*k[a1]^2*k[d2]+3*alpha*beta*R[b]*k[a1]*k[a2]*k[d1]+3*alpha*beta*R[b]*k[a1]*k[a2]*k[d2]+alpha*beta*R[b]*k[a2]^2*k[d1]+alpha*beta*R[b]*k[a2]^2*k[d2]+alpha*R[b]*k[a1]*k[d1]^2+3*alpha*R[b]*k[a1]*k[d1]*k[d2]+2*alpha*R[b]*k[a1]*k[d2]^2+2*alpha*R[b]*k[a2]*k[d1]^2+3*alpha*R[b]*k[a2]*k[d1]*k[d2]+alpha*R[b]*k[a2]*k[d2]^2+beta^2*k[a1]*k[a2]*k[d1]+beta^2*k[a1]*k[a2]*k[d2]+2*beta*k[a1]*k[d1]^2+3*beta*k[a1]*k[d1]*k[d2]+beta*k[a1]*k[d2]^2+beta*k[a2]*k[d1]^2+3*beta*k[a2]*k[d1]*k[d2]+2*beta*k[a2]*k[d2]^2+2*k[d1]^3+7*k[d1]^2*k[d2]+7*k[d1]*k[d2]^2+2*k[d2]^3)

quite clearly there are expressions in there that can be factorised by (k[a1]+k[a2]) and the two quotients have the same denominator. Is there any way of minimizing the length of this expression by factorizing where appropriate, merging denominators when appropriate etc?

## A possible bug with(Logic)...

I am not sure why p is assigned to 1 when I do a logic problem.

The letter p should stay as p and not be assigned to one. I suspect it has something to do with a statement that is always true. This is annoying because sometimes I have expressions with p in a formula later on, and I didn't realize p has been assigned to 1. And I can't use p in a logical formula either since it's already been assigned to 1.

## How to expression a function in terms of different...

Hello,

Lets say I have some expression F that is a function of n and N like, F=n+N-1 and I want to express that in terms of x, where x=n/N. How would I do this in maple? Thanks in advance.

## what is special about variable y and z? ordering o...

I noticed Maple gives different order of term (but still correct) when variable y or z is used, vs. other letters in this computation.

In this example below, integral results are given, using one letter of the alphabet at a time in the integrand.

Only when the variable is y or z, Maple shows expression in different form from all the others (negative sign pulled out). The result are correct ofcourse, but was wondering why this hapens only for these two variables? I would have expected that variable name (letter used) should not make any difference to the final form.

restart;
interface(rtablesize=infinity):
chars:=[seq(parse(StringTools:-Char(i)),i=97..122)]: #generate a..z variables, may be there is better way?
Matrix([seq([chars[i0],simplify(int((c0^2 - c1^2)/(chars[i0] - x0+I*c3), x0))],i0=1..nops(chars))]);

Gives (this below. Notice the very last 2 entries below)

Is this something common in Maple? Does it depend on the computation being performed? Can a user do something to tell Maple not to change order/form of expression depending on what variable letter is used?

## discrete sequence...

This sequence has a special name does anyone know what it is? i mean id look it up on oeis but unfortunately the asthetics of their presentation dont meet my strict standards, so yes i did work out an expression for it but if anyone knows the easiest in a singular expression.. very helpful right now.

1, 1, 2, 2, 3, 3, 4, 4, 5, 5

## Issues with differential and D operator...

Hi,

I am trying to do a numerical approximate method 'method of multiple scales'. And in doing so I am getting following equation.

 >
 >
 (1)
 >
 (2)
 >

Now I need to substitute x_1(T0,T1,T2)=R(T1,T2)sin(omega*T0+phi(T1,T2)) in the expression and evaluate it.  But on substituting, it is not solving for the 'D' operator. In a similar line if I will have a differential term like

D1(x1)(T0-tau_1,T1,T2) and I have to substitute x1(T0-tau_1,T1,T2) then how can i do it?

Thanks and regards

Sunit

## How do I find everything about an expression?...

I know that whattype() is used to find the basic data type of an expression. Unfortunately that information is rarely useful. How can I dig down deeper and get Maple to tell me more about the expression?

I read somewhere that there is a properties() procedure that does that but I cannot find that procedure.

Thanks.

## Adding a term, then subtracting the term....

Hello people in mapleprimes,

I have an equation called aa in the following.

alias(`&delta;x`=dx, `&Delta;x`=Dx,`&Delta;y`=Dy,`&Delta;z`=Dz):
aa:=Dz=f(x+Dx,y+Dy)-f(x,y);

As for modification of this expression, I ask your favor to teach me.

Then, I want to change this aa to D[1](f)(x+theta__1*Dx,y+Dy)*Dx+D[2](f)(x,y+theta__2*Dy)*Dy.

But, to do so, I have to split aa into the one including -f(x,y+Dy)+f(x,y+Dy) between two terms

of aa.

But, as maple cancels these terms, I can't do so. How can I insert two terms, then

obtain the expression  D[1](f)(x+theta__1*Dx,y+Dy)*Dx+D[2](f)(x,y+theta__2*Dy)*Dy?

taro

## Saving the multiple output of an expression withou...

Hi, I am new to maple, but I think that my question should be simple.

I have a matrix where each element is an expression. I want to compute the matrix for different constant and to save it without crushing the previous matrix.

If the file that I joined, I have a first part where the constant are defined. In the second part the expression of the matrix is defined. Finally, I compute each matrix with different constant. Each results is called C_p0, C_s0, C_g0. When I called them back, only the last matrix computed remains.

I would like to be able to save each matrix to performed operation on them later.

Thank you.

Forum_Question1.mw

Homogénéisation

 Paramètre des matériaux

Tenseurs Élémentaires

Tenseur de rigidité

Matrice de rigidité

 (1.2.1.1.1)

 (1.2.1.1.2)

 (1.2.1.1.3)

 (1)

 1 2 3 4 5 6 7 Last Page 1 of 9
﻿