Recent content by Physics_rocks

  1. P

    Mathematica What is ___ vs _ in Mathematica ?

    Hi guys , I have the next declaration in Mathematica : myfunc [lis_list] and myfync [x_,y___] what does "lis_list" means ? I know that when I want to declare a variable of a function I must write myfunc[SomeVar_] with one _ but what are 3 times _ (meaning ___) I hope...
  2. P

    Mathematica Functions in Mathematica - sort function

    Thank you . This would do ? sort[list_] := For[i = 1 ; i < Length[list]; i++; If [ list[i] < list[i + 1] ; j = list[i + 1] , list[i + 1] = list[i], list[i] = j; ] ?
  3. P

    Mathematica Functions in Mathematica - sort function

    Hi , I'm trying to write down the following function : sort[list_] it needs to sort a list of numbers by checking each two adjacent numbers and swap them if it is needed , but it doesn't work . I need to implement it using Pattern Matching . but I don't understand how can I...
  4. P

    Mathematica A few questions in Mathematica

    Hi , I'm trying to solve the following equation: e^x=x^3 + x^2 -1/4* x -4 using this code : NSolve[Exp[x] = x^3 + x^2 - 0.25 * x - 4, x] but it doesn't work . In addition I'm trying to solve it graphically by plotting the left and right functions simultaneously . but how ? with...
  5. P

    Mathematica Can someone please explain how to write functions in Wolfram Mathematica ?

    I'm good in writing functions in Matlab , however since moving to Mathematica , I find it pretty hard to write them . For instance I need to write a function that returns a [1,0,-1] to integers, meaning x>0 , x==0 , x<0 with a single If , but I didn't find a way with one (only two)...
  6. P

    Mathematica Mastering Mathematica Functions: Recursive Vector Squaring & List Sorting

    Hi guys , I'm a little new with Mathematica and I'm trying to write down some functions. the first one is writing a functions that square the elements in a vector , recursively , using patterns . so , I tried this one : x = Range[1, 10]; sq[0,list_]=list^2; sq[sum_,list_] :=...
  7. P

    MATLAB Understanding Matrix Operations: A/C vs. A\C, A./A, and More in MATLAB

    Hi all , I'd like your help with some actions taken with matrices . if A=[1 2 3 ; 4 5 6 ; 7 8 9 ] and C=[1 3 -1 ; 2 4 0 ; 6 0 1 ] what is the difference between A/C and A\C ? what does it mean A./A ? what is A. ? MATLAB doesn't give me an answer when I write A. thanx
  8. P

    MATLAB What Does A=[3 6 1 9] Mean in MATLAB?

    Hi guys , When I say A= [3 6 1 9] ; what does it mean about A ? thanks
  9. P

    MATLAB A problem in Matlab ,code doesn't work

    for example , when I type in Matlab the following input : simp('sin',0,pi/3,40)+simp('cos',0,pi/3,40) sin suppose to be used , but it doesn't . It says : "? Error using ==> sin Not enough input arguments. " "Error in ==> integral=integral+4*eval(f); "
  10. P

    MATLAB A problem in Matlab ,code doesn't work

    Hi guys , I need to write a code in order to calculate Simpson's Rule. Here is my code , what's wrong with it ? function [integral]=simp(f,a,b,n) if mod(n,2)~=0 warning('n must be even!') else h=(b-a)/n; integral=0; for i=1:1:n-1 x=a+i*h...
  11. P

    MATLAB Problem with drawing a function in MATLAB

    hi guys , I'm trying to draw the following function , however MATLAB doesn't like my code . What am I doing wrong ? z = x + (y – 100)^2 where x = -50 : 50, y = 0 : 200 my code : [x,y]=meshgrid(-50:1:50,-0:1:200) surf(x , y , x. + (y.-100)^2) thank you
Back
Top