Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

In this example, i have a top module A. Inside it, I have module named my_RECORD (which happened to be option object) that I want to return back to caller when they call a proc.

Maple allows me to declare the proc to return my_RECORD. No problem., But when making a local variable inside the proc and using o::my_RECORD it complains  that my_RECORD does not exist. 

The solution is to change o::my_RECORD to o::A:-my_RECORD

My question why it did not complain the same way on the return value on the proc?   for me, they are both semantically the same. One says the proc returns this type, and the other says the local variable is this type. So why had to do A:-my_RECORD on one but not the other? 

Here is an example. Maple 2021.2 on windows 10.

restart;

interface(warnlevel=4);
kernelopts('assertlevel'=2):

3

A:=module()
 #this is the RECORD to return
  local module my_RECORD()
   option object;
   export data::string:="";
  end module;
   
  export do_analysis:=proc()::my_RECORD;   
    local o::my_RECORD; #error here. But this is the same above line above?    
    o:=Object(my_RECORD);
    o:-data:="test";
    return o;        
  end proc;
end module;

_m2642451182336

A:-do_analysis()

Error, (in do_analysis) type `my_RECORD` does not exist

#FIXED BELOW
restart;

A:=module()
    #this is the RECORD to return
    local module my_RECORD()
        option object;
        export data::string:="";
    end module;
   
    export do_analysis:=proc()::my_RECORD;
          local o::A:-my_RECORD;    
          o:=Object(my_RECORD);
          o:-data:="test";
          return o;        
    end proc;
end module;

_m2642339719872

A:-do_analysis()

module my_RECORD () export data::string; option object; end module

 

Download A_no_lib.mw

As maple 1d input:

expr:=(1/2)*a*(b/c)/d;     

As 2 d input : 

This rightside of the equation i like to get in Maple , but how?

answer

I have a very simple task:

convert([a,b],`*`)

the result is of course a*b.  However if I load the Physics package beforehand, that is,

with(Physics)
convert([a,b],`*`)

the followinkg error shows up:

Error, unrecognized conversion: Physics:-`*`

I have read that the Physcs package redefines the mutiplication. This must be the source of the problem.
But how can I proceed. I need to do this task with the Physics package loaded. 
Any help will be appreciated! 

Hello everyone, I'm trying to interpolate a function using the roots of a Chebyshev polynomial as interpolation points, and then compute the absolute error. I want to compute that error via numerical integration, however, Maple is returning the expression of the integration itself. Why is that?

This is the code I'm using:

with(CurveFitting):

u := x -> exp(1/2*x^2 - 1/2):

r := evalf(allvalues(RootOf(ChebyshevT(5, x), x))):
points := Vector(5, i -> r[i]):
u_points := Vector(5, i -> u(points[i])):

P__2 := PolynomialInterpolation(points, u_points, x):

evalf(int(abs(u(x) - P__2), x = -1 .. 1))

This is the result:

I often create diagrams in Maple and export them so I can embed them in a Word Doc.  Lately, when I right-click on the picture so I can select "export," the entire program closes.   It seems to happen more when the picture is in 3D.   Am I doing something wrong?     Thanks.

           David

This is the graph I want but Nb must be equal to Nt. I should get values -diff(theta(eta), eta) for Bi or Nt Nb first?

BiNbNtxx.mw

Dear Users!

Hope everyone is fine here. Let me explain my problem first for this consider
diff(Y(xi), xi) = mu*(1-Y(xi)^2)
Then the derivative of a function U=u(Y(xi)) using chain rule (and expression menstiones as red) is given as,
diff(U, xi) = (diff(diff(Y, xi), Y))*U and (diff(diff(Y, xi), Y))*U = mu*(1-Y(xi)^2)*(diff(U, Y))
Similarly the second-order derivaitve of U=u(Y(xi)) using chain rule (and expression menstiones as red) is given as,
((ⅆ)^(2))/(ⅆ xi^(2))U=(ⅆ)/(ⅆ xi)(mu (1-Y^(2)(xi))*(ⅆ)/(ⅆ Y)U)=((ⅆ)/(ⅆ Y)*(ⅆ)/(ⅆ xi)Y)(mu (1-Y^(2)(xi))*(ⅆ)/(ⅆ Y)U)=(ⅆ)/(ⅆ Y)(mu^(2) (1-Y^(2)(xi))^(2)*(ⅆ)/(ⅆ Y)U)=-2 Y(xi) mu^(2) (1-Y^(2)(xi))*(ⅆ)/(ⅆ Y)U+ mu^(2) (1-Y^(2)(xi))^(2)*((ⅆ)^(2))/(ⅆ Y^(2))U;
In the similar way I want to compute the higher-order (like 5th order) derivaitve of U w.r.t. xi using the chain rule  (and expression menstiones as red) explained in above. Kindly help me soolve my problem

I am waiting for positive response.

Hi there!

I need a function that receives a function of several complex variables f(z), z=z_1,...z_n as an argument and returns its decomposition into its real and imaginary parts as functions of real variables: f(z)=u(x,y)+i*v(x,y).

Here is my Maple code for the case of two complex variables z_1, z_2:

UV:=proc(f, n) #second argument n is a number of variables
  local i, X, Y, XY, w, u, v:
  X:=[seq(x[i], i=1..n)]: # Create lists of real variables x_j, y_j
  Y:=[seq(y[i], i=1..n)]:
  XY:=zip((a,b)->a+I*b, X, Y): # Create a list of x_j + I * y_j
  map(a -> assume(a, real), X): # assume all x_j, y_j are real
  map(a -> assume(a, real), Y):
  w:=f(op(XY)): # substitute x+iy into f(z)
  u:=Re(w):
  v:=Im(w):
  return([u, v]):
end proc:

To call the function, I need to type something like this:
UV((z1,z2) -> exp(z1+z2), 2) 

The trouble I have is when I try calling this function inside another function that receives as arguments n functions of n complex arguments, in other words, it receives two lists, say: Z:=[z_1,...z_n], F:=[f_1,...f_n]. At some point, I need to decompose each f_j into its real and imaginary parts but unfortunately calling UV inside this function neither accepts lists
UV(Z -> f_j, n)
nor it understands something like
UV(op(Z) -> f_j, n) or UV((op(Z)) -> f_j, n).

Maybe my approach to this problem is incorrect from the very beginning, but I don't see any other acceptable ways to do it. Can anybody help me?

  • How to get the ln(z) 3d plot example in the FunctionAdvisor /plot ?
  • a table plot, to show different plots together 

I do not understand why  simplify(eq,size,assume =t::real); gives an error but simplify(eq,size) assuming t::real; does not.

Which is the correct way to use assumptions with simplify? Inside or outside? And why would it make a difference?

Maple 2020.2 on windows 10.

interface(version);

`Standard Worksheet Interface, Maple 2021.2, Windows 10, November 23 2021 Build ID 1576349`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1122 and is the same as the version installed in this computer, created 2021, December 22, 16:3 hours Pacific Time.`

restart

eq:=t = 1/2*Int(1/ln(exp(t^2-2*t*y+y^2))^(1/2)/exp(t^2-2*t*y+y^2)/(exp(t^2-2*t*y+y^2)-1),exp(t^2-2*t*y+y^2))+c[1];
simplify(eq,size,assume =t::real);
 

t = (1/2)*(Int(1/(ln(exp(t^2-2*t*y+y^2))^(1/2)*exp(t^2-2*t*y+y^2)*(exp(t^2-2*t*y+y^2)-1)), exp(t^2-2*t*y+y^2)))+c[1]

Error, (in assuming) when calling '`anonymous procedure called from tools/recurse/indets`'. Received: 'invalid input: `simplify/int/simplify` expects its 3rd argument, r, to be of type {name, list({range, name = range}), name = anything}, but received exp((t-y)^2)'

simplify(eq,size) assuming t::real;

t = (1/2)*(Int(1/(ln(exp((y-t)^2))^(1/2)*exp((y-t)^2)*(exp((y-t)^2)-1)), exp((y-t)^2)))+c[1]

 

I know the above inert int looks strange, but this is why it is inert. Later on there will be change of variable to make the integration variable a single symbol again as in normal integration usage.

Download simplify_error.mw

Equação26_12.mw

Download Equação26_12.mw

Hello!

How can i get datas and graphs of implicit function. I tried...

with(DEtools, odeadvisor);

ode := diff(y(x), x) = (-0.1*(y(x) - 0.7)^3 - 0.8*y(x)*(y(x) - 0.7)^2)/(0.7^2 - 2*0.7*y(x) + y(x)^2 - 0.7*0.2*0.8);
                                    3                        2
         d         -0.1 (y(x) - 0.7)  - 0.8 y(x) (y(x) - 0.7) 
 ode := --- y(x) = -------------------------------------------
         dx                                        2          
                            0.378 - 1.4 y(x) + y(x)           
odeadvisor(ode);
          /                            3                        2\
          | d         -0.1 (y(x) - 0.7)  - 0.8 y(x) (y(x) - 0.7) |
odeadvisor|--- y(x) = -------------------------------------------|
          | dx                                        2          |
          \                    0.378 - 1.4 y(x) + y(x)           /
ans := dsolve(ode, implicit);
                2        9                    199                
ans := x + ----------- + -- ln(10 y(x) - 7) + --- ln(90 y(x) - 7)
           10 y(x) - 7   28                   252                

   + _C1 = 0
ic1 := y(0) = 0;
                        ic1 := y(0) = 0
sol := dsolve([ode, ic1], implicit);
                2        9                    199                
sol := x + ----------- + -- ln(10 y(x) - 7) + --- ln(90 y(x) - 7)
           10 y(x) - 7   28                   252                

     2   10         10         
   + - - -- ln(7) - -- I Pi = 0
     7   9          9          
subs(x = 1, sol);
   9        2        9                    199                
   - + ----------- + -- ln(10 y(1) - 7) + --- ln(90 y(1) - 7)
   7   10 y(1) - 7   28                   252                

        10         10         
      - -- ln(7) - -- I Pi = 0
        9          9          
solve(9/7 + 2/(10*y(1) - 7) + (9*ln(10*y(1) - 7))/28 + (199*ln(90*y(1) - 7))/252 - (10*ln(7))/9 - 10*I*Pi/9 = 0, y(1));
1     /      /                                                  
-- exp|RootOf|-280 I Pi exp(_Z) - 280 ln(7) exp(_Z) + 15680 I Pi
90    \      \                                                  

          /1           56\                                       
   + 81 ln|- exp(_Z) - --| exp(_Z) + 199 _Z exp(_Z) + 15680 ln(7)
          \9           9 /                                       

                          /1           56\                   \\
   + 324 exp(_Z) - 4536 ln|- exp(_Z) - --| - 11144 _Z - 13608||
                          \9           9 /                   //

     7 
   + --
     90
implicitplot(sol, x = 0 .. 10, y = 0 .. 10);
                /         2        9                 
    implicitplot|x + ----------- + -- ln(10 y(x) - 7)
                \    10 y(x) - 7   28                

         199                   2   10         10           
       + --- ln(90 y(x) - 7) + - - -- ln(7) - -- I Pi = 0, 
         252                   7   9          9            

                              \
      x = 0 .. 10, y = 0 .. 10|
                              /
but I wasn't successful.

Thanks

Thank you everyone!

I am trying to solve an ODE with nonlinear boundary conditions, it is a BVP. And the maple let me to specify an approximate initial solution. I just don't know how to define the initial solution. What format is the initial solution? I have tried the Help Document told me to, but I still can't figure it out. Please help me, thank you!

In

I want to compute x__0 as a function of alpha. I tried fsolve but could not make it work (see attached).

What did I do wrong? Are there other ways in Maple to solve such problems?

I am stuck here and would very much appreciate help.

inverse_function_with_fsolve.mw

Update:

Its likely that the recently introduced warnings for definite integrals would have helped in this case to find a solution on my own. When I run this worksheet with Maple 2023, it immediately suggests the use of assumptions.

Hi everyone. 

I need a program in maple to simulate the orbit of a satellite slowed down by the earth's atmosphere.

I chose the simple case, in which the orbits of the two are elliptical and I use The animation to do this. In this case I did not consider that the satellite interacts with the atmosphere.

Now,  I need equations to write part of the program in which I think the satellite is slowed down by the earth's atmosphere. I don't have any ideea to resolve this problem.

Soo.. I really need your' help as soon as posible.

Thank you a lot! 

Dear Users!

Hope you are doing well. I have a funtion give bellow:
beta[1]*exp(x*alpha[1]+y*beta[1]-z*sqrt(-alpha[1]^2-beta[1]^2))/(1+exp(x*alpha[1]+y*beta[1]-z*sqrt(-alpha[1]^2-beta[1]^2)));
For any value of alpha[1] and beta[1] the term highlighted red becomes the imaginary form. I want to separate the real and imaginary parts of this function. Kindly help me in this matter, thanks

First 228 229 230 231 232 233 234 Last Page 230 of 2097