Re: General--Difficulties in Understanding Mathematica Syntax
- To: mathgroup at smc.vnet.net
- Subject: [mg68964] Re: General--Difficulties in Understanding Mathematica Syntax
- From: Peter Pein <petsie at dordos.net>
- Date: Fri, 25 Aug 2006 05:35:28 -0400 (EDT)
- References: <echdk4$oir$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
madhukarrapaka at yahoo.com schrieb:
> Hi Mathematica Experts,
>
> Sorry for a lengthy query.
>
> I am new to Mathematica. The syntax of mathematica is quite different from other programming languages.
> I am confused how to use loops like "If",FOR;DO;...
>
> Here i am giving details of a problem i want to solve. I made an attempt to solve this. Please go thru it and give me necessary corrections.
>
> Here i am giving the details:
> P = 10.3;l = 0.45mm;T = 0.9;r0 = 0.025mm;d = 0.1643mm;
> r[xk_, yk_] := (Sqrt[(x - xk)^2 + (y - yk)^2]);
> Intensity[xk_, yk_] := (P/(2*Pi*r[xk, yk]*l))*T^(r[xk, yk] - r0);
> Imoy=[Integrate[Intensity[xk, yk]],{xk, 0.1, -0.1}, {yk, 0.1, -0.1}] ;
> Print[Imoy]
>
> Then i am getting some value, which is not the correct one.
> How to check the output for each step in Mathematica(for example: if i want to find out the values of "r", In C language i can use Printf statement to print the values of "r" for each xk,yk)
>
> And if i want to evaluate the "Intensity[xk_, yk_] " depending on a condition (say: r[xk,yk]<d) [I think it can be done by using IF statement, but i have no clue how to use the IF statement in MATHEMATICA].
>
> Please help me by providing some advices.
>
> It would be better if one can provide me some examples., or documentation which contains some solved examples in Mathematica.
>
> Thanks in advance.
>
> Link to the forum page for this post:
> http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Special:Forum_ViewTopic&pid=12943#p12943
> Posted through http://www.mathematica-users.org [[postId=12943]]
>
>
Hi you could try
Reap[Intgrate[Sow[Intensity...]]] or you could change "Intensity" to
(Print["xk= ", xk,"yk= "yk]; (P/...) )
HTH
Peter