Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

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

 

I created a little procedure to automatically size text areas based on content. It sizes the text area based on wraparound and tab characters, something that the autosize for the code edit region does not do. (Hint to Maple developers)

Enjoy.

    AutosizeTextArea:=proc(TextAreaName, {intMinRows::nonnegint:=5, intMinChars::nonnegint:=50, intMaxChars::nonnegint:=140})
        description "Autosizes the TextArea based on content",
                  "Parameters",
                  "1) TextAreaName__The name of the textarea",
                  "Optional Parameters",
                  "intMinRows________Minimum number of visible rows",
                  "intMinChars_______Minimum character width",
                  "intMaxChars_______Maximum character width";
        uses DocumentTools, StringTools;          
        local strLines, intLongestLine, nLines;
        strLines := Split(GetProperty(TextAreaName,'value'),"\n");
        intLongestLine := max('numelems'~(strLines));
        # Count the characters in each line (add 7 extra characters for each tab). Determine the number of lines to display each line due to wraparound, then add all these together
        #   to determine the number of rows to display.
        nLines := add(ceil~(('numelems'~(strLines) + StringTools:-CountCharacterOccurrences~(strLines, "\t")*~7)/~intMaxChars));
        SetProperty(TextAreaName, 'visibleRows', max(nLines, intMinRows), 'refresh' = true);
        SetProperty(TextAreaName, 'visibleCharacterWidth', min(max(intLongestLine, intMinChars),intMaxChars), 'refresh' = true);
    
    end proc:

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.
 

restart;
deq1 := diff(u(x, y), x) - diff(u(x, y), y$2) = exp(x+y);
                              /  2         \             
              / d         \   | d          |             
      deq1 := |--- u(x, y)| - |---- u(x, y)| = exp(x + y)
              \ dx        /   |   2        |             
                              \ dy         /             

deq2 := diff(u(x, y), x) - diff(u(x, y), y$2) = exp(1)^(x+y);
                            /  2         \                  
            / d         \   | d          |           (x + y)
    deq2 := |--- u(x, y)| - |---- u(x, y)| = (exp(1))       
            \ dx        /   |   2        |                  
                            \ dy         /                  

pdsolve(deq1, u(x,y));  ### no result
pdsolve(deq2, u(x,y));
                        /                                        
                        |                                        
PDESolStrucApplyFunction|uApplyFunction(x,y)=_F1ApplyFunction(x)
                        \                                        

                        1
  _F2ApplyFunction(y) - -
                        2

                       x+y                                                                                   
  (expApplyFunction(1))    (_C1 expApplyFunction(uminus0y)+_C2 expApplyFunction(y)+_C3 expApplyFunction(y) y)
  -----------------------------------------------------------------------------------------------------------
                                            _C3 expApplyFunction(y)                                          

  ,[{diffApplyFunction(_F1ApplyFunction(x),x)=_c[1] _F1

  ApplyFunction(x),diffApplyFunction(diffApplyFunction(_F2

                                                    \
                                                    |
  ApplyFunction(y),y),y)=_c[1] _F2ApplyFunction(y)}]|
                                                    /

No solution appears when the differential equation is expressed in standard form, but when exp(x + y) is converted to

exp(1)^(x + y) the correct solution appears.

 

Can anyone help with forcing this to simplify

assume(x>0)

assum(y>0)

simplify(sqrt(-x^2-y^2))

I am looking for this to force the sqrt to return as the imaginary number multiplied by the square root of x^2+y^2

simplify(sqrt(-x^2)) does simplify as far as bringing in the imaginary number 

Many thanks

Hello
I solved an equation using Maple . but in answer there is RootOf statement that I can't change to a simple statement without RootOf.

restart

``

``

((Lr2*(vo+vs)*sqrt(Lr1*Lr2)+vo*Lr1*sqrt(Lr1*Lr2))*sin(t*sqrt((Lr1+Lr2)/(Lr1*Lr2*cr)))*sqrt(cr*(Lr1+Lr2))+vs*t*Lr1*(Lr1+Lr2))/((Lr1+Lr2)^2*Lr1)

((Lr2*(vo+vs)*(Lr1*Lr2)^(1/2)+vo*Lr1*(Lr1*Lr2)^(1/2))*sin(t*((Lr1+Lr2)/(Lr1*Lr2*cr))^(1/2))*(cr*(Lr1+Lr2))^(1/2)+vs*t*Lr1*(Lr1+Lr2))/((Lr1+Lr2)^2*Lr1)``

(1)

eq := ((Lr2*(vo+vs)*sqrt(Lr1*Lr2)+vo*Lr1*sqrt(Lr1*Lr2))*sin(t*sqrt((Lr1+Lr2)/(Lr1*Lr2*cr)))*sqrt(cr*(Lr1+Lr2))+vs*t*Lr1*(Lr1+Lr2))/((Lr1+Lr2)^2*Lr1)

((Lr2*(vo+vs)*(Lr1*Lr2)^(1/2)+vo*Lr1*(Lr1*Lr2)^(1/2))*sin(t*((Lr1+Lr2)/(Lr1*Lr2*cr))^(1/2))*(cr*(Lr1+Lr2))^(1/2)+vs*t*Lr1*(Lr1+Lr2))/((Lr1+Lr2)^2*Lr1)

(2)

solve(eq, t)

-(Lr1*Lr2)^(1/2)*(Lr1*cr+Lr2*cr)^(1/2)*sin(RootOf(Lr1*sin(_Z)*(Lr1*cr+Lr2*cr)^(1/2)*((Lr1+Lr2)/(Lr1*Lr2*cr))^(1/2)*(Lr1*Lr2)^(1/2)*vo+Lr2*sin(_Z)*(Lr1*cr+Lr2*cr)^(1/2)*((Lr1+Lr2)/(Lr1*Lr2*cr))^(1/2)*(Lr1*Lr2)^(1/2)*vo+Lr2*sin(_Z)*(Lr1*cr+Lr2*cr)^(1/2)*((Lr1+Lr2)/(Lr1*Lr2*cr))^(1/2)*(Lr1*Lr2)^(1/2)*vs+_Z*Lr1^2*vs+_Z*Lr1*vs*Lr2))*(Lr1*vo+Lr2*vo+Lr2*vs)/(Lr1*(Lr1+Lr2)*vs)

(3)

``

Download spr.mw

How can I simplify to an answer without RootOf?

Thank u

I want to create a 2D and 3D graph of the following question. Evaluate F xy+y+z along the curve r(t)=2ti+tj+(2-2t)k, 0<=t<=1 I found the line integral to be 13/2. I am just stuck on how to graph this in 2D and 3D.

Thank you all in advance! I enjoy learning all the new tricks in Maple from you all.

First 353 354 355 356 357 358 359 Last Page 355 of 2097