Rouben Rostamian

MaplePrimes Activity


These are replies submitted by Rouben Rostamian

@spm71 In your original question you wrote that you want to type the commands into a file and then execute the file.  But now you write "when I type ... in the command prompt...".  So, do you want to write commands to a file, or type them at the command prompt?

Anyway, when you type at the command prompt, pressing "Enter" tells Maple to go ahead and execute what you have typed.  However, "for i from 1 to 5 do" is not a complete command, so understandably Maple refuses to execute it.  To break a line rather than execute it, hold down then Shift key and then press Enter.

As to your question regarding executing a file, I have already written that you do it in Maple with the command:

    read "thefilename";

 

@Carl Love That's interesting.  Following your line of investigation, I produced the following minimal example which demonstrates the problem:

> eq := Pi*x = piecewise(t<1, 2 , 3);


> solve(eq, x);

> plot(%, t=0..4);

Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct


As you have pointed out, the problem is that the pieces of the solution are expressed as lists rathen than simple expressions.  I will report this to Maple Support for a possible fix.

 

@H-R I know nothing about Word so I cannot be of help here.  I think writing mathematics in Word is quite uncommon.  Most mathematics is written in LaTeX, and the EPS format integrates quite nicely with LaTeX.

@Carl Love Thank you very much for your very thorough explanation of the issue.  I should have looked at the case x$0 more closely.

@sazroberson I have had no problems with exporting images in the EPS format and including them in books and journal articles.  Perhaps erik10's needs go beyond the basic usage which I have dealt with.

That said, I do realize that a major shortcoming of the EPS format is its inability to handle transparency, but that is not a fault of Maple; it is a limitation of EPS.  In a few cases where I have had to deal with transparency, I have exported the image as PNG and then wrapped the result in EPS.

 

@nm This one is simpler:

restart;

f := x -> x + 3;

seq(f(x), x=50..70, 5);

 

@Carl Love If so, then how do we explain this:

P := 5*a*b;

op(P);

                    5, a, b

subs(a*b=4, P);

                    20

@Kitonum I think the following is a cleaner way for checking for correctness:

sol := solve({seq((pii.P)[i]=pii[i], i=1..6)});

eval(pii.P - pii, sol);

                    [ 0.    0.    0.    0.    0.   0. ]

@Kitonum You wrote pii.P[i] while you meant (pii.P)[i].  After that correction we get

 

Thank you all for your replies and interesting discussion.  It appears that Kitonum's solution, that is,

collect(algsubs(1/(T[1]*V[2])=U, B), U);

is the most effective in this case.  Carl Love's sentiment regarding algsubs()'s quirks is duly noted.

@Alejandro Jakubi Doh! (slapping my forehead).  Why didn't I think of that?

I gues I was not thinking.  But please also have a look at the amended question above.

@nm That's an excellent solution, but please see the amended question above.

Amended problem

Having seen the replies from nm and Alejandro Jakubi, I realize that I have been careless in posing my question.  The actual expression which I wish to simplify is somewhat more complex than "A" shown above.  I made up the reduced expression "A" assuming that the solution of one will also be the solution of the other, but I was wrong.  Here is what I should have asked:

B := (V[1]*T[2]*(alpha-1)*(exp(-t/T[2])*T[2]-exp(-t/T[1])*T[1])*c[1,`in`]/((T[1]-T[2])*T[1]*V[2])-(T[1]*V[2]-T[2]*V[1])*exp(-t/T[2])*(beta-1)*c[2,`in`]/(T[1]*V[2]))/(c[1,`in`]*alpha*T[2]*V[1]/(T[1]*V[2])+beta*(T[1]*V[2]-T[2]*V[1])*c[2,`in`]/(T[1]*V[2]));

(V[1]*T[2]*(alpha-1)*(exp(-t/T[2])*T[2]-exp(-t/T[1])*T[1])*c[1, `in`]/((T[1]-T[2])*T[1]*V[2])-(T[1]*V[2]-T[2]*V[1])*exp(-t/T[2])*(beta-1)*c[2, `in`]/(T[1]*V[2]))/(c[1, `in`]*alpha*T[2]*V[1]/(T[1]*V[2])+beta*(T[1]*V[2]-T[2]*V[1])*c[2, `in`]/(T[1]*V[2]))

(1)

What was "u" in "A" is now "T[1]*V[2]" in "B", so collect() no longer works.  Since T[1]*V[2] also appears elswhere in "B", the subs() trick does not work either.  Here is my hand-crafted simplification:

(V[1]*T[2]*(-alpha+1)*(exp(-t/T[1])*T[1]-exp(-t/T[2])*T[2])*c[1,`in`]/(T[1]-T[2])+(T[1]*V[2]-T[2]*V[1])*exp(-t/T[2])*(-beta+1)*c[2,`in`])/(beta*(T[1]*V[2]-T[2]*V[1])*c[2,`in`]+c[1,`in`]*alpha*T[2]*V[1]);

(V[1]*T[2]*(-alpha+1)*(exp(-t/T[1])*T[1]-exp(-t/T[2])*T[2])*c[1, `in`]/(T[1]-T[2])+(T[1]*V[2]-T[2]*V[1])*exp(-t/T[2])*(-beta+1)*c[2, `in`])/(beta*(T[1]*V[2]-T[2]*V[1])*c[2, `in`]+c[1, `in`]*alpha*T[2]*V[1])

(1)

 

@Carl Love  Yes, as a rule I do pay attention to the ongoing discussion.  In this case, however, I failed to notice your answer, possibly because it was so terse, but that's not a good excuse.  I am sorry for having repeated your answer.  I attempted to remove my post but apparently there is no mechanism provided for that.

@Konstantin@ You get the second derivative from the differential equation itself:

de := diff(y(x), x$2)-1.0325*diff(y(x), x)+1.36*y(x)=sin(2*x);
solve(de, diff(y(x), x$2));

This expresses the second derivative in terms of y(x) and the derivative of y(x) which you already have from dsolve.

 

First 88 89 90 91 Page 90 of 91