Syntax Error? x and y components of E field in unit vector form

In summary, the discussion revolves around the representation of electric field (E) components in unit vector form, specifically focusing on the x and y components. It emphasizes the importance of correctly expressing these components to avoid syntax errors in mathematical calculations and programming contexts, ensuring clarity and precision in the depiction of vector quantities in physics.
  • #1
zelikman
7
2
Homework Statement
NA
Relevant Equations
NA
I am trying to work through the MIT free coursework to study Physics before next semester and I am having a heck of a time with the strict answer syntax, or I am having a fundamental issue with the physics, of course.

The problem is from "Week 1: Electrostatics Problem Solving Practice 1 W1PS4: Unit vector decomposition for Electric Field." in the course and I will provide the exact webpage for reference at this link.

I am trying to work on (Part b) to calculate the components of the E field. The problem asks for the answer to be in terms of "k, a, and q."

I have tried many different answers now and simplifying them is starting to give me a headache. So, I will not do so in this case - just to elaborate more in my process in solving this, as well as giving myself a bit of a rest.

I am aware of how nasty this looks and I apologize...

The approach I am taking is to just "plug and chug," seeing as it is a fairly simple problem.

E = k times the summation of each point charge. This equation is that I am using. Point charge equation for E field

I have to answer in terms of k - so the epsilon bit is replaced.

I wonder if the origin of my vector notation is giving me issues? If I come from point P with my vector notation or go toward? I tried both and was unsuccessful, but clearing that up would be nice either way! My assumption is that it must come from point P (i.e. r_P,1 "r vector from P to 1" would be -2ai + aj).

Can someone clarify this for me?

TL;DR - When calculating the E field from a point, do the vector directions need to originate from the point? I would assume yes, and, with that being said, does my work look incorrect? Or, is it possible/likely that the required syntax for answering via this website's software is throwing a false error.

Any help is most appreciated!

P.S. I cannot find the homework template!
 
Physics news on Phys.org
  • #2
I could not add these images in the original post for some reason. Here is added context.

I have the question, one of the many answers I tried, and the equation I am using.

Once again, I could not find the template for homework questions but I can use it if need be!

Also, this is a free course from MIT and has no grading to follow, so I put NA on the Homework Statement.
 

Attachments

  • jk2qS.png
    jk2qS.png
    11.4 KB · Views: 47
  • GEEJl.png
    GEEJl.png
    17.1 KB · Views: 61
  • 5ZH54.png
    5ZH54.png
    22.9 KB · Views: 47
  • #3
Equation (2.4.3) that you posted assumes that the charge is at the origin. If the charge is not at the origin but at point ##(x',y',z')##, and the point of interest P is at ##x,y,z##, then the electric field at point P is $$\mathbf{E}=\frac{q}{4\pi\epsilon_0}\frac{(x-x')\mathbf{\hat x}+(y-y')\mathbf{\hat y}+(z-z')\mathbf{\hat z}}{\left[(x-x')^2+(y-y')^2+(z-z')^2\right]^{3/2}}.$$If you have more than one charges, you write the electric field due to each as shown above and then add the vectors as usual.

So for the two charges you posted, you need to read the coordinates of each charge and the point of interest from the graph and plug in.

If you need additional help, please post your results. We prefer that you use LaTeX. Click on "LaTeX Guide" (Lower left above "Attach files") to learn how.
 
Last edited:
  • Like
Likes Delta2 and MatinSAR
  • #4
kuruman said:
Equation (2.4.3) that you posted assumes that the charge is at the origin. If the charge is not at the origin but at point ##(,x',y',z')##, at the point of interest P is at ##x,y,z##, then the electric field at point P is $$\mathbf{E}=\frac{q}{4\pi\epsilon_0}\frac{(x-x')\mathbf{\hat x}+(y-y')\mathbf{\hat y}+(z-z')\mathbf{\hat z}}{\left[(x-x')^2+(x-x')^2+(y-y')^2+(z-z')^2\right]^{3/2}}.$$
I think this equation has one extra ## (x-x') ^2##.
 
  • Like
Likes kuruman
  • #5
Thank you for the reply! I posted from my phone, so it wasn't very easy to see the whole post and make any edits. The images that show context for the question are different from most. In this problem, the point is assigned the position at the origin and the "r" value is calculated with simply trig and algebra. So the equation I used should be sufficient.

With that being said, though, I wonder if the answer would be opposite in sign if I chose the wrong point as the origin? It has been several days since I made this forum post and tried to get help, so I haven't made a new attempt in over a week. I do believe that I already tried to modify the answer to come from the opposite point's perspective, though.

I think I will write down my work very neatly and thoroughly and get back to you with the whole process to make this clearer. I have a suspicion that the issue lies in how the answer is entered into MIT's course portal, rather than a calculation error... I'll be back sometime within the next few hours with that. I need to run some errands first!
 
  • Like
Likes MatinSAR
  • #6
MatinSAR said:
I think this equation has one extra ## (x-x') ^2##.
Yes, I agree, good catch. I got overzealous with pasting. It's fixed now, thanks.
 
  • Like
Likes MatinSAR
  • #7
MatinSAR said:
I think this equation has one extra ## (x-x') ^2##.
Thank you for pointing that out. I assumed it was a simple mistype!
 
  • Like
Likes MatinSAR
  • #8
kuruman said:
Yes, I agree, good catch. I got overzealous with pasting. It's fixed now, thanks.
Now I think I made a mistake by posting that ... I knew it was a typo.
Please excuse the pedantry.
zelikman said:
Thank you for pointing that out. I assumed it was a simple mistype!
Ofcourse it was. As a student I know 0 physics compare to advisors here.
 
  • #9
MatinSAR said:
Now I think I made a mistake by posting that ... I knew it was a typo.
Please excuse the pedantry.

Ofcourse it was. As a student I know 0 physics compare to advisors here.
I do not consider it a mistake. I consider it constructive criticism that improved the thread. You may not know as much physics as the advisors, but you should have learned by now that in physics when you're right, you're right and when you're wrong you're wrong. In other words, being right or wrong is not a matter of opinion. Advisors can also be wrong or make mistakes and these can be pointed out by students.
 
  • Like
Likes MatinSAR
  • #10
Hi @zelikman. I'd like to add this to what's already been said.

First, note (what I believe is) a mistake in your first attachment:
##\vec E = \Sigma \frac 1{4 \pi \epsilon_0} \frac {q_i}{r_i^2} \hat r##
has a missing subscript and should be
##\vec E = \Sigma \frac 1{4 \pi \epsilon_0} \frac {q_i}{r_i^2} \hat r_i##

The above equation adopts the convention that each ##\vec r_i## points from charge ##q_i## to the point where the field is being evaluated. This may be convenient sometimes but if you want to directly incorporate the coordinates of each charge, @kuruman's approach is the way to go.

I think you have a sign-error in your working. Here’s one way to check for such errors.

By inspection of the diagram, we see that the field at P from ##q_1## (a positive charge) points to the right and downwards. This means its x-component is positive (and its y-component is negative). But in your (incorrect) answer you have made ##q_1##'s x-component negative by putting a minus sign in front a ‘2’.

(Similarly the field at P from ##q_2## (a negative charge) will also have a positive x-component and negative y-component.)

Edit: Gramatical ererr korected.
 
Last edited:
  • Like
Likes SammyS and MatinSAR
  • #11
I have come back with some work to show.

I am very sorry for the huge delay. I have been busy trying to work overtime to get my car fixed.

Here is a decent display of all of my work. I tried to make a decent layout and write more neatly, but I apologize for how bad it still is.

20240112_183223.jpg
20240112_183220.jpg
20240112_183215.jpg


Does anything jump out as wrong with my final E field calculation? Since the first time I got this answer wrong I have had a feeling that the syntax is causing trouble, not my physics - but I have no illusions of being an expert. I just feel that I have gone through each step carefully and have already had several problems with the syntax for entering answers through this portal.
 
  • #12
This was a long buildup into a somewhat bittersweet conclusion.

The problem was in the syntax. I think it can't properly understand the associative or distributive properties.

Just to provide context and for the extremely rare possibility that someone else finds that free MIT course and needs a hand - I will post the solutions that I got.

final goofus.jpg


I would like to say thank you to all who had some input or advice to give! Take care!

I wish it didn't take me three weeks to get this problem done. 😔
 
  • #13
zelikman said:
I think it can't properly understand the associative or distributive properties.
Looks to me that your expression for ##E_x## in post #12 has the opposite sign from that in post #2.
 
  • Like
Likes MatinSAR
  • #14
haruspex said:
Looks to me that your expression for ##E_x## in post #12 has the opposite sign from that in post #2.
I was pretty tired when I posted this and neglected to go over my old work. It seems that you're right. When I got the correct answer I collected certain variables outside to do the simple math with a cleaner workspace. It obviously made progress.

Good point though. Now that I have a fresh perspective this morning. I think it is just the same problem that plagued my calculus days. Messy algebra and mixed up signs.

Thank you as well.
 
Last edited:

FAQ: Syntax Error? x and y components of E field in unit vector form

What is a syntax error in the context of calculating x and y components of an electric field?

A syntax error refers to a mistake in the code or mathematical notation that prevents the correct calculation or representation of the x and y components of the electric field. This could involve incorrect use of variables, operators, or functions in the programming language or mathematical expression being used.

How do you represent the x and y components of an electric field in unit vector form?

The x and y components of an electric field can be represented in unit vector form as E = Ex * i + Ey * j, where Ex and Ey are the magnitudes of the electric field components along the x and y axes, respectively, and i and j are the unit vectors in the x and y directions.

What are common mistakes that lead to syntax errors when calculating electric field components?

Common mistakes include misspelling variable names, incorrect use of mathematical operators, missing parentheses, and using incompatible units. These errors can lead to incorrect calculations or failure to execute the code properly.

How can you troubleshoot a syntax error when calculating the electric field components?

To troubleshoot a syntax error, carefully check the code or mathematical expressions for typos, ensure all variables are correctly defined, verify the correct use of operators and parentheses, and make sure the units are consistent. Using debugging tools or software can also help identify the exact location and cause of the error.

Can syntax errors affect the physical interpretation of the electric field components?

Yes, syntax errors can significantly affect the physical interpretation of the electric field components. Incorrect calculations due to syntax errors can lead to wrong magnitudes and directions of the electric field, which can mislead the understanding of the physical phenomena being studied.

Back
Top