MaplePrimes Questions

Consider this piece of program

restart:
interface(version)
Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 21 2015 Build ID 1097895
with(Units):
a := 3*Unit('m');
                       3 Units:-Unit('m')

I would like to define a new quantity b which is the dimensionless variant of a.
I browsed the Units package to look for a function that would "remove" the dimension of a dimensional quantity like a above (that is to get '3' alone).

As I couldn't find such a function I use to use this workaround.

b := remove(has, a, Unit);
                               3

Is this a robust strategy?
What would you propose to "remove" the dimension of a?

Thanks in advance

I'm trying to get the plot command to display correctly on a logarithmic axis. The calculations in Maple are correct but the plots using logarithmic axis are wrong and start at different points on the x-axis. Is there a way to force Maple to display set points along the axis? e.g. 1, 3, 5, 10 of each logarithmic range. 

Log_plot_example.mw

hi

 Calculate the attached equation with Maple

While I can scroll through the applications if my cursor is on the right.  I can't actually scroll through the applications on screen I keep getting thrown back to the top line. 

It's finicky, somehow managed it to work but it's finicky.  Not as nicely laid out as before.

When running this

expr:=5;
for item in expr do
    print(item);
od;

it prints 5 as expected. When when running

expr:=I;  (* NOTICE this is complex  I not the number 1 *)
for item in expr do
    print(item);
od;

it prints the number 1 and not I

I am sure there is a good reason why this happens.

But what should one do to insure they get the complex I in the second example when iterating over a sum of numbers, which in this example happened to be just one number who is complex? I know I can add explicit check to avoid this edge case.

The problem is that I want to iterate of sum of iterms, One or more of them can be complex I. (it is a result of doing series expansion of function at infinity, and I want to iterate over each term in the series one by one).

expr:=9+I:
for item in expr do
    print(item);
od;

Gives   9,1   and not 9,I

While

expr:=a+I:
for item in expr do
    print(item);
od;

does now give exected output   I,a  and not 1,a

 

What should one do to insure the for loop always get each term in the sum, even if it is complex?

I can't check the item inside the loop, because by then it is too late as the compelx I is lost already.

Is there a better way to iterate over sum of terms and look at each term as is and not lose the complex I in the way?

Maple 2022.1

Update 

For now, I am doing this hack. Since the input is always a sum (with + or - terms), then I convert the input to string, split on delimitors and then parse the entries back to Maple and now it is a list so I can iterate over each term. 

expr:=I+3:
String(expr):
StringTools:-SubstituteAll(%,"+","|+"):
StringTools:-SubstituteAll(%,"-","|-"):
StringTools:-Split(%,"|"):
map(Z->parse(Z),%):
for item in % do
    print(item);
od;

And when expr is

expr:=1+5*I+sin(x)-sqrt(8)*I-a;

It is a hack, but I could not find a relaible way to iterate over each term in the sum of terms without losing the complex I if one term was complex. I need to test this more. It is meant to work only on expression which is sum of terms, which is where I will use it.

Compare the output of the above for expr:=1-I;

The for loop gives 1,-1  but the string hack gives 1,-I which is what I wanted.

Ofcourse the above could fail if there is a "-" or "+" inside the term itself (for example  1+I+sin(1-x) , but this do not happen for the cases I am using this for, which just looking at terms of series expansion around either zero or infinity. These will be just power series terms separated by "+" or possibly "-"

If there is better way do this, that will be great.

 

 

 

When I enter x-y Maple echoes x-y. When I enter y-x Maple echoes y-x. When I enter b - a Maple echoes  b-a.  But when I enter a-b Maple echoes -b + a

I fiind this promotion of negatives, which also occurs in more complicated expression, somewhat confusing.

Is there any description of the rules Maple uses and perhaps ways of controlling them?

Why doesn't 

plot((-2)^x, x = -2 .. 2)

produce anything?

I guess this is some kind of tricky function since for non-integer x it seems not to correspond to a real number.

This came up for me when thinking about a sequence n(c^n), where |c|<1.

Is there some way to plot the values of a sequence? 

Suppose H is a 2*2 matrix and (x0,y0) is the center of an ellipse. We want to draw the ellipse in form of (x-x0,y-y0)H(x-x0,y-y0)^T. 

Equivalently, suppose we use variable P to show both x and y in the vector form. How is it possible to draw P^T H P? I would be thankful if you could give me and example.


 

``

eq1 := -6*sin(theta)*(cos(theta)^2*(diff(n(r, theta), r))*a^3+cos(theta)^2*a^4+3*cos(theta)^2*a^2*r^2+(diff(n(r, theta), r))*a*r^2+2*r^4-n(r, theta)*a*r)/(r^2+cos(theta)^2*a^2)^(3/2) = 0

-6*sin(theta)*(cos(theta)^2*(diff(n(r, theta), r))*a^3+cos(theta)^2*a^4+3*cos(theta)^2*a^2*r^2+(diff(n(r, theta), r))*a*r^2+2*r^4-n(r, theta)*a*r)/(r^2+cos(theta)^2*a^2)^(3/2) = 0

(1)

eq2 := -(6*(cos(theta)^2*sin(theta)*(diff(n(r, theta), theta))*a^3+a^4*r*cos(theta)+2*cos(theta)*a^2*r^3+cos(theta)*r^5+n(r, theta)*a^3*cos(theta)+cos(theta)*n(r, theta)*a*r^2+sin(theta)*(diff(n(r, theta), theta))*a*r^2))/(r^2+cos(theta)^2*a^2)^(3/2) = 0

-6*(cos(theta)^2*sin(theta)*(diff(n(r, theta), theta))*a^3+a^4*r*cos(theta)+2*cos(theta)*a^2*r^3+cos(theta)*r^5+n(r, theta)*a^3*cos(theta)+cos(theta)*n(r, theta)*a*r^2+sin(theta)*(diff(n(r, theta), theta))*a*r^2)/(r^2+cos(theta)^2*a^2)^(3/2) = 0

(2)

pdsolve([eq1, eq2])

{n(r, theta) = (1/2)*(4*r^2+2*a^2*cos(2*theta)+2*a^2)^(1/2)*((Int(-2*((a^4+3*a^2*r^2)*cos(2*theta)+a^4+3*r^2*a^2+4*r^4)/((4*r^2+2*a^2*cos(2*theta)+2*a^2)^(1/2)*(a^2*cos(2*theta)+a^2+2*r^2)*a), r))*sin(theta)+Int(5*(a^2*(-(1/5)*(a^2+4*r^2)^2*cos(3*theta)+(-(3/5)*a^4-(8/5)*r^2*a^2)*cos(5*theta)-(1/5)*a^4*cos(7*theta)+cos(theta)*(a^4+(16/5)*r^2*a^2+(16/5)*r^4))*(4*r^2+2*a^2*cos(2*theta)+2*a^2)^(1/2)*(Int(16*((a^2+3*r^2)*cos(2*theta)+a^2-r^2)/(4*r^2+2*a^2*cos(2*theta)+2*a^2)^(5/2), r))-(16/5)*(a^2+r^2)*((-(1/2)*a^2-2*r^2)*cos(3*theta)-(1/2)*a^2*cos(5*theta)+cos(theta)*(a^2+2*r^2))*r)*a/((4*r^2+2*a^2*cos(2*theta)+2*a^2)^(1/2)*((32*a^4+64*a^2*r^2)*cos(2*theta)+8*a^4*cos(4*theta)+24*a^4+64*r^2*a^2+64*r^4)), theta)+_C1)/sin(theta)}, {n(r, theta) = -(a^2*r+r^3)/a}

(3)

``


 

Download PDE_integral.mw

Hey guys im using maple 2022 with last version of Physics package (version 2022) , I know my question might be stupid but in the following expression 

restart;
with(Physics[Vectors]);
Setup(mathematicalnotation = true);
with(Physics);
Setup(op = {I__b, I__s, Omega, `&omega;_`});
eval(I__b . (diff(`&omega;_`(t), t)), {I__b = <<I__1 | 0 | 0>, <0 | I__2 | 0>, <0 | 0 | I__3>>, `&omega;_`(t) = <omega[1](t), omega[2](t), omega[3](t)>})

I want to get the following as result

but I keep getting the unevaluated one as follows

What am I doing wrong here, 

thanks in advance

 

 

 

i have a problem in an optimzation problem. in the problem using NLPSolve to find the minimum, i have an integration which i use the Int command to be solved in the optimization process, but this error occures: Error, (in Optimization:-NLPSolve) could not store Int(..) in a floating-point rtable 
please help to solve the problem, tnx in advance

restart:with(LinearAlgebra):

N:=3:

m:=Vector([ 1 , log(x+b3) , b2/(x+b3) ]):

A:=m.m^+:

for i to N do
m||i:=eval(A,[x=x||i]);
od:

M:=add(w||i*m||i,i=1..N-1)+(1-add(w||i,i=1..N-1))*m||N:

MM:=( LinearAlgebra:-Trace(MatrixInverse(M)) ):

IF1:=evalf(Int(MM,[b2=1..2,b3=1..2],method = _d01ajc,epsilon=0.001)):

s:= Optimization:-NLPSolve(IF1,w1=0..1,w2=0..1,x1=1..10,x2=1..10,x3=1..10,variables=[w1,w2,x1,x2,x3],initialpoint={w1=0.6,w2=.1,x1=8,x2=7,x3=5},maximize=false,method=modifiednewton)

Error, (in Optimization:-NLPSolve) could not store Int(Int(16.6666666666666679*(-448.000000000000057*ln(7.+b3)*ln(5.+b3)+76.1999999999999886*ln(8.+b3)^2*b3^2+.199999999999999956*ln(8.+b3)^2*b3^4+.399999999999999911*ln(5.+b3)^2*b3^4+527.500000000000000*ln(5.+b3)^2+780.799999999999727*ln(8.+b3)^2+191.100000000000023*ln(7.+b3)^2+89.0999999999999943*ln(5.+b3)^2*b3^2+9.79999999999999893*ln(5.+b3)^2*b3^3+6.39999999999999858*ln(8.+b3)^2*b3^3+400.*ln(8.+b3)^2*b3+12.3000000000000025*ln(7.+b3)^2*b3^2+84.0000000000000142*ln(7.+b3)^2*b3+356.*ln(5.+b3)^2*b3+.600000000000000089*ln(7.+b3)^2*b3^3-1176.*ln(8.+b3)*ln(5.+b3)+280.*ln(8.+b ... 99999999999716*ln(7.+b3)*ln(5.+b3))^2), b2 = 1. .. 2.), b3 = 1. .. 2.) in a floating-point rtable

 

 

Download LinearLog-A-Bayesian_1.mw

"Warning, unable to evaluate 2 of the 6 functions to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct" How to fix it?

mww.mw

Hi, 

everyone! I want to define a function with a constant (i. e., 1/3 in the following figure). Actually, I tried it by "proc" or "piecewise", but it does not work.  So could you give me some suggestions? Thanks a lot!

g:=proc(n+1/4)
  if (n=0) then 1
    else 0
  end;
end proc;

How do i solve nonlinear coupled orinary differential equation with boundary conditions?

restart;
alias(u = u(x, y, z, t), f = f(x, y, z, t));
                              u, f
u := (diff(f, y, x, x, x, x))*f^4-(diff(f, x, x, x, x))*(diff(f, y))*f^3-4*(diff(f, y, x, x, x))*(diff(f, x))*f^3+8*(diff(f, x, x, x))*(diff(f, x))*(diff(f, y))*f^2-4*(diff(f, x, x, x))*(diff(f, y, x))*f^3+12*(diff(f, y, x, x))*(diff(f, x))^2*f^2-36*(diff(f, x, x))*(diff(f, x))^2*(diff(f, y))*f+24*(diff(f, x, x))*(diff(f, x))*(diff(f, y, x))*f^2-6*(diff(f, x, x))*(diff(f, y, x, x))*f^3+6*(diff(f, x, x))^2*(diff(f, y))*f^2-24*(diff(f, x))^3*(diff(f, y, x))*f+24*(diff(f, x))^4*(diff(f, y))+2*(diff(f, y, x, t))*f^4-2*(diff(f, y, x))*(diff(f, t))*f^3-2*(diff(f, x, t))*(diff(f, y))*f^3+4*(diff(f, x))*(diff(f, y))*(diff(f, t))*f^2-2*(diff(f, x))*(diff(f, y, t))*f^3-3*(diff(f, z, x, x))*f^4+3*(diff(f, x, x))*(diff(f, z))*f^3+6*(diff(f, x))*(diff(f, z, x))*f^3-6*(diff(f, x))^2*(diff(f, z))*f^2;

First 270 271 272 273 274 275 276 Last Page 272 of 2427