Mathematica - 2D plot for function of 2 vars?

Click For Summary

Discussion Overview

The discussion revolves around creating 2D plots for a function of two variables, f(a,b), specifically focusing on how to visualize f(a,b) against a for various discrete values of b. The context includes technical aspects of using Mathematica for plotting.

Discussion Character

  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • One participant inquires about generating multiple 2D plots of f(a,b) vs a for specific values of b, expressing difficulty in achieving this with 2D plotting functions in Mathematica.
  • Another participant suggests a solution by defining a new function f1(b) that mirrors f(a,b) and using the Plot function to create the desired plots for specified b values.
  • A further suggestion is made to automate the plotting process by using a Table function to generate a series of plots for a range of values, which could simplify the process for larger datasets.
  • A participant expresses appreciation for the proposed improvement in automating the plotting process.

Areas of Agreement / Disagreement

Participants appear to agree on the proposed methods for creating the plots, with no evident disagreement on the solutions offered.

Contextual Notes

The discussion does not address potential limitations or assumptions regarding the function f(a,b) or the specific implementation details in Mathematica.

Who May Find This Useful

Users of Mathematica interested in plotting functions of two variables, particularly those looking for methods to visualize data efficiently in 2D.

dcnicholls
Messages
6
Reaction score
0
I have a function of two variables, f(a,b). I want to create a series of 2D plots (on the same plot) of f(a,b) vs a, for a=1 to 10, for a set of discrete values of b (e.g. b=10,20,50,100).

Is there a simple way to do this? Plot3D works, but I cannot find how to do it in 2D.

DN
 
Physics news on Phys.org
Solved: Define a second function f1(b) with the same formula as f(a,b), and use:

Plot[{f1[10],f1[20],f[50],f[100]},{a,1,10}]

Does the job.

DN
 
Also if you want to automoate it more you can make it a table:

Plot[Table[f1,{i,1,100,5}],{a,1,10}]

Makes a table of f1 as i goes from 1 to 100 by 5. Easier if you want a lot of them.
 
Thanks, useful improvement.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
5
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K