awass

321 Reputation

10 Badges

20 years, 61 days

MaplePrimes Activity


These are replies submitted by awass

@Carl Love That clears things up; thank you.

@Kitonum Thanks for your response.

I understand now that evalc is the command I need and that does in fact do the job.

 

However, the solution expand(Re((2-I*X)^4)) assuming X::real; is very mysterious.
(Note Re(expand(((2-I*X)^4)) assuming X::real; also works. )

It tells Maple to take the real part of the expression and then expand it? Whats to expand? After the real part has been taken the job is done. My alternative, to expand and then take the real part makes more sense. I wonder what Maple is doing.

@Rouben Rostamian  Thanks for your response. The transform command is exactly what is needed.

@Markiyan Hirnyk Thanks for your response. It is true that you  can(usually) break up the original curve into pieces that can be paramterized and then use that paramter together with parameterplot. And as you show, it can be quite a bit of work to pull t off. Furthermore, a curve might have places that cannot be so paramterized. The transform command takes care of thses problems directly.

@Markiyan Hirnyk

Sorry if that was not clear.

Let me try an example in 2 dimensions-there is less typing.
 

Suppose we have curve C given implicitly by the equation. s^6 + s t^5 + t^8 =1 or some such. Suppose also we have functions x(s,t), y(s,t) given by some equations like x= t cos(s+t^2) , y= s^3-sin(t). Can I plot the curve x(s,t), y(s,t) for (s,t) in C?

My previous example was in 3 variables and I had k(r,a,b) = 0 which defines a surface S.  The function k was complicated: r sqrt(1-r^2)( cos a cos b) etc I  wanted to plot a surface in x,y,z space where x = x(r,a,b) was a bit complicated. Sorry if that was not clear.

 

the equation k is x1 x2 - y1 y2 = 1/4  in 4 space variables.

The surface lies on a sphere of radius 1 so x1^2+x2^2+y1^2+y2^2=1.

 

One cannot plot in 4 space so I wrote x1= r cos a, y1=r sin a,

x2= sqrt(1-r^2) cos b, y2= sqrt(1-r^2) sin b and plugged that in to get a function K(r,a b ) =1/4.

(Note that this reduces the number of variables to 3.)

My intention was then to take the r,a,b values from the implicit3d plot and plot3d those using 

x1= r cos a, y1=r sin a,

x2= sqrt(1-r^2) cos b, y2= sqrt(1-r^2) sin b. Hence my question.

 

I say that I wanted to plot that but there is a simple workaround, namely

I project to R^3 stereographically via
x=x1/(1-y2), y=y1/)1-y2), z=2x2/(1-y2)

Then  I can express k interms of x,y,z  via s = x^2+y^2+z^2, x1= = 2x/(1+s), y1= = 2y/(1+s), y1= = 2z/(1+s), y2=( -1+x^2+y^2+z^2)/(1+s) to get an equation in K(x,y,z) = 1/4 and implicit3d plot that directly.

But since the issue came up I thought I'd ask.

@Joe Riel Strange. Perhaps I have a corrupt copy. The problem repeats with many variations.
When I enter type(w,Vector) I get false so perhaps that is why w2.w hangs.

@Carl Love That certainly is easy; thank you.

I was wondering why Maple does not do that automatically.



 

restart;
with(VectorCalculus):with(LinearAlgebra):
g:=(x,y)->A*x+B*y+a*x^2+b*x*y+c*y^2+d*x^3+h*x^2*y+k*x*y^2+l*y^3;
w:=Gradient(g(x,y),[x,y]);
w2:=Hessian(g(x,y),[x,y]);
w2.w;  # This fails every time

 

 

@Carl Love Also, the local t; can be omitted:

alpha3:= proc(x::numeric) 
     evalf(Int(sin(t^3)*cos(t^2), t= 0..x))
end proc:

or even

alpha5:=(x::numeric) -> evalf(Int(sin(t^3)*cos(t^2), t= 0..x)):

Both work but require quotes in dsolve and plot.

@Carl Love Thank you for pointing out that my post belongs under questions and thank you for answering my question.

Your solution does work. It can be simplified a bit to
alpha2:= proc(x::numeric) 
local t;
     evalf(Int(sin(t^3)*cos(t^2), t= 0..x))
end proc:

Sol:= dsolve({diff(y(x), x) = 'alpha2(x)'*y(x), y(0)=1}, numeric, known= [alpha2]);

The if statement is replaced by testing the argument with :: numeric and quoting the function in dsolve or when plotting.

Curiously, the if statement and testing the argument with :: numeric both result in a function that Maple cannot differentiate.

BTW, what does numeric signify? How does it differ from realcons or real? I know that "real" is an assumption one can make and "realcons" is a type; how does numeric fit into that lineup?

 

thanks again

@Carl Love Thank you for the explanation.

Is &where mostly for Maple staff or is it intended to be used by all? If the latter, it would be nice to see examples of its use. The showstat(`&where`) code was far from clear to me. (It referred to local variables only and not to any input as far as I could see.)

@Carl Love 

 

Hi,

I have searched in vain for information about the expression &where. Can you help?

 

many thanks

@Preben Alsholm THank you for your clear explanation of piecewise.

 

As to Maple "knowing" about laplace I meant that when dsolve is called with  my linear ODE system with constant coefficients and initial conditions it takes what seems like forever to find a solution without my hint (method = laplace). I would think method = laplace might be the default.

@Carl Love 

OK Here is the code. Thx
restart;
Typesetting[Settings](useprime,prime = t);
                            true, x


R := piecewise(t < 0.1e-7, 57, t > 0.1e-7, 57-48*exp(-t+0.1e-7)/(0.1e-7));


print(`output redirected...`); # input placeholder
 R :=  /                                                    -8
       |                  57                        t < 1 10  
      <                                                       
       |                    9    /         -8\          -8    
       \ 57 - 4.800000000 10  exp\-t + 1 10  /      1 10   < t


dsolve({diff(y(t), t)-R(t)*y(t)^2 = 0, y(0) = 1}, numeric);
%;
Error, (in unknown) invalid input: `dsolve/numeric/lexorder` expects its 2nd argument, b, to be of type {indexed, name, numeric}, but received piecewise(t < 0.1e-7, 57, 0.1e-7 < t, 57-4800000000.*exp(-t+0.1e-7))


dsolve({diff(y(t), t)-R(t)*y(t)^2 = 0, y(0) = 1}, numeric);
%;
Error, (in unknown) invalid input: `dsolve/numeric/lexorder` expects its 2nd argument, b, to be of type {indexed, name, numeric}, but received piecewise(t < 0.1e-7, 57, 0.1e-7 < t, 57-4800000000.*exp(-t+0.1e-7))


dsolve({diff(y(t), t)-7*y(t) = R(t), y(0) = 1}, numeric);
%;
Error, (in unknown) invalid input: `dsolve/numeric/lexorder` expects its 2nd argument, b, to be of type {indexed, name, numeric}, but received piecewise(t < 0.1e-7, 57, 0.1e-7 < t, 57-4800000000.*exp(-t+0.1e-7))




4 5 6 7 8 9 10 Page 6 of 10