Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.maple > #1153

Re: Local Variables in Proc

From Joe Riel <joer@san.rr.com>
Newsgroups comp.soft-sys.math.maple
Subject Re: Local Variables in Proc
Date 2015-07-07 09:54 -0700
Organization A noiseless patient Spider
Message-ID <87oajnlxgv.fsf@san.rr.com> (permalink)
References <KaidndA_z5XxsRHInZ2dnUU7-LmdnZ2d@megapath.net> <876161c8if.fsf@san.rr.com> <TO-dnWPKi9gtPwbInZ2dnUU7-b-dnZ2d@megapath.net>

Show all headers | View raw


"Thomas D. Dean" <tomdean@speakeasy.org> writes:

> On 07/03/15 13:04, Joe Riel wrote:
>> "Thomas D. Dean" <tomdean@speakeasy.org> writes:
>>
>>
>   <snip>
>>
>> What problem are you seeing?  The procedure runs here, but
>> I'm using a developmental version of Syrup.  It returns
>>
>>   100 [M&Omega;]
>>
>
> I did not see my follow-up.

I believe that was because it was an email to my home account.
That's fine, but I'll reply here for now.
>
> If the variables at the top of the loop proc are local, I believe
> Solve does not see them.
>
>> lprint(vout);
> Rin*Vsource*(1+2*I*Pi*f*Cs*Rlk)/(-Rin-R[ac]-R[dc]-R[rad]+4*Rin*Rlk*Pi^2*f^2*Cs
> *Cin*R[dc]+4*Rin*Rlk*Pi^2*f^2*Cs*Cin*R[rad]+4*Rin*Rlk*Pi^2*f^2*Cs*Cin*R[ac]+4*
> Rin*Rlk*Pi^2*f^2*Cs*Cl*R[dc]+4*Rin*Rlk*Pi^2*f^2*Cs*Cl*R[rad]+4*Rin*Rlk*Pi^2*f^
> 2*Cs*Cl*R[ac]+Pi^2*f^2*Cs^2*Rlk*Rin*R[dc]+Pi^2*f^2*Cs^2*Rlk*Rin*R[rad]+Pi^2*f^
> 2*Cs^2*Rlk*Rin*R[ac]+4*Pi^2*f^2*Cs*Rlk*L+2*Pi^2*f^2*Cs*Rin*L+4*Rin*Pi^2*f^2*
> Cin*L+4*Rin*Pi^2*f^2*Cl*L-2*I*Pi*f*L-I*Pi*f*Cs*Rin*R[dc]-I*Pi*f*Cs*Rin*R[ac]-2
> *I*Pi*f*Cs*Rlk*R[dc]-2*I*Pi*f*Cs*Rlk*R[ac]-2*I*Rin*Pi*f*Cl*R[dc]-2*I*Pi*f*Cs*
> Rlk*Rin-2*I*Rin*Pi*f*Cin*R[dc]-2*I*Rin*Pi*f*Cin*R[ac]-2*I*Rin*Pi*f*Cl*R[ac]-2*
> I*Pi*f*Cin*R[rad]*Rin-2*I*Pi*f*Cl*R[rad]*Rin-I*Pi*f*Cs*R[rad]*Rin-2*I*Pi*f*Cs*
> R[rad]*Rlk+2*I*Pi^3*f^3*Cs^2*Rlk*Rin*L+8*I*Rin*Rlk*Pi^3*f^3*Cs*Cin*L+8*I*Rin*
> Rlk*Pi^3*f^3*Cs*Cl*L)
>
>
> If the variables at the top of the loop proc are global, they are
> resolved in the output.
>
>> lprint(vout);
> 207910026653364218531593147959/100*431^(1/2)*Pi*f*(1+102000*I*Pi*f)/(
> 1472043695300510799566465673155530920000000000*f^(5/2)*Pi^2-\
> 275807751189202459178030605427833680000000*I*f^(3/2)*Pi-\
> 2515346568072981843848888330395200000*f^(1/2)-\
> 8579230077542378853734926131788585600000000*I*431^(1/2)*Pi*f+
> 504585722070646176901051491206400000000000000000*I*431^(1/2)*Pi^3*f^3+
> 23876801514746295125740205994438446400000000000*431^(1/2)*Pi^2*f^2-\
> 81053810280021791299895549227584000000*431^(1/2)+82597277124675000*431^(1/2)*
> Pi^6*f^6-15475742554950*I*431^(1/2)*Pi^5*f^5-141137643*431^(1/2)*Pi^4*f^4)
>
> Tom Dean

That is expected.  The string that is the syrup deck is parsed, using
the Maple parse command.  Doing so always evaluates symbols in a global
context.  If you wanted the local context you would have to embed the
values in the string, say with sprintf or StringTools:-FormatMessage.
For example,

  val := x -> map(convert,x,unit_free):

  ckt := StringTools:-FormatMessage(
    "* Ideal Loop Source\n"
    "Vloop    1 2 %1\n"
    "Lloop    2 3 %2\n"
    ...
    , val(Vsource)
    , val(Lloop)
    ...);
    

-- 
Joe Riel

Back to comp.soft-sys.math.maple | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Local Variables in Proc "Thomas D. Dean" <tomdean@speakeasy.org> - 2015-06-25 09:29 -0700
  Re: Local Variables in Proc Joe Riel <joer@san.rr.com> - 2015-07-03 13:04 -0700
    Re: Local Variables in Proc "Thomas D. Dean" <tomdean@speakeasy.org> - 2015-07-07 02:58 -0700
      Re: Local Variables in Proc Joe Riel <joer@san.rr.com> - 2015-07-07 09:54 -0700

csiph-web