MaplePrimes Questions

Hi

I have constructed a model of an UR5e in maplesim with the hop to be able to test my controller writen in python on it. 

I hope to be able from the model to

  • Enter a tourqvalue for the joints.
  • Extract joint angles, joint velocitys as well as the forces and tourqes that affects the end effector.
  • (If posible) visualize the sumulated robot arm so I can se that the motion reflects that of the real robot arm.

the simulated robot arm 

The question is how to best do this in a semi realtime way?

I have been looking into generating a FMU but if there are other ways to do this, then I am open to ides. 

The contorller is based on a haptic algoritm for connecting two robot arms and I will only get one robot arm due to prise and space constraints.

This means that I will reseave realtime information from the real robot arm into my python controller that then i supose to take inforamtion from the simulated arm and with information from both arms calculate the tourqe values for both arms joints. 

 

Thanks in advance for all youre help

Eric Ragnarsson

Any idea why

if 2+89^(1/2)>0 then
   print("yes");
else
   print("no");
fi;

gives

Since 

evalf(2+89^(1/2))

is 11.4339.

 

I tried in Mathematica, and it works there

If[2 + 89^(1/2) > 0, Print["Yes"], Print["No"]]

What is the correct way to do this in Maple? i.e. to check that a numerical value is >0 ?

This is done in code, where the value I am doing this check on are known to be numeric, but I do not know what form they will be, I just know they will contain no floating point numbers. Only exact numbers.

The problem is the 89^(1/2). Maple knows it is >0 

is(89^(1/2)>0)

        true

but 

if (89)^(1/2)>0 then
   print("yes");
else
   print("no");
fi;

May be because 89 is prime. Should I replace my if with is for this check? 

interface(version)
Standard Worksheet Interface, Maple 2020.1, Windows 10, July 30 

   2020 Build ID 1482634


Physics:-Version()
The "Physics Updates" version in the MapleCloud is 867 and is 

   the same as the version installed in this computer, created 

   2020, November 12, 9:14 hours Pacific Time.


 

 

Hi, 

I often need to draw several curves on the same figure and the question of which colors to choose to distinguish them is crucial. 
In particular when these curves depend on a parameter I would like to color them by using a "regular" change of color.
The trick I use is this one
 

# here I want to plot N=10 different curves

N := 10:

# step 1: generate a list of colours using colorscheme
# (I was hoping for 10 levels of colors but I got 19)

plot(x, x=0..1, colorscheme=["Gold", "Blue"], numpoints=N):
MyColors := op([1,2, 2], %);
M := numelems(MyColors[..,1]);

# step 2: do the plots of interest, for instance

plots:-display(
  seq(
    plot(m*x^2, x=0..1, color=ColorTools:-Color([entries(MyColors[round(m/N*M)], nolist)])), 
    m=1..N
  )
);

My question is: How can we make that MyColors be a matrix whose the number of rows equal N (this to avoid the round(m/N*M) operation)?
(I will accept any other strategy)

Thanks in advance

I am wondering if there are examples of agent-based models in economics domain that have been implemented in Maple.

Any infomration/source is more than welcome!

 

Thanks in advance

I actually want to numerically solve Karhunen-Loeve Decomposition, which is reduced to homogenous Fredholm integral equation second kind when the kernel is the function of correlation of variables, by using any procedures (Galerkin is better if it is availabe). FYI, with "intsolve" I just got f(x)=0. 

The uploaded worksheet contains a copy of figure of a pencil from a geometry book, followed by a failed attempt to code Maple to produce the same figure.

The book containing the figure gives no indication of how to code for the figure. Can the figure be produced in Maple?

Respondents will have to establish their own path to DirectSearch.

Pencil.mw

I have Maple solve a system of equations.  I then want to assign the result to the different variables for use later in the worksheet.  How do I do this?
 

 

{C1 = .6666666670*Ceq, C2 = 2.000000002*Ceq, L1 = 0.1377592863e-15/Ceq, R1 = 0.8802817643e-8/Ceq}

(24)

c1 := sol3[1]

C1 = .6666666670*Ceq

(25)

l1 := sol3[2]

C2 = 2.000000002*Ceq

(26)

r1 := sol3[3]

L1 = 0.1377592863e-15/Ceq

(27)

Solutions, C2=10pf

Ceqsol := 20*e-12

20*e-12

(28)

C1sol := subs(Ceq = Ceqsol, c1)

C1 = 13.33333334*e-8.000000004

(29)
 

 

 


First, all I want to do is assign the solution value for C1 to C1.  Not being able to do this, I try to assign C1 to "different" variable c1, but the assignment is C1~=.66667* Ceq, instead of just the value of C1.  Later, I then try to substitute the value of Ceq, to get the solution for c1, and instead of just getting the value, I get  that C1= 13.33x10^-8 is assigned to C1sol, again instead of just the value, 13.33x10^-8.  How do I just assign the values to these variables instead of the expressions?

 

Thank you.

Download new_filter_solution.mw

i have ode system of two dependent variables y and x  and one independent varibale time. how can i find explicit expression between y and x? 

 

restart

sys:=diff(x(t),t)=x(t)*y(t)+t,diff(y(t),t)=x(t)-t;

diff(x(t), t) = x(t)*y(t)+t, diff(y(t), t) = x(t)-t

(1)

dsolve([sys,x(0)=0,y(0)=1],[x(t),y(t)],series)

{x(t) = series((1/2)*t^2+(1/6)*t^3+(1/24)*t^4-(1/24)*t^5+O(t^6),t,6), y(t) = series(1-(1/2)*t^2+(1/6)*t^3+(1/24)*t^4+(1/120)*t^5+O(t^6),t,6)}

(2)

 

 

 


 

Download explicit.mw

I am a newbie in Maple! I tried both ThermophysicalData and its CoolProp package to find saturation pressure of vapor for given air-water mixture temperature.

I want to calculate water vapor density in air or simply Absolute humidity (kg/m3)

But i can not see any meaningful function or combination of functions/properties in CoolProp to give such output.

P_w in CoolProp, HApropSI takes this as input only that is not usefule either way inpoutput

The rationale is to work from RH and then calculate P_w as output: P_w=RH x P_g where P_g is vapor saturation pressure at the given ambient condition.

From there all world is yours!

You can use ideal gas rules to do everything. But i cant use CoolProp to calculate the ABsolute humidty for given RH and ambient condition.

 

Note that clearly i can calculate all these from hand calculation as well as approximation formuale of Clausius-Clapeyron equation. But i wanted to do in Maple with its packages.

 

Any help is appreciated!?

Regards

Sina

 

 

Dear there,

I want to create a new package. 

Goal of the package:

I have two functions psi(n,m,x) and w(n,x).

 

These functions are defined differently in case A, and in case B

 

In my future works,

I want to use the functions psi(n,m,x) and w(n,x) in ONE (same) worksheet by calling the package.

 

Case A;

 K:=2^(k-1):
with(orthopoly): 
psi:=(n,m,x)->piecewise((n-1)/K <= x and x <= n/K,
(sqrt((m+1/2)*2^k))*LegendreP(m,2^k*x-2*n+1), 0);   
w:=(n,x)->1;  
 

 

Case B;

K:=2^(k-1):
with(orthopoly):
unprotect(gamma):
h:=(m,epsilon,gamma)->2^(epsilon+gamma+1)*GAMMA(epsilon+m+1)*GAMMA(gamma+m+1)/((2*m+1+epsilon+gamma)*m!*GAMMA(epsilon+gamma+1));


psi:=(n,m,x)->piecewise((n-1)/K <= x and x <= n/K,  2^(k/2) *h(m,epsilon,gamma)*simplify(JacobiP(m,epsilon,gamma,2^(k)*x-2*n+1)), 0); 
  

w:=(n,x)->(1-x)^(epsilon)*(1+x)^gamma; 

How can we achieve this in the simplest way?

 

MY TRY: (Please click to download the code.mw)

test:=module()
export functionA,functionB;
 option package;


######################################################
functionA:=proc(k,M) local K,h,psi,w; 
K:=2^(k-1):
with(orthopoly): 
psi:=(n,m,x)->piecewise((n-1)/K <= x and x <= n/K,
(sqrt((m+1/2)*2^k))*LegendreP(m,2^k*x-2*n+1), 0);   
w:=(n,x)->1;   
return psi(n,m,x) ,w:
end proc:
######################################################


functionB:=proc(k,M,epsilon,gamma) local K,h,psi,w; 
K:=2^(k-1):
with(orthopoly):
unprotect(gamma):
h:=(m,epsilon,gamma)->2^(epsilon+gamma+1)*GAMMA(epsilon+m+1)*GAMMA(gamma+m+1)/((2*m+1+epsilon+gamma)*m!*GAMMA(epsilon+gamma+1));


psi:=(n,m,x)->piecewise((n-1)/K <= x and x <= n/K,  2^(k/2) *h(m,epsilon,gamma)*simplify(JacobiP(m,epsilon,gamma,2^(k)*x-2*n+1)), 0); 
  

w:=(n,x)->(1-x)^(epsilon)*(1+x)^gamma;   
return psi(n,m,x),w(n,x):
end proc:
######################################################

end module;


savelib(test):


# FOR EXAMPLE
restart:
with(test);

#For k=2,M=3 in FunctionA, let's calculate values of "Psi(2)" and "w(2,x)"
k:=2:
M:=3:
K:=2^(k-1):
N:=K*M:
(psi,w):=functionA(2,3):
psi:=(n,m,x)->psi; 
w:=(n,x)->w;
unprotect(Psi):
Psi:=x->Array([seq(seq(psi(i,j,x),j=0..M-1),i=1..K)] )^+:
Psi(2);
w(2,x);


#Now, let's calculate values of "Psi(2)" and "w(2,x)" For  k=3,M=4, epsilon=1, gamma=2 in FunctionA 

 (psi,w):=functionB(3,4,1,2):
Psi(2);
w(2,x);

 

 

 

Hi,
Please see the attached file. 

s1.mw

Hi, I hope your going well

 

I was wondering if i can index my matrix column like in the image below and if i can replace u(1) for is estamted value

 

 

 

 

Thank a lot <3

 

 

 

 

 

 

 

 

 

How do I get Maple to simplify:

 

Io := I Cp Vin L1/(M sqrt(Cp L1))

 

to :  I sqrt(L1 CP) Vin/ M  ?

 

Furthermore, if  w = 1/sqrt(L1 *CP),  how do I get Maple to display the solution or the simplification as:

I*Vin/(w M) ?

I've t ried multiple substitutions and simplifications to no avail.

 

Thank you.

Jorge

 

I*Cp*RL*Vin*L1/(M*(Cp*L1)^(1/2))

(4)

simplify(I*Cp*RL*Vin*L1/(M*(L1*Cp)^(1/2)), 'symbolic')

I*Cp^(1/2)*RL*Vin*L1^(1/2)/M

(5)

 

NULL

Io := Vores/RL

I*Cp*Vin*L1/(M*(Cp*L1)^(1/2))

(6)

simplify(I*Cp*Vin*L1/(M*(L1*Cp)^(1/2)))

I*Cp*Vin*L1/(M*(Cp*L1)^(1/2))

(7)

simplify(I*Cp*Vin*L1/(M*(L1*Cp)^(1/2)), 'assume = real')

I*Cp*Vin*L1/(M*(Cp*L1)^(1/2))

(8)

combine(Vores/RL, power)

I*Cp*Vin*L1/(M*(Cp*L1)^(1/2))

(9)

factor(I*Cp*Vin*L1/(M*(L1*Cp)^(1/2)))

I*Cp*Vin*L1/(M*(Cp*L1)^(1/2))

(10)

combine(I*Cp*Vin*L1/(M*(L1*Cp)^(1/2)), radical)

I*Cp*Vin*L1/(M*(Cp*L1)^(1/2))

(11)

I*Cp*Vin*L1/(M*(L1*Cp)^(1/2))

cancel(I*Cp*Vin*L1/(M*(Cp*L1)^(1/2)))

(12)

simplify(cancel(I*Cp*Vin*L1/(M*(L1*Cp)^(1/2))), 'assume = real')

I*Cp*Vin*L1/(M*(Cp*L1)^(1/2))

(13)

simplify(I*Cp*Vin*L1/(M*(L1*Cp)^(1/2)), 'radical')

I*Cp*Vin*L1/(M*(Cp*L1)^(1/2))

(14)

simplify(I*Cp*Vin*L1/(M*(L1*Cp)^(1/2)), 'symbolic')

I*Cp^(1/2)*Vin*L1^(1/2)/M

(15)

``


 

Download Resonant_xformer.mw

 

Sometimes I find Maple a bit unconsequent regarding indexing, some things start with 0, others with 1.

The ReplaceChild function clearly starts with 1 for example, as you see in the help function.

ReplaceChild( 2 = XMLElement( "NEW", [], "text" ), doc )

replaces the second element in the list.

When using the AddChild function, one has to enter 0.

The AddChild(xmlTree, child, n) command creates a new XML element from xmlTree by inserting the XML element child at the position indicated by n. Parameter n must be less than or equal to the number of children in the original tree xmlTree. The new child node child becomes the n + 1st child of the resulting tree.

The first sentence sounds logical, but I would then expect the position of the first element to be 1. The other 2 sentences in the help file contradict the first one in my opinion. Either the position of the element is 0, as stated in the first sentence - then it also should be possible to get its value in the position 0. Or it is 1, but then it also should have been defined at position 1.
 

First 443 444 445 446 447 448 449 Last Page 445 of 2393