Computer Engineering major changed to Physics.

In summary, the conversation revolved around the importance of learning C++ for physicists, as well as recommendations for online tutorials and resources. The participants also discussed the benefits and drawbacks of knowing multiple programming languages, specifically Java and Fortran, and shared their personal experiences and preferences. The conversation also touched on the teaching methods and languages used in universities for computer science and engineering majors, as well as the advantages of overloading certain operators in C++. The conversation concluded with a discussion about the use of FORTRAN in scientific programming and its perceived clunkiness compared to C++.
  • #1
americanforest
223
0
I was a Computer Engineering major, hated it, and changed to Physics. Now it seems like every Physics professor I speak to wants to know if I know C++. I don't, but I know Java very well. I guess if computing is so crucial for a Physicist to know I should continue learning it, although I won't like it.

Anyway, to the point. Anybody know where I can find any good C/C++ tutorials online?
 
Physics news on Phys.org
  • #2
Since you know Java very well, I would skip the tuts and jump ahead to the language specification/references.

Well, that's usually how I like to be introduced to new languages.
 
Last edited:
  • #3
I agree with verty, If you know Java, all you have to learn is syntax, you should already have a grasp of classes and objects, so you could basically just google for C++ tutorials there are about a bajillion.

ALso if you were a Comp Engineering major don't you have any of the programming books or did they teach you java instead of C++?
 
  • #4
Also you'll probably want to get a book on algorithms. (I have no opinion about which book since I don't know them well myself)
 
  • #5
mr_coffee said:
did they teach you java instead of C++?

Java :mad: :mad:
 
  • #6
I would rather learn Java than C++, our whole Computer Science and Engineering major changed because IBM asked Penn State why they arn't teaching us java, we want java programmers!

So now they offer java, yay!

PS: Make sure you learn standard java, not the old stuff!
 
  • #7
Is C++ the most important language for a physicist to learn? How about C, Fortran, or some other one. I know Matlab is important.
 
  • #8
Well at my school the languages for engineers were Fortran and BASIC. Seems pretty outdated to me, anyway i am self taugh in Object Pascal, which is a language i like.
 
  • #9
Here's something on C++
http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html
 
  • #10
If you already know some programming (e.g. in Java) and don't mind spending money for a dead-tree product, I highly recommend "Accelerated C++" by Koenig and Moo, published by Addison Wesley. It presents a modern view of C++, taking full advantage of the standard library (why re-invent the wheel?).
 
  • #12
Well at my school the languages for engineers were Fortran and BASIC.

I hope that doesn't include Computer Engineers!
 
  • #13
mr_coffee said:
I hope that doesn't include Computer Engineers!

Hahahaha no, Manufacturing Engineers and Civil Engineers.
 
  • #14
go buy Stroustups the c++ programming language.
 
  • #15
Why only one language (esp. for CE and CS majors)?? Here you wouldn't make it out of first year without knowing at least basic MIPS/assembly and have a good working knowledge of C++/Java.

I'm in science and by the end of the year (freshman) I'll have formally learned scheme/java/c++.

I guess it depends on how much you know before you enter uni.

Is C++ the most important language for a physicist to learn? How about C, Fortran, or some other one. I know Matlab is important.

You should know all. Well, I know I wouldn't be programming in fortran but at least being able to read it is important. You can call fortran routines from C/C++ as well. And good luck learning C++ without picking up the majority of C along with it :) (C++ is just a superset of C)

To answer the OP, like others have said you should have no problem picking up C++ as Java stole a lot of syntax from C/C++ (though they might not admit it ;]). Find a condensed book with little intro material and/or look at some OSS or specification/syntax pages.

I've used this place as a reference but haven't looked at it in any detail:
http://www.cplusplus.com/
 
  • #16
Why only one language (esp. for CE and CS majors)??
He isn't a CS or CE major...

in 2 semesters how do they teach you 3 languages?
Or did you take AP CS courses in high school to cover your intro to programming and intermediate programming?
 
  • #17
depending on the size of the application, physicists usually ask for one of f/c/c++ because most simulations these days deal with high performance computing (geometric or numerical) which may be limited in matlab/java. C/C++ usually becuase at some point you want to render or visualize your data. And its a lot nicer than fortran =] but that's my opinion because i started with turbo pascal and turbo C.
printf, fprintf are your friends, i never got the handle on overloading the << and >> operators though i do like overloading math ops.
 
  • #18
I use FORTRAN, and have been dabbling in a little Visual C#. FORTRAN is extremely clunky, but it only does what you want it to, no more and no less, which is ideal for teaching programming for beginners.
 
  • #19
Overloading the >> and << operators are fantastic for reading into and out of a file, you can then populate any type of STL data structure that C++ supplies and do whatever you want with them.

I'm sure C can do it too but the code is so ugly!

C++ can be ugly too if you don't know what your doing but it can also be poetic looking and I have yet to see any pretty C code but I guess that doesn't matter if your a physics major.
 
  • #20
mr_coffee said:
Or did you take AP CS courses in high school to cover your intro to programming and intermediate programming?

At my school you can enter the CS course stream at different points depending on your experience (you have to prove it in some way.) I chose to take a functional programming course even though it was an intro programming course (the 'norm' is a intro course in java) because I hadn't done any functional programming. However, since this is a CS department course they switch over to java close to the end of the second semester to match everyone else (up to basic algorithm design and data abstraction). We learned everything, including mutation and OOP in scheme and then they basically showed us java's syntax and static typing. These two courses were my two electives for first year.

Since I'm really a physics major, one of my core courses first year is a scientific programming class that teaches numerical methods in C++.

It is easier for me as programming was a hobby and I was nearly a CS major. (I did take CS in HS but visual basic sucks :D)
 
  • #21
mr_coffee said:
I'm sure C can do it too but the code is so ugly!

LIES!

Code:
#define F 0xF
#define U 512

#define std(x,y)                                     (*x)(const char *,...)=y##f
#define str(l,e,x)                                                       l e,l x
#define mx(p,v1,v2)                                p[3]=v2,p[1]=v1,p[2]=v2,*p=v1
#define vi(n)                                                        q+2,n,q+3,n
#define rt                                                                return

                                                             #include <stdlib.h>
                                                              #include <stdio.h>

                          typedef double n; n *d,*b,*f; typedef unsigned char c;
char _[ ]="    <?%s version=\"1.0\"?>\n<%s %s=\"%d\" %s=\"%d\">\n", q [7][7] = {
"ivory","black","width","height","text"};int v,std(i,scan),std(o,print);

int cc(str(const void*,x,y))
{
        rt(*(n*)x>*(n*)y)-(*(n*)x<*(n*)y);
                                                                               }
        n t(n f,n g,str(n*,x,y))
                                                                               {
        f=*x++-f,g=g-*x,*y=f*f;rt *y+g*g;
                                                                               }
        c*ln(n*p)
                                                                               {
        c*f=((c*)(d+2*(2+v))+2*(p-d)); while(!*f) mx(f,rand(),rand());rt f;
                                                                               }
        n*put(str(n*,f,l),n z)
                                                                               {
        int r=(l-f)/4,p=*(f+(r*=2))<z;rt r>0?put(f+p*r,p?l:f+r,z):f;
                                                                               }
        n*g(n u,n w)
                                                                               {
        n y=u/(U-1),*s=put(d,d+v+2,y),z=w/(U-1),k,l=t(y,z,s,&k),
        m=l,*r[4],g[4],*f; c p; for(mx(r,s,0),mx(g,k,l);
        p=*(1+g)<*g,(m>*(g+1))+(*g<m);s=*f<m?m=*f,*(r+p):s)*(f=g+p+2)=t
        
        (y,z,*(r+p)+=p?-2:2,p+g);rt s;
                                                                               }
        c*a(str(n*,x,r))
                                                                               {
        n*y; int i=0,j=0,k=0,u;for(u=0;y=g(*x+u/4/4.,*r+u%4/4.),16>u;++u)
        i+=*ln(y),j+=*(1+ln(y)),k+=*(ln(y)+2);
        *_=i/u,*(1+_)=j/u,*(_+2)=k/u;rt(c*)_;
}

void tr(n x,n y,n i)
{
        c*h,w;n*m=g(y,i); for(w=4*(x<2);++w<4&&m==g(w/2*x+y,i+w%2*x););       
        for(w=4*(w>3&&(h=x>1?ln(m):a(&y,&i))&&o("<rect style=\"fill:rgb(%d,%d,%d\
        );\" x=\"%f\" y=\"%f\" %s=\"%f\" %s=\"%f\"/>\n",*h,*(1+h),*(2+h),str(F+,
        y,i),vi(x))),x/=2;x>0&&w<4;++w)tr(x,y+w/2*x,w%2*x+i);
}

int main()
{
        long k,r=1e6,h;d=calloc(r,k=sizeof(n)),f=d+r,b=d;

        while(0<(h=i("%lf",b)))*--f=*b++;v=b-d;if

        (!h+v%2+!v&&(r=0x630C65u)){o("\n0x7");while(r-->0)o("F");rt -1;}
        mx((d+v),-r,r);qsort(d,2+(v/=2),2*k,cc);
        tr(U,0&o(4+_,"xml","svg",vi(2*F+U)),0);

        for(b=d-1+r,k=0;r=1,v>k++;b-=2)
        str(o("<%s x=\"%f\" y=\"%f\" fill=\"%s\" %s-anchor=\"end\">%d</%s>\n",
        4+q,str(F+r/2.-5+U**,b,(b-1)),q+r,q+4,k+!o
        ("<circle style=\"fill:%s;\" cx=\"%f\" cy=\"%f\" r=\"3\"/>\n",
        r+q,str(F+r/4.+U**,b,(b-1))),4+q),&&r--,);

        free(d);rt o("</svg>\n")-7;
}

:P
(C obfuscation contest)
 
Last edited:
  • #22
americanforest said:
I was a Computer Engineering major, hated it, and changed to Physics. Now it seems like every Physics professor I speak to wants to know if I know C++. I don't, but I know Java very well. I guess if computing is so crucial for a Physicist to know I should continue learning it, although I won't like it.

Anyway, to the point. Anybody know where I can find any good C/C++ tutorials online?
For C programming, you can't go wrong with K&R The C Programming Language. It's a book, but it's seriously worth it.
 
  • #23
Pseudo Statistic said:
For C programming, you can't go wrong with K&R The C Programming Language. It's a book, but it's seriously worth it.

I agree with this! I thought I knew C until I bought this book... you should still definitely pick up something for C++ though.
 
  • #24
LOLACAUST!
thanks cscott thanks for that delicious mess of code :P
 

1. What prompted the change from a Computer Engineering major to Physics?

The decision to change majors is a personal one and may vary for each individual. However, some common reasons for this change could include a growing interest in physics, a desire for a more theoretical and mathematical approach to understanding technology, or a change in career goals.

2. Will my previous coursework in Computer Engineering count towards my new Physics major?

In most cases, some of your previous coursework will count towards your new major. However, this may vary depending on the specific courses and curriculum of your new program. It is best to consult with an academic advisor to determine which courses will transfer and fulfill requirements for your new major.

3. How different is the coursework and curriculum for a Physics major compared to a Computer Engineering major?

The coursework and curriculum for Physics and Computer Engineering majors are quite different. While both majors involve a strong foundation in math and science, the focus and approach to these subjects will vary. Physics majors will take more theoretical and mathematical courses, while Computer Engineering majors will focus more on the practical applications of technology.

4. Will I still be able to pursue a career in technology with a Physics major?

Absolutely! A degree in Physics can open up many opportunities in the technology industry. Many companies and organizations value the problem-solving and analytical skills that are developed through a Physics education. Additionally, you may also choose to pursue a graduate degree in a more specialized area of technology.

5. How can I make the most of this major change and ensure a successful transition?

To make the most of this change, it is important to communicate with your academic advisor and professors. They can provide guidance on course selection and help you stay on track to graduate on time. Additionally, consider joining student organizations and participating in research opportunities to gain practical experience and connections in the field. Lastly, stay open-minded and be willing to embrace new challenges and learning experiences through your new major.

Similar threads

  • STEM Academic Advising
Replies
3
Views
294
  • STEM Academic Advising
Replies
23
Views
3K
  • STEM Academic Advising
Replies
3
Views
748
  • STEM Academic Advising
Replies
24
Views
2K
  • STEM Academic Advising
Replies
2
Views
850
Replies
6
Views
845
  • STEM Academic Advising
Replies
11
Views
2K
  • STEM Academic Advising
Replies
9
Views
1K
Replies
2
Views
890
Replies
16
Views
1K
Back
Top