Search results

  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

    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...
  3. 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...
  4. 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)...
  5. P

    Mathematica Mathematica functions

    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_] :=...
  6. P

    Questions about Matrices

    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
  7. P

    MATLAB What is A. in Matlab ?

    Hi guys , When I say A= [3 6 1 9] ; what does it mean about A ? thanks
  8. 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...
  9. 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
Top