MaplePrimes Questions

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? 

 

 

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.

 

Can someone please help with this simple plotting assignment.

 

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

 

Peace out!

 

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

Thanks so much!

thoughts_about_cost_functions.mw

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!

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 particular column in that matrix

 

Matrix ([[21,30],[8,4]]).  Has to sorted on column one only and output. Matrix ([[8,4],[21,30]]). In this I have given only 2×2  it could be a n×n

Without too much code

 

 

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

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.

 

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 horizontal asymptotes: y=0.7, y=-0.7 and vertical asymptotes: x=0.001, x=-0.001?

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)])]:
	newcond:=[Threads:-Seq(cond[(ind[j]+1)..ind[j+1]],j=1..(numelems(ind)-1))];
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

 

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.   

please help to find solution  numerically and how to plot. 

Thanks in advence

 

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

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

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

Thanks in advance.

         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

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

excset  3  task4

 

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)]);

Array(%id = 18446745862042054398)

(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

Error, invalid terms in product: 0 .. 30

 

# generate X-values for interval [a,b]

X:= Array(0..N, [seq(j, j=a..b, x[i])]);

Error, invalid input: seq expects its 3rd argument, step, to be of type numeric, but received 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 .

 


 

Download vraag_excset3_task_4.mw

  

First 250 251 252 253 254 255 256 Last Page 252 of 2143