question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plotting function with min/max problem

See original GitHub issue

I try to plot:

$Plot{min(3; 14/(9*a)) @ a = 0.1 : 3}

But was: Unexpected error: Index was outside the bounds of the array. Please check the expression consistency. This works correctly:

$Plot{14/(9*a)*(14/(9*a) ≤ 3) + 3*(14/(9*a) > 3) @ a = 0.1 : 3}

So, is it simple mistake or deep calculation problem? $Area works nomally with this function, $Integral doesn’t works too.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Proektsoftbgcommented, Sep 20, 2022

@cser thank you for your feedback. About plot-min, probably it is a minor bug. I will take a look. About $Integral, it must be used only for analytic functions (continuous and smooth) - without jumps or angles. This is how Tanh-Sinh method works. But for such functions, it is many times faster than $Area. I included this into the documentation.

If you have discontinuities (say at point c), you have to separate the integral and sum both parts:

$Integral{f(x) @ x = a : c} + $Integral{f(x) @ x = c: b}

0reactions
csercommented, Sep 22, 2022

Yes! It works now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Finding the min and max values of a function and marking ...
This is what i have so far to find the points that are zero and mark them on the graph. But i cant...
Read more >
Solve minimax constraint problem - MATLAB fminimax
In this case, the solution is not unique. Many points satisfy the constraints and have the same minimax value. Plot the surface representing...
Read more >
min max values of plotted function differ from input #302
I need to plot two functions g(x) = 1.842*(x-0.0359)*2.145 and h(x) = 1.417((x-0.0359))**1.751 in the range of x, 0.06 to 0.24.
Read more >
Ex: Find the Max and Min of an Objective Function ... - YouTube
This video explains how to find the max and min of an objective function given the graph of the feasible region.
Read more >
automatically setting x axis range to min, max x values ...
The range of the x axis seems to get set to the range of the first list of x values that is passed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found