## how to replace multiple items in expression withou...

Given some expression, I want to replace each exp(.....) in it with something else.

This is what I currently do. First I find all the exp() terms, then using a loop and use subs  like this

restart;
expr:=1/exp(z)*arcsinh(x*exp(C[1]))+x*sin(exp(x))+3*exp(C[1]*y)*sqrt(sin(exp(3*h)));

#find all exp terms
s:=select(x->has(x,exp),indets(expr));
s:=select(x->op(0,x)='exp',s)

Now, lets says I want to replace each with Z

I tried to use but that did not work.

So now I am doing this

for item in s do
expr:=subs(item=Z,expr);
od:
expr

is it possible do this without a loop? could not do it using ~

With map, I can do this map(x->subs(x=Z,expr),s) but this does not replace it inside expr where I want.

Assignment is not allowed inside the above so I can not do  this map(x->expr:=subs(x=Z,expr),s)

And if I do expr:=map(x->subs(x=Z,expr),s)  it does not work either. it gives

How to do the replacement without using a do loop?

## How to plot a graph that depends on an integral....

I have the following question, plot the graph of mu=5*log_10(D_L/10) where D_L=(c/H_0)*\int_0^z dz'/[A(1+z')^4+B(1+z)^3+C]^{1/2} with resepct to z, where A,B,C are numerical values given beforehand, and c is the speed of light and H_0 is the current Hubble constant.

Thanks, just by experience, can I learnt these syntax languages.

Peace out!

## Help with solving ODE?...

Might anyone be able to tell me what I am doing wrong trying to solve for this ODE?

Thanks so much!

## Why inequal plot like this?...

Hi there,

Can someone explain to me why is it happening? If smaller equal than coloured well, if smaller then just the equal line appears. Why?

with(plots);
dm1 := .23; pm12 := .7; dm12 := .23;
inequal(pm1*(dm12+am21)-pm12*(dm1+am21) <= 0, pm1 = 0 .. 1, am21 = 0 .. 1, color = "Nautical 1");

inequal(pm1*(dm12+am21)-pm12*(dm1+am21) < 0, pm1 = 0 .. 1, am21 = 0 .. 1, color = "Nautical 1")

Thank you!

## This code is not running. kindly help me out for f...

restart;
PDEtools[declare](f(x), prime = x);
N := 4;
f(x) :=  sum(p^i*f[i](x), i = 0..N):
HPMEq := (1 - p)*diff(f(x), x $3) + p*(diff(f(x), x$ 3) + 1/2*diff(f(x), x, x)*f(x));
for i from 0 to N do
equ[1][i] := coeff(HPMEq, p, i) = 0;
end do;
cond[1][0] := f[0](0) = 0, D(f[0])(0) = 0, D(f[0])(5) = 1

for j to N do
cond[1][j] := f[j](0) = 0, D(f[j])(0) = 0, D(f[j])(5) = 0;
end do

for i from 0 to N do
dsolve({cond[1][i], equ[1][i]}, f[i](x));
f[i](x) := rhs(%);
end do;
f(x) := evalf(simplify(sum(f[n](x), n = 0 .. N)))

convert(f(x), 'rational')

subs(x = 2.4, diff(f(x), x))

## How to sort a matrix based on one column...

How to sort a matrix based on one particular column in that matrix

.  Has to sorted on column one only and output. . In this I have given only 2×2  it could be a n×n

Without too much code

## how to find an ellipse inscribed in a given triang...

Is it  possible to draw an ellipse inscribled in a given triangle and we know its orthoptist circle ? Thank you very much.

## How to get prime derivative notation at specific x...

Prime_Derivative_Notation_for_Explicit_X_Values.mwPrime_Derivative_Notation_for_Explicit_X_Values.mw

## I hope this works. I can't seem to paste my MW file in this window in a readable format.

## how to obtain simpler integrate result...

This is the Maple code

restart;
result:=int(1/tanh(u),u)

simplify(result,size) ;
simplify(result,symbolic);
simplify(result,ln);
simplify(result,trig);

Any suggestions?

## How to find a rational function with give horizont...

How to find a rational function with give horizontal asymptotes: y=0.7, y=-0.7 and vertical asymptotes: x=0.001, x=-0.001?

## How to partition a list fast? ...

Hello

I have a list with a large number of elements and I need to partition it in chunks of a specific size.  Here is my attempt

listpart := proc(cond::list,nchunk::nonnegint:=1000)
if numelems(cond) < nchunk then
newcond:=[cond]:
else
ss:=[\$(1..numelems(cond))]:
sss:=map(mod,ss,nchunk):
ind:=[ListTools:-SearchAll(0,sss)]:
ind:=[0,op(ind),ifelse(ss[numelems(ss)]=ind[numelems(ind)],[],ss[numelems(ss)])]:
end if:
return(newcond):
end proc:

It does not run as fast as I thought.  I am not even sure if Threads:-Seq could be used in this case.  Please tell me what I am doing wrong and how I can modify the code to get a faster response.

Many thanks

Ed

## need code, its very urgent...

Hello all

could anyone tell how to solve following nonliner equations numerically.

f '''' - c1(g'') + R(f ' f '' - f f ''' )=0

g'' + c2(f '' -2g) -c3(f g' - f ' g)=0

f ' (-1)=0,   f ' (1)=0,   f(-1)=1-A, F(1) =1, g(-1)=0, g(1)=0

c1=3.2, c2=3.3, c3=3.4, R= -10 and A=1.6 are constants.

## Why integration of dirac delta with argument sin i...

Hello,

I am trying to calculate an integral involving dirac delta as given below

int(Dirac(sin(x)),x=-3/2*Pi..3/2*Pi)

However, Maple returns the integral unevaluated as

How can I get it evaluated? the result should be 3 here.

## Physics package update...

Hello each and everyone,

I have a problem with updating the Physics Package. (At the moment I run version 709)

But when I try to update to version 710 I have the following error (see the screenshot)

I don't know what's happening.

Kind regards to all.

Jean-Michel

## Drawing a polygonal approximation of a curve C...

I try to make a procedure for this

Was it by a example of Riemann sum that  x-values in a array are stored for  numerical value, but in this task it seems that the array must be filled with the symbol x1,x2 , etc

Should this be needed ?

blz64.pdf

blz_65.pdf

Was it first for a partition about a interval ( example Riemannn sum) that i got  a list of numeric values

 > a:= 0: b:= 5: N:= 30: i= 0..N :
 > X:= Array(0..N, [seq(j, j=a..b, (b-a)/N)]);
 (1)

Now i want  to get a list  of  x-values in Array X ,  starting from  0  to N  :

example: array X =[x0= 0, x1=1/6, ...]

 > x[i]:= a+(b-a)*i/N; # for i = 0..N # endpoints subintervals
 > # generate X-values for interval [a,b]
 > X:= Array(0..N, [seq(j, j=a..b, x[i])]);
 >

the values  x1,x2....stored  in Array X are used in further calulations
If there is a need for naming x1= 0 , x2= ..  in the Array A ? , probably not .

 >