MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: General--Difficulties in Understanding Mathematica Syntax

  • To: mathgroup at
  • Subject: [mg68964] Re: General--Difficulties in Understanding Mathematica Syntax
  • From: Peter Pein <petsie at>
  • Date: Fri, 25 Aug 2006 05:35:28 -0400 (EDT)
  • References: <echdk4$oir$>
  • Sender: owner-wri-mathgroup at

madhukarrapaka at 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:
> Posted through [[postId=12943]]
Hi you could try
Reap[Intgrate[Sow[Intensity...]]] or you could change "Intensity" to 
(Print["xk= ", xk,"yk= "yk]; (P/...) )


  • Prev by Date: Re: position lists
  • Next by Date: Re: Re: Re: Trigonometric simplification
  • Previous by thread: Re: General--Difficulties in Understanding Mathematica Syntax
  • Next by thread: RE: General--Difficulties in Understanding Mathematica Syntax