jrive

195 Reputation

6 Badges

3 years, 346 days

MaplePrimes Activity


These are questions asked by jrive

 I can't seem to figure out how to use arctan on a complex number in Maple.  I expect arctan(a+jb) assuming a and b are real to return atan(b/a).  Instead, returns arctan(a+Ib).  How do I do this?

restart

````

assum := R1::real, C1::real, omega::real, vab::real

R1::real, C1::real, omega::real, vab::real

(1)

Pab := expand(rationalize(vab/(R1-I/(omega*C1))))``

vab*omega^2*C1^2*R1/(C1^2*R1^2*omega^2+1)+I*vab*omega*C1/(C1^2*R1^2*omega^2+1)

(2)

Pabmag := `assuming`([abs(Pab)], [assum])

(vab^2*omega^4*C1^4*R1^2/(C1^2*R1^2*omega^2+1)^2+vab^2*omega^2*C1^2/(C1^2*R1^2*omega^2+1)^2)^(1/2)

(3)

Pabang := `assuming`([arctan(Pab)], [assum])

arctan(vab*omega^2*C1^2*R1/(C1^2*R1^2*omega^2+1)+I*vab*omega*C1/(C1^2*R1^2*omega^2+1))

(4)

``

test out how to use arctan....

`assuming`([arctan(a+I*b)], [a::real, b::real])

arctan(a+I*b)

(5)

``

Download complex_power_RC.mw

Hello, 

I use Syrup to solve for the transfer function of a circuit, and in particular, the voltage at a given node.   If I use the "trans" option, the solution generates the expected result, in the expected format.  Syrup solves the differential equations and the resulting time domain equation is as expected.

If I then use the 'AC'  option, I get the result in the s-domain.  I then solve for the step response, and take the inverse Laplace transform.  The solution is given in terms of sinh and cosh.   

If I plot the voltage in either solution as a function of time, the plots are identical.  So, the sinh/cosh solution must be somehow simplifiable so that it "looks" like the time domain solution I get from the transient analysis.
 

restart

with(inttrans)

with(Syrup)NULL

with(DynamicSystems)

interface('displayprecision' = 8)

with(plots)

NULL

assum := R1::real, C1::real, R2::real, C2::real, R1 > 0, R2 > 0, C1 > 0, C2 > 0, t::realvin::real, vin > 0

vin::real, 0 < vin

(1)

ckt := [vin(5), Rm(1.0*10^7), Cm(1.8*10^(-11), ic = 0), `&//`(R1(9.*10^6), C1(1.5*10^(-11), ic = 0)), `&//`(R2(1.*10^6), C2(1.5*10^(-11), ic = 0))]

[vin(5), Rm(10000000.0), Cm(0.1800000000e-10, ic = 0), `&//`(R1(9000000.), C1(0.1500000000e-10, ic = 0)), `&//`(R2(1000000.), C2(0.1500000000e-10, ic = 0))]

(2)

NULL

NULL

ckt1 := [vin(0), Rm(0.10e8), Cm(0.18e-10, ic = 2.5), `&//`(R1(0.9e7), C1(0.15e-10, ic = 2.25)), `&//`(R2(0.1e7), C2(0.15e-10, ic = .25))]

[vin(0), Rm(0.10e8), Cm(0.18e-10, ic = 2.5), `&//`(R1(0.9e7), C1(0.15e-10, ic = 2.25)), `&//`(R2(0.1e7), C2(0.15e-10, ic = .25))]

(3)

Draw(ckt)

Solution doing Transient Analysis

deqs, rest := Solve(ckt, 'tran', 'returnall')

sol1 := dsolve(deqs):

Reassign rest to include the solution.

rest := eval(rest,sol1):

Compute the voltage across the capacitor Cm.

tmp1:=simplify(eval(v[Cm](t), sol1));

(1/32164)*(-415*8041^(1/2)-40205)*exp((100000/459)*(-119+8041^(1/2))*t)+5/2+(1/32164)*(415*8041^(1/2)-40205)*exp(-(100000/459)*(119+8041^(1/2))*t)

(4)

evalf[5]((1/32164)*(-415*8041^(1/2)-40205)*exp((100000/459)*(-119+8041^(1/2))*t)+5/2+(1/32164)*(415*8041^(1/2)-40205)*exp(-(100000/459)*(119+8041^(1/2))*t))

-2.4070*exp(-6389.4*t)+2.5000-0.92993e-1*exp(-45461.*t)

(5)

solve(tmp1=2.5*(1-exp(-1)),t)

p10 := plot(tmp1, t = 0 .. 0.00050000, color = 'blue', linestyle = 'dash')

p10 := plot(tmp1, t = 0 .. 0.5e-3, color = 'blue', linestyle = 'dash')

 

Solution from AC analysis:

sol, rest := Solve(ckt, 'returnall')

vnode2 := eval(v[2], sol)

1000000*(27*s+1000000)/(1377*s^2+71400000*s+400000000000)

(7)

1000000*(27*s+1000000)/(1377*s^2+71400000*s+400000000000)

(8)

``

NULLNULL

Impulse Response

temp1 := invlaplace(vnode2, s, t)

(1000000/24123)*exp(-(700000/27)*t)*(3*8041^(1/2)*sinh((100000/459)*t*8041^(1/2))+473*cosh((100000/459)*t*8041^(1/2)))

(9)

"(->)"

41.454*exp(-25926.*t)*(269.02*sinh(19536.*t)+473.*cosh(19536.*t))

(10)

Step Response

temp2 := invlaplace(vnode2/s, s, t)

5/2-(5/16082)*exp(-(700000/27)*t)*(83*8041^(1/2)*sinh((100000/459)*t*8041^(1/2))+8041*cosh((100000/459)*t*8041^(1/2)))

(11)

p1 := plot({temp2, (1-exp(-1))*2.5}, t = 0 .. 0.5e-3)

temp3 := solve(temp2 = (1-exp(-1))*2.5, t)

0.1505875131e-3

(12)

p2 := plot([temp3, temp3], [0, 2.5])

display({p1, p10, p2})

 
   

``

What is going on?  Where are the sinh and cosh terms in the solution coming from and why wont it simplify so that it looks like the other solution if they are identical?  Is there something special I need to do when using the invlaplace function?

Thanks!

Download help_maple.mw

 

 

How (can I?) display the value in a legend in Engineering format -- 10^3, 10^-6, etc?

Lres := 1/((2*Pi*freq)^2*Cres);
ftest := 10e6;
p1 := plot(eval(subs(freq = ftest, Lres)), Cres = 0.10000000 .. 0.10000000, labels = [Cres, 'Lres'], legend = ftest, color = red, title = 'Inductance*Value*as*a*Function*of*Resonant*Capacitance', axis = [gridlines = [default]]);

I would like the legend to display 10^6 rather than 1^7.

I've tried changing the default number format for the whole worksheet to Engineering, but that doesn't seem to apply to legends.

 

thank you.

I have a system of equations that returns a RealRange :

xLp_tmp := RealRange(85.32914119, infinity)

it actually looks like this:
 

anyway, I want to "pick" the lowerbound of that range and assign it to a variable but I can't figure  out how to do it.  

I've tried:

xLp_tmp[1] 

lowerbound(xLp_tmp)

but neither worked.  I don't know what else to try.

Thank you in advance for the help.

I solve a system of equations, and am having difficulty 1) understanding what I"m seeing, 2) using the results.
 

Download substitution_help.mw

 

At (21), I get the solution to the system of equations.  I then want to use substitute a value for xC1 that supports the solution, and plug it into the other variables that are solved in terms of it.  However, I can't figure out how to do this.  I keep getting errors like:

Error, invalid input: eval expects its 2nd argument, eqns, to be of type {integer, equation, set(equation)}, but received {Rsrc = .9640102828*xC1^2+0.2570694087e-2*(140625.*xC1^4-151321.*xC1^2)^(1/2), xC2 = -0.1333333333e-2*(281250.*xC1^3+750.*xC1*(140625.*xC1^4-151321.*xC1^2)^(1/2)+51018750.*xC1^2+136050.*(140625.*xC1^4-151321.*xC1^2)^(1/2)-151321.*xC1)/(375.*xC1^2+(140625.*xC1^4-151321.*xC1^2)^(1/2)), xC1 <= -363.3194071}

please see attached file.

I assume I'm getting 2 solutions.  I'm picking the first one and trying to then solve for the other variables once I pick a value for xC1.

 

Thank you,

substitution_help.mw

2 3 4 5 6 7 Page 4 of 7