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

  • #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: 19
  • GEEJl.png
    GEEJl.png
    17.1 KB · Views: 25
  • 5ZH54.png
    5ZH54.png
    22.9 KB · Views: 22
  • #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:

1. What is a syntax error?

A syntax error occurs when the rules of a programming language are not followed. This can include missing brackets, semicolons, or incorrect variable names.

2. What are the x and y components of E field in unit vector form?

The x and y components of the electric field (E) in unit vector form can be represented as E = Ex i + Ey j, where Ex is the x-component and Ey is the y-component of the electric field vector.

3. How do you calculate the x and y components of the electric field in unit vector form?

To calculate the x and y components of the electric field in unit vector form, you can use the formula Ex = E * cos(theta) and Ey = E * sin(theta), where E is the magnitude of the electric field and theta is the angle it makes with the x-axis.

4. Why is it important to represent the electric field in unit vector form?

Representing the electric field in unit vector form allows for easier manipulation and calculation of vector quantities. It also helps in understanding the direction and magnitude of the electric field at a specific point in space.

5. What are some common mistakes to avoid when dealing with syntax errors in programming?

Some common mistakes to avoid when dealing with syntax errors in programming include missing semicolons, incorrect variable names, mismatched brackets, and using reserved keywords as variable names. It is important to pay attention to detail and follow the syntax rules of the programming language you are using.

Similar threads

  • Introductory Physics Homework Help
Replies
5
Views
809
  • Introductory Physics Homework Help
Replies
14
Views
649
  • Introductory Physics Homework Help
Replies
17
Views
405
  • Introductory Physics Homework Help
Replies
4
Views
2K
  • Introductory Physics Homework Help
Replies
4
Views
1K
  • Introductory Physics Homework Help
Replies
1
Views
1K
  • Introductory Physics Homework Help
Replies
7
Views
1K
  • Introductory Physics Homework Help
Replies
27
Views
2K
  • Introductory Physics Homework Help
Replies
11
Views
693
  • Introductory Physics Homework Help
Replies
6
Views
1K
Back
Top