Re: How to sum the results given by loop



On 24 Jun, 17:50, "Shanmukha Moturu" <Shanmukharao.Mot...@xxxxxxxxx>
wrote:
Hi
i am have writen simple program as shown below

Z = input('Enter number of charge particles');
L = input('Enter the length of a plate');
H = input('Enter the distances between two plates');
X = input('Enter the value of x axis for point P');
Y = input('Enter the value of y axis for point p');
P = 0; <<<<<===================
       for n = 0:(Z-1)
        N = (2*n)+1;
        r = (N*L*1e-2)/(2*Z);
        rn = sqrt((Y*1e-6)^2+(r^2));
        P= P + 1/rn <<<<<===================
        Vp = (1/6.672e-12)*P; <<<<<===================
       end
        Vp
when i run this program i found that Vp is giving  nth
value of P.
But, what i am looking for is add all the P values
i mean P = (1/r1+1/r2+....+1/rn)
so that the sum of this value will be multipled by
(1/6.672e-12)
I tryed to do this by defing p2 = p2+P, but i'm unbale to
get it.
how i do this kind of problem

I've indicated some modifications which might help.

Rune
.



Relevant Pages

  • Re: force
    ... >> Volume is only applicable to space with 3 axis or more ... > You are attributing the properties of charge pairs to regions ... a charge dictates soft twisting of the ... > universe to take posession of the test mass. ...
    (sci.physics.relativity)
  • New improved facts part 4v031
    ... Field is an expresion of potential although charge may be reqiured to ... Charge is a function of field change and is not required to maintain the ... expresed soley as a function of voltage athough the term volts tends to get ... The vertical axis is Duration, Volts, Charge, Quantum effects: ...
    (sci.physics.relativity)
  • Re: Energy gained by a charge in static E
    ... If you do this during a period of strong field the charge ... which is still the same endpoint). ... circulates around some axis. ... will fail already in the plate capacitor with movements only ...
    (sci.physics.electromag)
  • How to sum the results given by loop
    ... Z = input('Enter number of charge particles'); ... X = input('Enter the value of x axis for point P'); ... when i run this program i found that Vp is giving nth ... so that the sum of this value will be multipled by ...
    (comp.soft-sys.matlab)